@asiyst/sdk 0.1.31 → 0.1.33
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 +99 -42
- package/dist/index.cjs +8614 -2114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1580 -17
- package/dist/index.d.ts +1580 -17
- package/dist/index.js +8577 -2115
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -142,9 +142,90 @@ interface AsiystEventMap {
|
|
|
142
142
|
name: string;
|
|
143
143
|
error: string;
|
|
144
144
|
};
|
|
145
|
+
"asiyst:animation:failed": {
|
|
146
|
+
animationId?: string;
|
|
147
|
+
name: string;
|
|
148
|
+
error: string;
|
|
149
|
+
};
|
|
145
150
|
"asiyst:error": {
|
|
146
151
|
code: string;
|
|
147
152
|
message: string;
|
|
153
|
+
hint?: string;
|
|
154
|
+
};
|
|
155
|
+
"state": AsiystSDKState | {
|
|
156
|
+
state: AsiystSDKState;
|
|
157
|
+
previousState?: AsiystSDKState;
|
|
158
|
+
details?: Record<string, unknown>;
|
|
159
|
+
};
|
|
160
|
+
"asiyst:state": {
|
|
161
|
+
state: AsiystSDKState;
|
|
162
|
+
previousState?: AsiystSDKState;
|
|
163
|
+
details?: Record<string, unknown>;
|
|
164
|
+
};
|
|
165
|
+
"asiyst:avatar:state": {
|
|
166
|
+
state: AvatarLifecycleState;
|
|
167
|
+
};
|
|
168
|
+
"asiyst:chat:state": {
|
|
169
|
+
state: ChatLifecycleState;
|
|
170
|
+
};
|
|
171
|
+
"progress": AsiystProgress;
|
|
172
|
+
"asiyst:progress": AsiystProgress;
|
|
173
|
+
"error": {
|
|
174
|
+
code: string;
|
|
175
|
+
message: string;
|
|
176
|
+
hint?: string;
|
|
177
|
+
};
|
|
178
|
+
"visitor_session_started": {
|
|
179
|
+
sessionId: string;
|
|
180
|
+
timestamp?: string;
|
|
181
|
+
};
|
|
182
|
+
"avatar_ready": {
|
|
183
|
+
modelFormat: string;
|
|
184
|
+
animationCount: number;
|
|
185
|
+
loadDurationMs?: number;
|
|
186
|
+
};
|
|
187
|
+
"page_changed": {
|
|
188
|
+
pageUrl: string;
|
|
189
|
+
pagePath?: string;
|
|
190
|
+
};
|
|
191
|
+
"visitor_idle": {
|
|
192
|
+
idleSeconds: number;
|
|
193
|
+
};
|
|
194
|
+
"greeting_triggered": {
|
|
195
|
+
greetingMessage: string;
|
|
196
|
+
delayMs?: number;
|
|
197
|
+
};
|
|
198
|
+
"greeting_completed": {
|
|
199
|
+
durationMs?: number;
|
|
200
|
+
};
|
|
201
|
+
"action_received": {
|
|
202
|
+
actionId: string;
|
|
203
|
+
actionType: string;
|
|
204
|
+
};
|
|
205
|
+
"action_started": {
|
|
206
|
+
actionId: string;
|
|
207
|
+
actionType: string;
|
|
208
|
+
};
|
|
209
|
+
"action_completed": {
|
|
210
|
+
actionId: string;
|
|
211
|
+
status: "completed";
|
|
212
|
+
result?: unknown;
|
|
213
|
+
};
|
|
214
|
+
"action_failed": {
|
|
215
|
+
actionId: string;
|
|
216
|
+
status: "failed";
|
|
217
|
+
error?: unknown;
|
|
218
|
+
};
|
|
219
|
+
"speech_started": {
|
|
220
|
+
text: string;
|
|
221
|
+
durationEstimateMs?: number;
|
|
222
|
+
};
|
|
223
|
+
"speech_completed": {
|
|
224
|
+
durationMs?: number;
|
|
225
|
+
};
|
|
226
|
+
"speech_simulated": {
|
|
227
|
+
durationMs?: number;
|
|
228
|
+
simulated: boolean;
|
|
148
229
|
};
|
|
149
230
|
}
|
|
150
231
|
type AsiystEventName = keyof AsiystEventMap;
|
|
@@ -154,6 +235,7 @@ type AssistantMode = "guided" | "assist";
|
|
|
154
235
|
type ActionKind = "navigate" | "click" | "highlight" | "scroll" | "type" | "select" | "open" | "close" | "filter" | "open-menu" | "open-modal" | "search" | "wait" | "explain" | "complete";
|
|
155
236
|
type HighlightStyle = "spotlight" | "outline" | "glow" | "pointer" | "pulse" | "dim";
|
|
156
237
|
type ElementKind = "button" | "link" | "input" | "select" | "textarea" | "form" | "navigation" | "heading" | "menu" | "dialog" | "tab" | "card" | "search" | "section" | "other";
|
|
238
|
+
type TargetSource = "developer" | "cloud" | "local";
|
|
157
239
|
interface TargetRef {
|
|
158
240
|
id?: string;
|
|
159
241
|
role?: string;
|
|
@@ -161,6 +243,55 @@ interface TargetRef {
|
|
|
161
243
|
selector?: string;
|
|
162
244
|
}
|
|
163
245
|
type TargetInput = string | TargetRef;
|
|
246
|
+
type AsiystSDKState = "idle" | "registering" | "authorizing" | "fetching-config" | "loading-avatar" | "ready" | "error";
|
|
247
|
+
type AvatarLifecycleState = "initializing" | "loading" | "ready" | "error" | "unavailable";
|
|
248
|
+
type ChatLifecycleState = "initializing" | "ready" | "error" | "unavailable";
|
|
249
|
+
interface AsiystProgress {
|
|
250
|
+
stage: string;
|
|
251
|
+
loadedBytes?: number;
|
|
252
|
+
totalBytes?: number;
|
|
253
|
+
percentage?: number;
|
|
254
|
+
assetName?: string;
|
|
255
|
+
}
|
|
256
|
+
interface AsiystFallbackOptions {
|
|
257
|
+
mode: "image" | "2d" | "chat-only";
|
|
258
|
+
imageUrl?: string;
|
|
259
|
+
}
|
|
260
|
+
interface DiagnosticResult {
|
|
261
|
+
ok: boolean;
|
|
262
|
+
status?: number;
|
|
263
|
+
code?: string;
|
|
264
|
+
message?: string;
|
|
265
|
+
durationMs?: number;
|
|
266
|
+
}
|
|
267
|
+
interface AsiystDiagnosticReport {
|
|
268
|
+
sdkVersion: string;
|
|
269
|
+
origin: string;
|
|
270
|
+
state: AsiystSDKState;
|
|
271
|
+
registration: DiagnosticResult;
|
|
272
|
+
authorization: DiagnosticResult;
|
|
273
|
+
runtimeConfig: DiagnosticResult;
|
|
274
|
+
avatar?: {
|
|
275
|
+
avatarId: string;
|
|
276
|
+
format?: string;
|
|
277
|
+
assets: Array<{
|
|
278
|
+
name: string;
|
|
279
|
+
format: string;
|
|
280
|
+
sizeBytes?: number;
|
|
281
|
+
loaded: boolean;
|
|
282
|
+
}>;
|
|
283
|
+
};
|
|
284
|
+
webgl: {
|
|
285
|
+
supported: boolean;
|
|
286
|
+
rendererAvailable: boolean;
|
|
287
|
+
};
|
|
288
|
+
errors: Array<{
|
|
289
|
+
code: string;
|
|
290
|
+
message: string;
|
|
291
|
+
hint?: string;
|
|
292
|
+
}>;
|
|
293
|
+
durationMs: number;
|
|
294
|
+
}
|
|
164
295
|
interface InitOptions {
|
|
165
296
|
projectId: string;
|
|
166
297
|
publicKey: string;
|
|
@@ -172,6 +303,8 @@ interface InitOptions {
|
|
|
172
303
|
allowedActions?: ActionKind[];
|
|
173
304
|
observeHistory?: boolean;
|
|
174
305
|
visitorSessionId?: string;
|
|
306
|
+
debug?: boolean;
|
|
307
|
+
fallback?: AsiystFallbackOptions;
|
|
175
308
|
}
|
|
176
309
|
interface ThemeConfig {
|
|
177
310
|
accent?: string;
|
|
@@ -210,6 +343,8 @@ interface AvatarDataSource {
|
|
|
210
343
|
headers?: Record<string, string>;
|
|
211
344
|
credentials?: string;
|
|
212
345
|
}
|
|
346
|
+
type RuntimeLifecycleState = "uninitialized" | "initializing" | "registering" | "loading_config" | "loading_manifest" | "loading_assets" | "mounting" | "ready" | "degraded" | "failed" | "destroying" | "destroyed";
|
|
347
|
+
type AnimationCategory = "idle" | "movement" | "greeting" | "communication" | "thinking" | "pointing" | "reaction" | "gesture" | "transition";
|
|
213
348
|
interface AvatarAnimation {
|
|
214
349
|
id?: string;
|
|
215
350
|
name: string;
|
|
@@ -218,7 +353,52 @@ interface AvatarAnimation {
|
|
|
218
353
|
loopMode?: string;
|
|
219
354
|
durationMs?: number;
|
|
220
355
|
assetUrl?: string | null;
|
|
356
|
+
downloadUrl?: string | null;
|
|
221
357
|
integrity?: string;
|
|
358
|
+
normalizedName?: string;
|
|
359
|
+
category?: AnimationCategory;
|
|
360
|
+
format?: string;
|
|
361
|
+
}
|
|
362
|
+
interface AvatarRuntimeConfig {
|
|
363
|
+
version: number;
|
|
364
|
+
schemaVersion: string;
|
|
365
|
+
avatar: {
|
|
366
|
+
scale: number;
|
|
367
|
+
mobileScale: number;
|
|
368
|
+
defaultPosition: AnchorPosition | string;
|
|
369
|
+
format: "fbx" | "glb";
|
|
370
|
+
};
|
|
371
|
+
movement: {
|
|
372
|
+
enabled: boolean;
|
|
373
|
+
walkingSpeed: number;
|
|
374
|
+
runningSpeed: number;
|
|
375
|
+
};
|
|
376
|
+
greeting: {
|
|
377
|
+
enabled: boolean;
|
|
378
|
+
initialDelayMs: number;
|
|
379
|
+
greetingMessage: string;
|
|
380
|
+
firstVisitBehavior: "greet_after_delay" | "greet_immediately" | "silent";
|
|
381
|
+
cooldownSeconds: number;
|
|
382
|
+
maxAutomaticGreetings: number;
|
|
383
|
+
};
|
|
384
|
+
speech: {
|
|
385
|
+
enabled: boolean;
|
|
386
|
+
voice: string | null;
|
|
387
|
+
speakingRate: number;
|
|
388
|
+
language?: string;
|
|
389
|
+
};
|
|
390
|
+
interaction: {
|
|
391
|
+
clickEnabled: boolean;
|
|
392
|
+
requireConfirmationForClicks: boolean;
|
|
393
|
+
};
|
|
394
|
+
context: {
|
|
395
|
+
maxElements: number;
|
|
396
|
+
maxPayloadBytes: number;
|
|
397
|
+
};
|
|
398
|
+
performance?: {
|
|
399
|
+
loadingPriority?: string;
|
|
400
|
+
reducedMotionBehavior?: string;
|
|
401
|
+
};
|
|
222
402
|
}
|
|
223
403
|
interface AvatarBranding {
|
|
224
404
|
siteLogoUrl?: string | null;
|
|
@@ -252,6 +432,9 @@ interface ProjectConfig {
|
|
|
252
432
|
dataSources: AvatarDataSource[];
|
|
253
433
|
elementSelectors: Record<string, string>;
|
|
254
434
|
maxMessageChars?: number;
|
|
435
|
+
runtimeConfig?: AvatarRuntimeConfig;
|
|
436
|
+
separateAnimations?: AvatarAnimation[];
|
|
437
|
+
manifest?: Record<string, unknown>;
|
|
255
438
|
}
|
|
256
439
|
interface Rect {
|
|
257
440
|
x: number;
|
|
@@ -316,9 +499,238 @@ interface WorkflowDefinition {
|
|
|
316
499
|
steps: TaskStep[];
|
|
317
500
|
}
|
|
318
501
|
|
|
319
|
-
|
|
320
|
-
|
|
502
|
+
/**
|
|
503
|
+
* Asiyst SPA & Website Navigation Adapter Architecture
|
|
504
|
+
* Supports Next.js (App & Pages Router), custom host adapters, and native browser navigation fallback.
|
|
505
|
+
*/
|
|
506
|
+
interface NavigationAdapter {
|
|
507
|
+
name: string;
|
|
508
|
+
navigateToRoute(route: string): Promise<boolean>;
|
|
509
|
+
navigateBack(): Promise<boolean>;
|
|
510
|
+
navigateForward(): Promise<boolean>;
|
|
511
|
+
getCurrentRoute(): string;
|
|
512
|
+
getLastNavigatedRoute?(): string | null;
|
|
513
|
+
cleanup?(): void;
|
|
514
|
+
}
|
|
515
|
+
interface AppRouterLike {
|
|
516
|
+
push(href: string, options?: {
|
|
517
|
+
scroll?: boolean;
|
|
518
|
+
}): void | Promise<boolean | void>;
|
|
519
|
+
back(): void;
|
|
520
|
+
forward(): void;
|
|
521
|
+
replace?(href: string, options?: {
|
|
522
|
+
scroll?: boolean;
|
|
523
|
+
}): void;
|
|
524
|
+
refresh?(): void;
|
|
525
|
+
}
|
|
526
|
+
declare function setGlobalNavigationAdapter(adapter: NavigationAdapter | null): void;
|
|
527
|
+
declare class DefaultBrowserNavigationAdapter implements NavigationAdapter {
|
|
528
|
+
private readonly win;
|
|
529
|
+
name: string;
|
|
530
|
+
protected lastNavigatedRoute: string | null;
|
|
531
|
+
constructor(win: Window);
|
|
532
|
+
getLastNavigatedRoute(): string | null;
|
|
533
|
+
navigateToRoute(route: string): Promise<boolean>;
|
|
534
|
+
navigateBack(): Promise<boolean>;
|
|
535
|
+
navigateForward(): Promise<boolean>;
|
|
536
|
+
getCurrentRoute(): string;
|
|
537
|
+
}
|
|
538
|
+
declare class NextJsPagesNavigationAdapter implements NavigationAdapter {
|
|
539
|
+
private readonly win;
|
|
540
|
+
name: string;
|
|
541
|
+
protected lastNavigatedRoute: string | null;
|
|
542
|
+
constructor(win: Window);
|
|
543
|
+
static isAvailable(win: Window): boolean;
|
|
544
|
+
getLastNavigatedRoute(): string | null;
|
|
545
|
+
navigateToRoute(route: string): Promise<boolean>;
|
|
546
|
+
navigateBack(): Promise<boolean>;
|
|
547
|
+
navigateForward(): Promise<boolean>;
|
|
548
|
+
getCurrentRoute(): string;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Next.js App Router Navigation Adapter
|
|
552
|
+
* Uses the supported Next.js App Router integration contract (`next/navigation` useRouter instance)
|
|
553
|
+
* without depending on undocumented internal Next.js properties.
|
|
554
|
+
*/
|
|
555
|
+
declare class NextJsAppRouterNavigationAdapter implements NavigationAdapter {
|
|
556
|
+
private readonly router;
|
|
557
|
+
private readonly win;
|
|
558
|
+
private readonly getRouteFn?;
|
|
559
|
+
name: string;
|
|
560
|
+
protected lastNavigatedRoute: string | null;
|
|
561
|
+
constructor(router: AppRouterLike, win?: Window, getRouteFn?: (() => string) | undefined);
|
|
562
|
+
static fromWindow(win: Window): NextJsAppRouterNavigationAdapter | null;
|
|
563
|
+
static isAvailable(win: Window): boolean;
|
|
564
|
+
getLastNavigatedRoute(): string | null;
|
|
565
|
+
navigateToRoute(route: string): Promise<boolean>;
|
|
566
|
+
navigateBack(): Promise<boolean>;
|
|
567
|
+
navigateForward(): Promise<boolean>;
|
|
568
|
+
getCurrentRoute(): string;
|
|
569
|
+
}
|
|
570
|
+
declare function createNextAppRouterAdapter(router: AppRouterLike, win?: Window, getRouteFn?: () => string): NextJsAppRouterNavigationAdapter;
|
|
571
|
+
declare class CustomHostNavigationAdapter implements NavigationAdapter {
|
|
572
|
+
private readonly pushFn;
|
|
573
|
+
private readonly backFn?;
|
|
574
|
+
private readonly forwardFn?;
|
|
575
|
+
private readonly getRouteFn?;
|
|
576
|
+
name: string;
|
|
577
|
+
protected lastNavigatedRoute: string | null;
|
|
578
|
+
constructor(pushFn: (route: string) => Promise<boolean> | boolean, backFn?: (() => Promise<boolean> | boolean) | undefined, forwardFn?: (() => Promise<boolean> | boolean) | undefined, getRouteFn?: (() => string) | undefined);
|
|
579
|
+
getLastNavigatedRoute(): string | null;
|
|
580
|
+
navigateToRoute(route: string): Promise<boolean>;
|
|
581
|
+
navigateBack(): Promise<boolean>;
|
|
582
|
+
navigateForward(): Promise<boolean>;
|
|
583
|
+
getCurrentRoute(): string;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Canonical humanoid bone names according to AUBR (Asiyst Universal Body Representation).
|
|
588
|
+
* Standardized on anatomical OpenXR / VRM semantic conventions.
|
|
589
|
+
*/
|
|
590
|
+
type CanonicalBoneName = "hips" | "spine" | "chest" | "upperChest" | "neck" | "head" | "leftShoulder" | "leftUpperArm" | "leftLowerArm" | "leftHand" | "rightShoulder" | "rightUpperArm" | "rightLowerArm" | "rightHand" | "leftUpperLeg" | "leftLowerLeg" | "leftFoot" | "leftToes" | "rightUpperLeg" | "rightLowerLeg" | "rightFoot" | "rightToes";
|
|
591
|
+
declare const CANONICAL_BONE_NAMES: readonly CanonicalBoneName[];
|
|
592
|
+
type RigType = "mixamo" | "rigify" | "unreal" | "vrm" | "generic_humanoid" | "partial_humanoid" | "unsupported";
|
|
593
|
+
interface AvatarRigCapabilities {
|
|
594
|
+
readonly rigType: RigType;
|
|
595
|
+
readonly isHumanoid: boolean;
|
|
596
|
+
readonly confidence: number;
|
|
597
|
+
readonly proceduralIdle: boolean;
|
|
598
|
+
readonly proceduralLocomotion: boolean;
|
|
599
|
+
readonly proceduralRunning: boolean;
|
|
600
|
+
readonly turning: boolean;
|
|
601
|
+
readonly legIK: boolean;
|
|
602
|
+
readonly armIK: boolean;
|
|
603
|
+
readonly footPlacement: boolean;
|
|
604
|
+
readonly headLookAt: boolean;
|
|
605
|
+
readonly upperBodyGestures: boolean;
|
|
606
|
+
readonly facialAnimation: boolean;
|
|
607
|
+
readonly clipPlayback: boolean;
|
|
608
|
+
readonly missingRequiredBones: CanonicalBoneName[];
|
|
609
|
+
readonly missingOptionalBones: CanonicalBoneName[];
|
|
610
|
+
}
|
|
611
|
+
type MotionState = "idle" | "listening" | "thinking" | "speaking" | "starting" | "walking" | "running" | "turning" | "gesturing" | "pointing" | "waving" | "reaching" | "stopping" | "errorRecovery";
|
|
612
|
+
type GestureType = "wave" | "point_left" | "point_right" | "point_forward" | "point_element" | "agree" | "disagree" | "shrug" | "think" | "explain" | "present" | "welcome" | "acknowledge" | "invite" | "reach" | "celebrate";
|
|
613
|
+
type ExpressionType = "neutral" | "listening" | "thinking" | "speaking" | "happy" | "concerned" | "surprised";
|
|
614
|
+
interface CharacterProportions {
|
|
615
|
+
totalHeight: number;
|
|
616
|
+
legLength: number;
|
|
617
|
+
thighLength: number;
|
|
618
|
+
shinLength: number;
|
|
619
|
+
footHeight: number;
|
|
620
|
+
spineLength: number;
|
|
621
|
+
shoulderWidth: number;
|
|
622
|
+
hipWidth: number;
|
|
623
|
+
armLength: number;
|
|
624
|
+
}
|
|
625
|
+
interface AUBRJoint {
|
|
626
|
+
readonly semanticName: CanonicalBoneName;
|
|
627
|
+
readonly bone: THREE.Bone;
|
|
628
|
+
readonly parentName?: CanonicalBoneName;
|
|
629
|
+
readonly restPosition: THREE.Vector3;
|
|
630
|
+
readonly restQuaternion: THREE.Quaternion;
|
|
631
|
+
readonly restScale: THREE.Vector3;
|
|
632
|
+
readonly restDirection: THREE.Vector3;
|
|
633
|
+
readonly length: number;
|
|
634
|
+
targetPosition: THREE.Vector3;
|
|
635
|
+
targetQuaternion: THREE.Quaternion;
|
|
636
|
+
targetScale: THREE.Vector3;
|
|
637
|
+
blendWeight: number;
|
|
638
|
+
}
|
|
639
|
+
interface LookAtTarget {
|
|
640
|
+
position: THREE.Vector3;
|
|
641
|
+
weight: number;
|
|
642
|
+
clampYawDeg?: number;
|
|
643
|
+
clampPitchDeg?: number;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
interface TourStep {
|
|
647
|
+
id: string;
|
|
648
|
+
title?: string;
|
|
649
|
+
explanation?: string;
|
|
650
|
+
narrative?: string;
|
|
651
|
+
targetElementId?: string;
|
|
652
|
+
targetId?: string;
|
|
653
|
+
targetRoute?: string;
|
|
654
|
+
route?: string;
|
|
655
|
+
highlightStyle?: HighlightStyle;
|
|
656
|
+
spotlight?: boolean;
|
|
657
|
+
avatarPosition?: "left" | "right" | "top" | "bottom" | "auto";
|
|
658
|
+
placement?: "left" | "right" | "top" | "bottom" | "auto";
|
|
659
|
+
pointAtTarget?: boolean;
|
|
660
|
+
gesture?: string;
|
|
661
|
+
audioUrl?: string;
|
|
662
|
+
videoUrl?: string;
|
|
663
|
+
documentUrl?: string;
|
|
664
|
+
actionButtonText?: string;
|
|
665
|
+
autoAdvanceMs?: number;
|
|
666
|
+
}
|
|
667
|
+
interface TourDefinition {
|
|
668
|
+
id: string;
|
|
669
|
+
title: string;
|
|
670
|
+
description?: string;
|
|
671
|
+
steps: TourStep[];
|
|
672
|
+
}
|
|
673
|
+
type TourStatus = "idle" | "running" | "paused" | "completed" | "cancelled" | "error";
|
|
674
|
+
interface TourStepChangeEvent {
|
|
675
|
+
tourId: string;
|
|
676
|
+
stepIndex: number;
|
|
677
|
+
totalSteps: number;
|
|
678
|
+
step: TourStep;
|
|
679
|
+
}
|
|
680
|
+
interface TourEngineOptions {
|
|
681
|
+
navigateToRoute?: (route: string) => Promise<void>;
|
|
682
|
+
moveToElement?: (elementId: string, placement?: any) => Promise<void>;
|
|
683
|
+
pointAtElement?: (elementId: string) => Promise<void>;
|
|
684
|
+
highlightElement?: (elementId: string, style?: HighlightStyle) => Promise<void>;
|
|
685
|
+
clearHighlight?: () => void;
|
|
686
|
+
speak?: (text: string) => Promise<void>;
|
|
687
|
+
playGesture?: (gesture: string) => boolean | Promise<boolean>;
|
|
688
|
+
onStepChanged?: (event: TourStepChangeEvent) => void;
|
|
689
|
+
onTourCompleted?: (tourId: string) => void;
|
|
690
|
+
onTourError?: (tourId: string, error: string) => void;
|
|
691
|
+
}
|
|
692
|
+
declare class TourEngine {
|
|
693
|
+
private activeTour;
|
|
694
|
+
private currentStepIndex;
|
|
695
|
+
private status;
|
|
696
|
+
private autoAdvanceTimer?;
|
|
697
|
+
private readonly onNavigateToRoute?;
|
|
698
|
+
private readonly onMoveToElement?;
|
|
699
|
+
private readonly onPointAtElement?;
|
|
700
|
+
private readonly onHighlightElement?;
|
|
701
|
+
private readonly onClearHighlight?;
|
|
702
|
+
private readonly onSpeakExplanation?;
|
|
703
|
+
private readonly onPlayGesture?;
|
|
704
|
+
private stepChangeListeners;
|
|
705
|
+
private tourCompleteListeners;
|
|
706
|
+
private tourErrorListeners;
|
|
707
|
+
constructor(optionsOrNavigate?: TourEngineOptions | ((route: string) => Promise<void>), onMoveToElement?: (elementId: string) => Promise<void>, onPointAtElement?: (elementId: string) => Promise<void>, onHighlightElement?: (elementId: string, style?: HighlightStyle) => Promise<void>, onSpeakExplanation?: (text: string) => Promise<void>, onStepChanged?: (event: TourStepChangeEvent) => void, onTourCompleted?: (tourId: string) => void, onTourError?: (tourId: string, error: string) => void);
|
|
708
|
+
onStepChange(fn: (event: TourStepChangeEvent) => void): () => void;
|
|
709
|
+
onTourComplete(fn: (tourId: string) => void): () => void;
|
|
710
|
+
onTourError(fn: (tourId: string, error: string) => void): () => void;
|
|
711
|
+
getStatus(): TourStatus;
|
|
712
|
+
getActiveTour(): TourDefinition | null;
|
|
713
|
+
getCurrentStep(): TourStep | null;
|
|
714
|
+
getCurrentStepIndex(): number;
|
|
715
|
+
startTour(tour: TourDefinition): Promise<void>;
|
|
716
|
+
nextStep(): Promise<void>;
|
|
717
|
+
previousStep(): Promise<void>;
|
|
718
|
+
pauseTour(): void;
|
|
719
|
+
resumeTour(): Promise<void>;
|
|
720
|
+
stopTour(): void;
|
|
721
|
+
cancelTour(): void;
|
|
722
|
+
private completeTour;
|
|
723
|
+
private goToStep;
|
|
724
|
+
private clearAutoAdvanceTimer;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
interface AsiystClientInstance {
|
|
728
|
+
init(): Promise<void>;
|
|
321
729
|
destroy(): Promise<void>;
|
|
730
|
+
getState(): AsiystSDKState;
|
|
731
|
+
getAvatarState(): AvatarLifecycleState;
|
|
732
|
+
getChatState(): ChatLifecycleState;
|
|
733
|
+
diagnose(): Promise<AsiystDiagnosticReport>;
|
|
322
734
|
open(): void;
|
|
323
735
|
close(): void;
|
|
324
736
|
getConfig(): ProjectConfig;
|
|
@@ -328,10 +740,49 @@ declare const Asiyst: {
|
|
|
328
740
|
getVerificationStatus(): "connected" | "inactive" | "not_detected" | "error";
|
|
329
741
|
isRuntimeConnected(): boolean;
|
|
330
742
|
getAvatarPerformanceMetrics(): AvatarPerformanceMetrics | null;
|
|
743
|
+
setNavigationAdapter(adapter: NavigationAdapter | null): void;
|
|
331
744
|
avatar: {
|
|
332
745
|
show(): void;
|
|
333
746
|
hide(): void;
|
|
334
|
-
|
|
747
|
+
load(url?: string): Promise<void>;
|
|
748
|
+
moveTo(target: TargetInput | {
|
|
749
|
+
x: number;
|
|
750
|
+
y: number;
|
|
751
|
+
}): Promise<void>;
|
|
752
|
+
moveToElement(targetId: string, options?: {
|
|
753
|
+
speed?: number;
|
|
754
|
+
}): Promise<void>;
|
|
755
|
+
stopMoving(): void;
|
|
756
|
+
stopAnimation(fadeOutMs?: number): void;
|
|
757
|
+
navigateTo(route: string): Promise<void>;
|
|
758
|
+
ackAction(result: any): Promise<void>;
|
|
759
|
+
confirmAction(actionId: string, decision: "approved" | "declined"): Promise<any>;
|
|
760
|
+
animation: {
|
|
761
|
+
play(name: string, options?: {
|
|
762
|
+
loopMode?: string;
|
|
763
|
+
speed?: number;
|
|
764
|
+
}): Promise<boolean>;
|
|
765
|
+
};
|
|
766
|
+
context: {
|
|
767
|
+
submit(): Promise<void>;
|
|
768
|
+
};
|
|
769
|
+
interact: {
|
|
770
|
+
highlight(targetId: TargetInput, options?: {
|
|
771
|
+
style?: HighlightStyle;
|
|
772
|
+
durationMs?: number;
|
|
773
|
+
} | HighlightStyle): Promise<void>;
|
|
774
|
+
pointAt(targetId: TargetInput): Promise<void>;
|
|
775
|
+
};
|
|
776
|
+
navigation: {
|
|
777
|
+
goTo(route: string): Promise<void>;
|
|
778
|
+
};
|
|
779
|
+
speech: {
|
|
780
|
+
speak(text: string, options?: any): Promise<void>;
|
|
781
|
+
};
|
|
782
|
+
action: {
|
|
783
|
+
ack(result: any): Promise<void>;
|
|
784
|
+
confirm(actionId: string, decision: "approved" | "declined"): Promise<any>;
|
|
785
|
+
};
|
|
335
786
|
pointAt(target: TargetInput): Promise<void>;
|
|
336
787
|
highlight(target: TargetInput, style?: HighlightStyle): Promise<void>;
|
|
337
788
|
speak(message: string): void;
|
|
@@ -339,8 +790,149 @@ declare const Asiyst: {
|
|
|
339
790
|
celebrate(): void;
|
|
340
791
|
playAnimation(nameOrIntent: string, options?: {
|
|
341
792
|
loopMode?: string;
|
|
793
|
+
speed?: number;
|
|
342
794
|
}): boolean;
|
|
343
795
|
setPosition(x: number, y: number): void;
|
|
796
|
+
walkTo(target: TargetInput | {
|
|
797
|
+
x: number;
|
|
798
|
+
y: number;
|
|
799
|
+
}, speed?: number): Promise<void>;
|
|
800
|
+
runTo(target: TargetInput | {
|
|
801
|
+
x: number;
|
|
802
|
+
y: number;
|
|
803
|
+
}, speed?: number): Promise<void>;
|
|
804
|
+
stop(): void;
|
|
805
|
+
turnTo(direction: "left" | "right" | "front"): void;
|
|
806
|
+
lookAt(x: number, y: number, z?: number): void;
|
|
807
|
+
lookAtScreen(screenX: number, screenY: number): void;
|
|
808
|
+
playGesture(type: GestureType, options?: {
|
|
809
|
+
duration?: number;
|
|
810
|
+
speed?: number;
|
|
811
|
+
mirror?: boolean;
|
|
812
|
+
}): boolean;
|
|
813
|
+
setExpression(type: ExpressionType, intensity?: number): void;
|
|
814
|
+
getCapabilities(): AvatarRigCapabilities | null;
|
|
815
|
+
};
|
|
816
|
+
tour: {
|
|
817
|
+
start(tour: TourDefinition): Promise<void>;
|
|
818
|
+
next(): Promise<void>;
|
|
819
|
+
previous(): Promise<void>;
|
|
820
|
+
pause(): void;
|
|
821
|
+
resume(): Promise<void>;
|
|
822
|
+
stop(): void;
|
|
823
|
+
cancel(): void;
|
|
824
|
+
getStatus(): TourStatus;
|
|
825
|
+
getCurrentStep(): TourStep | null;
|
|
826
|
+
};
|
|
827
|
+
task: {
|
|
828
|
+
start(input: string | TaskDefinition): Promise<void>;
|
|
829
|
+
cancel(): void;
|
|
830
|
+
};
|
|
831
|
+
workflow: {
|
|
832
|
+
start(workflowId: string): Promise<void>;
|
|
833
|
+
};
|
|
834
|
+
on<K extends keyof AsiystEventMap>(event: K, handler: (payload: AsiystEventMap[K]) => void): () => void;
|
|
835
|
+
off<K extends keyof AsiystEventMap>(event: K, handler: (payload: AsiystEventMap[K]) => void): void;
|
|
836
|
+
}
|
|
837
|
+
declare const Asiyst: {
|
|
838
|
+
init(options: InitOptions): Promise<void>;
|
|
839
|
+
destroy(): Promise<void>;
|
|
840
|
+
getState(): AsiystSDKState;
|
|
841
|
+
getAvatarState(): AvatarLifecycleState;
|
|
842
|
+
getChatState(): ChatLifecycleState;
|
|
843
|
+
diagnose(): Promise<AsiystDiagnosticReport>;
|
|
844
|
+
open(): void;
|
|
845
|
+
close(): void;
|
|
846
|
+
getConfig(): ProjectConfig;
|
|
847
|
+
reloadConfig(): Promise<ProjectConfig>;
|
|
848
|
+
updateConfig(partial: Partial<ProjectConfig>): Promise<void>;
|
|
849
|
+
getConnectionStatus(): "connected" | "disconnected" | "offline";
|
|
850
|
+
getVerificationStatus(): "connected" | "inactive" | "not_detected" | "error";
|
|
851
|
+
isRuntimeConnected(): boolean;
|
|
852
|
+
getAvatarPerformanceMetrics(): AvatarPerformanceMetrics | null;
|
|
853
|
+
setNavigationAdapter(adapter: NavigationAdapter | null): void;
|
|
854
|
+
avatar: {
|
|
855
|
+
show(): void;
|
|
856
|
+
hide(): void;
|
|
857
|
+
load(url?: string): Promise<void>;
|
|
858
|
+
moveTo(target: TargetInput | {
|
|
859
|
+
x: number;
|
|
860
|
+
y: number;
|
|
861
|
+
}): Promise<void>;
|
|
862
|
+
moveToElement(targetId: string, options?: {
|
|
863
|
+
speed?: number;
|
|
864
|
+
}): Promise<void>;
|
|
865
|
+
stopMoving(): void;
|
|
866
|
+
stopAnimation(fadeOutMs?: number): void;
|
|
867
|
+
navigateTo(route: string): Promise<void>;
|
|
868
|
+
ackAction(result: any): Promise<void>;
|
|
869
|
+
confirmAction(actionId: string, decision: "approved" | "declined"): Promise<any>;
|
|
870
|
+
animation: {
|
|
871
|
+
play(name: string, options?: {
|
|
872
|
+
loopMode?: string;
|
|
873
|
+
speed?: number;
|
|
874
|
+
}): Promise<boolean>;
|
|
875
|
+
};
|
|
876
|
+
context: {
|
|
877
|
+
submit(): Promise<void>;
|
|
878
|
+
};
|
|
879
|
+
interact: {
|
|
880
|
+
highlight(targetId: TargetInput, options?: {
|
|
881
|
+
style?: HighlightStyle;
|
|
882
|
+
durationMs?: number;
|
|
883
|
+
} | HighlightStyle): Promise<void>;
|
|
884
|
+
pointAt(targetId: TargetInput): Promise<void>;
|
|
885
|
+
};
|
|
886
|
+
navigation: {
|
|
887
|
+
goTo(route: string): Promise<void>;
|
|
888
|
+
};
|
|
889
|
+
speech: {
|
|
890
|
+
speak(text: string, options?: any): Promise<void>;
|
|
891
|
+
};
|
|
892
|
+
action: {
|
|
893
|
+
ack(result: any): Promise<void>;
|
|
894
|
+
confirm(actionId: string, decision: "approved" | "declined"): Promise<any>;
|
|
895
|
+
};
|
|
896
|
+
pointAt: (target: TargetInput) => Promise<void>;
|
|
897
|
+
highlight: (target: TargetInput, style?: HighlightStyle) => Promise<void>;
|
|
898
|
+
speak(message: string): void;
|
|
899
|
+
think(): void;
|
|
900
|
+
celebrate(): void;
|
|
901
|
+
playAnimation(nameOrIntent: string, options?: {
|
|
902
|
+
loopMode?: string;
|
|
903
|
+
speed?: number;
|
|
904
|
+
}): boolean;
|
|
905
|
+
setPosition(x: number, y: number): void;
|
|
906
|
+
walkTo(target: TargetInput | {
|
|
907
|
+
x: number;
|
|
908
|
+
y: number;
|
|
909
|
+
}, speed?: number): Promise<void>;
|
|
910
|
+
runTo(target: TargetInput | {
|
|
911
|
+
x: number;
|
|
912
|
+
y: number;
|
|
913
|
+
}, speed?: number): Promise<void>;
|
|
914
|
+
stop(): void;
|
|
915
|
+
turnTo(direction: "left" | "right" | "front"): void;
|
|
916
|
+
lookAt(x: number, y: number, z?: number): void;
|
|
917
|
+
lookAtScreen(screenX: number, screenY: number): void;
|
|
918
|
+
playGesture(type: GestureType, options?: {
|
|
919
|
+
duration?: number;
|
|
920
|
+
speed?: number;
|
|
921
|
+
mirror?: boolean;
|
|
922
|
+
}): boolean;
|
|
923
|
+
setExpression(type: ExpressionType, intensity?: number): void;
|
|
924
|
+
getCapabilities(): AvatarRigCapabilities | null;
|
|
925
|
+
};
|
|
926
|
+
tour: {
|
|
927
|
+
start(tour: TourDefinition): Promise<void>;
|
|
928
|
+
next(): Promise<void>;
|
|
929
|
+
previous(): Promise<void>;
|
|
930
|
+
pause(): void;
|
|
931
|
+
resume(): Promise<void>;
|
|
932
|
+
stop(): void;
|
|
933
|
+
cancel(): void;
|
|
934
|
+
getStatus(): TourStatus;
|
|
935
|
+
getCurrentStep(): TourStep | null;
|
|
344
936
|
};
|
|
345
937
|
task: {
|
|
346
938
|
start(input: string | TaskDefinition): Promise<void>;
|
|
@@ -352,12 +944,26 @@ declare const Asiyst: {
|
|
|
352
944
|
on<K extends keyof AsiystEventMap>(event: K, handler: (payload: AsiystEventMap[K]) => void): () => void;
|
|
353
945
|
off<K extends keyof AsiystEventMap>(event: K, handler: (payload: AsiystEventMap[K]) => void): void;
|
|
354
946
|
};
|
|
947
|
+
type AsiystInstance = typeof Asiyst;
|
|
948
|
+
declare function asiystInit(options: InitOptions): Promise<AsiystInstance>;
|
|
949
|
+
declare function createAsiystInstance(options: InitOptions): Promise<AsiystClientInstance>;
|
|
355
950
|
|
|
356
951
|
declare const SDK_VERSION: string;
|
|
357
952
|
|
|
953
|
+
type AsiystErrorCode = "UNAUTHORIZED" | "TOKEN_EXPIRED" | "FORBIDDEN" | "ORIGIN_REQUIRED" | "PROJECT_NOT_FOUND" | "AVATAR_NOT_FOUND" | "ASSET_UNAVAILABLE" | "CONTEXT_INVALID" | "CONFIRMATION_REQUIRED" | "CONFIRMATION_EXPIRED" | "RESTRICTED_CREDENTIAL_TARGET" | "RATE_LIMITED" | "SERVER_ERROR" | "DOMAIN_NOT_APPROVED" | "ORIGIN_NOT_APPROVED" | "AUTHENTICATION_FAILED" | "CONFIG_INVALID" | "OPERATION_CANCELLED" | "ASSET_TIMEOUT" | "ASSET_LOAD_CANCELLED" | "NETWORK_ERROR" | "WEBGL_UNAVAILABLE" | "ASSET_PARSE_FAILED" | "UNSUPPORTED_ASSET_FORMAT" | "SKELETON_INCOMPATIBLE" | "ANIMATION_NOT_FOUND" | "ANIMATION_FAILED" | "TARGET_NOT_FOUND" | "TARGET_STALE" | "RESTRICTED_TARGET" | "MOVEMENT_FAILED" | "SPEECH_UNAVAILABLE" | "NAVIGATION_BLOCKED" | "ACTION_TIMEOUT" | "DEPENDENCY_FAILED" | "RUNTIME_DESTROYED" | "AVATAR_NOT_READY" | "UNKNOWN_ERROR";
|
|
954
|
+
interface AsiystErrorOptions {
|
|
955
|
+
code: AsiystErrorCode | string;
|
|
956
|
+
message: string;
|
|
957
|
+
hint?: string;
|
|
958
|
+
status?: number;
|
|
959
|
+
cause?: unknown;
|
|
960
|
+
}
|
|
358
961
|
declare class AsiystError extends Error {
|
|
359
|
-
readonly code: string;
|
|
360
|
-
|
|
962
|
+
readonly code: AsiystErrorCode | string;
|
|
963
|
+
readonly hint?: string;
|
|
964
|
+
readonly status?: number;
|
|
965
|
+
readonly cause?: unknown;
|
|
966
|
+
constructor(optionsOrCode: AsiystErrorOptions | string, legacyMessage?: string, hint?: string);
|
|
361
967
|
}
|
|
362
968
|
declare class ConfigurationError extends AsiystError {
|
|
363
969
|
constructor(message: string);
|
|
@@ -460,6 +1066,21 @@ declare function evaluateActionPermission(action: ActionKind, config: ProjectCon
|
|
|
460
1066
|
};
|
|
461
1067
|
declare function isActionAllowed(action: ActionKind, config: ProjectConfig, source: "developer" | "cloud" | "local", currentUrl?: string, target?: string): boolean;
|
|
462
1068
|
|
|
1069
|
+
interface AssetTimeoutConfig {
|
|
1070
|
+
connectTimeoutMs?: number;
|
|
1071
|
+
stallTimeoutMs?: number;
|
|
1072
|
+
totalTimeoutMs?: number;
|
|
1073
|
+
}
|
|
1074
|
+
interface AssetLoadOptions {
|
|
1075
|
+
signal?: AbortSignal;
|
|
1076
|
+
timeoutMs?: number;
|
|
1077
|
+
timeouts?: AssetTimeoutConfig;
|
|
1078
|
+
integrity?: string;
|
|
1079
|
+
expectedFormat?: "fbx" | "glb";
|
|
1080
|
+
assetName?: string;
|
|
1081
|
+
onProgress?: (progress: AsiystProgress) => void;
|
|
1082
|
+
maxRetries?: number;
|
|
1083
|
+
}
|
|
463
1084
|
interface ParsedGlbMesh {
|
|
464
1085
|
name?: string;
|
|
465
1086
|
positions: Float32Array;
|
|
@@ -505,12 +1126,7 @@ declare class AssetLoader {
|
|
|
505
1126
|
private readonly createdObjectUrls;
|
|
506
1127
|
private readonly inFlightLoads;
|
|
507
1128
|
private readonly cachedAssets;
|
|
508
|
-
load(assetUrl: string, options?:
|
|
509
|
-
signal?: AbortSignal;
|
|
510
|
-
timeoutMs?: number;
|
|
511
|
-
integrity?: string;
|
|
512
|
-
expectedFormat?: "fbx" | "glb";
|
|
513
|
-
}): Promise<LoadedAvatarAsset>;
|
|
1129
|
+
load(assetUrl: string, options?: AssetLoadOptions): Promise<LoadedAvatarAsset>;
|
|
514
1130
|
private performLoad;
|
|
515
1131
|
isFbxBuffer(buffer: ArrayBuffer): boolean;
|
|
516
1132
|
parseFbxHeader(buffer: ArrayBuffer): {
|
|
@@ -528,12 +1144,55 @@ declare class AssetLoader {
|
|
|
528
1144
|
destroy(): void;
|
|
529
1145
|
}
|
|
530
1146
|
|
|
1147
|
+
interface ResolveResult {
|
|
1148
|
+
element: Element;
|
|
1149
|
+
mapped: MappedElement;
|
|
1150
|
+
}
|
|
1151
|
+
declare class TargetResolver {
|
|
1152
|
+
private readonly doc;
|
|
1153
|
+
private readonly configuredSelectors;
|
|
1154
|
+
private readonly mappedElements;
|
|
1155
|
+
constructor(doc: Document, configuredSelectors: () => Record<string, string>, mappedElements: () => MappedElement[]);
|
|
1156
|
+
resolve(input: TargetInput, source: TargetSource): ResolveResult;
|
|
1157
|
+
tryResolve(input: TargetInput, source: TargetSource): ResolveResult | null;
|
|
1158
|
+
private findElement;
|
|
1159
|
+
private matchBySemantics;
|
|
1160
|
+
private findMappedElement;
|
|
1161
|
+
private matchesMapped;
|
|
1162
|
+
private adHocMapped;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
type Handler<K extends keyof AsiystEventMap> = (payload: AsiystEventMap[K]) => void;
|
|
1166
|
+
declare class EventBus {
|
|
1167
|
+
private readonly listeners;
|
|
1168
|
+
on<K extends keyof AsiystEventMap>(event: K, handler: Handler<K>): () => void;
|
|
1169
|
+
off<K extends keyof AsiystEventMap>(event: K, handler: Handler<K>): void;
|
|
1170
|
+
emit<K extends keyof AsiystEventMap>(event: K, payload: AsiystEventMap[K]): void;
|
|
1171
|
+
removeAll(): void;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
declare class HighlightLayer {
|
|
1175
|
+
private readonly root;
|
|
1176
|
+
private readonly win;
|
|
1177
|
+
private box;
|
|
1178
|
+
private dim;
|
|
1179
|
+
private target;
|
|
1180
|
+
private readonly onViewport;
|
|
1181
|
+
constructor(root: HTMLElement, win: Window);
|
|
1182
|
+
start(): void;
|
|
1183
|
+
show(target: Element, style: HighlightStyle): void;
|
|
1184
|
+
hide(): void;
|
|
1185
|
+
isShowing(): boolean;
|
|
1186
|
+
stop(): void;
|
|
1187
|
+
private sync;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
531
1190
|
type AvatarPose = "idle" | "point" | "think" | "celebrate" | "speak" | "walk";
|
|
532
1191
|
interface AvatarRenderer {
|
|
533
1192
|
mount(container: HTMLElement, config: ProjectConfig): void;
|
|
534
1193
|
unmount(): void;
|
|
535
1194
|
applyConfig(config: ProjectConfig): void;
|
|
536
|
-
setPosition(x: number, y: number, animate: boolean): void;
|
|
1195
|
+
setPosition(x: number, y: number, animate: boolean, durationMs?: number): void;
|
|
537
1196
|
setFacing(direction: "left" | "right"): void;
|
|
538
1197
|
setPose(pose: AvatarPose): void;
|
|
539
1198
|
setSpeech(text: string | null): void;
|
|
@@ -541,6 +1200,345 @@ interface AvatarRenderer {
|
|
|
541
1200
|
width: number;
|
|
542
1201
|
height: number;
|
|
543
1202
|
};
|
|
1203
|
+
startProceduralWalk?(speed?: number, screenVelocityPx?: number): void;
|
|
1204
|
+
startProceduralRun?(speed?: number, screenVelocityPx?: number): void;
|
|
1205
|
+
stopProceduralLocomotion?(): void;
|
|
1206
|
+
lookAt?(target: any): void;
|
|
1207
|
+
lookAtScreen?(x: number, y: number, w: number, h: number): void;
|
|
1208
|
+
playProceduralGesture?(type: any, options?: any): boolean;
|
|
1209
|
+
getCapabilities?(): any;
|
|
1210
|
+
}
|
|
1211
|
+
declare class MovementEngine {
|
|
1212
|
+
private readonly win;
|
|
1213
|
+
private readonly doc;
|
|
1214
|
+
private readonly renderer;
|
|
1215
|
+
private readonly resolver;
|
|
1216
|
+
private readonly events;
|
|
1217
|
+
private readonly getConfig;
|
|
1218
|
+
private x;
|
|
1219
|
+
private y;
|
|
1220
|
+
private readonly onViewport;
|
|
1221
|
+
private followTarget;
|
|
1222
|
+
private activeNavigationTimer?;
|
|
1223
|
+
private navigationResolve?;
|
|
1224
|
+
constructor(win: Window, doc: Document, renderer: AvatarRenderer, resolver: TargetResolver, events: EventBus, getConfig: () => ProjectConfig);
|
|
1225
|
+
start(): void;
|
|
1226
|
+
stop(): void;
|
|
1227
|
+
goToAnchor(): void;
|
|
1228
|
+
moveTo(target: TargetInput, source: TargetSource, speed?: number, isRun?: boolean): Promise<Rect>;
|
|
1229
|
+
pointAt(target: TargetInput, source: TargetSource): Promise<void>;
|
|
1230
|
+
moveToCoord(destX: number, destY: number, speed?: number, isRun?: boolean): Promise<void>;
|
|
1231
|
+
private placeBeside;
|
|
1232
|
+
setPosition(x: number, y: number, animate: boolean, durationMs?: number): void;
|
|
1233
|
+
currentPosition(): {
|
|
1234
|
+
x: number;
|
|
1235
|
+
y: number;
|
|
1236
|
+
};
|
|
1237
|
+
stopMoving(): void;
|
|
1238
|
+
private cancelActiveNavigation;
|
|
1239
|
+
faceDirection(direction: "left" | "right" | "center" | "forward"): void;
|
|
1240
|
+
private viewport;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
declare class AUBRSkeleton {
|
|
1244
|
+
readonly joints: Map<CanonicalBoneName, AUBRJoint>;
|
|
1245
|
+
readonly proportions: CharacterProportions;
|
|
1246
|
+
readonly capabilities: AvatarRigCapabilities;
|
|
1247
|
+
readonly modelRoot: THREE.Object3D;
|
|
1248
|
+
private readonly boneToCanonical;
|
|
1249
|
+
constructor(modelRoot: THREE.Object3D);
|
|
1250
|
+
getJoint(name: CanonicalBoneName): AUBRJoint | undefined;
|
|
1251
|
+
getBone(name: CanonicalBoneName): THREE.Bone | undefined;
|
|
1252
|
+
hasJoint(name: CanonicalBoneName): boolean;
|
|
1253
|
+
isInitialized(): boolean;
|
|
1254
|
+
getProportions(): CharacterProportions;
|
|
1255
|
+
restoreBindPose(mask?: Set<CanonicalBoneName>): void;
|
|
1256
|
+
/**
|
|
1257
|
+
* Restores joints to their reference bind pose.
|
|
1258
|
+
* If a bone mask is provided, only bones in the mask are restored.
|
|
1259
|
+
*/
|
|
1260
|
+
resetToRestPose(mask?: Set<CanonicalBoneName>): void;
|
|
1261
|
+
/**
|
|
1262
|
+
* Commits all target positions and target quaternions to the underlying Three.js bones.
|
|
1263
|
+
*/
|
|
1264
|
+
apply(): void;
|
|
1265
|
+
/**
|
|
1266
|
+
* Forces hierarchy world matrix update across the character tree.
|
|
1267
|
+
*/
|
|
1268
|
+
updateWorldMatrices(): void;
|
|
1269
|
+
/**
|
|
1270
|
+
* Sets joint target rotation relative to rest pose in local space.
|
|
1271
|
+
*/
|
|
1272
|
+
setJointRotationDelta(name: CanonicalBoneName, deltaQuat: THREE.Quaternion, weight?: number): void;
|
|
1273
|
+
private calculateProportions;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
declare class IKCoordinator {
|
|
1277
|
+
private readonly skeleton;
|
|
1278
|
+
private leftArmChain?;
|
|
1279
|
+
private rightArmChain?;
|
|
1280
|
+
constructor(skeleton: AUBRSkeleton);
|
|
1281
|
+
private initChains;
|
|
1282
|
+
/**
|
|
1283
|
+
* Solves and applies left leg Two-Bone IK.
|
|
1284
|
+
*/
|
|
1285
|
+
solveLeftLeg(targetFootPosModel: THREE.Vector3, weight?: number): void;
|
|
1286
|
+
/**
|
|
1287
|
+
* Solves and applies right leg Two-Bone IK.
|
|
1288
|
+
*/
|
|
1289
|
+
solveRightLeg(targetFootPosModel: THREE.Vector3, weight?: number): void;
|
|
1290
|
+
/**
|
|
1291
|
+
* Solves arm reaching/pointing toward 3D target position using FABRIK.
|
|
1292
|
+
*/
|
|
1293
|
+
solveArmReach(side: "left" | "right", targetPosWorld: THREE.Vector3, weight?: number): void;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
declare class IdleEngine {
|
|
1297
|
+
private readonly skeleton;
|
|
1298
|
+
private clock;
|
|
1299
|
+
private breathPhase;
|
|
1300
|
+
private swayPhase;
|
|
1301
|
+
private weightShift;
|
|
1302
|
+
private targetWeightShift;
|
|
1303
|
+
private nextWeightShiftTime;
|
|
1304
|
+
constructor(skeleton: AUBRSkeleton);
|
|
1305
|
+
update(delta: number, weight?: number): void;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
interface LocomotionParams {
|
|
1309
|
+
speed: number;
|
|
1310
|
+
isRunning?: boolean;
|
|
1311
|
+
headingAngle?: number;
|
|
1312
|
+
screenVelocityPx?: number;
|
|
1313
|
+
}
|
|
1314
|
+
declare class LocomotionEngine {
|
|
1315
|
+
private readonly skeleton;
|
|
1316
|
+
private readonly ik?;
|
|
1317
|
+
private phase;
|
|
1318
|
+
private currentSpeed;
|
|
1319
|
+
private targetSpeed;
|
|
1320
|
+
private moving;
|
|
1321
|
+
private isRunning;
|
|
1322
|
+
private strideLength;
|
|
1323
|
+
private stepHeight;
|
|
1324
|
+
private baseFrequency;
|
|
1325
|
+
private readonly leftFootTarget;
|
|
1326
|
+
private readonly rightFootTarget;
|
|
1327
|
+
constructor(skeleton: AUBRSkeleton, ik?: IKCoordinator | undefined);
|
|
1328
|
+
startWalking(speed?: number, screenVelocityPx?: number): void;
|
|
1329
|
+
startRunning(speed?: number, screenVelocityPx?: number): void;
|
|
1330
|
+
isMovingState(): boolean;
|
|
1331
|
+
isMoving(): boolean;
|
|
1332
|
+
getGaitPhase(): number;
|
|
1333
|
+
private calibrateStride;
|
|
1334
|
+
setMotion(params: LocomotionParams): void;
|
|
1335
|
+
stop(): void;
|
|
1336
|
+
update(delta: number, weight?: number): void;
|
|
1337
|
+
getPhase(): number;
|
|
1338
|
+
getSpeed(): number;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
declare class TurnEngine {
|
|
1342
|
+
private readonly skeleton;
|
|
1343
|
+
private currentYaw;
|
|
1344
|
+
private targetYaw;
|
|
1345
|
+
private isTurning;
|
|
1346
|
+
private turnAngularVelocity;
|
|
1347
|
+
constructor(skeleton: AUBRSkeleton);
|
|
1348
|
+
setTargetHeading(targetYawRad: number): void;
|
|
1349
|
+
setFacingDirection(direction: "left" | "right" | "center" | "forward"): void;
|
|
1350
|
+
update(delta: number, isLocomoting?: boolean): void;
|
|
1351
|
+
getYaw(): number;
|
|
1352
|
+
isTurnActive(): boolean;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
declare class BalanceEngine {
|
|
1356
|
+
private readonly skeleton;
|
|
1357
|
+
private centerOfMassOffset;
|
|
1358
|
+
private targetOffset;
|
|
1359
|
+
constructor(skeleton: AUBRSkeleton);
|
|
1360
|
+
/**
|
|
1361
|
+
* Applies corrective counter-lean to spine and pelvis when the character extends an arm or leans.
|
|
1362
|
+
*/
|
|
1363
|
+
applyCompensation(reachOffset: THREE.Vector3, weight?: number): void;
|
|
1364
|
+
reset(): void;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
declare class LookAtEngine {
|
|
1368
|
+
private readonly skeleton;
|
|
1369
|
+
private target;
|
|
1370
|
+
private currentYaw;
|
|
1371
|
+
private currentPitch;
|
|
1372
|
+
private targetYaw;
|
|
1373
|
+
private targetPitch;
|
|
1374
|
+
private saccadeTimer;
|
|
1375
|
+
private saccadeOffsetYaw;
|
|
1376
|
+
private saccadeOffsetPitch;
|
|
1377
|
+
constructor(skeleton: AUBRSkeleton);
|
|
1378
|
+
setTarget(target: LookAtTarget | null): void;
|
|
1379
|
+
lookAtScreenCoords(screenX: number, screenY: number, winWidth: number, winHeight: number): void;
|
|
1380
|
+
clearTarget(): void;
|
|
1381
|
+
update(delta: number, globalWeight?: number): void;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
declare class GestureEngine {
|
|
1385
|
+
private readonly skeleton;
|
|
1386
|
+
private readonly ik?;
|
|
1387
|
+
private activeGesture;
|
|
1388
|
+
constructor(skeleton: AUBRSkeleton, ik?: IKCoordinator | undefined);
|
|
1389
|
+
play(type: GestureType, options?: {
|
|
1390
|
+
duration?: number;
|
|
1391
|
+
targetWorldPos?: THREE.Vector3;
|
|
1392
|
+
onComplete?: () => void;
|
|
1393
|
+
}): boolean;
|
|
1394
|
+
stop(): void;
|
|
1395
|
+
isPlaying(): boolean;
|
|
1396
|
+
getCurrentGesture(): GestureType | null;
|
|
1397
|
+
playGesture(type: GestureType, options?: {
|
|
1398
|
+
duration?: number;
|
|
1399
|
+
targetWorldPos?: THREE.Vector3;
|
|
1400
|
+
onComplete?: () => void;
|
|
1401
|
+
}): boolean;
|
|
1402
|
+
stopGesture(): void;
|
|
1403
|
+
isGestureActive(): boolean;
|
|
1404
|
+
getActiveGestureType(): GestureType | null;
|
|
1405
|
+
update(delta: number): void;
|
|
1406
|
+
private getDefaultDuration;
|
|
1407
|
+
private determineHand;
|
|
1408
|
+
private synthesizeWave;
|
|
1409
|
+
private synthesizePoint;
|
|
1410
|
+
private synthesizeAgree;
|
|
1411
|
+
private synthesizeDisagree;
|
|
1412
|
+
private synthesizeShrug;
|
|
1413
|
+
private synthesizeThink;
|
|
1414
|
+
private synthesizeExplain;
|
|
1415
|
+
private synthesizeOpenHands;
|
|
1416
|
+
private synthesizeAcknowledge;
|
|
1417
|
+
private synthesizeReach;
|
|
1418
|
+
private synthesizeCelebrate;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
declare class FacialAnimationEngine {
|
|
1422
|
+
private readonly modelRoot;
|
|
1423
|
+
private morphMeshes;
|
|
1424
|
+
private isSpeaking;
|
|
1425
|
+
private speechClock;
|
|
1426
|
+
private targetExpression;
|
|
1427
|
+
private blinkTimer;
|
|
1428
|
+
private nextBlinkInterval;
|
|
1429
|
+
private blinkDuration;
|
|
1430
|
+
private blinkProgress;
|
|
1431
|
+
private isBlinking;
|
|
1432
|
+
constructor(modelRoot: THREE.Object3D);
|
|
1433
|
+
private discoverMorphTargets;
|
|
1434
|
+
setSpeaking(speaking: boolean): void;
|
|
1435
|
+
setExpression(expression: ExpressionType): void;
|
|
1436
|
+
update(delta: number): void;
|
|
1437
|
+
private applyExpression;
|
|
1438
|
+
private setMorphWeight;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
interface StateTransitionEvent {
|
|
1442
|
+
from: MotionState;
|
|
1443
|
+
to: MotionState;
|
|
1444
|
+
timestamp: number;
|
|
1445
|
+
}
|
|
1446
|
+
declare class MotionStateMachine {
|
|
1447
|
+
private currentState;
|
|
1448
|
+
private previousState;
|
|
1449
|
+
private transitionProgress;
|
|
1450
|
+
private transitionDuration;
|
|
1451
|
+
private stateTime;
|
|
1452
|
+
private readonly listeners;
|
|
1453
|
+
getState(): MotionState;
|
|
1454
|
+
getPreviousState(): MotionState;
|
|
1455
|
+
getTransitionProgress(): number;
|
|
1456
|
+
transitionTo(nextState: MotionState, transitionDuration?: number): boolean;
|
|
1457
|
+
update(delta: number): void;
|
|
1458
|
+
onTransition(listener: (event: StateTransitionEvent) => void): () => void;
|
|
1459
|
+
private canTransition;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
interface MotionLayerWeights {
|
|
1463
|
+
idleWeight: number;
|
|
1464
|
+
locomotionWeight: number;
|
|
1465
|
+
gestureWeight: number;
|
|
1466
|
+
lookAtWeight: number;
|
|
1467
|
+
clipWeight: number;
|
|
1468
|
+
}
|
|
1469
|
+
declare class MotionCoordinator {
|
|
1470
|
+
private readonly skeleton;
|
|
1471
|
+
private weights;
|
|
1472
|
+
private static readonly LOWER_BODY_BONES;
|
|
1473
|
+
private static readonly UPPER_BODY_BONES;
|
|
1474
|
+
private static readonly HEAD_BONES;
|
|
1475
|
+
private readonly mixerSnapshotPos;
|
|
1476
|
+
private readonly mixerSnapshotQuat;
|
|
1477
|
+
constructor(skeleton: AUBRSkeleton);
|
|
1478
|
+
setWeights(partial: Partial<MotionLayerWeights>): void;
|
|
1479
|
+
getWeights(): Readonly<MotionLayerWeights>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Step 1: Pre-Mixer Restore.
|
|
1482
|
+
* Restores bones not owned by an active exclusive mixer action back to reference rest pose.
|
|
1483
|
+
* Prevents transform drift from prior procedural calculations.
|
|
1484
|
+
*/
|
|
1485
|
+
preMixerRestore(): void;
|
|
1486
|
+
/**
|
|
1487
|
+
* Step 2: Post-Mixer Snapshot.
|
|
1488
|
+
* Reads Three.js bone transforms evaluated by AnimationMixer into scratch buffer.
|
|
1489
|
+
*/
|
|
1490
|
+
snapshotMixerOutput(): void;
|
|
1491
|
+
/**
|
|
1492
|
+
* Step 3: Layer Blending.
|
|
1493
|
+
* Combines mixer output with procedural locomotion, gesture, idle, and gaze based on bone masks.
|
|
1494
|
+
*/
|
|
1495
|
+
blendLayers(hasActiveClip: boolean): void;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
declare class ProceduralMovementEngine {
|
|
1499
|
+
readonly skeleton: AUBRSkeleton;
|
|
1500
|
+
readonly ik: IKCoordinator;
|
|
1501
|
+
readonly idle: IdleEngine;
|
|
1502
|
+
readonly locomotion: LocomotionEngine;
|
|
1503
|
+
readonly turn: TurnEngine;
|
|
1504
|
+
readonly balance: BalanceEngine;
|
|
1505
|
+
readonly lookAtEngine: LookAtEngine;
|
|
1506
|
+
readonly gesture: GestureEngine;
|
|
1507
|
+
readonly facial: FacialAnimationEngine;
|
|
1508
|
+
readonly stateMachine: MotionStateMachine;
|
|
1509
|
+
readonly coordinator: MotionCoordinator;
|
|
1510
|
+
private isEnabled;
|
|
1511
|
+
private stopTimer?;
|
|
1512
|
+
constructor(modelRoot: THREE.Object3D);
|
|
1513
|
+
getCapabilities(): AvatarRigCapabilities;
|
|
1514
|
+
setEnabled(enabled: boolean): void;
|
|
1515
|
+
walk(speed?: number, screenVelocityPx?: number): void;
|
|
1516
|
+
run(speed?: number, screenVelocityPx?: number): void;
|
|
1517
|
+
stopLocomotion(): void;
|
|
1518
|
+
dispose(): void;
|
|
1519
|
+
private clearStopTimer;
|
|
1520
|
+
setFacing(direction: "left" | "right" | "center" | "forward"): void;
|
|
1521
|
+
setTargetHeading(yawRad: number): void;
|
|
1522
|
+
playGesture(type: GestureType, options?: {
|
|
1523
|
+
duration?: number;
|
|
1524
|
+
targetWorldPos?: THREE.Vector3;
|
|
1525
|
+
onComplete?: () => void;
|
|
1526
|
+
}): boolean;
|
|
1527
|
+
stopGesture(): void;
|
|
1528
|
+
lookAt(target: LookAtTarget | null): void;
|
|
1529
|
+
lookAtScreen(screenX: number, screenY: number, winW: number, winH: number): void;
|
|
1530
|
+
setSpeaking(speaking: boolean): void;
|
|
1531
|
+
setExpression(expression: ExpressionType): void;
|
|
1532
|
+
/**
|
|
1533
|
+
* Pre-Mixer update pass.
|
|
1534
|
+
* Restores bones to reference bind pose to prevent cumulative transform drift.
|
|
1535
|
+
*/
|
|
1536
|
+
preMixerUpdate(): void;
|
|
1537
|
+
/**
|
|
1538
|
+
* Main procedural pipeline tick.
|
|
1539
|
+
* Invoked in FbxRenderer.startLoop() after mixer.update(delta) and before renderer.render().
|
|
1540
|
+
*/
|
|
1541
|
+
update(delta: number, hasActiveMixerClip: boolean): void;
|
|
544
1542
|
}
|
|
545
1543
|
|
|
546
1544
|
interface FbxRenderMetrics {
|
|
@@ -563,8 +1561,10 @@ declare class FbxRenderer {
|
|
|
563
1561
|
private modelRoot;
|
|
564
1562
|
private rawObject;
|
|
565
1563
|
private mixer;
|
|
1564
|
+
private proceduralEngine;
|
|
566
1565
|
private allAnimations;
|
|
567
1566
|
private readonly animationMetadataList;
|
|
1567
|
+
private readonly failedAnimations;
|
|
568
1568
|
private readonly assetLoader;
|
|
569
1569
|
private currentAction;
|
|
570
1570
|
private animFrameId;
|
|
@@ -572,15 +1572,54 @@ declare class FbxRenderer {
|
|
|
572
1572
|
private facing;
|
|
573
1573
|
private currentPose;
|
|
574
1574
|
private initialRenderCompleted;
|
|
1575
|
+
private contextLost;
|
|
575
1576
|
private resizeListener?;
|
|
1577
|
+
private contextLostListener?;
|
|
1578
|
+
private contextRestoredListener?;
|
|
576
1579
|
private baseScale;
|
|
1580
|
+
private configFallbackMap;
|
|
577
1581
|
mount(container: HTMLElement, asset: LoadedFbxAsset | LoadedGlbAsset, options?: FbxMountOptions): Promise<FbxRenderMetrics>;
|
|
578
1582
|
setFacing(direction: "left" | "right"): void;
|
|
1583
|
+
getCurrentPose(): AvatarPose;
|
|
1584
|
+
isReady(): boolean;
|
|
579
1585
|
setPose(pose: AvatarPose): void;
|
|
580
1586
|
startInitialIdleAnimation(config?: Partial<ProjectConfig>): boolean;
|
|
581
1587
|
loadExternalAnimations(animations: AvatarAnimation[], targetAnimationName?: string): Promise<void>;
|
|
1588
|
+
getFailedAnimations(): Array<{
|
|
1589
|
+
name: string;
|
|
1590
|
+
id?: string;
|
|
1591
|
+
error: string;
|
|
1592
|
+
code?: string;
|
|
1593
|
+
}>;
|
|
582
1594
|
retargetClip(clip: THREE.AnimationClip, targetObject: THREE.Object3D): THREE.AnimationClip | null;
|
|
583
|
-
|
|
1595
|
+
private readonly animationFinishedResolvers;
|
|
1596
|
+
private handleAnimationFinished;
|
|
1597
|
+
stopAnimation(fadeOutMs?: number): void;
|
|
1598
|
+
getCurrentAnimationName(): string | null;
|
|
1599
|
+
setConfigFallbackMap(map: Map<string, string> | Record<string, string>): void;
|
|
1600
|
+
/**
|
|
1601
|
+
* 7-Step Intent Resolution Order with separate idle fallback (Section 4):
|
|
1602
|
+
* 1. Exact animation ID
|
|
1603
|
+
* 2. Exact animation name
|
|
1604
|
+
* 3. Normalized animation name
|
|
1605
|
+
* 4. Manifest intent match
|
|
1606
|
+
* 5. Manifest category match
|
|
1607
|
+
* 6. Synonym matching (intent/category mapping)
|
|
1608
|
+
* 7. Configured fallback mapping
|
|
1609
|
+
* 8. Separate idle fallback when no valid match exists
|
|
1610
|
+
*/
|
|
1611
|
+
playAnimation(nameOrIntent: string, loopMode?: string, crossFadeDuration?: number, speed?: number): boolean;
|
|
1612
|
+
playAnimationAsync(nameOrIntent: string, options?: {
|
|
1613
|
+
loopMode?: string;
|
|
1614
|
+
crossFadeDuration?: number;
|
|
1615
|
+
speed?: number;
|
|
1616
|
+
timeoutMs?: number;
|
|
1617
|
+
}): Promise<{
|
|
1618
|
+
played: boolean;
|
|
1619
|
+
completed: boolean;
|
|
1620
|
+
clipName?: string;
|
|
1621
|
+
interrupted?: boolean;
|
|
1622
|
+
}>;
|
|
584
1623
|
isRendered(): boolean;
|
|
585
1624
|
validateGeometry(rawObject: THREE.Object3D): {
|
|
586
1625
|
meshCount: number;
|
|
@@ -593,6 +1632,21 @@ declare class FbxRenderer {
|
|
|
593
1632
|
getCamera(): THREE.PerspectiveCamera | null;
|
|
594
1633
|
getModelRoot(): THREE.Group | null;
|
|
595
1634
|
getMixer(): THREE.AnimationMixer | null;
|
|
1635
|
+
getProceduralEngine(): ProceduralMovementEngine | null;
|
|
1636
|
+
getCapabilities(): AvatarRigCapabilities | null;
|
|
1637
|
+
startProceduralWalk(speed?: number, screenVelocityPx?: number): void;
|
|
1638
|
+
startProceduralRun(speed?: number, screenVelocityPx?: number): void;
|
|
1639
|
+
stopProceduralLocomotion(): void;
|
|
1640
|
+
playProceduralGesture(type: GestureType, options?: {
|
|
1641
|
+
duration?: number;
|
|
1642
|
+
targetWorldPos?: THREE.Vector3;
|
|
1643
|
+
onComplete?: () => void;
|
|
1644
|
+
}): boolean;
|
|
1645
|
+
stopProceduralGesture(): void;
|
|
1646
|
+
lookAt(target: LookAtTarget | null): void;
|
|
1647
|
+
lookAtScreen(screenX: number, screenY: number, winW: number, winH: number): void;
|
|
1648
|
+
setSpeaking(speaking: boolean): void;
|
|
1649
|
+
setExpression(expr: ExpressionType): void;
|
|
596
1650
|
}
|
|
597
1651
|
|
|
598
1652
|
type AvatarRenderState = "idle" | "loading" | "ready" | "error";
|
|
@@ -624,17 +1678,33 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
624
1678
|
private lastErrorMessage;
|
|
625
1679
|
private renderMetrics;
|
|
626
1680
|
private metricsTracker?;
|
|
1681
|
+
private fallbackOptions?;
|
|
1682
|
+
setFallbackOptions(opts?: AsiystFallbackOptions): void;
|
|
627
1683
|
setMetricsTracker(tracker: AvatarMetricsTracker): void;
|
|
628
1684
|
mount(container: HTMLElement, config: ProjectConfig): void;
|
|
629
1685
|
unmount(): void;
|
|
630
1686
|
applyConfig(config: ProjectConfig): void;
|
|
631
1687
|
setPanelOpen(open: boolean): void;
|
|
632
|
-
loadAsset(config: ProjectConfig, metricsTracker?: AvatarMetricsTracker
|
|
1688
|
+
loadAsset(config: ProjectConfig, metricsTracker?: AvatarMetricsTracker, options?: {
|
|
1689
|
+
onProgress?: (p: AsiystProgress) => void;
|
|
1690
|
+
fallback?: AsiystFallbackOptions;
|
|
1691
|
+
}): Promise<boolean>;
|
|
1692
|
+
updateProgress(progress: AsiystProgress): void;
|
|
1693
|
+
renderErrorState(error: AsiystError | Error, fallbackOptions?: AsiystFallbackOptions): void;
|
|
633
1694
|
renderLoader(): void;
|
|
634
1695
|
private renderLoadedAsset;
|
|
635
1696
|
private renderLoadingPlaceholder;
|
|
636
1697
|
private renderFallback;
|
|
637
|
-
setPosition(x: number, y: number, animate: boolean): void;
|
|
1698
|
+
setPosition(x: number, y: number, animate: boolean, durationMs?: number): void;
|
|
1699
|
+
startProceduralWalk(speed?: number, screenVelocityPx?: number): void;
|
|
1700
|
+
startProceduralRun(speed?: number, screenVelocityPx?: number): void;
|
|
1701
|
+
stopProceduralLocomotion(): void;
|
|
1702
|
+
playProceduralGesture(type: any, options?: any): boolean;
|
|
1703
|
+
lookAt(target: any): void;
|
|
1704
|
+
lookAtScreen(screenX: number, screenY: number, winW: number, winH: number): void;
|
|
1705
|
+
setSpeaking(speaking: boolean): void;
|
|
1706
|
+
setExpression(expr: any): void;
|
|
1707
|
+
getCapabilities(): any;
|
|
638
1708
|
setFacing(direction: "left" | "right"): void;
|
|
639
1709
|
setPose(pose: AvatarPose): void;
|
|
640
1710
|
setSpeech(text: string | null): void;
|
|
@@ -642,7 +1712,8 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
642
1712
|
width: number;
|
|
643
1713
|
height: number;
|
|
644
1714
|
};
|
|
645
|
-
playAnimation(nameOrIntent: string, loopMode?: string): boolean;
|
|
1715
|
+
playAnimation(nameOrIntent: string, loopMode?: string, crossFadeDuration?: number, speed?: number): boolean;
|
|
1716
|
+
stopAnimation(fadeOutMs?: number): void;
|
|
646
1717
|
setHidden(hidden: boolean): void;
|
|
647
1718
|
isHidden(): boolean;
|
|
648
1719
|
getRenderState(): AvatarRenderState;
|
|
@@ -661,4 +1732,496 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
661
1732
|
getNameTag(): HTMLElement | undefined;
|
|
662
1733
|
}
|
|
663
1734
|
|
|
664
|
-
|
|
1735
|
+
declare class AvatarController {
|
|
1736
|
+
private readonly renderer;
|
|
1737
|
+
private readonly movement;
|
|
1738
|
+
private readonly highlights;
|
|
1739
|
+
private readonly resolver;
|
|
1740
|
+
private readonly events;
|
|
1741
|
+
private readonly liveRegion;
|
|
1742
|
+
private readonly getConfig;
|
|
1743
|
+
constructor(renderer: CssAvatarRenderer, movement: MovementEngine, highlights: HighlightLayer, resolver: TargetResolver, events: EventBus, liveRegion: HTMLElement, getConfig: () => ProjectConfig);
|
|
1744
|
+
show(): void;
|
|
1745
|
+
hide(): void;
|
|
1746
|
+
moveTo(target: TargetInput, source?: TargetSource): Promise<void>;
|
|
1747
|
+
pointAt(target: TargetInput, source?: TargetSource): Promise<void>;
|
|
1748
|
+
highlight(target: TargetInput, style?: HighlightStyle, source?: TargetSource): Promise<string>;
|
|
1749
|
+
speak(message: string): void;
|
|
1750
|
+
think(): void;
|
|
1751
|
+
celebrate(): void;
|
|
1752
|
+
playAnimation(nameOrIntent: string, options?: {
|
|
1753
|
+
loopMode?: string;
|
|
1754
|
+
crossFadeDuration?: number;
|
|
1755
|
+
speed?: number;
|
|
1756
|
+
}): boolean;
|
|
1757
|
+
stopAnimation(fadeOutMs?: number): void;
|
|
1758
|
+
setPosition(x: number, y: number): void;
|
|
1759
|
+
walkTo(target: TargetInput | {
|
|
1760
|
+
x: number;
|
|
1761
|
+
y: number;
|
|
1762
|
+
}, options?: number | {
|
|
1763
|
+
speed?: number;
|
|
1764
|
+
}): Promise<void>;
|
|
1765
|
+
runTo(target: TargetInput | {
|
|
1766
|
+
x: number;
|
|
1767
|
+
y: number;
|
|
1768
|
+
}, options?: number | {
|
|
1769
|
+
speed?: number;
|
|
1770
|
+
}): Promise<void>;
|
|
1771
|
+
stop(): void;
|
|
1772
|
+
turnTo(direction: "left" | "right" | "center" | "forward" | "front"): void;
|
|
1773
|
+
lookAt(targetOrX: any, y?: number, z?: number): void;
|
|
1774
|
+
lookAtScreen(x: number, y: number, w?: number, h?: number): void;
|
|
1775
|
+
playGesture(type: any, options?: any): boolean;
|
|
1776
|
+
setExpression(expr: any, intensity?: number): void;
|
|
1777
|
+
getCapabilities(): any;
|
|
1778
|
+
applyConfig(config: ProjectConfig): void;
|
|
1779
|
+
getFigure(): HTMLElement | undefined;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Asiyst Avatar Action Protocol 1.0
|
|
1784
|
+
* Authoritative schema, type definitions, dependency validation, and policy checks.
|
|
1785
|
+
*/
|
|
1786
|
+
declare const AVATAR_ACTION_PROTOCOL_VERSION: "1.0";
|
|
1787
|
+
declare const AVATAR_ACTION_TYPES: readonly ["play_animation", "stop_animation", "set_animation_speed", "set_idle_animation", "set_behavior_state", "move_to", "move_to_element", "walk_to", "run_to", "stop_movement", "face_direction", "look_at", "speak", "stop_speech", "pause_speech", "resume_speech", "point_to_element", "highlight_element", "hover_element", "click_element", "focus_element", "scroll_to_element", "wait_for_element", "verify_action", "navigate_to_url", "navigate_to_route", "navigate_to_element", "navigate_back", "navigate_forward", "refresh_context", "get_page_context", "find_element"];
|
|
1788
|
+
type AvatarActionType = (typeof AVATAR_ACTION_TYPES)[number];
|
|
1789
|
+
declare const ACTION_STATUSES: readonly ["received", "validating", "authorized", "queued", "executing", "completed", "failed", "cancelled", "timed_out", "denied", "awaiting_confirmation"];
|
|
1790
|
+
type AvatarActionStatus = (typeof ACTION_STATUSES)[number];
|
|
1791
|
+
type ActionRiskLevel = "low" | "medium" | "high" | "restricted";
|
|
1792
|
+
declare const ACTION_RISK_MAP: Record<AvatarActionType, ActionRiskLevel>;
|
|
1793
|
+
declare function isSensitiveTarget(targetId?: string, selector?: string): boolean;
|
|
1794
|
+
interface AvatarActionItem {
|
|
1795
|
+
id: string;
|
|
1796
|
+
type: AvatarActionType;
|
|
1797
|
+
priority?: number;
|
|
1798
|
+
dependsOn?: string[];
|
|
1799
|
+
payload: Record<string, unknown>;
|
|
1800
|
+
requiresConfirmation?: boolean;
|
|
1801
|
+
status?: AvatarActionStatus;
|
|
1802
|
+
expirationMs?: number;
|
|
1803
|
+
}
|
|
1804
|
+
interface AvatarActionPlan {
|
|
1805
|
+
protocolVersion: typeof AVATAR_ACTION_PROTOCOL_VERSION;
|
|
1806
|
+
requestId: string;
|
|
1807
|
+
conversationId?: string | null;
|
|
1808
|
+
timestamp?: string;
|
|
1809
|
+
actions: AvatarActionItem[];
|
|
1810
|
+
}
|
|
1811
|
+
interface DependencyValidationResult {
|
|
1812
|
+
valid: boolean;
|
|
1813
|
+
error?: string;
|
|
1814
|
+
stages?: AvatarActionItem[][];
|
|
1815
|
+
}
|
|
1816
|
+
interface ActionValidationResult {
|
|
1817
|
+
valid: boolean;
|
|
1818
|
+
data?: AvatarActionItem;
|
|
1819
|
+
error?: string;
|
|
1820
|
+
code?: string;
|
|
1821
|
+
}
|
|
1822
|
+
declare function validateActionItem(item: unknown): ActionValidationResult;
|
|
1823
|
+
/**
|
|
1824
|
+
* Validates dependency graph using Kahn's algorithm and resolves execution stages.
|
|
1825
|
+
*/
|
|
1826
|
+
declare function validateActionDependencies(actions: AvatarActionItem[]): DependencyValidationResult;
|
|
1827
|
+
declare function validateActionPlan(plan: unknown): {
|
|
1828
|
+
valid: boolean;
|
|
1829
|
+
data?: AvatarActionPlan;
|
|
1830
|
+
error?: string;
|
|
1831
|
+
stages?: AvatarActionItem[][];
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1834
|
+
interface RuntimeContextTarget {
|
|
1835
|
+
id: string;
|
|
1836
|
+
type: string;
|
|
1837
|
+
label?: string;
|
|
1838
|
+
visible?: boolean;
|
|
1839
|
+
bounds: {
|
|
1840
|
+
x: number;
|
|
1841
|
+
y: number;
|
|
1842
|
+
width: number;
|
|
1843
|
+
height: number;
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
interface RuntimeContextRequest {
|
|
1847
|
+
url: string;
|
|
1848
|
+
path: string;
|
|
1849
|
+
title?: string;
|
|
1850
|
+
pageType?: string;
|
|
1851
|
+
viewport?: {
|
|
1852
|
+
width: number;
|
|
1853
|
+
height: number;
|
|
1854
|
+
scrollX: number;
|
|
1855
|
+
scrollY: number;
|
|
1856
|
+
};
|
|
1857
|
+
targets: RuntimeContextTarget[];
|
|
1858
|
+
}
|
|
1859
|
+
interface RuntimeActionConfirmResponse {
|
|
1860
|
+
success: true;
|
|
1861
|
+
confirmed: boolean;
|
|
1862
|
+
actionId: string;
|
|
1863
|
+
confirmationToken?: string;
|
|
1864
|
+
expiresAt?: string;
|
|
1865
|
+
message?: string;
|
|
1866
|
+
}
|
|
1867
|
+
interface RuntimeEventRequest {
|
|
1868
|
+
type: string;
|
|
1869
|
+
pageUrl?: string;
|
|
1870
|
+
payload?: Record<string, unknown>;
|
|
1871
|
+
}
|
|
1872
|
+
interface RuntimeEventResponse {
|
|
1873
|
+
success: true;
|
|
1874
|
+
eventId: string;
|
|
1875
|
+
type: string;
|
|
1876
|
+
recorded: boolean;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
interface RegisteredTarget {
|
|
1880
|
+
id: string;
|
|
1881
|
+
element: HTMLElement;
|
|
1882
|
+
type: string;
|
|
1883
|
+
label: string;
|
|
1884
|
+
registeredAt: number;
|
|
1885
|
+
}
|
|
1886
|
+
declare class TargetRegistry {
|
|
1887
|
+
private readonly doc;
|
|
1888
|
+
private readonly targets;
|
|
1889
|
+
private readonly elementToId;
|
|
1890
|
+
constructor(doc: Document);
|
|
1891
|
+
clear(): void;
|
|
1892
|
+
register(element: HTMLElement, customId?: string): string;
|
|
1893
|
+
get(targetId: string): HTMLElement | null;
|
|
1894
|
+
destroy(): void;
|
|
1895
|
+
isStale(targetId: string): boolean;
|
|
1896
|
+
getFreshBounds(targetId: string): {
|
|
1897
|
+
x: number;
|
|
1898
|
+
y: number;
|
|
1899
|
+
width: number;
|
|
1900
|
+
height: number;
|
|
1901
|
+
} | null;
|
|
1902
|
+
scanPage(maxTargets?: number): RuntimeContextTarget[];
|
|
1903
|
+
createContextSnapshot(maxTargets?: number, maxPayloadBytes?: number): RuntimeContextRequest;
|
|
1904
|
+
private generateTargetId;
|
|
1905
|
+
private detectElementType;
|
|
1906
|
+
private extractSafeLabel;
|
|
1907
|
+
private isElementVisible;
|
|
1908
|
+
private isSensitiveElement;
|
|
1909
|
+
private detectPageType;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
interface ConfirmationRequestDetails {
|
|
1913
|
+
actionId: string;
|
|
1914
|
+
actionType: string;
|
|
1915
|
+
riskLevel?: string;
|
|
1916
|
+
targetId?: string;
|
|
1917
|
+
targetLabel?: string;
|
|
1918
|
+
description?: string;
|
|
1919
|
+
requestId?: string;
|
|
1920
|
+
sessionId?: string;
|
|
1921
|
+
projectId?: string;
|
|
1922
|
+
parametersHash?: string;
|
|
1923
|
+
}
|
|
1924
|
+
interface ConfirmationManagerOptions {
|
|
1925
|
+
container?: HTMLElement;
|
|
1926
|
+
allowTestTokens?: boolean;
|
|
1927
|
+
sendConfirmRequest?: (actionId: string, actionType: string, targetId: string | undefined, decision: "approved" | "declined") => Promise<RuntimeActionConfirmResponse>;
|
|
1928
|
+
}
|
|
1929
|
+
declare class ConfirmationManager {
|
|
1930
|
+
private activeDialog?;
|
|
1931
|
+
private readonly consumedTokens;
|
|
1932
|
+
private readonly consumedNonces;
|
|
1933
|
+
private readonly activeTokens;
|
|
1934
|
+
private readonly container?;
|
|
1935
|
+
private readonly sendConfirmRequest?;
|
|
1936
|
+
private readonly allowTestTokens;
|
|
1937
|
+
constructor(containerOrOptions?: HTMLElement | ConfirmationManagerOptions, sendConfirmRequest?: (actionId: string, actionType: string, targetId: string | undefined, decision: "approved" | "declined") => Promise<RuntimeActionConfirmResponse>);
|
|
1938
|
+
/**
|
|
1939
|
+
* Validates and marks a one-time confirmation token as consumed.
|
|
1940
|
+
*
|
|
1941
|
+
* SECURITY ARCHITECTURE NOTE:
|
|
1942
|
+
* The client decodes Base64URL payload claims solely for preliminary contextual binding checks
|
|
1943
|
+
* (e.g. confirming matching project, session, action, target, parameter hash, and unexpired timestamp).
|
|
1944
|
+
* It does NOT verify cryptographic signature integrity (signing secrets stay exclusively on the backend).
|
|
1945
|
+
* Single-use tracking here is in-memory and supplementary. Distributed replay prevention requires
|
|
1946
|
+
* atomic backend token consumption via database transaction.
|
|
1947
|
+
*/
|
|
1948
|
+
consumeToken(token: string, details: ConfirmationRequestDetails): {
|
|
1949
|
+
valid: boolean;
|
|
1950
|
+
reason?: string;
|
|
1951
|
+
error?: string;
|
|
1952
|
+
};
|
|
1953
|
+
issueDirectToken(details: ConfirmationRequestDetails, ttlSeconds?: number): string;
|
|
1954
|
+
requestConfirmation(details: ConfirmationRequestDetails): Promise<{
|
|
1955
|
+
approved: boolean;
|
|
1956
|
+
token?: string;
|
|
1957
|
+
expiresAt?: string;
|
|
1958
|
+
}>;
|
|
1959
|
+
closeDialog(): void;
|
|
1960
|
+
destroy(): void;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
type SpeechStatus = "idle" | "requested" | "started" | "completed" | "interrupted" | "cancelled" | "unavailable" | "failed" | "simulated";
|
|
1964
|
+
interface SpeechExecutionResult {
|
|
1965
|
+
durationMs: number;
|
|
1966
|
+
completed: boolean;
|
|
1967
|
+
status: SpeechStatus;
|
|
1968
|
+
mode: "native" | "simulated" | "unavailable";
|
|
1969
|
+
}
|
|
1970
|
+
interface SpeechOptions {
|
|
1971
|
+
voice?: string | null;
|
|
1972
|
+
speakingRate?: number;
|
|
1973
|
+
pitch?: number;
|
|
1974
|
+
language?: string;
|
|
1975
|
+
interruptible?: boolean;
|
|
1976
|
+
}
|
|
1977
|
+
declare class SpeechPlayer {
|
|
1978
|
+
private readonly win;
|
|
1979
|
+
private activeUtterance;
|
|
1980
|
+
private voices;
|
|
1981
|
+
private voicesLoaded;
|
|
1982
|
+
private isSpeakingInternal;
|
|
1983
|
+
private currentStatus;
|
|
1984
|
+
onSpeechStart?: (text: string, durationEstimateMs: number) => void;
|
|
1985
|
+
onSpeechEnd?: (durationMs: number, status: SpeechStatus) => void;
|
|
1986
|
+
constructor(win: Window);
|
|
1987
|
+
private initVoices;
|
|
1988
|
+
isSupported(): boolean;
|
|
1989
|
+
isSpeaking(): boolean;
|
|
1990
|
+
getActiveUtterance(): SpeechSynthesisUtterance | null;
|
|
1991
|
+
areVoicesLoaded(): boolean;
|
|
1992
|
+
getStatus(): SpeechStatus;
|
|
1993
|
+
speak(text: string, options?: SpeechOptions): Promise<SpeechExecutionResult>;
|
|
1994
|
+
stop(reason?: "cancelled" | "interrupted"): void;
|
|
1995
|
+
pause(): void;
|
|
1996
|
+
resume(): void;
|
|
1997
|
+
destroy(): void;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
interface ActionExecutionContext {
|
|
2001
|
+
requestId: string;
|
|
2002
|
+
projectId?: string;
|
|
2003
|
+
sessionId?: string;
|
|
2004
|
+
action: AvatarActionItem;
|
|
2005
|
+
targetRegistry: TargetRegistry;
|
|
2006
|
+
confirmationManager?: ConfirmationManager;
|
|
2007
|
+
speechPlayer: SpeechPlayer;
|
|
2008
|
+
config: ProjectConfig;
|
|
2009
|
+
events: EventBus;
|
|
2010
|
+
doc: Document;
|
|
2011
|
+
win: Window;
|
|
2012
|
+
playAnimation: (nameOrIntent: string, options?: {
|
|
2013
|
+
loopMode?: string;
|
|
2014
|
+
crossFadeDuration?: number;
|
|
2015
|
+
speed?: number;
|
|
2016
|
+
}) => boolean;
|
|
2017
|
+
stopAnimation: (fadeOutMs?: number) => void;
|
|
2018
|
+
moveToCoord: (x: number, y: number, speed?: number) => Promise<void>;
|
|
2019
|
+
moveToElementTarget: (targetId: string, speed?: number) => Promise<void>;
|
|
2020
|
+
stopMovement: () => void;
|
|
2021
|
+
faceDirection: (direction: "left" | "right" | "center" | "forward") => void;
|
|
2022
|
+
highlightElement: (element: HTMLElement, durationMs?: number, color?: string) => Promise<void>;
|
|
2023
|
+
submitContext: () => Promise<void>;
|
|
2024
|
+
lookAtScreen?: (x: number, y: number) => void;
|
|
2025
|
+
playGesture?: (type: string, options?: any) => boolean;
|
|
2026
|
+
setExpression?: (expr: string) => void;
|
|
2027
|
+
startTour?: (tour: any) => Promise<void>;
|
|
2028
|
+
stopTour?: () => void;
|
|
2029
|
+
sendAck: (ack: {
|
|
2030
|
+
requestId: string;
|
|
2031
|
+
actionId: string;
|
|
2032
|
+
status: AvatarActionStatus;
|
|
2033
|
+
result?: Record<string, unknown> | null;
|
|
2034
|
+
error?: {
|
|
2035
|
+
code?: string;
|
|
2036
|
+
message?: string;
|
|
2037
|
+
details?: unknown;
|
|
2038
|
+
} | null;
|
|
2039
|
+
clientTimestamp: string;
|
|
2040
|
+
}) => Promise<void>;
|
|
2041
|
+
}
|
|
2042
|
+
type ActionHandler = (context: ActionExecutionContext) => Promise<Record<string, unknown> | void>;
|
|
2043
|
+
declare class ActionScheduler {
|
|
2044
|
+
private readonly getContext;
|
|
2045
|
+
private readonly handlers;
|
|
2046
|
+
private readonly completedActionIds;
|
|
2047
|
+
private readonly failedActionIds;
|
|
2048
|
+
private readonly resourceLocks;
|
|
2049
|
+
private currentPlanRequestId?;
|
|
2050
|
+
private isExecuting;
|
|
2051
|
+
constructor(getContext: (action: AvatarActionItem) => ActionExecutionContext);
|
|
2052
|
+
registerHandler(actionType: string, handler: ActionHandler): void;
|
|
2053
|
+
isBusy(): boolean;
|
|
2054
|
+
getCurrentRequestId(): string | undefined;
|
|
2055
|
+
executePlan(plan: unknown): Promise<{
|
|
2056
|
+
success: boolean;
|
|
2057
|
+
executedCount: number;
|
|
2058
|
+
failedCount: number;
|
|
2059
|
+
results: Record<string, {
|
|
2060
|
+
status: AvatarActionStatus;
|
|
2061
|
+
result?: unknown;
|
|
2062
|
+
error?: string;
|
|
2063
|
+
}>;
|
|
2064
|
+
}>;
|
|
2065
|
+
private executeSingleAction;
|
|
2066
|
+
private registerDefaultHandlers;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
declare class GreetingManager {
|
|
2070
|
+
private readonly configProvider;
|
|
2071
|
+
private readonly speechPlayer;
|
|
2072
|
+
private readonly playAnimation;
|
|
2073
|
+
private readonly events;
|
|
2074
|
+
private greetingCount;
|
|
2075
|
+
private lastGreetingTime;
|
|
2076
|
+
private delayTimer?;
|
|
2077
|
+
private visitorInteracted;
|
|
2078
|
+
constructor(configProvider: () => AvatarRuntimeConfig | undefined, speechPlayer: SpeechPlayer, playAnimation: (nameOrIntent: string) => boolean, events: EventBus);
|
|
2079
|
+
markUserInteracted(): void;
|
|
2080
|
+
evaluateAndTriggerGreeting(isFirstVisit?: boolean, isRouteChange?: boolean): void;
|
|
2081
|
+
private executeGreeting;
|
|
2082
|
+
destroy(): void;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
declare class RuntimeEventReporter {
|
|
2086
|
+
private readonly sendBackendEvent;
|
|
2087
|
+
private readonly events;
|
|
2088
|
+
private inFlight;
|
|
2089
|
+
private readonly queue;
|
|
2090
|
+
constructor(sendBackendEvent: (event: RuntimeEventRequest) => Promise<RuntimeEventResponse | void>, events: EventBus);
|
|
2091
|
+
report(type: string, pageUrl: string, payload?: Record<string, unknown>): void;
|
|
2092
|
+
private flush;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
interface TwoBoneIKChain {
|
|
2096
|
+
rootBone: THREE.Bone;
|
|
2097
|
+
midBone: THREE.Bone;
|
|
2098
|
+
endBone: THREE.Bone;
|
|
2099
|
+
poleVector: THREE.Vector3;
|
|
2100
|
+
length1: number;
|
|
2101
|
+
length2: number;
|
|
2102
|
+
}
|
|
2103
|
+
interface TwoBoneIKOptions {
|
|
2104
|
+
minKneeAngle?: number;
|
|
2105
|
+
maxKneeAngle?: number;
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Closed-form analytical Two-Bone Inverse Kinematics solver.
|
|
2109
|
+
* Solves in O(1) constant time using the trigonometric Law of Cosines.
|
|
2110
|
+
* Completely immune to iterative divergence or local minima.
|
|
2111
|
+
*/
|
|
2112
|
+
declare class TwoBoneIK {
|
|
2113
|
+
/**
|
|
2114
|
+
* Solves two-bone kinematic chain. Supports:
|
|
2115
|
+
* 1. (chain: TwoBoneIKChain, targetPosModel, rootPosModel, poleVectorModel) -> TwoBoneIKSolveResult
|
|
2116
|
+
* 2. (rootBone: THREE.Bone, midBone: THREE.Bone, tipBone: THREE.Bone, target: THREE.Vector3, poleVector: THREE.Vector3, options?: TwoBoneIKOptions) -> boolean
|
|
2117
|
+
*/
|
|
2118
|
+
static solve(chainOrRoot: TwoBoneIKChain | THREE.Bone, targetOrMid: THREE.Vector3 | THREE.Bone, rootPosOrTip?: THREE.Vector3 | THREE.Bone, poleVectorOrTarget?: THREE.Vector3, optionsOrPole?: TwoBoneIKOptions | THREE.Vector3, extraOptions?: TwoBoneIKOptions): any;
|
|
2119
|
+
private static solveAnalytical;
|
|
2120
|
+
/**
|
|
2121
|
+
* Applies solved two-bone IK rotations to the target AUBR joints in-place.
|
|
2122
|
+
*/
|
|
2123
|
+
static applyLegIK(thighBone: THREE.Bone, shinBone: THREE.Bone, footBone: THREE.Bone, thighLength: number, shinLength: number, targetFootPosModel: THREE.Vector3, poleVector: THREE.Vector3, weight?: number, modelRoot?: THREE.Object3D): void;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
interface FABRIKChain {
|
|
2127
|
+
bones: THREE.Bone[];
|
|
2128
|
+
segmentLengths: number[];
|
|
2129
|
+
totalLength: number;
|
|
2130
|
+
jointConstraints?: Array<{
|
|
2131
|
+
minAngleRad: number;
|
|
2132
|
+
maxAngleRad: number;
|
|
2133
|
+
}>;
|
|
2134
|
+
}
|
|
2135
|
+
interface FABRIKSolveResult {
|
|
2136
|
+
solvedPositions: THREE.Vector3[];
|
|
2137
|
+
reached: boolean;
|
|
2138
|
+
iterations: number;
|
|
2139
|
+
converged?: boolean;
|
|
2140
|
+
distanceToTarget?: number;
|
|
2141
|
+
}
|
|
2142
|
+
interface FABRIKSolverOptions {
|
|
2143
|
+
tolerance?: number;
|
|
2144
|
+
maxIterations?: number;
|
|
2145
|
+
poleVector?: THREE.Vector3;
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Forward And Backward Reaching Inverse Kinematics (FABRIK) solver.
|
|
2149
|
+
* Efficiently solves arbitrary multi-joint chains with segment length preservation
|
|
2150
|
+
* and pole-vector orientation constraints.
|
|
2151
|
+
*/
|
|
2152
|
+
declare class FABRIKSolver {
|
|
2153
|
+
private static readonly DEFAULT_MAX_ITERATIONS;
|
|
2154
|
+
private static readonly DEFAULT_TOLERANCE_SQ;
|
|
2155
|
+
private readonly chain;
|
|
2156
|
+
private readonly options;
|
|
2157
|
+
private currentPositions;
|
|
2158
|
+
constructor(bones: THREE.Bone[], options?: FABRIKSolverOptions);
|
|
2159
|
+
/**
|
|
2160
|
+
* Solves the chain instance toward a target in world/model space.
|
|
2161
|
+
*/
|
|
2162
|
+
solve(targetPos: THREE.Vector3, poleVector?: THREE.Vector3): {
|
|
2163
|
+
converged: boolean;
|
|
2164
|
+
reached: boolean;
|
|
2165
|
+
distanceToTarget: number;
|
|
2166
|
+
positions: THREE.Vector3[];
|
|
2167
|
+
};
|
|
2168
|
+
/**
|
|
2169
|
+
* Returns latest solved positions.
|
|
2170
|
+
*/
|
|
2171
|
+
getPositions(): THREE.Vector3[];
|
|
2172
|
+
/**
|
|
2173
|
+
* Applies the solved positions to the underlying bones.
|
|
2174
|
+
*/
|
|
2175
|
+
applyToBones(weight?: number): void;
|
|
2176
|
+
/**
|
|
2177
|
+
* Builds FABRIK chain data from an array of sequential descendant bones.
|
|
2178
|
+
*/
|
|
2179
|
+
static createChain(bones: THREE.Bone[]): FABRIKChain;
|
|
2180
|
+
/**
|
|
2181
|
+
* Solves joint chain positions toward target position in model/world space.
|
|
2182
|
+
*/
|
|
2183
|
+
static solve(chain: FABRIKChain, targetPos: THREE.Vector3, poleVector?: THREE.Vector3, options?: FABRIKSolverOptions): FABRIKSolveResult;
|
|
2184
|
+
/**
|
|
2185
|
+
* Projects middle hinge joint onto plane defined by pole vector.
|
|
2186
|
+
*/
|
|
2187
|
+
private static applyPoleVector;
|
|
2188
|
+
/**
|
|
2189
|
+
* Converts solved world positions back into local bone rotations for the Three.js hierarchy.
|
|
2190
|
+
*/
|
|
2191
|
+
static applyPositionsToBones(chain: FABRIKChain, solvedPositions: THREE.Vector3[], weight?: number): void;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
interface RigDetectionResult {
|
|
2195
|
+
rigType: RigType;
|
|
2196
|
+
capabilities: AvatarRigCapabilities;
|
|
2197
|
+
matchedBones: Map<CanonicalBoneName, THREE.Bone>;
|
|
2198
|
+
mappedBones: Map<CanonicalBoneName, THREE.Bone>;
|
|
2199
|
+
confidence: number;
|
|
2200
|
+
}
|
|
2201
|
+
declare class RigDetector {
|
|
2202
|
+
/**
|
|
2203
|
+
* Normalizes arbitrary bone identifier into a clean matching token.
|
|
2204
|
+
*/
|
|
2205
|
+
static cleanBoneName(rawName: string): string;
|
|
2206
|
+
/**
|
|
2207
|
+
* Analyzes an imported 3D model root, identifies all bones, maps them to canonical AUBR,
|
|
2208
|
+
* validates hierarchy, and reports capability profile.
|
|
2209
|
+
*/
|
|
2210
|
+
static detect(modelRoot: THREE.Object3D): RigDetectionResult;
|
|
2211
|
+
/**
|
|
2212
|
+
* Alias for detect()
|
|
2213
|
+
*/
|
|
2214
|
+
static detectRig(modelRoot: THREE.Object3D): RigDetectionResult;
|
|
2215
|
+
/**
|
|
2216
|
+
* Assesses avatar rig capabilities from detection result or model.
|
|
2217
|
+
*/
|
|
2218
|
+
static assessCapabilities(detection: RigDetectionResult, modelRoot?: THREE.Object3D): AvatarRigCapabilities;
|
|
2219
|
+
private static identifyRigFlavor;
|
|
2220
|
+
private static findBestBoneMatch;
|
|
2221
|
+
private static validateHierarchyConstraints;
|
|
2222
|
+
private static isDescendantOf;
|
|
2223
|
+
private static detectFacialCapabilities;
|
|
2224
|
+
private static createUnsupportedCapabilities;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
export { ACTION_RISK_MAP, ACTION_STATUSES, type AUBRJoint, AUBRSkeleton, AVATAR_ACTION_PROTOCOL_VERSION, AVATAR_ACTION_TYPES, type ActionExecutionContext, type ActionHandler, type ActionKind, ActionNotAllowedError, type ActionRiskLevel, ActionScheduler, type AnimationCategory, type AppRouterLike, Asiyst, type AsiystClientInstance, type AsiystDiagnosticReport, AsiystError, type AsiystErrorCode, type AsiystEventMap, type AsiystEventName, type AsiystFallbackOptions, type AsiystInstance, type AsiystProgress, type AsiystSDKState, AssetLoader, type AssistantMode, AuthenticationError, type AvatarActionItem, type AvatarActionPlan, type AvatarActionStatus, type AvatarActionType, type AvatarAnimation, type AvatarBranding, AvatarController, type AvatarLifecycleState, type AvatarLoadingTimestamps, AvatarMetricsTracker, type AvatarPerformanceMetrics, type AvatarPose, type AvatarRenderer, type AvatarRigCapabilities, type AvatarRuntimeConfig, CANONICAL_BONE_NAMES, type CanonicalBoneName, type CharacterProportions, type ChatLifecycleState, ConfigurationError, ConfirmationManager, type ConfirmationRequestDetails, CssAvatarRenderer, CustomHostNavigationAdapter, DefaultBrowserNavigationAdapter, type DiagnosticResult, type ExpressionType, FABRIKSolver, FacialAnimationEngine, type FbxMountOptions, type FbxRenderMetrics, FbxRenderer, GestureEngine, type GestureType, GreetingManager, type HighlightStyle, IdleEngine, type InitOptions, InitializationError, LocomotionEngine, LookAtEngine, type MappedElement, MotionCoordinator, type MotionLayerWeights, type MotionState, MotionStateMachine, MovementEngine, type NavigationAdapter, NetworkError, NextJsAppRouterNavigationAdapter, NextJsPagesNavigationAdapter, ProceduralMovementEngine, type ProjectConfig, type RegisteredTarget, RigDetector, type RigType, RuntimeEventReporter, type RuntimeLifecycleState, SDK_VERSION, type SpeechOptions, SpeechPlayer, type TargetInput, TargetNotFoundError, type TargetRef, TargetRegistry, type TaskDefinition, TaskExecutionError, TaskStatus, type TaskStep, type TourDefinition, TourEngine, type TourEngineOptions, type TourStatus, type TourStep, type TourStepChangeEvent, TwoBoneIK, type WebsiteMapSnapshot, type WorkflowDefinition, anchorToViewport, asiystInit, canNavigateTo, canTransition, computeAvatarDestination, createAsiystInstance, createNextAppRouterAdapter, evaluateActionPermission, fallbackConfig, isActionAllowed, isSafeSelector, isSensitiveTarget, normalizeProjectConfig, sanitizeText, setGlobalNavigationAdapter, validateActionDependencies, validateActionItem, validateActionPlan, validateInitOptions, validateWebsiteDomain };
|