UNPKG

@promptbook/remote-server

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

82 lines (81 loc) 3.14 kB
import type { AvatarDefinition } from './types/AvatarDefinition'; import type { AvatarInteractionState, AvatarPointerType } from './types/AvatarVisualDefinition'; /** * Internal interaction state kept between animation frames. * * @private utility of the avatar rendering system */ export type AvatarInteractionRuntimeState = AvatarInteractionState & { readonly lastFrameMs: number | null; }; /** * Raw shared pointer sample used to derive one avatar-local gaze target. * * @private utility of the avatar rendering system */ export type AvatarPointerSnapshot = { readonly clientX: number; readonly clientY: number; readonly isPointerActive: boolean; readonly pointerType: Exclude<AvatarPointerType, 'idle'>; }; /** * Avatar-local pointer target resolved from viewport coordinates. * * @private utility of the avatar rendering system */ export type AvatarPointerTarget = { readonly gazeX: number; readonly gazeY: number; readonly bodyOffsetX: number; readonly bodyOffsetY: number; readonly intensity: number; readonly isPointerActive: boolean; readonly pointerType: AvatarPointerType; }; /** * Creates one stable cache key from the meaningful avatar-definition fields. * * @param avatarDefinition Normalized or raw avatar definition. * @returns Stable cache key that ignores object identity churn. * * @private utility of the avatar rendering system */ export declare function createAvatarDefinitionKey(avatarDefinition: AvatarDefinition): string; /** * Returns the neutral interaction state used by static/server-side renders. * * @returns Zeroed interaction state. * * @private utility of the avatar rendering system */ export declare function createIdleAvatarInteractionState(): AvatarInteractionState; /** * Creates a fresh runtime state for the interactive animation loop. * * @returns Runtime interaction state with neutral values. * * @private utility of the avatar rendering system */ export declare function createAvatarInteractionRuntimeState(): AvatarInteractionRuntimeState; /** * Converts the shared viewport pointer state into one avatar-local gaze target. * * @param avatarBounds Canvas bounds in viewport coordinates. * @param pointerSnapshot Latest shared pointer sample. * @returns Local target used to steer eyes and subtle body lean. * * @private utility of the avatar rendering system */ export declare function resolveAvatarPointerTarget(avatarBounds: Pick<DOMRectReadOnly, 'left' | 'top' | 'width' | 'height'>, pointerSnapshot: AvatarPointerSnapshot | null): AvatarPointerTarget; /** * Advances the smoothed interaction state toward the latest pointer target. * * @param runtimeState Previous animation-frame state. * @param pointerTarget Latest local pointer target. * @param nowMs Current animation-frame timestamp. * @returns Next runtime state to keep in the animation loop. * * @private utility of the avatar rendering system */ export declare function stepAvatarInteractionRuntimeState(runtimeState: AvatarInteractionRuntimeState, pointerTarget: AvatarPointerTarget, nowMs: number): AvatarInteractionRuntimeState;