@elizaos/app-core 2.0.0-alpha.37
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/.turbo/turbo-build.log +2 -0
- package/LICENSE +21 -0
- package/dist/App.d.ts +5 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +198 -0
- package/dist/actions/character.d.ts +27 -0
- package/dist/actions/character.d.ts.map +1 -0
- package/dist/actions/character.js +97 -0
- package/dist/actions/chat-helpers.d.ts +47 -0
- package/dist/actions/chat-helpers.d.ts.map +1 -0
- package/dist/actions/chat-helpers.js +79 -0
- package/dist/actions/cloud.d.ts +17 -0
- package/dist/actions/cloud.d.ts.map +1 -0
- package/dist/actions/cloud.js +43 -0
- package/dist/actions/index.d.ts +12 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +11 -0
- package/dist/actions/lifecycle.d.ts +43 -0
- package/dist/actions/lifecycle.d.ts.map +1 -0
- package/dist/actions/lifecycle.js +118 -0
- package/dist/actions/onboarding.d.ts +12 -0
- package/dist/actions/onboarding.d.ts.map +1 -0
- package/dist/actions/onboarding.js +28 -0
- package/dist/actions/triggers.d.ts +23 -0
- package/dist/actions/triggers.d.ts.map +1 -0
- package/dist/actions/triggers.js +148 -0
- package/dist/api/client.d.ts +2823 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +2392 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +1 -0
- package/dist/autonomy/index.d.ts +48 -0
- package/dist/autonomy/index.d.ts.map +1 -0
- package/dist/autonomy/index.js +330 -0
- package/dist/bridge/capacitor-bridge.d.ts +153 -0
- package/dist/bridge/capacitor-bridge.d.ts.map +1 -0
- package/dist/bridge/capacitor-bridge.js +193 -0
- package/dist/bridge/electrobun-rpc.d.ts +19 -0
- package/dist/bridge/electrobun-rpc.d.ts.map +1 -0
- package/dist/bridge/electrobun-rpc.js +27 -0
- package/dist/bridge/electrobun-runtime.d.ts +3 -0
- package/dist/bridge/electrobun-runtime.d.ts.map +1 -0
- package/dist/bridge/electrobun-runtime.js +17 -0
- package/dist/bridge/index.d.ts +6 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +5 -0
- package/dist/bridge/native-plugins.d.ts +82 -0
- package/dist/bridge/native-plugins.d.ts.map +1 -0
- package/dist/bridge/native-plugins.js +39 -0
- package/dist/bridge/plugin-bridge.d.ts +116 -0
- package/dist/bridge/plugin-bridge.d.ts.map +1 -0
- package/dist/bridge/plugin-bridge.js +203 -0
- package/dist/bridge/storage-bridge.d.ts +39 -0
- package/dist/bridge/storage-bridge.d.ts.map +1 -0
- package/dist/bridge/storage-bridge.js +135 -0
- package/dist/chat/index.d.ts +57 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +161 -0
- package/dist/coding/index.d.ts +25 -0
- package/dist/coding/index.d.ts.map +1 -0
- package/dist/coding/index.js +25 -0
- package/dist/components/AdvancedPageView.d.ts +17 -0
- package/dist/components/AdvancedPageView.d.ts.map +1 -0
- package/dist/components/AdvancedPageView.js +137 -0
- package/dist/components/AgentActivityBox.d.ts +7 -0
- package/dist/components/AgentActivityBox.d.ts.map +1 -0
- package/dist/components/AgentActivityBox.js +25 -0
- package/dist/components/ApiKeyConfig.d.ts +26 -0
- package/dist/components/ApiKeyConfig.d.ts.map +1 -0
- package/dist/components/ApiKeyConfig.js +121 -0
- package/dist/components/AppsPageView.d.ts +7 -0
- package/dist/components/AppsPageView.d.ts.map +1 -0
- package/dist/components/AppsPageView.js +31 -0
- package/dist/components/AppsView.d.ts +8 -0
- package/dist/components/AppsView.d.ts.map +1 -0
- package/dist/components/AppsView.js +149 -0
- package/dist/components/AvatarLoader.d.ts +9 -0
- package/dist/components/AvatarLoader.d.ts.map +1 -0
- package/dist/components/AvatarLoader.js +45 -0
- package/dist/components/AvatarSelector.d.ts +23 -0
- package/dist/components/AvatarSelector.d.ts.map +1 -0
- package/dist/components/AvatarSelector.js +105 -0
- package/dist/components/BscTradePanel.d.ts +22 -0
- package/dist/components/BscTradePanel.d.ts.map +1 -0
- package/dist/components/BscTradePanel.js +221 -0
- package/dist/components/BugReportModal.d.ts +2 -0
- package/dist/components/BugReportModal.d.ts.map +1 -0
- package/dist/components/BugReportModal.js +218 -0
- package/dist/components/CharacterView.d.ts +8 -0
- package/dist/components/CharacterView.d.ts.map +1 -0
- package/dist/components/CharacterView.js +703 -0
- package/dist/components/ChatAvatar.d.ts +8 -0
- package/dist/components/ChatAvatar.d.ts.map +1 -0
- package/dist/components/ChatAvatar.js +89 -0
- package/dist/components/ChatComposer.d.ts +37 -0
- package/dist/components/ChatComposer.d.ts.map +1 -0
- package/dist/components/ChatComposer.js +136 -0
- package/dist/components/ChatMessage.d.ts +24 -0
- package/dist/components/ChatMessage.d.ts.map +1 -0
- package/dist/components/ChatMessage.js +167 -0
- package/dist/components/ChatModalView.d.ts +10 -0
- package/dist/components/ChatModalView.d.ts.map +1 -0
- package/dist/components/ChatModalView.js +57 -0
- package/dist/components/ChatView.d.ts +14 -0
- package/dist/components/ChatView.d.ts.map +1 -0
- package/dist/components/ChatView.js +511 -0
- package/dist/components/CloudSourceControls.d.ts +13 -0
- package/dist/components/CloudSourceControls.d.ts.map +1 -0
- package/dist/components/CloudSourceControls.js +14 -0
- package/dist/components/CodingAgentSettingsSection.d.ts +2 -0
- package/dist/components/CodingAgentSettingsSection.d.ts.map +1 -0
- package/dist/components/CodingAgentSettingsSection.js +268 -0
- package/dist/components/CommandPalette.d.ts +2 -0
- package/dist/components/CommandPalette.d.ts.map +1 -0
- package/dist/components/CommandPalette.js +181 -0
- package/dist/components/CompanionSceneHost.d.ts +15 -0
- package/dist/components/CompanionSceneHost.d.ts.map +1 -0
- package/dist/components/CompanionSceneHost.js +343 -0
- package/dist/components/CompanionShell.d.ts +17 -0
- package/dist/components/CompanionShell.d.ts.map +1 -0
- package/dist/components/CompanionShell.js +15 -0
- package/dist/components/CompanionView.d.ts +2 -0
- package/dist/components/CompanionView.d.ts.map +1 -0
- package/dist/components/CompanionView.js +22 -0
- package/dist/components/ConfigPageView.d.ts +11 -0
- package/dist/components/ConfigPageView.d.ts.map +1 -0
- package/dist/components/ConfigPageView.js +275 -0
- package/dist/components/ConfigSaveFooter.d.ts +8 -0
- package/dist/components/ConfigSaveFooter.d.ts.map +1 -0
- package/dist/components/ConfigSaveFooter.js +10 -0
- package/dist/components/ConfirmModal.d.ts +61 -0
- package/dist/components/ConfirmModal.d.ts.map +1 -0
- package/dist/components/ConfirmModal.js +164 -0
- package/dist/components/ConnectionFailedBanner.d.ts +6 -0
- package/dist/components/ConnectionFailedBanner.d.ts.map +1 -0
- package/dist/components/ConnectionFailedBanner.js +22 -0
- package/dist/components/ConnectorsPageView.d.ts +7 -0
- package/dist/components/ConnectorsPageView.d.ts.map +1 -0
- package/dist/components/ConnectorsPageView.js +8 -0
- package/dist/components/ConversationsSidebar.d.ts +9 -0
- package/dist/components/ConversationsSidebar.d.ts.map +1 -0
- package/dist/components/ConversationsSidebar.js +116 -0
- package/dist/components/CustomActionEditor.d.ts +10 -0
- package/dist/components/CustomActionEditor.d.ts.map +1 -0
- package/dist/components/CustomActionEditor.js +578 -0
- package/dist/components/CustomActionsPanel.d.ts +9 -0
- package/dist/components/CustomActionsPanel.d.ts.map +1 -0
- package/dist/components/CustomActionsPanel.js +107 -0
- package/dist/components/CustomActionsView.d.ts +2 -0
- package/dist/components/CustomActionsView.d.ts.map +1 -0
- package/dist/components/CustomActionsView.js +134 -0
- package/dist/components/DatabasePageView.d.ts +5 -0
- package/dist/components/DatabasePageView.d.ts.map +1 -0
- package/dist/components/DatabasePageView.js +28 -0
- package/dist/components/DatabaseView.d.ts +9 -0
- package/dist/components/DatabaseView.d.ts.map +1 -0
- package/dist/components/DatabaseView.js +311 -0
- package/dist/components/ElizaCloudDashboard.d.ts +2 -0
- package/dist/components/ElizaCloudDashboard.d.ts.map +1 -0
- package/dist/components/ElizaCloudDashboard.js +657 -0
- package/dist/components/EmotePicker.d.ts +2 -0
- package/dist/components/EmotePicker.d.ts.map +1 -0
- package/dist/components/EmotePicker.js +343 -0
- package/dist/components/ErrorBoundary.d.ts +22 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.js +31 -0
- package/dist/components/FineTuningView.d.ts +2 -0
- package/dist/components/FineTuningView.d.ts.map +1 -0
- package/dist/components/FineTuningView.js +433 -0
- package/dist/components/GameView.d.ts +11 -0
- package/dist/components/GameView.d.ts.map +1 -0
- package/dist/components/GameView.js +295 -0
- package/dist/components/GameViewOverlay.d.ts +8 -0
- package/dist/components/GameViewOverlay.d.ts.map +1 -0
- package/dist/components/GameViewOverlay.js +70 -0
- package/dist/components/GlobalEmoteOverlay.d.ts +2 -0
- package/dist/components/GlobalEmoteOverlay.d.ts.map +1 -0
- package/dist/components/GlobalEmoteOverlay.js +112 -0
- package/dist/components/Header.d.ts +8 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +121 -0
- package/dist/components/HeartbeatsView.d.ts +2 -0
- package/dist/components/HeartbeatsView.d.ts.map +1 -0
- package/dist/components/HeartbeatsView.js +378 -0
- package/dist/components/InventoryView.d.ts +10 -0
- package/dist/components/InventoryView.d.ts.map +1 -0
- package/dist/components/InventoryView.js +162 -0
- package/dist/components/KnowledgeView.d.ts +20 -0
- package/dist/components/KnowledgeView.d.ts.map +1 -0
- package/dist/components/KnowledgeView.js +480 -0
- package/dist/components/LanguageDropdown.d.ts +30 -0
- package/dist/components/LanguageDropdown.d.ts.map +1 -0
- package/dist/components/LanguageDropdown.js +98 -0
- package/dist/components/LifoMonitorPanel.d.ts +21 -0
- package/dist/components/LifoMonitorPanel.d.ts.map +1 -0
- package/dist/components/LifoMonitorPanel.js +24 -0
- package/dist/components/LifoSandboxView.d.ts +5 -0
- package/dist/components/LifoSandboxView.d.ts.map +1 -0
- package/dist/components/LifoSandboxView.js +333 -0
- package/dist/components/LoadingScreen.d.ts +13 -0
- package/dist/components/LoadingScreen.d.ts.map +1 -0
- package/dist/components/LoadingScreen.js +39 -0
- package/dist/components/LogsPageView.d.ts +2 -0
- package/dist/components/LogsPageView.d.ts.map +1 -0
- package/dist/components/LogsPageView.js +7 -0
- package/dist/components/LogsView.d.ts +5 -0
- package/dist/components/LogsView.d.ts.map +1 -0
- package/dist/components/LogsView.js +71 -0
- package/dist/components/MediaGalleryView.d.ts +9 -0
- package/dist/components/MediaGalleryView.d.ts.map +1 -0
- package/dist/components/MediaGalleryView.js +236 -0
- package/dist/components/MediaSettingsSection.d.ts +11 -0
- package/dist/components/MediaSettingsSection.d.ts.map +1 -0
- package/dist/components/MediaSettingsSection.js +329 -0
- package/dist/components/MessageContent.d.ts +51 -0
- package/dist/components/MessageContent.d.ts.map +1 -0
- package/dist/components/MessageContent.js +553 -0
- package/dist/components/OnboardingWizard.d.ts +2 -0
- package/dist/components/OnboardingWizard.d.ts.map +1 -0
- package/dist/components/OnboardingWizard.js +59 -0
- package/dist/components/PairingView.d.ts +5 -0
- package/dist/components/PairingView.d.ts.map +1 -0
- package/dist/components/PairingView.js +28 -0
- package/dist/components/PermissionsSection.d.ts +20 -0
- package/dist/components/PermissionsSection.d.ts.map +1 -0
- package/dist/components/PermissionsSection.js +368 -0
- package/dist/components/PluginsPageView.d.ts +5 -0
- package/dist/components/PluginsPageView.d.ts.map +1 -0
- package/dist/components/PluginsPageView.js +8 -0
- package/dist/components/PluginsView.d.ts +21 -0
- package/dist/components/PluginsView.d.ts.map +1 -0
- package/dist/components/PluginsView.js +1531 -0
- package/dist/components/ProviderSwitcher.d.ts +42 -0
- package/dist/components/ProviderSwitcher.d.ts.map +1 -0
- package/dist/components/ProviderSwitcher.js +480 -0
- package/dist/components/RestartBanner.d.ts +2 -0
- package/dist/components/RestartBanner.d.ts.map +1 -0
- package/dist/components/RestartBanner.js +36 -0
- package/dist/components/RuntimeView.d.ts +10 -0
- package/dist/components/RuntimeView.d.ts.map +1 -0
- package/dist/components/RuntimeView.js +165 -0
- package/dist/components/SaveCommandModal.d.ts +12 -0
- package/dist/components/SaveCommandModal.d.ts.map +1 -0
- package/dist/components/SaveCommandModal.js +84 -0
- package/dist/components/SecretsView.d.ts +9 -0
- package/dist/components/SecretsView.d.ts.map +1 -0
- package/dist/components/SecretsView.js +249 -0
- package/dist/components/SettingsView.d.ts +9 -0
- package/dist/components/SettingsView.d.ts.map +1 -0
- package/dist/components/SettingsView.js +230 -0
- package/dist/components/ShellOverlays.d.ts +8 -0
- package/dist/components/ShellOverlays.d.ts.map +1 -0
- package/dist/components/ShellOverlays.js +10 -0
- package/dist/components/ShortcutsOverlay.d.ts +2 -0
- package/dist/components/ShortcutsOverlay.d.ts.map +1 -0
- package/dist/components/ShortcutsOverlay.js +79 -0
- package/dist/components/SkillsView.d.ts +11 -0
- package/dist/components/SkillsView.d.ts.map +1 -0
- package/dist/components/SkillsView.js +358 -0
- package/dist/components/StartupFailureView.d.ts +8 -0
- package/dist/components/StartupFailureView.d.ts.map +1 -0
- package/dist/components/StartupFailureView.js +15 -0
- package/dist/components/StreamView.d.ts +16 -0
- package/dist/components/StreamView.d.ts.map +1 -0
- package/dist/components/StreamView.js +300 -0
- package/dist/components/StripeEmbeddedCheckout.d.ts +24 -0
- package/dist/components/StripeEmbeddedCheckout.d.ts.map +1 -0
- package/dist/components/StripeEmbeddedCheckout.js +101 -0
- package/dist/components/SubscriptionStatus.d.ts +22 -0
- package/dist/components/SubscriptionStatus.d.ts.map +1 -0
- package/dist/components/SubscriptionStatus.js +301 -0
- package/dist/components/SystemWarningBanner.d.ts +6 -0
- package/dist/components/SystemWarningBanner.d.ts.map +1 -0
- package/dist/components/SystemWarningBanner.js +46 -0
- package/dist/components/ThemeToggle.d.ts +21 -0
- package/dist/components/ThemeToggle.d.ts.map +1 -0
- package/dist/components/ThemeToggle.js +24 -0
- package/dist/components/TrajectoriesView.d.ts +12 -0
- package/dist/components/TrajectoriesView.d.ts.map +1 -0
- package/dist/components/TrajectoriesView.js +183 -0
- package/dist/components/TrajectoryDetailView.d.ts +13 -0
- package/dist/components/TrajectoryDetailView.d.ts.map +1 -0
- package/dist/components/TrajectoryDetailView.js +112 -0
- package/dist/components/TriggersView.d.ts +2 -0
- package/dist/components/TriggersView.d.ts.map +1 -0
- package/dist/components/TriggersView.js +1 -0
- package/dist/components/VectorBrowserView.d.ts +10 -0
- package/dist/components/VectorBrowserView.d.ts.map +1 -0
- package/dist/components/VectorBrowserView.js +997 -0
- package/dist/components/VoiceConfigView.d.ts +11 -0
- package/dist/components/VoiceConfigView.d.ts.map +1 -0
- package/dist/components/VoiceConfigView.js +329 -0
- package/dist/components/VrmStage.d.ts +21 -0
- package/dist/components/VrmStage.d.ts.map +1 -0
- package/dist/components/VrmStage.js +252 -0
- package/dist/components/WhatsAppQrOverlay.d.ts +8 -0
- package/dist/components/WhatsAppQrOverlay.d.ts.map +1 -0
- package/dist/components/WhatsAppQrOverlay.js +63 -0
- package/dist/components/apps/AppDetailPane.d.ts +15 -0
- package/dist/components/apps/AppDetailPane.d.ts.map +1 -0
- package/dist/components/apps/AppDetailPane.js +13 -0
- package/dist/components/apps/AppsCatalogGrid.d.ts +20 -0
- package/dist/components/apps/AppsCatalogGrid.d.ts.map +1 -0
- package/dist/components/apps/AppsCatalogGrid.js +18 -0
- package/dist/components/apps/extensions/HyperscapeAppDetailPanel.d.ts +3 -0
- package/dist/components/apps/extensions/HyperscapeAppDetailPanel.d.ts.map +1 -0
- package/dist/components/apps/extensions/HyperscapeAppDetailPanel.js +253 -0
- package/dist/components/apps/extensions/registry.d.ts +4 -0
- package/dist/components/apps/extensions/registry.d.ts.map +1 -0
- package/dist/components/apps/extensions/registry.js +10 -0
- package/dist/components/apps/extensions/types.d.ts +7 -0
- package/dist/components/apps/extensions/types.d.ts.map +1 -0
- package/dist/components/apps/extensions/types.js +1 -0
- package/dist/components/apps/helpers.d.ts +7 -0
- package/dist/components/apps/helpers.d.ts.map +1 -0
- package/dist/components/apps/helpers.js +46 -0
- package/dist/components/avatar/VrmAnimationLoader.d.ts +30 -0
- package/dist/components/avatar/VrmAnimationLoader.d.ts.map +1 -0
- package/dist/components/avatar/VrmAnimationLoader.js +99 -0
- package/dist/components/avatar/VrmBlinkController.d.ts +37 -0
- package/dist/components/avatar/VrmBlinkController.d.ts.map +1 -0
- package/dist/components/avatar/VrmBlinkController.js +98 -0
- package/dist/components/avatar/VrmCameraManager.d.ts +57 -0
- package/dist/components/avatar/VrmCameraManager.d.ts.map +1 -0
- package/dist/components/avatar/VrmCameraManager.js +277 -0
- package/dist/components/avatar/VrmEngine.d.ts +229 -0
- package/dist/components/avatar/VrmEngine.d.ts.map +1 -0
- package/dist/components/avatar/VrmEngine.js +1950 -0
- package/dist/components/avatar/VrmFootShadow.d.ts +18 -0
- package/dist/components/avatar/VrmFootShadow.d.ts.map +1 -0
- package/dist/components/avatar/VrmFootShadow.js +83 -0
- package/dist/components/avatar/VrmViewer.d.ts +45 -0
- package/dist/components/avatar/VrmViewer.d.ts.map +1 -0
- package/dist/components/avatar/VrmViewer.js +341 -0
- package/dist/components/avatar/mixamoVRMRigMap.d.ts +3 -0
- package/dist/components/avatar/mixamoVRMRigMap.d.ts.map +1 -0
- package/dist/components/avatar/mixamoVRMRigMap.js +56 -0
- package/dist/components/avatar/retargetMixamoFbxToVrm.d.ts +9 -0
- package/dist/components/avatar/retargetMixamoFbxToVrm.d.ts.map +1 -0
- package/dist/components/avatar/retargetMixamoFbxToVrm.js +88 -0
- package/dist/components/avatar/retargetMixamoGltfToVrm.d.ts +11 -0
- package/dist/components/avatar/retargetMixamoGltfToVrm.d.ts.map +1 -0
- package/dist/components/avatar/retargetMixamoGltfToVrm.js +80 -0
- package/dist/components/chainConfig.d.ts +84 -0
- package/dist/components/chainConfig.d.ts.map +1 -0
- package/dist/components/chainConfig.js +268 -0
- package/dist/components/companion/CompanionHeader.d.ts +15 -0
- package/dist/components/companion/CompanionHeader.d.ts.map +1 -0
- package/dist/components/companion/CompanionHeader.js +7 -0
- package/dist/components/companion/CompanionSceneHost.d.ts +2 -0
- package/dist/components/companion/CompanionSceneHost.d.ts.map +1 -0
- package/dist/components/companion/CompanionSceneHost.js +1 -0
- package/dist/components/companion/VrmStage.d.ts +3 -0
- package/dist/components/companion/VrmStage.d.ts.map +1 -0
- package/dist/components/companion/VrmStage.js +1 -0
- package/dist/components/companion/walletUtils.d.ts +95 -0
- package/dist/components/companion/walletUtils.d.ts.map +1 -0
- package/dist/components/companion/walletUtils.js +167 -0
- package/dist/components/companion-shell-styles.d.ts +38 -0
- package/dist/components/companion-shell-styles.d.ts.map +1 -0
- package/dist/components/companion-shell-styles.js +248 -0
- package/dist/components/confirm-delete-control.d.ts +16 -0
- package/dist/components/confirm-delete-control.d.ts.map +1 -0
- package/dist/components/confirm-delete-control.js +12 -0
- package/dist/components/conversations/ConversationListItem.d.ts +31 -0
- package/dist/components/conversations/ConversationListItem.d.ts.map +1 -0
- package/dist/components/conversations/ConversationListItem.js +52 -0
- package/dist/components/conversations/conversation-utils.d.ts +9 -0
- package/dist/components/conversations/conversation-utils.d.ts.map +1 -0
- package/dist/components/conversations/conversation-utils.js +138 -0
- package/dist/components/format.d.ts +54 -0
- package/dist/components/format.d.ts.map +1 -0
- package/dist/components/format.js +82 -0
- package/dist/components/index.d.ts +93 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +92 -0
- package/dist/components/inventory/CopyableAddress.d.ts +8 -0
- package/dist/components/inventory/CopyableAddress.d.ts.map +1 -0
- package/dist/components/inventory/CopyableAddress.js +18 -0
- package/dist/components/inventory/InventoryToolbar.d.ts +25 -0
- package/dist/components/inventory/InventoryToolbar.d.ts.map +1 -0
- package/dist/components/inventory/InventoryToolbar.js +28 -0
- package/dist/components/inventory/NftGrid.d.ts +13 -0
- package/dist/components/inventory/NftGrid.d.ts.map +1 -0
- package/dist/components/inventory/NftGrid.js +29 -0
- package/dist/components/inventory/TokenLogo.d.ts +12 -0
- package/dist/components/inventory/TokenLogo.d.ts.map +1 -0
- package/dist/components/inventory/TokenLogo.js +33 -0
- package/dist/components/inventory/TokensTable.d.ts +24 -0
- package/dist/components/inventory/TokensTable.d.ts.map +1 -0
- package/dist/components/inventory/TokensTable.js +26 -0
- package/dist/components/inventory/constants.d.ts +52 -0
- package/dist/components/inventory/constants.d.ts.map +1 -0
- package/dist/components/inventory/constants.js +121 -0
- package/dist/components/inventory/index.d.ts +9 -0
- package/dist/components/inventory/index.d.ts.map +1 -0
- package/dist/components/inventory/index.js +8 -0
- package/dist/components/inventory/media-url.d.ts +6 -0
- package/dist/components/inventory/media-url.d.ts.map +1 -0
- package/dist/components/inventory/media-url.js +28 -0
- package/dist/components/inventory/useInventoryData.d.ts +53 -0
- package/dist/components/inventory/useInventoryData.d.ts.map +1 -0
- package/dist/components/inventory/useInventoryData.js +332 -0
- package/dist/components/knowledge-upload-image.d.ts +27 -0
- package/dist/components/knowledge-upload-image.d.ts.map +1 -0
- package/dist/components/knowledge-upload-image.js +146 -0
- package/dist/components/labels.d.ts +6 -0
- package/dist/components/labels.d.ts.map +1 -0
- package/dist/components/labels.js +40 -0
- package/dist/components/onboarding/ActivateStep.d.ts +2 -0
- package/dist/components/onboarding/ActivateStep.d.ts.map +1 -0
- package/dist/components/onboarding/ActivateStep.js +6 -0
- package/dist/components/onboarding/ConnectionStep.d.ts +2 -0
- package/dist/components/onboarding/ConnectionStep.d.ts.map +1 -0
- package/dist/components/onboarding/ConnectionStep.js +552 -0
- package/dist/components/onboarding/OnboardingPanel.d.ts +9 -0
- package/dist/components/onboarding/OnboardingPanel.d.ts.map +1 -0
- package/dist/components/onboarding/OnboardingPanel.js +24 -0
- package/dist/components/onboarding/OnboardingStepNav.d.ts +2 -0
- package/dist/components/onboarding/OnboardingStepNav.d.ts.map +1 -0
- package/dist/components/onboarding/OnboardingStepNav.js +14 -0
- package/dist/components/onboarding/PermissionsStep.d.ts +2 -0
- package/dist/components/onboarding/PermissionsStep.d.ts.map +1 -0
- package/dist/components/onboarding/PermissionsStep.js +7 -0
- package/dist/components/onboarding/RpcStep.d.ts +2 -0
- package/dist/components/onboarding/RpcStep.d.ts.map +1 -0
- package/dist/components/onboarding/RpcStep.js +125 -0
- package/dist/components/onboarding/WakeUpStep.d.ts +2 -0
- package/dist/components/onboarding/WakeUpStep.d.ts.map +1 -0
- package/dist/components/onboarding/WakeUpStep.js +82 -0
- package/dist/components/permissions/PermissionIcon.d.ts +4 -0
- package/dist/components/permissions/PermissionIcon.d.ts.map +1 -0
- package/dist/components/permissions/PermissionIcon.js +12 -0
- package/dist/components/permissions/StreamingPermissions.d.ts +20 -0
- package/dist/components/permissions/StreamingPermissions.d.ts.map +1 -0
- package/dist/components/permissions/StreamingPermissions.js +173 -0
- package/dist/components/plugins/showcase-data.d.ts +7 -0
- package/dist/components/plugins/showcase-data.d.ts.map +1 -0
- package/dist/components/plugins/showcase-data.js +464 -0
- package/dist/components/shared/ShellHeaderControls.d.ts +27 -0
- package/dist/components/shared/ShellHeaderControls.d.ts.map +1 -0
- package/dist/components/shared/ShellHeaderControls.js +60 -0
- package/dist/components/skeletons.d.ts +17 -0
- package/dist/components/skeletons.d.ts.map +1 -0
- package/dist/components/skeletons.js +22 -0
- package/dist/components/stream/ActivityFeed.d.ts +5 -0
- package/dist/components/stream/ActivityFeed.d.ts.map +1 -0
- package/dist/components/stream/ActivityFeed.js +57 -0
- package/dist/components/stream/AvatarPip.d.ts +5 -0
- package/dist/components/stream/AvatarPip.d.ts.map +1 -0
- package/dist/components/stream/AvatarPip.js +6 -0
- package/dist/components/stream/ChatContent.d.ts +6 -0
- package/dist/components/stream/ChatContent.d.ts.map +1 -0
- package/dist/components/stream/ChatContent.js +69 -0
- package/dist/components/stream/ChatTicker.d.ts +5 -0
- package/dist/components/stream/ChatTicker.d.ts.map +1 -0
- package/dist/components/stream/ChatTicker.js +34 -0
- package/dist/components/stream/IdleContent.d.ts +5 -0
- package/dist/components/stream/IdleContent.d.ts.map +1 -0
- package/dist/components/stream/IdleContent.js +17 -0
- package/dist/components/stream/StatusBar.d.ts +36 -0
- package/dist/components/stream/StatusBar.d.ts.map +1 -0
- package/dist/components/stream/StatusBar.js +140 -0
- package/dist/components/stream/StreamSettings.d.ts +33 -0
- package/dist/components/stream/StreamSettings.d.ts.map +1 -0
- package/dist/components/stream/StreamSettings.js +99 -0
- package/dist/components/stream/StreamTerminal.d.ts +2 -0
- package/dist/components/stream/StreamTerminal.d.ts.map +1 -0
- package/dist/components/stream/StreamTerminal.js +52 -0
- package/dist/components/stream/StreamVoiceConfig.d.ts +10 -0
- package/dist/components/stream/StreamVoiceConfig.d.ts.map +1 -0
- package/dist/components/stream/StreamVoiceConfig.js +88 -0
- package/dist/components/stream/helpers.d.ts +32 -0
- package/dist/components/stream/helpers.d.ts.map +1 -0
- package/dist/components/stream/helpers.js +110 -0
- package/dist/components/stream/overlays/OverlayLayer.d.ts +20 -0
- package/dist/components/stream/overlays/OverlayLayer.d.ts.map +1 -0
- package/dist/components/stream/overlays/OverlayLayer.js +24 -0
- package/dist/components/stream/overlays/built-in/ActionTickerWidget.d.ts +8 -0
- package/dist/components/stream/overlays/built-in/ActionTickerWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/ActionTickerWidget.js +44 -0
- package/dist/components/stream/overlays/built-in/AlertPopupWidget.d.ts +7 -0
- package/dist/components/stream/overlays/built-in/AlertPopupWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/AlertPopupWidget.js +62 -0
- package/dist/components/stream/overlays/built-in/BrandingWidget.d.ts +7 -0
- package/dist/components/stream/overlays/built-in/BrandingWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/BrandingWidget.js +36 -0
- package/dist/components/stream/overlays/built-in/CustomHtmlWidget.d.ts +26 -0
- package/dist/components/stream/overlays/built-in/CustomHtmlWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/CustomHtmlWidget.js +78 -0
- package/dist/components/stream/overlays/built-in/PeonGlassWidget.d.ts +11 -0
- package/dist/components/stream/overlays/built-in/PeonGlassWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/PeonGlassWidget.js +188 -0
- package/dist/components/stream/overlays/built-in/PeonHudWidget.d.ts +10 -0
- package/dist/components/stream/overlays/built-in/PeonHudWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/PeonHudWidget.js +168 -0
- package/dist/components/stream/overlays/built-in/PeonSakuraWidget.d.ts +11 -0
- package/dist/components/stream/overlays/built-in/PeonSakuraWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/PeonSakuraWidget.js +213 -0
- package/dist/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts +8 -0
- package/dist/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/ThoughtBubbleWidget.js +59 -0
- package/dist/components/stream/overlays/built-in/ViewerCountWidget.d.ts +7 -0
- package/dist/components/stream/overlays/built-in/ViewerCountWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/ViewerCountWidget.js +34 -0
- package/dist/components/stream/overlays/built-in/index.d.ts +13 -0
- package/dist/components/stream/overlays/built-in/index.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/index.js +12 -0
- package/dist/components/stream/overlays/registry.d.ts +11 -0
- package/dist/components/stream/overlays/registry.d.ts.map +1 -0
- package/dist/components/stream/overlays/registry.js +16 -0
- package/dist/components/stream/overlays/types.d.ts +67 -0
- package/dist/components/stream/overlays/types.d.ts.map +1 -0
- package/dist/components/stream/overlays/types.js +7 -0
- package/dist/components/stream/overlays/useOverlayLayout.d.ts +27 -0
- package/dist/components/stream/overlays/useOverlayLayout.d.ts.map +1 -0
- package/dist/components/stream/overlays/useOverlayLayout.js +162 -0
- package/dist/components/trajectory-format.d.ts +6 -0
- package/dist/components/trajectory-format.d.ts.map +1 -0
- package/dist/components/trajectory-format.js +43 -0
- package/dist/components/ui-badges.d.ts +23 -0
- package/dist/components/ui-badges.d.ts.map +1 -0
- package/dist/components/ui-badges.js +38 -0
- package/dist/components/ui-switch.d.ts +14 -0
- package/dist/components/ui-switch.d.ts.map +1 -0
- package/dist/components/ui-switch.js +15 -0
- package/dist/components/vector-browser-three.d.ts +4 -0
- package/dist/components/vector-browser-three.d.ts.map +1 -0
- package/dist/components/vector-browser-three.js +19 -0
- package/dist/config/config-catalog.d.ts +376 -0
- package/dist/config/config-catalog.d.ts.map +1 -0
- package/dist/config/config-catalog.js +724 -0
- package/dist/config/config-field.d.ts +68 -0
- package/dist/config/config-field.d.ts.map +1 -0
- package/dist/config/config-field.js +821 -0
- package/dist/config/config-renderer.d.ts +176 -0
- package/dist/config/config-renderer.d.ts.map +1 -0
- package/dist/config/config-renderer.js +403 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/ui-renderer.d.ts +26 -0
- package/dist/config/ui-renderer.d.ts.map +1 -0
- package/dist/config/ui-renderer.js +815 -0
- package/dist/config/ui-spec.d.ts +164 -0
- package/dist/config/ui-spec.d.ts.map +1 -0
- package/dist/config/ui-spec.js +13 -0
- package/dist/events/index.d.ts +42 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +41 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/useBugReport.d.ts +14 -0
- package/dist/hooks/useBugReport.d.ts.map +1 -0
- package/dist/hooks/useBugReport.js +18 -0
- package/dist/hooks/useCanvasWindow.d.ts +38 -0
- package/dist/hooks/useCanvasWindow.d.ts.map +1 -0
- package/dist/hooks/useCanvasWindow.js +273 -0
- package/dist/hooks/useChatAvatarVoice.d.ts +10 -0
- package/dist/hooks/useChatAvatarVoice.d.ts.map +1 -0
- package/dist/hooks/useChatAvatarVoice.js +71 -0
- package/dist/hooks/useContextMenu.d.ts +17 -0
- package/dist/hooks/useContextMenu.d.ts.map +1 -0
- package/dist/hooks/useContextMenu.js +100 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +17 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.js +67 -0
- package/dist/hooks/useLifoSync.d.ts +18 -0
- package/dist/hooks/useLifoSync.d.ts.map +1 -0
- package/dist/hooks/useLifoSync.js +113 -0
- package/dist/hooks/useMemoryMonitor.d.ts +87 -0
- package/dist/hooks/useMemoryMonitor.d.ts.map +1 -0
- package/dist/hooks/useMemoryMonitor.js +210 -0
- package/dist/hooks/useRenderGuard.d.ts +17 -0
- package/dist/hooks/useRenderGuard.d.ts.map +1 -0
- package/dist/hooks/useRenderGuard.js +36 -0
- package/dist/hooks/useRetakeCapture.d.ts +12 -0
- package/dist/hooks/useRetakeCapture.d.ts.map +1 -0
- package/dist/hooks/useRetakeCapture.js +59 -0
- package/dist/hooks/useStreamPopoutNavigation.d.ts +3 -0
- package/dist/hooks/useStreamPopoutNavigation.d.ts.map +1 -0
- package/dist/hooks/useStreamPopoutNavigation.js +17 -0
- package/dist/hooks/useTimeout.d.ts +11 -0
- package/dist/hooks/useTimeout.d.ts.map +1 -0
- package/dist/hooks/useTimeout.js +32 -0
- package/dist/hooks/useVoiceChat.d.ts +129 -0
- package/dist/hooks/useVoiceChat.d.ts.map +1 -0
- package/dist/hooks/useVoiceChat.js +1071 -0
- package/dist/hooks/useWhatsAppPairing.d.ts +11 -0
- package/dist/hooks/useWhatsAppPairing.d.ts.map +1 -0
- package/dist/hooks/useWhatsAppPairing.js +95 -0
- package/dist/i18n/index.d.ts +7 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +53 -0
- package/dist/i18n/locales/en.json +1196 -0
- package/dist/i18n/locales/es.json +1196 -0
- package/dist/i18n/locales/ko.json +1196 -0
- package/dist/i18n/locales/pt.json +1196 -0
- package/dist/i18n/locales/zh-CN.json +1196 -0
- package/dist/i18n/messages.d.ts +6 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +14 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/navigation/index.d.ts +27 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +230 -0
- package/dist/package.json +161 -0
- package/dist/platform/browser-launch.d.ts +2 -0
- package/dist/platform/browser-launch.d.ts.map +1 -0
- package/dist/platform/browser-launch.js +109 -0
- package/dist/platform/index.d.ts +64 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +155 -0
- package/dist/platform/init.d.ts +40 -0
- package/dist/platform/init.d.ts.map +1 -0
- package/dist/platform/init.js +158 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +72 -0
- package/dist/state/AppContext.d.ts +11 -0
- package/dist/state/AppContext.d.ts.map +1 -0
- package/dist/state/AppContext.js +4496 -0
- package/dist/state/index.d.ts +7 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +6 -0
- package/dist/state/internal.d.ts +6 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +5 -0
- package/dist/state/parsers.d.ts +26 -0
- package/dist/state/parsers.d.ts.map +1 -0
- package/dist/state/parsers.js +255 -0
- package/dist/state/persistence.d.ts +36 -0
- package/dist/state/persistence.d.ts.map +1 -0
- package/dist/state/persistence.js +254 -0
- package/dist/state/types.d.ts +402 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +70 -0
- package/dist/state/ui-preferences.d.ts +3 -0
- package/dist/state/ui-preferences.d.ts.map +1 -0
- package/dist/state/ui-preferences.js +1 -0
- package/dist/state/useApp.d.ts +4 -0
- package/dist/state/useApp.d.ts.map +1 -0
- package/dist/state/useApp.js +22 -0
- package/dist/state/vrm.d.ts +19 -0
- package/dist/state/vrm.d.ts.map +1 -0
- package/dist/state/vrm.js +65 -0
- package/dist/stories/AppMockProvider.d.ts +15 -0
- package/dist/stories/AppMockProvider.d.ts.map +1 -0
- package/dist/stories/AppMockProvider.js +14 -0
- package/dist/styles/anime.css +6324 -0
- package/dist/styles/base.css +196 -0
- package/dist/styles/onboarding-game.css +716 -0
- package/dist/styles/styles.css +2085 -0
- package/dist/styles/xterm.css +241 -0
- package/dist/types/index.d.ts +657 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/asset-url.d.ts +26 -0
- package/dist/utils/asset-url.d.ts.map +1 -0
- package/dist/utils/asset-url.js +99 -0
- package/dist/utils/assistant-text.d.ts +2 -0
- package/dist/utils/assistant-text.d.ts.map +1 -0
- package/dist/utils/assistant-text.js +161 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +38 -0
- package/dist/utils/desktop-dialogs.d.ts +19 -0
- package/dist/utils/desktop-dialogs.d.ts.map +1 -0
- package/dist/utils/desktop-dialogs.js +50 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/number-parsing.d.ts +44 -0
- package/dist/utils/number-parsing.d.ts.map +1 -0
- package/dist/utils/number-parsing.js +56 -0
- package/dist/utils/openExternalUrl.d.ts +2 -0
- package/dist/utils/openExternalUrl.d.ts.map +1 -0
- package/dist/utils/openExternalUrl.js +17 -0
- package/dist/utils/spoken-text.d.ts +2 -0
- package/dist/utils/spoken-text.d.ts.map +1 -0
- package/dist/utils/spoken-text.js +56 -0
- package/dist/utils/streaming-text.d.ts +3 -0
- package/dist/utils/streaming-text.d.ts.map +1 -0
- package/dist/utils/streaming-text.js +87 -0
- package/dist/voice/index.d.ts +2 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +1 -0
- package/dist/voice/types.d.ts +25 -0
- package/dist/voice/types.d.ts.map +1 -0
- package/dist/voice/types.js +166 -0
- package/package.json +86 -0
- package/src/App.tsx +469 -0
- package/src/actions/character.ts +113 -0
- package/src/actions/chat-helpers.ts +100 -0
- package/src/actions/cloud.ts +59 -0
- package/src/actions/index.ts +12 -0
- package/src/actions/lifecycle.ts +175 -0
- package/src/actions/onboarding.ts +46 -0
- package/src/actions/triggers.ts +190 -0
- package/src/ambient.d.ts +16 -0
- package/src/api/client.ts +5616 -0
- package/src/api/index.ts +1 -0
- package/src/autonomy/index.ts +477 -0
- package/src/bridge/capacitor-bridge.ts +295 -0
- package/src/bridge/electrobun-rpc.ts +58 -0
- package/src/bridge/electrobun-runtime.ts +28 -0
- package/src/bridge/index.ts +5 -0
- package/src/bridge/native-plugins.ts +134 -0
- package/src/bridge/plugin-bridge.ts +352 -0
- package/src/bridge/storage-bridge.ts +162 -0
- package/src/chat/index.ts +251 -0
- package/src/coding/index.ts +43 -0
- package/src/components/AdvancedPageView.tsx +362 -0
- package/src/components/AgentActivityBox.tsx +49 -0
- package/src/components/ApiKeyConfig.tsx +224 -0
- package/src/components/AppsPageView.tsx +52 -0
- package/src/components/AppsView.tsx +293 -0
- package/src/components/AvatarLoader.tsx +86 -0
- package/src/components/AvatarSelector.tsx +223 -0
- package/src/components/BscTradePanel.tsx +549 -0
- package/src/components/BugReportModal.tsx +499 -0
- package/src/components/CharacterView.tsx +1623 -0
- package/src/components/ChatAvatar.test.ts +96 -0
- package/src/components/ChatAvatar.tsx +147 -0
- package/src/components/ChatComposer.tsx +330 -0
- package/src/components/ChatMessage.tsx +448 -0
- package/src/components/ChatModalView.test.tsx +118 -0
- package/src/components/ChatModalView.tsx +125 -0
- package/src/components/ChatView.tsx +999 -0
- package/src/components/CloudSourceControls.tsx +80 -0
- package/src/components/CodingAgentSettingsSection.tsx +536 -0
- package/src/components/CommandPalette.tsx +284 -0
- package/src/components/CompanionSceneHost.tsx +498 -0
- package/src/components/CompanionShell.tsx +31 -0
- package/src/components/CompanionView.tsx +109 -0
- package/src/components/ConfigPageView.tsx +722 -0
- package/src/components/ConfigSaveFooter.tsx +41 -0
- package/src/components/ConfirmModal.tsx +379 -0
- package/src/components/ConnectionFailedBanner.tsx +91 -0
- package/src/components/ConnectorsPageView.tsx +13 -0
- package/src/components/ConversationsSidebar.tsx +279 -0
- package/src/components/CustomActionEditor.tsx +1125 -0
- package/src/components/CustomActionsPanel.tsx +288 -0
- package/src/components/CustomActionsView.tsx +322 -0
- package/src/components/DatabasePageView.tsx +55 -0
- package/src/components/DatabaseView.tsx +814 -0
- package/src/components/ElizaCloudDashboard.tsx +1696 -0
- package/src/components/EmotePicker.tsx +529 -0
- package/src/components/ErrorBoundary.tsx +76 -0
- package/src/components/FineTuningView.tsx +1080 -0
- package/src/components/GameView.tsx +551 -0
- package/src/components/GameViewOverlay.tsx +133 -0
- package/src/components/GlobalEmoteOverlay.tsx +152 -0
- package/src/components/Header.test.tsx +413 -0
- package/src/components/Header.tsx +400 -0
- package/src/components/HeartbeatsView.tsx +1002 -0
- package/src/components/InventoryView.tsx +372 -0
- package/src/components/KnowledgeView.tsx +1128 -0
- package/src/components/LanguageDropdown.tsx +187 -0
- package/src/components/LifoMonitorPanel.tsx +196 -0
- package/src/components/LifoSandboxView.tsx +499 -0
- package/src/components/LoadingScreen.tsx +77 -0
- package/src/components/LogsPageView.tsx +17 -0
- package/src/components/LogsView.tsx +239 -0
- package/src/components/MediaGalleryView.tsx +432 -0
- package/src/components/MediaSettingsSection.tsx +893 -0
- package/src/components/MessageContent.tsx +815 -0
- package/src/components/OnboardingWizard.test.tsx +107 -0
- package/src/components/OnboardingWizard.tsx +186 -0
- package/src/components/PairingView.tsx +110 -0
- package/src/components/PermissionsSection.tsx +818 -0
- package/src/components/PluginsPageView.tsx +9 -0
- package/src/components/PluginsView.tsx +3152 -0
- package/src/components/ProviderSwitcher.tsx +874 -0
- package/src/components/RestartBanner.tsx +76 -0
- package/src/components/RuntimeView.tsx +460 -0
- package/src/components/SaveCommandModal.tsx +211 -0
- package/src/components/SecretsView.tsx +569 -0
- package/src/components/SettingsView.tsx +825 -0
- package/src/components/ShellOverlays.tsx +41 -0
- package/src/components/ShortcutsOverlay.tsx +155 -0
- package/src/components/SkillsView.tsx +1435 -0
- package/src/components/StartupFailureView.tsx +63 -0
- package/src/components/StreamView.tsx +483 -0
- package/src/components/StripeEmbeddedCheckout.tsx +155 -0
- package/src/components/SubscriptionStatus.tsx +634 -0
- package/src/components/SystemWarningBanner.tsx +71 -0
- package/src/components/ThemeToggle.tsx +100 -0
- package/src/components/TrajectoriesView.tsx +526 -0
- package/src/components/TrajectoryDetailView.tsx +426 -0
- package/src/components/TriggersView.tsx +1 -0
- package/src/components/VectorBrowserView.tsx +1633 -0
- package/src/components/VoiceConfigView.tsx +674 -0
- package/src/components/VrmStage.test.ts +219 -0
- package/src/components/VrmStage.tsx +432 -0
- package/src/components/WhatsAppQrOverlay.tsx +230 -0
- package/src/components/__tests__/chainConfig.test.ts +220 -0
- package/src/components/apps/AppDetailPane.tsx +242 -0
- package/src/components/apps/AppsCatalogGrid.tsx +137 -0
- package/src/components/apps/extensions/HyperscapeAppDetailPanel.tsx +577 -0
- package/src/components/apps/extensions/registry.ts +16 -0
- package/src/components/apps/extensions/types.ts +9 -0
- package/src/components/apps/helpers.ts +44 -0
- package/src/components/avatar/VrmAnimationLoader.test.ts +164 -0
- package/src/components/avatar/VrmAnimationLoader.ts +151 -0
- package/src/components/avatar/VrmBlinkController.ts +118 -0
- package/src/components/avatar/VrmCameraManager.ts +407 -0
- package/src/components/avatar/VrmEngine.ts +2678 -0
- package/src/components/avatar/VrmFootShadow.ts +96 -0
- package/src/components/avatar/VrmViewer.tsx +421 -0
- package/src/components/avatar/__tests__/VrmCameraManager.test.ts +168 -0
- package/src/components/avatar/__tests__/VrmEngine.test.ts +1574 -0
- package/src/components/avatar/mixamoVRMRigMap.ts +62 -0
- package/src/components/avatar/retargetMixamoFbxToVrm.ts +144 -0
- package/src/components/avatar/retargetMixamoGltfToVrm.ts +119 -0
- package/src/components/chainConfig.ts +380 -0
- package/src/components/companion/CompanionHeader.tsx +47 -0
- package/src/components/companion/CompanionSceneHost.tsx +5 -0
- package/src/components/companion/VrmStage.tsx +2 -0
- package/src/components/companion/__tests__/walletUtils.test.ts +742 -0
- package/src/components/companion/walletUtils.ts +290 -0
- package/src/components/companion-shell-styles.test.ts +146 -0
- package/src/components/companion-shell-styles.ts +270 -0
- package/src/components/confirm-delete-control.tsx +69 -0
- package/src/components/conversations/ConversationListItem.tsx +185 -0
- package/src/components/conversations/conversation-utils.ts +151 -0
- package/src/components/format.ts +131 -0
- package/src/components/index.ts +92 -0
- package/src/components/inventory/CopyableAddress.tsx +41 -0
- package/src/components/inventory/InventoryToolbar.tsx +142 -0
- package/src/components/inventory/NftGrid.tsx +99 -0
- package/src/components/inventory/TokenLogo.tsx +71 -0
- package/src/components/inventory/TokensTable.tsx +216 -0
- package/src/components/inventory/constants.ts +170 -0
- package/src/components/inventory/index.ts +29 -0
- package/src/components/inventory/media-url.test.ts +38 -0
- package/src/components/inventory/media-url.ts +36 -0
- package/src/components/inventory/useInventoryData.ts +460 -0
- package/src/components/knowledge-upload-image.ts +215 -0
- package/src/components/labels.ts +46 -0
- package/src/components/onboarding/ActivateStep.tsx +30 -0
- package/src/components/onboarding/ConnectionStep.tsx +1530 -0
- package/src/components/onboarding/OnboardingPanel.tsx +39 -0
- package/src/components/onboarding/OnboardingStepNav.tsx +31 -0
- package/src/components/onboarding/PermissionsStep.tsx +20 -0
- package/src/components/onboarding/RpcStep.tsx +402 -0
- package/src/components/onboarding/WakeUpStep.tsx +184 -0
- package/src/components/permissions/PermissionIcon.tsx +25 -0
- package/src/components/permissions/StreamingPermissions.tsx +376 -0
- package/src/components/plugins/showcase-data.ts +481 -0
- package/src/components/shared/ShellHeaderControls.tsx +193 -0
- package/src/components/skeletons.tsx +88 -0
- package/src/components/stream/ActivityFeed.tsx +113 -0
- package/src/components/stream/AvatarPip.tsx +10 -0
- package/src/components/stream/ChatContent.tsx +126 -0
- package/src/components/stream/ChatTicker.tsx +55 -0
- package/src/components/stream/IdleContent.tsx +73 -0
- package/src/components/stream/StatusBar.tsx +469 -0
- package/src/components/stream/StreamSettings.tsx +506 -0
- package/src/components/stream/StreamTerminal.tsx +94 -0
- package/src/components/stream/StreamVoiceConfig.tsx +160 -0
- package/src/components/stream/helpers.ts +134 -0
- package/src/components/stream/overlays/OverlayLayer.tsx +75 -0
- package/src/components/stream/overlays/built-in/ActionTickerWidget.tsx +64 -0
- package/src/components/stream/overlays/built-in/AlertPopupWidget.tsx +87 -0
- package/src/components/stream/overlays/built-in/BrandingWidget.tsx +51 -0
- package/src/components/stream/overlays/built-in/CustomHtmlWidget.tsx +105 -0
- package/src/components/stream/overlays/built-in/PeonGlassWidget.tsx +265 -0
- package/src/components/stream/overlays/built-in/PeonHudWidget.tsx +247 -0
- package/src/components/stream/overlays/built-in/PeonSakuraWidget.tsx +278 -0
- package/src/components/stream/overlays/built-in/ThoughtBubbleWidget.tsx +77 -0
- package/src/components/stream/overlays/built-in/ViewerCountWidget.tsx +46 -0
- package/src/components/stream/overlays/built-in/index.ts +13 -0
- package/src/components/stream/overlays/registry.ts +22 -0
- package/src/components/stream/overlays/types.ts +90 -0
- package/src/components/stream/overlays/useOverlayLayout.ts +218 -0
- package/src/components/trajectory-format.ts +50 -0
- package/src/components/ui-badges.tsx +109 -0
- package/src/components/ui-switch.tsx +57 -0
- package/src/components/vector-browser-three.ts +27 -0
- package/src/config/config-catalog.ts +1092 -0
- package/src/config/config-field.tsx +1900 -0
- package/src/config/config-renderer.tsx +730 -0
- package/src/config/index.ts +11 -0
- package/src/config/ui-renderer.tsx +1751 -0
- package/src/config/ui-spec.ts +256 -0
- package/src/events/index.ts +89 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useBugReport.tsx +43 -0
- package/src/hooks/useCanvasWindow.ts +372 -0
- package/src/hooks/useChatAvatarVoice.ts +111 -0
- package/src/hooks/useContextMenu.ts +127 -0
- package/src/hooks/useKeyboardShortcuts.ts +86 -0
- package/src/hooks/useLifoSync.ts +143 -0
- package/src/hooks/useMemoryMonitor.ts +335 -0
- package/src/hooks/useRenderGuard.ts +43 -0
- package/src/hooks/useRetakeCapture.ts +67 -0
- package/src/hooks/useStreamPopoutNavigation.ts +27 -0
- package/src/hooks/useTimeout.ts +37 -0
- package/src/hooks/useVoiceChat.ts +1443 -0
- package/src/hooks/useWhatsAppPairing.ts +123 -0
- package/src/i18n/index.ts +76 -0
- package/src/i18n/locales/en.json +1196 -0
- package/src/i18n/locales/es.json +1196 -0
- package/src/i18n/locales/ko.json +1196 -0
- package/src/i18n/locales/pt.json +1196 -0
- package/src/i18n/locales/zh-CN.json +1196 -0
- package/src/i18n/messages.ts +21 -0
- package/src/index.ts +6 -0
- package/src/navigation/index.ts +282 -0
- package/src/navigation.test.ts +189 -0
- package/src/platform/browser-launch.test.ts +94 -0
- package/src/platform/browser-launch.ts +149 -0
- package/src/platform/index.ts +261 -0
- package/src/platform/init.ts +236 -0
- package/src/providers/index.ts +82 -0
- package/src/state/AppContext.tsx +5737 -0
- package/src/state/index.ts +6 -0
- package/src/state/internal.ts +77 -0
- package/src/state/parsers.test.ts +124 -0
- package/src/state/parsers.ts +309 -0
- package/src/state/persistence.ts +278 -0
- package/src/state/types.ts +694 -0
- package/src/state/ui-preferences.ts +3 -0
- package/src/state/useApp.ts +23 -0
- package/src/state/vrm.ts +76 -0
- package/src/stories/AppMockProvider.tsx +32 -0
- package/src/stories/ChatEmptyState.stories.tsx +27 -0
- package/src/stories/ChatMessage.stories.tsx +115 -0
- package/src/stories/CompanionHeader.stories.tsx +74 -0
- package/src/stories/CompanionView.stories.tsx +33 -0
- package/src/stories/ConversationListItem.stories.tsx +102 -0
- package/src/stories/TypingIndicator.stories.tsx +28 -0
- package/src/styles/anime.css +6324 -0
- package/src/styles/base.css +196 -0
- package/src/styles/onboarding-game.css +716 -0
- package/src/styles/styles.css +2085 -0
- package/src/styles/xterm.css +241 -0
- package/src/types/index.ts +715 -0
- package/src/types/react-test-renderer.d.ts +45 -0
- package/src/utils/asset-url.ts +110 -0
- package/src/utils/assistant-text.ts +172 -0
- package/src/utils/clipboard.ts +41 -0
- package/src/utils/desktop-dialogs.ts +80 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/number-parsing.ts +125 -0
- package/src/utils/openExternalUrl.ts +20 -0
- package/src/utils/spoken-text.ts +65 -0
- package/src/utils/streaming-text.ts +120 -0
- package/src/voice/index.ts +1 -0
- package/src/voice/types.ts +197 -0
- package/test/app/AppContext.pty-sessions.test.tsx +143 -0
- package/test/app/MessageContent.test.tsx +326 -0
- package/test/app/PermissionsOnboarding.test.tsx +216 -0
- package/test/app/PermissionsSection.test.tsx +186 -0
- package/test/app/advanced-trajectory-fine-tuning.e2e.test.ts +397 -0
- package/test/app/agent-activity-box.test.tsx +132 -0
- package/test/app/agent-transfer-lock.test.ts +274 -0
- package/test/app/api-client-electron-fallback.test.ts +139 -0
- package/test/app/api-client-timeout.test.ts +75 -0
- package/test/app/api-client-ws.test.ts +98 -0
- package/test/app/api-client.ws-max-reconnect.test.ts +139 -0
- package/test/app/api-client.ws-reconnect.test.ts +157 -0
- package/test/app/app-context-autonomy-events.test.ts +478 -0
- package/test/app/apps-page-view.test.ts +114 -0
- package/test/app/apps-view.test.ts +769 -0
- package/test/app/autonomous-workflows.e2e.test.ts +765 -0
- package/test/app/autonomy-events.test.ts +150 -0
- package/test/app/avatar-selector.test.tsx +52 -0
- package/test/app/bsc-trade-panel.test.tsx +134 -0
- package/test/app/bug-report-modal.test.tsx +353 -0
- package/test/app/character-customization.e2e.test.ts +1168 -0
- package/test/app/chat-advanced-features.e2e.test.ts +706 -0
- package/test/app/chat-composer.test.tsx +181 -0
- package/test/app/chat-language-header.test.ts +64 -0
- package/test/app/chat-message.test.tsx +222 -0
- package/test/app/chat-modal-view.test.tsx +191 -0
- package/test/app/chat-routine-filter.test.ts +96 -0
- package/test/app/chat-send-lock.test.ts +1302 -0
- package/test/app/chat-stream-api-client.test.tsx +390 -0
- package/test/app/chat-view-game-modal.test.tsx +661 -0
- package/test/app/chat-view.test.tsx +877 -0
- package/test/app/cloud-api.e2e.test.ts +258 -0
- package/test/app/cloud-login-flow.e2e.test.ts +494 -0
- package/test/app/cloud-login-lock.test.ts +411 -0
- package/test/app/command-palette.test.tsx +184 -0
- package/test/app/command-registry.test.ts +75 -0
- package/test/app/companion-greeting-wave.test.tsx +443 -0
- package/test/app/companion-stale-conversation.test.tsx +424 -0
- package/test/app/companion-view.test.tsx +686 -0
- package/test/app/confirm-delete-control.test.ts +79 -0
- package/test/app/confirm-modal.test.tsx +219 -0
- package/test/app/connectors-ui.e2e.test.ts +508 -0
- package/test/app/conversations-sidebar-game-modal.test.tsx +260 -0
- package/test/app/conversations-sidebar.test.tsx +160 -0
- package/test/app/custom-actions-smoke.test.ts +387 -0
- package/test/app/custom-avatar-api-client.test.ts +207 -0
- package/test/app/desktop-utils.test.ts +145 -0
- package/test/app/electrobun-rpc-bridge.test.ts +83 -0
- package/test/app/events.test.ts +88 -0
- package/test/app/export-import-flows.e2e.test.ts +700 -0
- package/test/app/fine-tuning-view.test.ts +471 -0
- package/test/app/game-view-auth-session.test.tsx +186 -0
- package/test/app/game-view.test.ts +444 -0
- package/test/app/global-emote-overlay.test.tsx +106 -0
- package/test/app/header-status.test.tsx +149 -0
- package/test/app/i18n.test.ts +152 -0
- package/test/app/inventory-bsc-view.test.ts +908 -0
- package/test/app/knowledge-ui.e2e.test.ts +762 -0
- package/test/app/knowledge-upload-helpers.test.ts +124 -0
- package/test/app/lifecycle-lock.test.ts +267 -0
- package/test/app/lifo-popout-utils.test.ts +208 -0
- package/test/app/lifo-safe-endpoint.test.ts +34 -0
- package/test/app/loading-screen.test.tsx +45 -0
- package/test/app/memory-monitor.test.ts +332 -0
- package/test/app/navigation.test.tsx +29 -0
- package/test/app/onboarding-finish-lock.test.ts +500 -0
- package/test/app/onboarding-language.test.tsx +161 -0
- package/test/app/onboarding-steps.test.tsx +371 -0
- package/test/app/open-external-url.test.ts +65 -0
- package/test/app/pages-navigation-smoke.e2e.test.ts +633 -0
- package/test/app/pairing-lock.test.ts +260 -0
- package/test/app/pairing-view.test.tsx +74 -0
- package/test/app/permissions-section.test.ts +432 -0
- package/test/app/plugin-bridge.test.ts +109 -0
- package/test/app/plugins-ui.e2e.test.ts +605 -0
- package/test/app/plugins-view-game-modal.test.tsx +650 -0
- package/test/app/plugins-view-toggle-restart.test.ts +129 -0
- package/test/app/provider-dropdown-default.test.tsx +164 -0
- package/test/app/restart-banner.test.tsx +197 -0
- package/test/app/retake-capture.test.ts +84 -0
- package/test/app/sandbox-api-client.test.ts +108 -0
- package/test/app/save-command-modal.test.tsx +109 -0
- package/test/app/secrets-view.test.tsx +92 -0
- package/test/app/settings-control-styles.test.tsx +142 -0
- package/test/app/settings-reset.e2e.test.ts +728 -0
- package/test/app/settings-sections.e2e.test.ts +614 -0
- package/test/app/shared-format.test.ts +44 -0
- package/test/app/shared-switch.test.ts +69 -0
- package/test/app/shell-mode-switching.e2e.test.ts +829 -0
- package/test/app/shell-mode-tab-memory.test.tsx +283 -0
- package/test/app/shell-overlays.test.tsx +50 -0
- package/test/app/shortcuts-overlay.test.tsx +111 -0
- package/test/app/sse-interruption.test.ts +122 -0
- package/test/app/startup-asset-missing.e2e.test.ts +126 -0
- package/test/app/startup-backend-missing.e2e.test.ts +118 -0
- package/test/app/startup-chat.e2e.test.ts +305 -0
- package/test/app/startup-conversation-restore.test.tsx +344 -0
- package/test/app/startup-failure-view.test.tsx +103 -0
- package/test/app/startup-onboarding.e2e.test.ts +612 -0
- package/test/app/startup-timeout.test.tsx +80 -0
- package/test/app/startup-token-401.e2e.test.ts +103 -0
- package/test/app/stream-helpers.test.ts +46 -0
- package/test/app/stream-popout-navigation.test.tsx +41 -0
- package/test/app/stream-status-bar.test.tsx +89 -0
- package/test/app/theme-toggle.test.tsx +33 -0
- package/test/app/training-api-client.test.ts +128 -0
- package/test/app/trajectories-view.test.tsx +220 -0
- package/test/app/triggers-api-client.test.ts +77 -0
- package/test/app/triggers-navigation.test.ts +118 -0
- package/test/app/triggers-view.e2e.test.ts +674 -0
- package/test/app/update-channel-lock.test.ts +259 -0
- package/test/app/vector-browser.async-cleanup.test.tsx +367 -0
- package/test/app/vector-browser.e2e.test.ts +653 -0
- package/test/app/vrm-stage.test.tsx +351 -0
- package/test/app/vrm-viewer.test.tsx +298 -0
- package/test/app/wallet-api-save-lock.test.ts +277 -0
- package/test/app/wallet-hooks.test.ts +405 -0
- package/test/app/wallet-ui-flows.e2e.test.ts +556 -0
- package/test/avatar/asset-url.test.ts +90 -0
- package/test/avatar/avatar-selector.test.ts +173 -0
- package/test/avatar/mixamo-vrm-rig-map.test.ts +111 -0
- package/test/avatar/voice-chat-streaming-text.test.ts +96 -0
- package/test/avatar/voice-chat.test.ts +391 -0
- package/test/ui/command-palette-commands.test.ts +57 -0
- package/test/ui/ui-renderer.test.ts +39 -0
- package/tsconfig.build.json +19 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,1574 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smoke-level unit tests for VrmEngine.
|
|
3
|
+
*
|
|
4
|
+
* THREE.js and @pixiv/three-vrm cannot run in a headless Node/Bun environment,
|
|
5
|
+
* so every external dependency is mocked. The tests verify the engine's public
|
|
6
|
+
* API contracts — lifecycle, state transitions, emote dispatch, and animation
|
|
7
|
+
* blending — without requiring a real WebGL context.
|
|
8
|
+
*/
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
10
|
+
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Mocks — must be declared before VrmEngine import
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
/** Minimal mock AnimationAction returned by AnimationMixer.clipAction */
|
|
16
|
+
function createMockAction() {
|
|
17
|
+
const action = {
|
|
18
|
+
enabled: true,
|
|
19
|
+
paused: false,
|
|
20
|
+
time: 0,
|
|
21
|
+
timeScale: 1,
|
|
22
|
+
weight: 1,
|
|
23
|
+
clampWhenFinished: false,
|
|
24
|
+
reset: vi.fn(() => {
|
|
25
|
+
action.enabled = true;
|
|
26
|
+
action.paused = false;
|
|
27
|
+
action.time = 0;
|
|
28
|
+
return action;
|
|
29
|
+
}),
|
|
30
|
+
play: vi.fn(() => action),
|
|
31
|
+
stop: vi.fn(() => action),
|
|
32
|
+
crossFadeFrom: vi.fn(() => action),
|
|
33
|
+
fadeIn: vi.fn(() => action),
|
|
34
|
+
fadeOut: vi.fn(() => action),
|
|
35
|
+
setLoop: vi.fn(() => action),
|
|
36
|
+
setEffectiveTimeScale: vi.fn((value: number) => {
|
|
37
|
+
action.timeScale = value;
|
|
38
|
+
return action;
|
|
39
|
+
}),
|
|
40
|
+
setEffectiveWeight: vi.fn((value: number) => {
|
|
41
|
+
action.weight = value;
|
|
42
|
+
return action;
|
|
43
|
+
}),
|
|
44
|
+
isRunning: vi.fn(() => true),
|
|
45
|
+
getClip: vi.fn(() => ({ tracks: [{ name: "t1" }, { name: "t2" }] })),
|
|
46
|
+
};
|
|
47
|
+
return action;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const hoisted = vi.hoisted(() => {
|
|
51
|
+
const mockAction = createMockAction();
|
|
52
|
+
const mixerListeners = new Map<string, Set<(event: unknown) => void>>();
|
|
53
|
+
const addMixerListener = vi.fn(
|
|
54
|
+
(type: string, listener: (event: unknown) => void) => {
|
|
55
|
+
const listeners = mixerListeners.get(type) ?? new Set();
|
|
56
|
+
listeners.add(listener);
|
|
57
|
+
mixerListeners.set(type, listeners);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
const removeMixerListener = vi.fn(
|
|
61
|
+
(type: string, listener: (event: unknown) => void) => {
|
|
62
|
+
const listeners = mixerListeners.get(type);
|
|
63
|
+
if (!listeners) return;
|
|
64
|
+
listeners.delete(listener);
|
|
65
|
+
if (listeners.size === 0) {
|
|
66
|
+
mixerListeners.delete(type);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
const emitMixerEvent = (type: string, event: unknown) => {
|
|
71
|
+
const listeners = mixerListeners.get(type);
|
|
72
|
+
if (!listeners) return;
|
|
73
|
+
for (const listener of [...listeners]) {
|
|
74
|
+
listener(event);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const mockMixerInstance = {
|
|
78
|
+
update: vi.fn(),
|
|
79
|
+
clipAction: vi.fn(() => mockAction),
|
|
80
|
+
addEventListener: addMixerListener,
|
|
81
|
+
removeEventListener: removeMixerListener,
|
|
82
|
+
};
|
|
83
|
+
const mockRendererInstance = {
|
|
84
|
+
setPixelRatio: vi.fn(),
|
|
85
|
+
setClearColor: vi.fn(),
|
|
86
|
+
setSize: vi.fn(),
|
|
87
|
+
render: vi.fn(),
|
|
88
|
+
dispose: vi.fn(),
|
|
89
|
+
forceContextLoss: vi.fn(),
|
|
90
|
+
domElement: {} as HTMLCanvasElement,
|
|
91
|
+
shadowMap: { enabled: false, type: 0 },
|
|
92
|
+
toneMapping: 0,
|
|
93
|
+
toneMappingExposure: 1.0,
|
|
94
|
+
outputColorSpace: "",
|
|
95
|
+
};
|
|
96
|
+
const mockWebGpuRendererInstance = {
|
|
97
|
+
setPixelRatio: vi.fn(),
|
|
98
|
+
setClearColor: vi.fn(),
|
|
99
|
+
setSize: vi.fn(),
|
|
100
|
+
render: vi.fn(),
|
|
101
|
+
dispose: vi.fn(),
|
|
102
|
+
domElement: {} as HTMLCanvasElement,
|
|
103
|
+
init: vi.fn(async () => {}),
|
|
104
|
+
};
|
|
105
|
+
const mockMToonMaterialLoaderPlugin = vi.fn(
|
|
106
|
+
function MockMToonMaterialLoaderPlugin(
|
|
107
|
+
this: { parser: unknown; options: unknown },
|
|
108
|
+
parser: unknown,
|
|
109
|
+
options: unknown,
|
|
110
|
+
) {
|
|
111
|
+
this.parser = parser;
|
|
112
|
+
this.options = options;
|
|
113
|
+
},
|
|
114
|
+
);
|
|
115
|
+
const mockVRMLoaderPlugin = vi.fn(function MockVRMLoaderPlugin(
|
|
116
|
+
this: { parser: unknown; options: unknown },
|
|
117
|
+
parser: unknown,
|
|
118
|
+
options?: unknown,
|
|
119
|
+
) {
|
|
120
|
+
this.parser = parser;
|
|
121
|
+
this.options = options;
|
|
122
|
+
});
|
|
123
|
+
const mockLoaderParser = { json: {} };
|
|
124
|
+
const mockLoaderRegister = vi.fn((factory: (parser: unknown) => unknown) => {
|
|
125
|
+
factory(mockLoaderParser);
|
|
126
|
+
});
|
|
127
|
+
const mockLoaderLoadAsync = vi.fn();
|
|
128
|
+
const mockLoaderSetDRACOLoader = vi.fn();
|
|
129
|
+
const mockLoaderSetMeshoptDecoder = vi.fn();
|
|
130
|
+
const mockSparkRendererOptions: unknown[] = [];
|
|
131
|
+
const mockSplatMeshOptions: unknown[] = [];
|
|
132
|
+
const mockDracoLoaderSetDecoderConfig = vi.fn();
|
|
133
|
+
const mockDracoLoaderSetDecoderPath = vi.fn();
|
|
134
|
+
const mockDracoLoaderPreload = vi.fn();
|
|
135
|
+
const navigatorMock = { gpu: undefined as unknown };
|
|
136
|
+
const fetchMock = vi.fn();
|
|
137
|
+
const responseArrayBufferMock = vi.fn();
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
addMixerListener,
|
|
141
|
+
mockDracoLoaderPreload,
|
|
142
|
+
mockDracoLoaderSetDecoderConfig,
|
|
143
|
+
mockDracoLoaderSetDecoderPath,
|
|
144
|
+
emitMixerEvent,
|
|
145
|
+
fetchMock,
|
|
146
|
+
mixerListeners,
|
|
147
|
+
mockLoaderLoadAsync,
|
|
148
|
+
mockLoaderParser,
|
|
149
|
+
mockLoaderRegister,
|
|
150
|
+
mockLoaderSetDRACOLoader,
|
|
151
|
+
mockLoaderSetMeshoptDecoder,
|
|
152
|
+
mockSparkRendererOptions,
|
|
153
|
+
mockSplatMeshOptions,
|
|
154
|
+
mockMixerInstance,
|
|
155
|
+
mockMToonMaterialLoaderPlugin,
|
|
156
|
+
mockRendererInstance,
|
|
157
|
+
responseArrayBufferMock,
|
|
158
|
+
mockVRMLoaderPlugin,
|
|
159
|
+
mockWebGpuRendererInstance,
|
|
160
|
+
navigatorMock,
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const mockCameraInstance = {
|
|
165
|
+
position: {
|
|
166
|
+
set: vi.fn(),
|
|
167
|
+
x: 0,
|
|
168
|
+
y: 1.1,
|
|
169
|
+
z: 2.8,
|
|
170
|
+
copy: vi.fn(),
|
|
171
|
+
clone: vi.fn(() => ({ x: 0, y: 1.1, z: 2.8 })),
|
|
172
|
+
},
|
|
173
|
+
rotation: { x: 0, y: 0 },
|
|
174
|
+
aspect: 1,
|
|
175
|
+
fov: 25,
|
|
176
|
+
near: 0.01,
|
|
177
|
+
far: 1000,
|
|
178
|
+
add: vi.fn(),
|
|
179
|
+
lookAt: vi.fn(),
|
|
180
|
+
updateProjectionMatrix: vi.fn(),
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const mockSceneInstance = {
|
|
184
|
+
add: vi.fn(),
|
|
185
|
+
remove: vi.fn(),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
vi.mock("three", () => {
|
|
189
|
+
const LoopRepeat = 2201;
|
|
190
|
+
const LoopOnce = 2200;
|
|
191
|
+
|
|
192
|
+
// Use class syntax for everything that gets `new`-ed
|
|
193
|
+
class MockWebGLRenderer {
|
|
194
|
+
setPixelRatio = hoisted.mockRendererInstance.setPixelRatio;
|
|
195
|
+
setClearColor = hoisted.mockRendererInstance.setClearColor;
|
|
196
|
+
setSize = hoisted.mockRendererInstance.setSize;
|
|
197
|
+
render = hoisted.mockRendererInstance.render;
|
|
198
|
+
dispose = hoisted.mockRendererInstance.dispose;
|
|
199
|
+
forceContextLoss = hoisted.mockRendererInstance.forceContextLoss;
|
|
200
|
+
domElement = hoisted.mockRendererInstance.domElement;
|
|
201
|
+
shadowMap = hoisted.mockRendererInstance.shadowMap;
|
|
202
|
+
toneMapping = hoisted.mockRendererInstance.toneMapping;
|
|
203
|
+
toneMappingExposure = hoisted.mockRendererInstance.toneMappingExposure;
|
|
204
|
+
outputColorSpace = hoisted.mockRendererInstance.outputColorSpace;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
class MockScene {
|
|
208
|
+
add = mockSceneInstance.add;
|
|
209
|
+
remove = mockSceneInstance.remove;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
class MockPerspectiveCamera {
|
|
213
|
+
position = mockCameraInstance.position;
|
|
214
|
+
rotation = mockCameraInstance.rotation;
|
|
215
|
+
aspect = mockCameraInstance.aspect;
|
|
216
|
+
fov = mockCameraInstance.fov;
|
|
217
|
+
near = mockCameraInstance.near;
|
|
218
|
+
far = mockCameraInstance.far;
|
|
219
|
+
add = mockCameraInstance.add;
|
|
220
|
+
lookAt = mockCameraInstance.lookAt;
|
|
221
|
+
updateProjectionMatrix = mockCameraInstance.updateProjectionMatrix;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
class MockClock {
|
|
225
|
+
start = vi.fn();
|
|
226
|
+
stop = vi.fn();
|
|
227
|
+
getDelta = vi.fn(() => 0.016);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
class MockGroup {
|
|
231
|
+
name = "";
|
|
232
|
+
position = { set: vi.fn() };
|
|
233
|
+
scale = { set: vi.fn(), setScalar: vi.fn() };
|
|
234
|
+
add = vi.fn();
|
|
235
|
+
remove = vi.fn();
|
|
236
|
+
updateMatrixWorld = vi.fn();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
class MockAnimationMixer {
|
|
240
|
+
update = hoisted.mockMixerInstance.update;
|
|
241
|
+
clipAction = hoisted.mockMixerInstance.clipAction;
|
|
242
|
+
addEventListener = hoisted.mockMixerInstance.addEventListener;
|
|
243
|
+
removeEventListener = hoisted.mockMixerInstance.removeEventListener;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
class MockDirectionalLight {
|
|
247
|
+
position = {
|
|
248
|
+
set: vi.fn().mockReturnValue({ normalize: vi.fn() }),
|
|
249
|
+
};
|
|
250
|
+
castShadow = false;
|
|
251
|
+
shadow = {
|
|
252
|
+
mapSize: { setScalar: vi.fn() },
|
|
253
|
+
camera: { near: 0, far: 0, left: 0, right: 0, top: 0, bottom: 0 },
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
class MockAmbientLight {}
|
|
258
|
+
|
|
259
|
+
class MockVector3 {
|
|
260
|
+
x = 0;
|
|
261
|
+
y = 0;
|
|
262
|
+
z = 0;
|
|
263
|
+
set = vi.fn().mockReturnThis();
|
|
264
|
+
add = vi.fn().mockReturnThis();
|
|
265
|
+
copy = vi.fn().mockReturnThis();
|
|
266
|
+
sub = vi.fn().mockReturnThis();
|
|
267
|
+
subVectors = vi.fn().mockReturnThis();
|
|
268
|
+
cross = vi.fn().mockReturnThis();
|
|
269
|
+
normalize = vi.fn().mockReturnThis();
|
|
270
|
+
dot = vi.fn(() => 1);
|
|
271
|
+
getWorldPosition = vi.fn().mockReturnThis();
|
|
272
|
+
getWorldDirection = vi.fn().mockReturnThis();
|
|
273
|
+
lengthSq = vi.fn(() => 1);
|
|
274
|
+
length = vi.fn(() => 1);
|
|
275
|
+
multiplyScalar = vi.fn().mockReturnThis();
|
|
276
|
+
setFromSpherical = vi.fn().mockReturnThis();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
class MockVector2 {
|
|
280
|
+
x = 0;
|
|
281
|
+
y = 0;
|
|
282
|
+
set = vi.fn((x: number, y: number) => {
|
|
283
|
+
this.x = x;
|
|
284
|
+
this.y = y;
|
|
285
|
+
return this;
|
|
286
|
+
});
|
|
287
|
+
copy = vi.fn((value: { x: number; y: number }) => {
|
|
288
|
+
this.x = value.x;
|
|
289
|
+
this.y = value.y;
|
|
290
|
+
return this;
|
|
291
|
+
});
|
|
292
|
+
sub = vi.fn().mockReturnThis();
|
|
293
|
+
lengthSq = vi.fn(() => 0);
|
|
294
|
+
multiplyScalar = vi.fn().mockReturnThis();
|
|
295
|
+
lerp = vi.fn((value: { x: number; y: number }, alpha: number) => {
|
|
296
|
+
this.x += (value.x - this.x) * alpha;
|
|
297
|
+
this.y += (value.y - this.y) * alpha;
|
|
298
|
+
return this;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
class MockBox3 {
|
|
303
|
+
setFromObject = vi.fn().mockReturnThis();
|
|
304
|
+
isEmpty = vi.fn(() => false);
|
|
305
|
+
min = { x: 0, y: 0, z: 0 };
|
|
306
|
+
max = { x: 0, y: 1.6, z: 0 };
|
|
307
|
+
getCenter = vi.fn(() => new MockVector3());
|
|
308
|
+
getSize = vi.fn(() => {
|
|
309
|
+
const v = new MockVector3();
|
|
310
|
+
v.x = 0.4;
|
|
311
|
+
v.y = 1.6;
|
|
312
|
+
v.z = 0.3;
|
|
313
|
+
return v;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
class MockSpherical {
|
|
318
|
+
radius = 1;
|
|
319
|
+
phi = Math.PI / 2;
|
|
320
|
+
theta = 0;
|
|
321
|
+
setFromVector3 = vi.fn().mockReturnThis();
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return {
|
|
325
|
+
WebGLRenderer: MockWebGLRenderer,
|
|
326
|
+
Scene: MockScene,
|
|
327
|
+
Group: MockGroup,
|
|
328
|
+
PerspectiveCamera: MockPerspectiveCamera,
|
|
329
|
+
Clock: MockClock,
|
|
330
|
+
AnimationMixer: MockAnimationMixer,
|
|
331
|
+
DirectionalLight: MockDirectionalLight,
|
|
332
|
+
AmbientLight: MockAmbientLight,
|
|
333
|
+
Vector2: MockVector2,
|
|
334
|
+
Vector3: MockVector3,
|
|
335
|
+
Box3: MockBox3,
|
|
336
|
+
Spherical: MockSpherical,
|
|
337
|
+
LoopRepeat,
|
|
338
|
+
LoopOnce,
|
|
339
|
+
PCFSoftShadowMap: 2,
|
|
340
|
+
NoToneMapping: 0,
|
|
341
|
+
SRGBColorSpace: "srgb",
|
|
342
|
+
Mesh: class MockMesh {
|
|
343
|
+
geometry = { dispose: vi.fn() };
|
|
344
|
+
material = { opacity: 1, map: { dispose: vi.fn() }, dispose: vi.fn() };
|
|
345
|
+
position = { set: vi.fn(), y: 0 };
|
|
346
|
+
rotation = { x: 0, y: 0, z: 0 };
|
|
347
|
+
receiveShadow = false;
|
|
348
|
+
},
|
|
349
|
+
PlaneGeometry: class MockPlaneGeometry {},
|
|
350
|
+
MeshBasicMaterial: class MockMeshBasicMaterial {
|
|
351
|
+
opacity = 1;
|
|
352
|
+
dispose = vi.fn();
|
|
353
|
+
},
|
|
354
|
+
CanvasTexture: class MockCanvasTexture {
|
|
355
|
+
dispose = vi.fn();
|
|
356
|
+
},
|
|
357
|
+
AnimationClip: Object.assign(
|
|
358
|
+
class MockAnimationClip {
|
|
359
|
+
tracks: unknown[] = [];
|
|
360
|
+
name = "";
|
|
361
|
+
},
|
|
362
|
+
{ findByName: vi.fn(() => null) },
|
|
363
|
+
),
|
|
364
|
+
MathUtils: {
|
|
365
|
+
clamp: vi.fn((value: number, min: number, max: number) =>
|
|
366
|
+
Math.min(Math.max(value, min), max),
|
|
367
|
+
),
|
|
368
|
+
degToRad: vi.fn((deg: number) => (deg * Math.PI) / 180),
|
|
369
|
+
lerp: vi.fn(
|
|
370
|
+
(start: number, end: number, alpha: number) =>
|
|
371
|
+
start + (end - start) * alpha,
|
|
372
|
+
),
|
|
373
|
+
},
|
|
374
|
+
};
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
vi.mock("three/webgpu", () => ({
|
|
378
|
+
WebGPURenderer: class MockWebGPURenderer {
|
|
379
|
+
setPixelRatio = hoisted.mockWebGpuRendererInstance.setPixelRatio;
|
|
380
|
+
setClearColor = hoisted.mockWebGpuRendererInstance.setClearColor;
|
|
381
|
+
setSize = hoisted.mockWebGpuRendererInstance.setSize;
|
|
382
|
+
render = hoisted.mockWebGpuRendererInstance.render;
|
|
383
|
+
dispose = hoisted.mockWebGpuRendererInstance.dispose;
|
|
384
|
+
domElement = hoisted.mockWebGpuRendererInstance.domElement;
|
|
385
|
+
init = hoisted.mockWebGpuRendererInstance.init;
|
|
386
|
+
},
|
|
387
|
+
}));
|
|
388
|
+
|
|
389
|
+
vi.mock("@sparkjsdev/spark", () => ({
|
|
390
|
+
SparkRenderer: class MockSparkRenderer {
|
|
391
|
+
renderOrder = 0;
|
|
392
|
+
uniforms = { numSplats: { value: 0 } };
|
|
393
|
+
focalDistance = 0;
|
|
394
|
+
apertureAngle = 0;
|
|
395
|
+
removeFromParent = vi.fn();
|
|
396
|
+
constructor(options?: { focalDistance?: number; apertureAngle?: number }) {
|
|
397
|
+
this.focalDistance = options?.focalDistance ?? 0;
|
|
398
|
+
this.apertureAngle = options?.apertureAngle ?? 0;
|
|
399
|
+
hoisted.mockSparkRendererOptions.push(options ?? {});
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
SplatModifier: class MockSplatModifier {
|
|
403
|
+
modifier: unknown;
|
|
404
|
+
constructor(modifier: unknown) {
|
|
405
|
+
this.modifier = modifier;
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
SplatGenerator: class MockSplatGenerator {},
|
|
409
|
+
SplatMesh: class MockSplatMesh {
|
|
410
|
+
initialized = Promise.resolve();
|
|
411
|
+
packedSplats = { numSplats: 0 };
|
|
412
|
+
isInitialized = true;
|
|
413
|
+
frustumCulled = false;
|
|
414
|
+
renderOrder = 0;
|
|
415
|
+
visible = true;
|
|
416
|
+
opacity = 1;
|
|
417
|
+
children: unknown[] = [];
|
|
418
|
+
position = { set: vi.fn(), y: 0 };
|
|
419
|
+
quaternion = { set: vi.fn(), identity: vi.fn() };
|
|
420
|
+
scale = { setScalar: vi.fn() };
|
|
421
|
+
worldModifier: unknown = null;
|
|
422
|
+
objectModifier: unknown = null;
|
|
423
|
+
getBoundingBox = vi.fn(() => ({
|
|
424
|
+
min: { y: 0 },
|
|
425
|
+
getCenter: vi.fn(() => ({ x: 0, y: 0, z: 0 })),
|
|
426
|
+
getSize: vi.fn(() => ({ x: 1, y: 1, z: 1 })),
|
|
427
|
+
}));
|
|
428
|
+
forEachSplat = vi.fn();
|
|
429
|
+
update = vi.fn();
|
|
430
|
+
updateGenerator = vi.fn();
|
|
431
|
+
updateVersion = vi.fn();
|
|
432
|
+
dispose = vi.fn();
|
|
433
|
+
constructor(options?: unknown) {
|
|
434
|
+
hoisted.mockSplatMeshOptions.push(options ?? {});
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
dyno: {
|
|
438
|
+
Gsplat: { type: "Gsplat" },
|
|
439
|
+
dynoBlock: vi.fn(() => ({ kind: "dynoBlock" })),
|
|
440
|
+
dynoFloat: vi.fn((value = 0) => ({ value })),
|
|
441
|
+
dynoVec3: vi.fn((value = new MockVector3()) => ({ value })),
|
|
442
|
+
dynoConst: vi.fn((_type: string, value: number) => ({ value })),
|
|
443
|
+
splitGsplat: vi.fn(() => ({
|
|
444
|
+
outputs: { center: {}, scales: {}, rgb: {}, opacity: {} },
|
|
445
|
+
})),
|
|
446
|
+
combineGsplat: vi.fn((value: unknown) => value),
|
|
447
|
+
add: vi.fn(() => ({})),
|
|
448
|
+
sub: vi.fn(() => ({})),
|
|
449
|
+
mul: vi.fn(() => ({})),
|
|
450
|
+
div: vi.fn(() => ({})),
|
|
451
|
+
abs: vi.fn(() => ({})),
|
|
452
|
+
clamp: vi.fn(() => ({})),
|
|
453
|
+
max: vi.fn(() => ({})),
|
|
454
|
+
mix: vi.fn(() => ({})),
|
|
455
|
+
smoothstep: vi.fn(() => ({})),
|
|
456
|
+
pow: vi.fn(() => ({})),
|
|
457
|
+
length: vi.fn(() => ({})),
|
|
458
|
+
swizzle: vi.fn(() => ({})),
|
|
459
|
+
},
|
|
460
|
+
}));
|
|
461
|
+
|
|
462
|
+
vi.mock("@pixiv/three-vrm", () => ({
|
|
463
|
+
MToonMaterialLoaderPlugin: hoisted.mockMToonMaterialLoaderPlugin,
|
|
464
|
+
VRMLoaderPlugin: hoisted.mockVRMLoaderPlugin,
|
|
465
|
+
VRMUtils: {
|
|
466
|
+
deepDispose: vi.fn(),
|
|
467
|
+
removeUnnecessaryVertices: vi.fn(),
|
|
468
|
+
combineSkeletons: vi.fn(),
|
|
469
|
+
},
|
|
470
|
+
}));
|
|
471
|
+
|
|
472
|
+
vi.mock("@pixiv/three-vrm/nodes", () => ({
|
|
473
|
+
MToonNodeMaterial: class MockMToonNodeMaterial {},
|
|
474
|
+
}));
|
|
475
|
+
|
|
476
|
+
vi.mock("three/examples/jsm/loaders/GLTFLoader.js", () => ({
|
|
477
|
+
GLTFLoader: class MockGLTFLoader {
|
|
478
|
+
register = hoisted.mockLoaderRegister;
|
|
479
|
+
setDRACOLoader = hoisted.mockLoaderSetDRACOLoader;
|
|
480
|
+
setMeshoptDecoder = hoisted.mockLoaderSetMeshoptDecoder;
|
|
481
|
+
loadAsync = hoisted.mockLoaderLoadAsync;
|
|
482
|
+
},
|
|
483
|
+
}));
|
|
484
|
+
|
|
485
|
+
vi.mock("three/examples/jsm/loaders/DRACOLoader.js", () => ({
|
|
486
|
+
DRACOLoader: class MockDRACOLoader {
|
|
487
|
+
setDecoderConfig = hoisted.mockDracoLoaderSetDecoderConfig;
|
|
488
|
+
setDecoderPath = hoisted.mockDracoLoaderSetDecoderPath;
|
|
489
|
+
preload = hoisted.mockDracoLoaderPreload;
|
|
490
|
+
},
|
|
491
|
+
}));
|
|
492
|
+
|
|
493
|
+
vi.mock("three/examples/jsm/libs/meshopt_decoder.module.js", () => ({
|
|
494
|
+
MeshoptDecoder: { supported: true },
|
|
495
|
+
}));
|
|
496
|
+
|
|
497
|
+
vi.mock("three/examples/jsm/controls/OrbitControls.js", () => ({
|
|
498
|
+
OrbitControls: class MockOrbitControls {
|
|
499
|
+
enablePan = true;
|
|
500
|
+
enableRotate = true;
|
|
501
|
+
enableZoom = true;
|
|
502
|
+
enableDamping = false;
|
|
503
|
+
dampingFactor = 0.05;
|
|
504
|
+
zoomSpeed = 1;
|
|
505
|
+
minDistance = 0;
|
|
506
|
+
maxDistance = Infinity;
|
|
507
|
+
minPolarAngle = 0;
|
|
508
|
+
maxPolarAngle = Math.PI;
|
|
509
|
+
target = { set: vi.fn(), copy: vi.fn(), x: 0, y: 0, z: 0 };
|
|
510
|
+
update = vi.fn();
|
|
511
|
+
dispose = vi.fn();
|
|
512
|
+
addEventListener = vi.fn();
|
|
513
|
+
removeEventListener = vi.fn();
|
|
514
|
+
enabled = true;
|
|
515
|
+
},
|
|
516
|
+
}));
|
|
517
|
+
|
|
518
|
+
vi.mock("@elizaos/app-core/utils", () => ({
|
|
519
|
+
resolveAppAssetUrl: vi.fn((p: string) => `/mock/${p}`),
|
|
520
|
+
}));
|
|
521
|
+
|
|
522
|
+
// Stub DOM APIs that VrmEngine relies on
|
|
523
|
+
const rafIds = { current: 0 };
|
|
524
|
+
Object.assign(globalThis, {
|
|
525
|
+
requestAnimationFrame: vi.fn(() => {
|
|
526
|
+
return ++rafIds.current;
|
|
527
|
+
}),
|
|
528
|
+
cancelAnimationFrame: vi.fn(),
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// VrmEngine.setup() accesses window.devicePixelRatio
|
|
532
|
+
Object.assign(globalThis, {
|
|
533
|
+
window: {
|
|
534
|
+
devicePixelRatio: 1,
|
|
535
|
+
addEventListener: vi.fn(),
|
|
536
|
+
removeEventListener: vi.fn(),
|
|
537
|
+
localStorage: {
|
|
538
|
+
getItem: vi.fn(() => null),
|
|
539
|
+
setItem: vi.fn(),
|
|
540
|
+
removeItem: vi.fn(),
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
});
|
|
544
|
+
Object.defineProperty(globalThis, "navigator", {
|
|
545
|
+
configurable: true,
|
|
546
|
+
value: hoisted.navigatorMock as unknown as Navigator,
|
|
547
|
+
});
|
|
548
|
+
Object.assign(globalThis, {
|
|
549
|
+
fetch: hoisted.fetchMock,
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// VrmEngine.createFootShadow accesses document.createElement
|
|
553
|
+
const mockCanvas2d = {
|
|
554
|
+
createRadialGradient: vi.fn(() => ({
|
|
555
|
+
addColorStop: vi.fn(),
|
|
556
|
+
})),
|
|
557
|
+
fillStyle: "",
|
|
558
|
+
fillRect: vi.fn(),
|
|
559
|
+
fill: vi.fn(),
|
|
560
|
+
beginPath: vi.fn(),
|
|
561
|
+
arc: vi.fn(),
|
|
562
|
+
};
|
|
563
|
+
Object.assign(globalThis, {
|
|
564
|
+
document: {
|
|
565
|
+
createElement: vi.fn(() => ({
|
|
566
|
+
width: 0,
|
|
567
|
+
height: 0,
|
|
568
|
+
getContext: vi.fn(() => mockCanvas2d),
|
|
569
|
+
})),
|
|
570
|
+
},
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
// ---------------------------------------------------------------------------
|
|
574
|
+
// Import after mocks
|
|
575
|
+
// ---------------------------------------------------------------------------
|
|
576
|
+
import { VrmEngine } from "../VrmEngine";
|
|
577
|
+
|
|
578
|
+
// ---------------------------------------------------------------------------
|
|
579
|
+
// Helpers
|
|
580
|
+
// ---------------------------------------------------------------------------
|
|
581
|
+
|
|
582
|
+
function createMockCanvas(): HTMLCanvasElement {
|
|
583
|
+
return {
|
|
584
|
+
clientWidth: 800,
|
|
585
|
+
clientHeight: 600,
|
|
586
|
+
getBoundingClientRect: () => ({
|
|
587
|
+
width: 800,
|
|
588
|
+
height: 600,
|
|
589
|
+
x: 0,
|
|
590
|
+
y: 0,
|
|
591
|
+
top: 0,
|
|
592
|
+
left: 0,
|
|
593
|
+
bottom: 600,
|
|
594
|
+
right: 800,
|
|
595
|
+
toJSON: () => ({}),
|
|
596
|
+
}),
|
|
597
|
+
} as unknown as HTMLCanvasElement;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
function createMockLoadedVrm() {
|
|
601
|
+
return {
|
|
602
|
+
scene: {
|
|
603
|
+
parent: null,
|
|
604
|
+
visible: true,
|
|
605
|
+
traverse: vi.fn(),
|
|
606
|
+
updateMatrixWorld: vi.fn(),
|
|
607
|
+
scale: { setScalar: vi.fn() },
|
|
608
|
+
position: { set: vi.fn() },
|
|
609
|
+
},
|
|
610
|
+
humanoid: {
|
|
611
|
+
getNormalizedBoneNode: vi.fn(() => null),
|
|
612
|
+
},
|
|
613
|
+
springBoneManager: {
|
|
614
|
+
reset: vi.fn(),
|
|
615
|
+
},
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
async function waitForEngineReady(engine: VrmEngine): Promise<void> {
|
|
620
|
+
await engine.whenReady();
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// ---------------------------------------------------------------------------
|
|
624
|
+
// Tests
|
|
625
|
+
// ---------------------------------------------------------------------------
|
|
626
|
+
|
|
627
|
+
describe("VrmEngine", () => {
|
|
628
|
+
let engine: VrmEngine;
|
|
629
|
+
|
|
630
|
+
beforeEach(() => {
|
|
631
|
+
vi.clearAllMocks();
|
|
632
|
+
hoisted.mixerListeners.clear();
|
|
633
|
+
hoisted.navigatorMock.gpu = undefined;
|
|
634
|
+
hoisted.fetchMock.mockResolvedValue({
|
|
635
|
+
ok: true,
|
|
636
|
+
status: 200,
|
|
637
|
+
arrayBuffer: hoisted.responseArrayBufferMock,
|
|
638
|
+
});
|
|
639
|
+
hoisted.responseArrayBufferMock.mockResolvedValue(new ArrayBuffer(8));
|
|
640
|
+
delete (window as Window & { __electrobunWindowId?: number })
|
|
641
|
+
.__electrobunWindowId;
|
|
642
|
+
delete (window as Window & { __electrobunWebviewId?: number })
|
|
643
|
+
.__electrobunWebviewId;
|
|
644
|
+
engine = new VrmEngine();
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
afterEach(() => {
|
|
648
|
+
engine.dispose();
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
// ── 1. Setup / dispose lifecycle ─────────────────────────────────
|
|
652
|
+
describe("setup / dispose lifecycle", () => {
|
|
653
|
+
it("creates an engine without throwing", () => {
|
|
654
|
+
expect(engine).toBeInstanceOf(VrmEngine);
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
it("is not initialized before setup()", () => {
|
|
658
|
+
expect(engine.isInitialized()).toBe(false);
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
it("is initialized after setup()", async () => {
|
|
662
|
+
const canvas = createMockCanvas();
|
|
663
|
+
engine.setup(canvas, vi.fn());
|
|
664
|
+
await waitForEngineReady(engine);
|
|
665
|
+
expect(engine.isInitialized()).toBe(true);
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
it("dispose() does not throw on an un-initialized engine", () => {
|
|
669
|
+
expect(() => engine.dispose()).not.toThrow();
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
it("dispose() cleans up after setup()", async () => {
|
|
673
|
+
const canvas = createMockCanvas();
|
|
674
|
+
engine.setup(canvas, vi.fn());
|
|
675
|
+
await waitForEngineReady(engine);
|
|
676
|
+
expect(engine.isInitialized()).toBe(true);
|
|
677
|
+
|
|
678
|
+
engine.dispose();
|
|
679
|
+
expect(engine.isInitialized()).toBe(false);
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
it("can be setup() again after dispose()", async () => {
|
|
683
|
+
const canvas = createMockCanvas();
|
|
684
|
+
engine.setup(canvas, vi.fn());
|
|
685
|
+
await waitForEngineReady(engine);
|
|
686
|
+
engine.dispose();
|
|
687
|
+
expect(engine.isInitialized()).toBe(false);
|
|
688
|
+
|
|
689
|
+
engine.setup(canvas, vi.fn());
|
|
690
|
+
await waitForEngineReady(engine);
|
|
691
|
+
expect(engine.isInitialized()).toBe(true);
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
it("re-setup with the same canvas reuses the engine (no dispose)", async () => {
|
|
695
|
+
const canvas = createMockCanvas();
|
|
696
|
+
// Assign domElement so the "same canvas" check passes
|
|
697
|
+
hoisted.mockRendererInstance.domElement = canvas;
|
|
698
|
+
|
|
699
|
+
const cb1 = vi.fn();
|
|
700
|
+
const cb2 = vi.fn();
|
|
701
|
+
engine.setup(canvas, cb1);
|
|
702
|
+
await waitForEngineReady(engine);
|
|
703
|
+
engine.setup(canvas, cb2);
|
|
704
|
+
expect(engine.isInitialized()).toBe(true);
|
|
705
|
+
// dispose should not have been called between the two setups
|
|
706
|
+
expect(hoisted.mockRendererInstance.dispose).not.toHaveBeenCalled();
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
it("pauses and resumes the render loop without disposing the scene", async () => {
|
|
710
|
+
const canvas = createMockCanvas();
|
|
711
|
+
engine.setup(canvas, vi.fn());
|
|
712
|
+
await waitForEngineReady(engine);
|
|
713
|
+
|
|
714
|
+
expect(globalThis.requestAnimationFrame).toHaveBeenCalledTimes(1);
|
|
715
|
+
|
|
716
|
+
engine.setPaused(true);
|
|
717
|
+
expect(globalThis.cancelAnimationFrame).toHaveBeenCalledTimes(1);
|
|
718
|
+
expect(hoisted.mockRendererInstance.dispose).not.toHaveBeenCalled();
|
|
719
|
+
|
|
720
|
+
engine.setPaused(false);
|
|
721
|
+
expect(globalThis.requestAnimationFrame).toHaveBeenCalledTimes(2);
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
it("waits for the renderer to finish initializing", async () => {
|
|
725
|
+
const canvas = createMockCanvas();
|
|
726
|
+
engine.setup(canvas, vi.fn());
|
|
727
|
+
|
|
728
|
+
await expect(engine.whenReady()).resolves.toBeUndefined();
|
|
729
|
+
expect(engine.isInitialized()).toBe(true);
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
it("defaults to WebGLRenderer when navigator.gpu is available", async () => {
|
|
733
|
+
hoisted.navigatorMock.gpu = {};
|
|
734
|
+
const canvas = createMockCanvas();
|
|
735
|
+
|
|
736
|
+
engine.setup(canvas, vi.fn());
|
|
737
|
+
await waitForEngineReady(engine);
|
|
738
|
+
|
|
739
|
+
const engineAny = engine as unknown as { rendererBackend: string };
|
|
740
|
+
expect(engineAny.rendererBackend).toBe("webgl");
|
|
741
|
+
expect(hoisted.mockWebGpuRendererInstance.init).not.toHaveBeenCalled();
|
|
742
|
+
expect(hoisted.mockRendererInstance.setPixelRatio).toHaveBeenCalledWith(
|
|
743
|
+
1,
|
|
744
|
+
);
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
it("uses WebGPURenderer when navigator.gpu is available and opted in", async () => {
|
|
748
|
+
hoisted.navigatorMock.gpu = {};
|
|
749
|
+
(
|
|
750
|
+
window.localStorage.getItem as ReturnType<typeof vi.fn>
|
|
751
|
+
).mockReturnValueOnce("webgpu");
|
|
752
|
+
const canvas = createMockCanvas();
|
|
753
|
+
|
|
754
|
+
engine.setup(canvas, vi.fn());
|
|
755
|
+
await waitForEngineReady(engine);
|
|
756
|
+
|
|
757
|
+
const engineAny = engine as unknown as { rendererBackend: string };
|
|
758
|
+
expect(engineAny.rendererBackend).toBe("webgpu");
|
|
759
|
+
expect(hoisted.mockWebGpuRendererInstance.init).toHaveBeenCalledTimes(1);
|
|
760
|
+
expect(
|
|
761
|
+
hoisted.mockWebGpuRendererInstance.setPixelRatio,
|
|
762
|
+
).toHaveBeenCalledWith(1);
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
it("uses WebGPURenderer by default in Electrobun runtime", async () => {
|
|
766
|
+
hoisted.navigatorMock.gpu = {};
|
|
767
|
+
(
|
|
768
|
+
window as Window & { __electrobunWindowId?: number }
|
|
769
|
+
).__electrobunWindowId = 1;
|
|
770
|
+
const canvas = createMockCanvas();
|
|
771
|
+
|
|
772
|
+
engine.setup(canvas, vi.fn());
|
|
773
|
+
await waitForEngineReady(engine);
|
|
774
|
+
|
|
775
|
+
const engineAny = engine as unknown as { rendererBackend: string };
|
|
776
|
+
expect(engineAny.rendererBackend).toBe("webgpu");
|
|
777
|
+
expect(hoisted.mockWebGpuRendererInstance.init).toHaveBeenCalledTimes(1);
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
it("cleans up WebGL resources during dispose()", async () => {
|
|
781
|
+
const canvas = createMockCanvas();
|
|
782
|
+
engine.setup(canvas, vi.fn());
|
|
783
|
+
await waitForEngineReady(engine);
|
|
784
|
+
|
|
785
|
+
engine.dispose();
|
|
786
|
+
|
|
787
|
+
expect(hoisted.mockRendererInstance.dispose).toHaveBeenCalled();
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
// ── 2. playEmote doesn't throw ───────────────────────────────────
|
|
792
|
+
describe("playEmote", () => {
|
|
793
|
+
it("returns immediately when VRM is not loaded (no mixer)", async () => {
|
|
794
|
+
const canvas = createMockCanvas();
|
|
795
|
+
engine.setup(canvas, vi.fn());
|
|
796
|
+
await waitForEngineReady(engine);
|
|
797
|
+
// No VRM loaded — playEmote should resolve silently
|
|
798
|
+
await expect(
|
|
799
|
+
engine.playEmote("/mock/emote.glb", 2, false),
|
|
800
|
+
).resolves.toBeUndefined();
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
it("stopEmote() does not throw when no emote is playing", async () => {
|
|
804
|
+
const canvas = createMockCanvas();
|
|
805
|
+
engine.setup(canvas, vi.fn());
|
|
806
|
+
await waitForEngineReady(engine);
|
|
807
|
+
expect(() => engine.stopEmote()).not.toThrow();
|
|
808
|
+
});
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
// ── 3. State transitions ─────────────────────────────────────────
|
|
812
|
+
describe("state transitions", () => {
|
|
813
|
+
it("initial state has no VRM loaded", () => {
|
|
814
|
+
const state = engine.getState();
|
|
815
|
+
expect(state.vrmLoaded).toBe(false);
|
|
816
|
+
expect(state.vrmName).toBeNull();
|
|
817
|
+
expect(state.idlePlaying).toBe(false);
|
|
818
|
+
expect(state.idleTime).toBe(0);
|
|
819
|
+
expect(state.idleTracks).toBe(0);
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
it("state after setup still has no VRM loaded", async () => {
|
|
823
|
+
const canvas = createMockCanvas();
|
|
824
|
+
engine.setup(canvas, vi.fn());
|
|
825
|
+
await waitForEngineReady(engine);
|
|
826
|
+
const state = engine.getState();
|
|
827
|
+
expect(state.vrmLoaded).toBe(false);
|
|
828
|
+
expect(state.vrmName).toBeNull();
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
it("state after dispose resets to initial", async () => {
|
|
832
|
+
const canvas = createMockCanvas();
|
|
833
|
+
engine.setup(canvas, vi.fn());
|
|
834
|
+
await waitForEngineReady(engine);
|
|
835
|
+
engine.dispose();
|
|
836
|
+
const state = engine.getState();
|
|
837
|
+
expect(state.vrmLoaded).toBe(false);
|
|
838
|
+
expect(state.vrmName).toBeNull();
|
|
839
|
+
expect(state.idlePlaying).toBe(false);
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
it("getState() returns the VrmEngineState shape", () => {
|
|
843
|
+
const state = engine.getState();
|
|
844
|
+
const keys = Object.keys(state).sort();
|
|
845
|
+
expect(keys).toEqual(
|
|
846
|
+
[
|
|
847
|
+
"idlePlaying",
|
|
848
|
+
"idleTime",
|
|
849
|
+
"idleTracks",
|
|
850
|
+
"loadError",
|
|
851
|
+
"revealStarted",
|
|
852
|
+
"vrmLoaded",
|
|
853
|
+
"vrmName",
|
|
854
|
+
].sort(),
|
|
855
|
+
);
|
|
856
|
+
});
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
// ── 4. Public setters ────────────────────────────────────────────
|
|
860
|
+
describe("public setters", () => {
|
|
861
|
+
it("setMouthOpen clamps values to [0, 1]", () => {
|
|
862
|
+
expect(() => engine.setMouthOpen(0)).not.toThrow();
|
|
863
|
+
expect(() => engine.setMouthOpen(1)).not.toThrow();
|
|
864
|
+
expect(() => engine.setMouthOpen(-0.5)).not.toThrow();
|
|
865
|
+
expect(() => engine.setMouthOpen(2.0)).not.toThrow();
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
it("setSpeaking toggles without throwing", () => {
|
|
869
|
+
expect(() => engine.setSpeaking(true)).not.toThrow();
|
|
870
|
+
expect(() => engine.setSpeaking(false)).not.toThrow();
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
it("setCameraAnimation merges partial config", () => {
|
|
874
|
+
expect(() => engine.setCameraAnimation({ enabled: false })).not.toThrow();
|
|
875
|
+
expect(() =>
|
|
876
|
+
engine.setCameraAnimation({ swayAmplitude: 0.1, speed: 1.5 }),
|
|
877
|
+
).not.toThrow();
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
it("setCompanionZoomNormalized clamps to the supported range", () => {
|
|
881
|
+
const engineAny = engine as unknown as { companionZoomTarget: number };
|
|
882
|
+
|
|
883
|
+
engine.setCompanionZoomNormalized(-0.5);
|
|
884
|
+
expect(engineAny.companionZoomTarget).toBe(0);
|
|
885
|
+
|
|
886
|
+
engine.setCompanionZoomNormalized(1.4);
|
|
887
|
+
expect(engineAny.companionZoomTarget).toBe(1);
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
it("queues the first world reveal until the VRM is ready", async () => {
|
|
891
|
+
const canvas = createMockCanvas();
|
|
892
|
+
engine.setup(canvas, vi.fn());
|
|
893
|
+
await waitForEngineReady(engine);
|
|
894
|
+
|
|
895
|
+
const engineAny = engine as unknown as {
|
|
896
|
+
worldReveal: {
|
|
897
|
+
waitingForVrm: boolean;
|
|
898
|
+
syncToTeleport: boolean;
|
|
899
|
+
progress: number;
|
|
900
|
+
controller: {
|
|
901
|
+
mesh: {
|
|
902
|
+
objectModifier: unknown;
|
|
903
|
+
updateGenerator: ReturnType<typeof vi.fn>;
|
|
904
|
+
updateVersion: ReturnType<typeof vi.fn>;
|
|
905
|
+
};
|
|
906
|
+
};
|
|
907
|
+
} | null;
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
await engine.setWorldUrl("/worlds/companion-day.spz");
|
|
911
|
+
|
|
912
|
+
expect(engineAny.worldReveal?.waitingForVrm).toBe(true);
|
|
913
|
+
expect(engineAny.worldReveal?.syncToTeleport).toBe(false);
|
|
914
|
+
expect(engineAny.worldReveal?.progress).toBe(0);
|
|
915
|
+
expect(
|
|
916
|
+
engineAny.worldReveal?.controller.mesh.objectModifier,
|
|
917
|
+
).toBeTruthy();
|
|
918
|
+
expect(
|
|
919
|
+
engineAny.worldReveal?.controller.mesh.updateGenerator,
|
|
920
|
+
).toHaveBeenCalled();
|
|
921
|
+
expect(
|
|
922
|
+
engineAny.worldReveal?.controller.mesh.updateVersion,
|
|
923
|
+
).toHaveBeenCalled();
|
|
924
|
+
});
|
|
925
|
+
|
|
926
|
+
it("resize() handles zero or negative dimensions gracefully", async () => {
|
|
927
|
+
const canvas = createMockCanvas();
|
|
928
|
+
engine.setup(canvas, vi.fn());
|
|
929
|
+
await waitForEngineReady(engine);
|
|
930
|
+
expect(() => engine.resize(0, 0)).not.toThrow();
|
|
931
|
+
expect(() => engine.resize(-1, 600)).not.toThrow();
|
|
932
|
+
expect(() => engine.resize(800, -1)).not.toThrow();
|
|
933
|
+
expect(() => engine.resize(1024, 768)).not.toThrow();
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
it("resize() is a no-op before setup()", () => {
|
|
937
|
+
expect(() => engine.resize(800, 600)).not.toThrow();
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
it("configures Spark native depth of field for world rendering", async () => {
|
|
941
|
+
const canvas = createMockCanvas();
|
|
942
|
+
engine.setup(canvas, vi.fn());
|
|
943
|
+
await waitForEngineReady(engine);
|
|
944
|
+
|
|
945
|
+
await engine.setWorldUrl("/worlds/companion-day.spz");
|
|
946
|
+
|
|
947
|
+
expect(hoisted.mockSplatMeshOptions.at(-1)).toMatchObject({
|
|
948
|
+
url: "/worlds/companion-day.spz",
|
|
949
|
+
});
|
|
950
|
+
expect(hoisted.mockSparkRendererOptions.at(-1)).toMatchObject({
|
|
951
|
+
apertureAngle: 0,
|
|
952
|
+
clipXY: 1.08,
|
|
953
|
+
focalDistance: 5,
|
|
954
|
+
maxStdDev: 2.35,
|
|
955
|
+
minAlpha: 0.0016,
|
|
956
|
+
view: expect.objectContaining({
|
|
957
|
+
depthBias: 1,
|
|
958
|
+
sortDistance: 0.035,
|
|
959
|
+
sortRadial: true,
|
|
960
|
+
sort360: false,
|
|
961
|
+
}),
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
const engineAny = engine as unknown as {
|
|
965
|
+
sparkRenderer: { focalDistance: number; apertureAngle: number };
|
|
966
|
+
updateSparkDepthOfField: (camera: {
|
|
967
|
+
position: { distanceTo: (target: unknown) => number };
|
|
968
|
+
}) => void;
|
|
969
|
+
};
|
|
970
|
+
engineAny.updateSparkDepthOfField({
|
|
971
|
+
position: { distanceTo: () => 4 },
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
expect(engineAny.sparkRenderer.focalDistance).toBe(4);
|
|
975
|
+
expect(engineAny.sparkRenderer.apertureAngle).toBeCloseTo(
|
|
976
|
+
2 * Math.atan(0.0125 / 4),
|
|
977
|
+
);
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
it("uses theme-specific floor offsets for companion worlds", async () => {
|
|
981
|
+
mockSceneInstance.add.mockClear();
|
|
982
|
+
|
|
983
|
+
const canvas = createMockCanvas();
|
|
984
|
+
engine.setup(canvas, vi.fn());
|
|
985
|
+
await waitForEngineReady(engine);
|
|
986
|
+
|
|
987
|
+
await engine.setWorldUrl("/worlds/companion-day.spz");
|
|
988
|
+
const daySplat = mockSceneInstance.add.mock.calls.at(-1)?.[0] as {
|
|
989
|
+
position: { set: ReturnType<typeof vi.fn> };
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
await engine.setWorldUrl("/worlds/companion-night.spz");
|
|
993
|
+
const nightSplat = mockSceneInstance.add.mock.calls.at(-1)?.[0] as {
|
|
994
|
+
position: { set: ReturnType<typeof vi.fn> };
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
const dayPosition = daySplat.position.set.mock.calls.at(-1) ?? [];
|
|
998
|
+
const nightPosition = nightSplat.position.set.mock.calls.at(-1) ?? [];
|
|
999
|
+
|
|
1000
|
+
expect(dayPosition[0]).toBeCloseTo(0, 5);
|
|
1001
|
+
expect(dayPosition[1]).toBeCloseTo(-0.35, 5);
|
|
1002
|
+
expect(dayPosition[2]).toBeCloseTo(0, 5);
|
|
1003
|
+
expect(nightPosition[0]).toBeCloseTo(0, 5);
|
|
1004
|
+
expect(nightPosition[1]).toBeCloseTo(-0.95, 5);
|
|
1005
|
+
expect(nightPosition[2]).toBeCloseTo(0, 5);
|
|
1006
|
+
});
|
|
1007
|
+
|
|
1008
|
+
it("starts a pending world reveal when the teleport dissolve begins", async () => {
|
|
1009
|
+
const canvas = createMockCanvas();
|
|
1010
|
+
engine.setup(canvas, vi.fn());
|
|
1011
|
+
await waitForEngineReady(engine);
|
|
1012
|
+
|
|
1013
|
+
await engine.setWorldUrl("/worlds/companion-day.spz");
|
|
1014
|
+
|
|
1015
|
+
const engineAny = engine as unknown as {
|
|
1016
|
+
teleportProgress: number;
|
|
1017
|
+
startPendingWorldReveal: (syncToTeleport: boolean) => void;
|
|
1018
|
+
worldReveal: {
|
|
1019
|
+
waitingForVrm: boolean;
|
|
1020
|
+
syncToTeleport: boolean;
|
|
1021
|
+
progress: number;
|
|
1022
|
+
controller: {
|
|
1023
|
+
mesh: {
|
|
1024
|
+
objectModifier: unknown;
|
|
1025
|
+
updateGenerator: ReturnType<typeof vi.fn>;
|
|
1026
|
+
};
|
|
1027
|
+
};
|
|
1028
|
+
} | null;
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
engineAny.teleportProgress = 0.35;
|
|
1032
|
+
engineAny.startPendingWorldReveal(true);
|
|
1033
|
+
|
|
1034
|
+
expect(engineAny.worldReveal?.waitingForVrm).toBe(false);
|
|
1035
|
+
expect(engineAny.worldReveal?.syncToTeleport).toBe(true);
|
|
1036
|
+
expect(engineAny.worldReveal?.progress).toBeCloseTo(0.35);
|
|
1037
|
+
expect(
|
|
1038
|
+
engineAny.worldReveal?.controller.mesh.objectModifier,
|
|
1039
|
+
).toBeTruthy();
|
|
1040
|
+
expect(
|
|
1041
|
+
engineAny.worldReveal?.controller.mesh.updateGenerator,
|
|
1042
|
+
).toHaveBeenCalled();
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
it("keeps the previous world alive while the next world dissolves in", async () => {
|
|
1046
|
+
const canvas = createMockCanvas();
|
|
1047
|
+
engine.setup(canvas, vi.fn());
|
|
1048
|
+
await waitForEngineReady(engine);
|
|
1049
|
+
|
|
1050
|
+
await engine.setWorldUrl("/worlds/companion-day.spz");
|
|
1051
|
+
|
|
1052
|
+
const engineAny = engine as unknown as {
|
|
1053
|
+
vrmReady: boolean;
|
|
1054
|
+
worldMesh: {
|
|
1055
|
+
opacity: number;
|
|
1056
|
+
objectModifier: unknown;
|
|
1057
|
+
dispose: ReturnType<typeof vi.fn>;
|
|
1058
|
+
} | null;
|
|
1059
|
+
worldReveal: {
|
|
1060
|
+
waitingForVrm: boolean;
|
|
1061
|
+
syncToTeleport: boolean;
|
|
1062
|
+
progress: number;
|
|
1063
|
+
duration: number;
|
|
1064
|
+
controller: {
|
|
1065
|
+
progressUniform: { value: number };
|
|
1066
|
+
mesh: {
|
|
1067
|
+
opacity: number;
|
|
1068
|
+
objectModifier: unknown;
|
|
1069
|
+
dispose: ReturnType<typeof vi.fn>;
|
|
1070
|
+
};
|
|
1071
|
+
radius: number;
|
|
1072
|
+
};
|
|
1073
|
+
incoming: {
|
|
1074
|
+
progressUniform: { value: number };
|
|
1075
|
+
mesh: {
|
|
1076
|
+
opacity: number;
|
|
1077
|
+
objectModifier: unknown;
|
|
1078
|
+
dispose: ReturnType<typeof vi.fn>;
|
|
1079
|
+
};
|
|
1080
|
+
radius: number;
|
|
1081
|
+
};
|
|
1082
|
+
outgoing: {
|
|
1083
|
+
progressUniform: { value: number };
|
|
1084
|
+
mesh: {
|
|
1085
|
+
opacity: number;
|
|
1086
|
+
objectModifier: unknown;
|
|
1087
|
+
dispose: ReturnType<typeof vi.fn>;
|
|
1088
|
+
};
|
|
1089
|
+
radius: number;
|
|
1090
|
+
} | null;
|
|
1091
|
+
} | null;
|
|
1092
|
+
updateWorldReveal: (stableDelta: number) => void;
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
const firstWorld = engineAny.worldMesh;
|
|
1096
|
+
expect(firstWorld).toBeTruthy();
|
|
1097
|
+
|
|
1098
|
+
engineAny.vrmReady = true;
|
|
1099
|
+
await engine.setWorldUrl("/worlds/companion-night.spz");
|
|
1100
|
+
const secondWorld = engineAny.worldMesh;
|
|
1101
|
+
|
|
1102
|
+
expect(secondWorld).toBeTruthy();
|
|
1103
|
+
expect(secondWorld).not.toBe(firstWorld);
|
|
1104
|
+
expect(firstWorld?.dispose).not.toHaveBeenCalled();
|
|
1105
|
+
expect(engineAny.worldReveal?.waitingForVrm).toBe(false);
|
|
1106
|
+
expect(engineAny.worldReveal?.syncToTeleport).toBe(false);
|
|
1107
|
+
expect(engineAny.worldReveal?.incoming.mesh).toBe(secondWorld);
|
|
1108
|
+
expect(engineAny.worldReveal?.outgoing?.mesh).toBe(firstWorld);
|
|
1109
|
+
expect(engineAny.worldReveal?.controller.mesh).toBe(secondWorld);
|
|
1110
|
+
expect(engineAny.worldReveal?.incoming.radius).toBeCloseTo(
|
|
1111
|
+
engineAny.worldReveal?.outgoing?.radius ?? 0,
|
|
1112
|
+
);
|
|
1113
|
+
expect(engineAny.worldReveal?.incoming.mesh.objectModifier).toBeTruthy();
|
|
1114
|
+
expect(engineAny.worldReveal?.outgoing?.mesh.objectModifier).toBeTruthy();
|
|
1115
|
+
|
|
1116
|
+
const halfDuration = (engineAny.worldReveal?.duration ?? 0) / 2;
|
|
1117
|
+
engineAny.updateWorldReveal(halfDuration);
|
|
1118
|
+
expect(engineAny.worldReveal?.progress).toBeCloseTo(0.5, 5);
|
|
1119
|
+
expect(engineAny.worldReveal?.incoming.progressUniform.value).toBeCloseTo(
|
|
1120
|
+
0.25,
|
|
1121
|
+
5,
|
|
1122
|
+
);
|
|
1123
|
+
expect(
|
|
1124
|
+
engineAny.worldReveal?.outgoing?.progressUniform.value,
|
|
1125
|
+
).toBeCloseTo(0.25, 5);
|
|
1126
|
+
expect(firstWorld?.dispose).not.toHaveBeenCalled();
|
|
1127
|
+
for (let i = 0; i < 32 && engineAny.worldReveal; i++) {
|
|
1128
|
+
engineAny.updateWorldReveal(0.4);
|
|
1129
|
+
}
|
|
1130
|
+
expect(engineAny.worldReveal).toBeNull();
|
|
1131
|
+
expect(firstWorld?.dispose).toHaveBeenCalled();
|
|
1132
|
+
expect(secondWorld?.opacity).toBe(1);
|
|
1133
|
+
});
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
// ── 5. Animation blending basics ─────────────────────────────────
|
|
1137
|
+
describe("animation blending", () => {
|
|
1138
|
+
it("stopEmote calls fadeOut on any active emote action", () => {
|
|
1139
|
+
const engineAny = engine as unknown as {
|
|
1140
|
+
emoteAction: ReturnType<typeof createMockAction> | null;
|
|
1141
|
+
idleAction: ReturnType<typeof createMockAction> | null;
|
|
1142
|
+
emoteTimeout: ReturnType<typeof setTimeout> | null;
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
const fakeEmoteAction = createMockAction();
|
|
1146
|
+
const fakeIdleAction = createMockAction();
|
|
1147
|
+
engineAny.emoteAction = fakeEmoteAction;
|
|
1148
|
+
engineAny.idleAction = fakeIdleAction;
|
|
1149
|
+
|
|
1150
|
+
engine.stopEmote();
|
|
1151
|
+
|
|
1152
|
+
expect(fakeIdleAction.crossFadeFrom).toHaveBeenCalledWith(
|
|
1153
|
+
fakeEmoteAction,
|
|
1154
|
+
0.4,
|
|
1155
|
+
false,
|
|
1156
|
+
);
|
|
1157
|
+
expect(fakeIdleAction.play).toHaveBeenCalled();
|
|
1158
|
+
expect(engineAny.emoteAction).toBeNull();
|
|
1159
|
+
});
|
|
1160
|
+
|
|
1161
|
+
it("playEmote crossfades from the current emote instead of bouncing through idle", async () => {
|
|
1162
|
+
const engineAny = engine as unknown as {
|
|
1163
|
+
vrm: object | null;
|
|
1164
|
+
mixer: {
|
|
1165
|
+
clipAction: ReturnType<typeof vi.fn>;
|
|
1166
|
+
addEventListener: ReturnType<typeof vi.fn>;
|
|
1167
|
+
removeEventListener: ReturnType<typeof vi.fn>;
|
|
1168
|
+
} | null;
|
|
1169
|
+
idleAction: ReturnType<typeof createMockAction> | null;
|
|
1170
|
+
emoteAction: ReturnType<typeof createMockAction> | null;
|
|
1171
|
+
loadEmoteClipCached: ReturnType<typeof vi.fn>;
|
|
1172
|
+
};
|
|
1173
|
+
const nextEmoteAction = createMockAction();
|
|
1174
|
+
const currentEmoteAction = createMockAction();
|
|
1175
|
+
const idleAction = createMockAction();
|
|
1176
|
+
|
|
1177
|
+
engineAny.vrm = {
|
|
1178
|
+
scene: {
|
|
1179
|
+
parent: null,
|
|
1180
|
+
},
|
|
1181
|
+
};
|
|
1182
|
+
engineAny.mixer = {
|
|
1183
|
+
clipAction: vi.fn(() => nextEmoteAction),
|
|
1184
|
+
addEventListener: vi.fn(),
|
|
1185
|
+
removeEventListener: vi.fn(),
|
|
1186
|
+
};
|
|
1187
|
+
engineAny.idleAction = idleAction;
|
|
1188
|
+
engineAny.emoteAction = currentEmoteAction;
|
|
1189
|
+
engineAny.loadEmoteClipCached = vi.fn().mockResolvedValue({});
|
|
1190
|
+
|
|
1191
|
+
await engine.playEmote("/mock/emote.glb", 2, false);
|
|
1192
|
+
|
|
1193
|
+
expect(nextEmoteAction.crossFadeFrom).toHaveBeenCalledWith(
|
|
1194
|
+
currentEmoteAction,
|
|
1195
|
+
0.4,
|
|
1196
|
+
false,
|
|
1197
|
+
);
|
|
1198
|
+
expect(idleAction.fadeIn).not.toHaveBeenCalled();
|
|
1199
|
+
expect(engineAny.emoteAction).toBe(nextEmoteAction);
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
it("restores idle as soon as a one-shot emote finishes", async () => {
|
|
1203
|
+
const engineAny = engine as unknown as {
|
|
1204
|
+
vrm: object | null;
|
|
1205
|
+
mixer: typeof hoisted.mockMixerInstance | null;
|
|
1206
|
+
idleAction: ReturnType<typeof createMockAction> | null;
|
|
1207
|
+
emoteAction: ReturnType<typeof createMockAction> | null;
|
|
1208
|
+
loadEmoteClipCached: ReturnType<typeof vi.fn>;
|
|
1209
|
+
};
|
|
1210
|
+
const nextEmoteAction = createMockAction();
|
|
1211
|
+
const idleAction = createMockAction();
|
|
1212
|
+
|
|
1213
|
+
engineAny.vrm = {
|
|
1214
|
+
scene: {
|
|
1215
|
+
parent: null,
|
|
1216
|
+
},
|
|
1217
|
+
};
|
|
1218
|
+
engineAny.mixer = hoisted.mockMixerInstance;
|
|
1219
|
+
engineAny.idleAction = idleAction;
|
|
1220
|
+
engineAny.emoteAction = null;
|
|
1221
|
+
engineAny.loadEmoteClipCached = vi
|
|
1222
|
+
.fn()
|
|
1223
|
+
.mockResolvedValue({ duration: 1.25 });
|
|
1224
|
+
hoisted.mockMixerInstance.clipAction.mockReturnValue(nextEmoteAction);
|
|
1225
|
+
|
|
1226
|
+
await engine.playEmote("/mock/emote.glb", 4, false);
|
|
1227
|
+
hoisted.emitMixerEvent("finished", {
|
|
1228
|
+
type: "finished",
|
|
1229
|
+
action: nextEmoteAction,
|
|
1230
|
+
direction: 1,
|
|
1231
|
+
});
|
|
1232
|
+
|
|
1233
|
+
expect(idleAction.play).toHaveBeenCalled();
|
|
1234
|
+
expect(idleAction.crossFadeFrom).toHaveBeenCalledWith(
|
|
1235
|
+
nextEmoteAction,
|
|
1236
|
+
0.4,
|
|
1237
|
+
false,
|
|
1238
|
+
);
|
|
1239
|
+
expect(engineAny.emoteAction).toBeNull();
|
|
1240
|
+
expect(
|
|
1241
|
+
hoisted.mockMixerInstance.removeEventListener,
|
|
1242
|
+
).toHaveBeenCalledWith("finished", expect.any(Function));
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
it("re-enables idle before blending back from an emote", () => {
|
|
1246
|
+
const engineAny = engine as unknown as {
|
|
1247
|
+
emoteAction: ReturnType<typeof createMockAction> | null;
|
|
1248
|
+
idleAction: ReturnType<typeof createMockAction> | null;
|
|
1249
|
+
};
|
|
1250
|
+
const fakeEmoteAction = createMockAction();
|
|
1251
|
+
const fakeIdleAction = createMockAction();
|
|
1252
|
+
fakeIdleAction.enabled = false;
|
|
1253
|
+
fakeIdleAction.paused = true;
|
|
1254
|
+
|
|
1255
|
+
engineAny.emoteAction = fakeEmoteAction;
|
|
1256
|
+
engineAny.idleAction = fakeIdleAction;
|
|
1257
|
+
|
|
1258
|
+
engine.stopEmote();
|
|
1259
|
+
|
|
1260
|
+
expect(fakeIdleAction.enabled).toBe(true);
|
|
1261
|
+
expect(fakeIdleAction.paused).toBe(false);
|
|
1262
|
+
expect(fakeIdleAction.setEffectiveTimeScale).toHaveBeenCalledWith(1);
|
|
1263
|
+
expect(fakeIdleAction.setEffectiveWeight).toHaveBeenCalledWith(1);
|
|
1264
|
+
expect(fakeIdleAction.crossFadeFrom).toHaveBeenCalledWith(
|
|
1265
|
+
fakeEmoteAction,
|
|
1266
|
+
0.4,
|
|
1267
|
+
false,
|
|
1268
|
+
);
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
it("uses the requested emote duration for one-shot fallback timing", async () => {
|
|
1272
|
+
const setTimeoutSpy = vi.spyOn(globalThis, "setTimeout");
|
|
1273
|
+
const engineAny = engine as unknown as {
|
|
1274
|
+
vrm: object | null;
|
|
1275
|
+
mixer: typeof hoisted.mockMixerInstance | null;
|
|
1276
|
+
idleAction: ReturnType<typeof createMockAction> | null;
|
|
1277
|
+
emoteAction: ReturnType<typeof createMockAction> | null;
|
|
1278
|
+
loadEmoteClipCached: ReturnType<typeof vi.fn>;
|
|
1279
|
+
};
|
|
1280
|
+
const nextEmoteAction = createMockAction();
|
|
1281
|
+
const idleAction = createMockAction();
|
|
1282
|
+
|
|
1283
|
+
try {
|
|
1284
|
+
engineAny.vrm = {
|
|
1285
|
+
scene: {
|
|
1286
|
+
parent: null,
|
|
1287
|
+
},
|
|
1288
|
+
};
|
|
1289
|
+
engineAny.mixer = hoisted.mockMixerInstance;
|
|
1290
|
+
engineAny.idleAction = idleAction;
|
|
1291
|
+
engineAny.emoteAction = null;
|
|
1292
|
+
engineAny.loadEmoteClipCached = vi
|
|
1293
|
+
.fn()
|
|
1294
|
+
.mockResolvedValue({ duration: 0.75 });
|
|
1295
|
+
hoisted.mockMixerInstance.clipAction.mockReturnValue(nextEmoteAction);
|
|
1296
|
+
|
|
1297
|
+
await engine.playEmote("/mock/emote.glb", 4, false);
|
|
1298
|
+
|
|
1299
|
+
expect(setTimeoutSpy).toHaveBeenLastCalledWith(
|
|
1300
|
+
expect.any(Function),
|
|
1301
|
+
4100,
|
|
1302
|
+
);
|
|
1303
|
+
} finally {
|
|
1304
|
+
engine.stopEmote();
|
|
1305
|
+
setTimeoutSpy.mockRestore();
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
|
|
1309
|
+
it("stopEmote clears pending emote timeout", () => {
|
|
1310
|
+
const engineAny = engine as unknown as {
|
|
1311
|
+
emoteTimeout: ReturnType<typeof setTimeout> | null;
|
|
1312
|
+
};
|
|
1313
|
+
engineAny.emoteTimeout = setTimeout(() => {}, 10_000);
|
|
1314
|
+
|
|
1315
|
+
engine.stopEmote();
|
|
1316
|
+
|
|
1317
|
+
expect(engineAny.emoteTimeout).toBeNull();
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
it("stopEmote restores idle lazily when the idle action is missing", () => {
|
|
1321
|
+
const fakeEmoteAction = createMockAction();
|
|
1322
|
+
const restoreIdleAfterEmote = vi.fn();
|
|
1323
|
+
const vrm = { scene: { parent: null } };
|
|
1324
|
+
const mixer = { clipAction: vi.fn() };
|
|
1325
|
+
const engineAny = engine as unknown as {
|
|
1326
|
+
emoteAction: ReturnType<typeof createMockAction> | null;
|
|
1327
|
+
idleAction: ReturnType<typeof createMockAction> | null;
|
|
1328
|
+
vrm: typeof vrm | null;
|
|
1329
|
+
mixer: typeof mixer | null;
|
|
1330
|
+
restoreIdleAfterEmote: ReturnType<typeof vi.fn>;
|
|
1331
|
+
};
|
|
1332
|
+
|
|
1333
|
+
engineAny.emoteAction = fakeEmoteAction;
|
|
1334
|
+
engineAny.idleAction = null;
|
|
1335
|
+
engineAny.vrm = vrm;
|
|
1336
|
+
engineAny.mixer = mixer;
|
|
1337
|
+
engineAny.restoreIdleAfterEmote = restoreIdleAfterEmote;
|
|
1338
|
+
|
|
1339
|
+
engine.stopEmote();
|
|
1340
|
+
|
|
1341
|
+
expect(restoreIdleAfterEmote).toHaveBeenCalledWith(
|
|
1342
|
+
fakeEmoteAction,
|
|
1343
|
+
0.4,
|
|
1344
|
+
vrm,
|
|
1345
|
+
mixer,
|
|
1346
|
+
);
|
|
1347
|
+
expect(engineAny.emoteAction).toBeNull();
|
|
1348
|
+
});
|
|
1349
|
+
|
|
1350
|
+
it("emote clip cache starts empty and is cleared on dispose", () => {
|
|
1351
|
+
const engineAny = engine as unknown as {
|
|
1352
|
+
emoteClipCache: Map<string, unknown>;
|
|
1353
|
+
};
|
|
1354
|
+
expect(engineAny.emoteClipCache.size).toBe(0);
|
|
1355
|
+
|
|
1356
|
+
engineAny.emoteClipCache.set("test.glb", {});
|
|
1357
|
+
expect(engineAny.emoteClipCache.size).toBe(1);
|
|
1358
|
+
|
|
1359
|
+
engine.dispose();
|
|
1360
|
+
expect(engineAny.emoteClipCache.size).toBe(0);
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1363
|
+
it("emoteRequestId is not incremented when no VRM is loaded", async () => {
|
|
1364
|
+
const engineAny = engine as unknown as {
|
|
1365
|
+
emoteRequestId: number;
|
|
1366
|
+
};
|
|
1367
|
+
const initial = engineAny.emoteRequestId;
|
|
1368
|
+
|
|
1369
|
+
// playEmote bails early (no VRM loaded) before incrementing the id
|
|
1370
|
+
await engine.playEmote("/mock/emote.glb", 2, false);
|
|
1371
|
+
expect(engineAny.emoteRequestId).toBe(initial);
|
|
1372
|
+
});
|
|
1373
|
+
});
|
|
1374
|
+
|
|
1375
|
+
// ── 6. loadVrmFromUrl guards ─────────────────────────────────────
|
|
1376
|
+
describe("loadVrmFromUrl guards", () => {
|
|
1377
|
+
it("throws when engine is not initialized", async () => {
|
|
1378
|
+
await expect(
|
|
1379
|
+
engine.loadVrmFromUrl("http://example.com/model.vrm"),
|
|
1380
|
+
).rejects.toThrow("VrmEngine not initialized");
|
|
1381
|
+
});
|
|
1382
|
+
|
|
1383
|
+
it("registers WebGPU-compatible VRM material loading when WebGPU is active", async () => {
|
|
1384
|
+
hoisted.navigatorMock.gpu = {};
|
|
1385
|
+
(
|
|
1386
|
+
window.localStorage.getItem as ReturnType<typeof vi.fn>
|
|
1387
|
+
).mockReturnValueOnce("webgpu");
|
|
1388
|
+
hoisted.mockLoaderLoadAsync.mockRejectedValueOnce(
|
|
1389
|
+
new Error("stop-after-register"),
|
|
1390
|
+
);
|
|
1391
|
+
const canvas = createMockCanvas();
|
|
1392
|
+
engine.setup(canvas, vi.fn());
|
|
1393
|
+
await waitForEngineReady(engine);
|
|
1394
|
+
|
|
1395
|
+
await expect(
|
|
1396
|
+
engine.loadVrmFromUrl("http://example.com/model.vrm"),
|
|
1397
|
+
).rejects.toThrow("stop-after-register");
|
|
1398
|
+
|
|
1399
|
+
expect(hoisted.mockMToonMaterialLoaderPlugin).toHaveBeenCalledTimes(1);
|
|
1400
|
+
expect(hoisted.mockLoaderSetMeshoptDecoder).toHaveBeenCalledWith(
|
|
1401
|
+
expect.objectContaining({ supported: true }),
|
|
1402
|
+
);
|
|
1403
|
+
expect(hoisted.mockLoaderSetDRACOLoader).toHaveBeenCalledTimes(1);
|
|
1404
|
+
expect(hoisted.mockDracoLoaderSetDecoderConfig).toHaveBeenCalledWith({
|
|
1405
|
+
type: "wasm",
|
|
1406
|
+
});
|
|
1407
|
+
expect(hoisted.mockDracoLoaderSetDecoderPath).toHaveBeenCalledWith(
|
|
1408
|
+
expect.stringContaining("vrm-decoders/draco/"),
|
|
1409
|
+
);
|
|
1410
|
+
expect(hoisted.mockDracoLoaderPreload).toHaveBeenCalledTimes(1);
|
|
1411
|
+
expect(hoisted.mockMToonMaterialLoaderPlugin).toHaveBeenCalledWith(
|
|
1412
|
+
hoisted.mockLoaderParser,
|
|
1413
|
+
expect.objectContaining({
|
|
1414
|
+
materialType: expect.any(Function),
|
|
1415
|
+
}),
|
|
1416
|
+
);
|
|
1417
|
+
expect(hoisted.mockVRMLoaderPlugin).toHaveBeenCalledWith(
|
|
1418
|
+
hoisted.mockLoaderParser,
|
|
1419
|
+
expect.any(Object),
|
|
1420
|
+
);
|
|
1421
|
+
});
|
|
1422
|
+
|
|
1423
|
+
it("captures load errors in engine state", async () => {
|
|
1424
|
+
hoisted.mockLoaderLoadAsync.mockRejectedValueOnce(
|
|
1425
|
+
new Error("meshopt decode failed"),
|
|
1426
|
+
);
|
|
1427
|
+
const canvas = createMockCanvas();
|
|
1428
|
+
engine.setup(canvas, vi.fn());
|
|
1429
|
+
await waitForEngineReady(engine);
|
|
1430
|
+
|
|
1431
|
+
await expect(
|
|
1432
|
+
engine.loadVrmFromUrl("http://example.com/model.vrm"),
|
|
1433
|
+
).rejects.toThrow("meshopt decode failed");
|
|
1434
|
+
|
|
1435
|
+
expect(engine.getState().loadError).toBe("meshopt decode failed");
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1438
|
+
it("fetches gzipped assets and parses the decompressed buffer", async () => {
|
|
1439
|
+
const parseResult = { userData: { vrm: undefined } };
|
|
1440
|
+
hoisted.mockLoaderLoadAsync.mockResolvedValueOnce(parseResult);
|
|
1441
|
+
const compressed = new Uint8Array([0x1f, 0x8b, 0x08, 0x00]).buffer;
|
|
1442
|
+
hoisted.responseArrayBufferMock.mockResolvedValueOnce(compressed);
|
|
1443
|
+
|
|
1444
|
+
class MockDecompressionStream {
|
|
1445
|
+
readable = new ReadableStream<Uint8Array>();
|
|
1446
|
+
writable = new WritableStream<Uint8Array>();
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
const originalDecompressionStream = globalThis.DecompressionStream;
|
|
1450
|
+
Object.assign(globalThis, {
|
|
1451
|
+
DecompressionStream:
|
|
1452
|
+
MockDecompressionStream as unknown as typeof DecompressionStream,
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
const pipeThroughSpy = vi
|
|
1456
|
+
.spyOn(Blob.prototype, "stream")
|
|
1457
|
+
.mockReturnValue({
|
|
1458
|
+
pipeThrough: vi.fn(() => new ReadableStream<Uint8Array>()),
|
|
1459
|
+
} as unknown as ReturnType<Blob["stream"]>);
|
|
1460
|
+
const responseArrayBuffer = vi
|
|
1461
|
+
.spyOn(Response.prototype, "arrayBuffer")
|
|
1462
|
+
.mockResolvedValueOnce(new ArrayBuffer(16));
|
|
1463
|
+
|
|
1464
|
+
const canvas = createMockCanvas();
|
|
1465
|
+
engine.setup(canvas, vi.fn());
|
|
1466
|
+
await waitForEngineReady(engine);
|
|
1467
|
+
|
|
1468
|
+
await expect(
|
|
1469
|
+
engine.loadVrmFromUrl("http://example.com/model.vrm.gz"),
|
|
1470
|
+
).rejects.toThrow("Loaded asset is not a VRM");
|
|
1471
|
+
|
|
1472
|
+
expect(hoisted.fetchMock).toHaveBeenCalledWith(
|
|
1473
|
+
"http://example.com/model.vrm.gz",
|
|
1474
|
+
);
|
|
1475
|
+
expect(pipeThroughSpy).toHaveBeenCalledTimes(1);
|
|
1476
|
+
expect(responseArrayBuffer).toHaveBeenCalledTimes(1);
|
|
1477
|
+
expect(hoisted.mockLoaderLoadAsync).toHaveBeenCalledWith(
|
|
1478
|
+
expect.stringMatching(/^blob:/),
|
|
1479
|
+
);
|
|
1480
|
+
|
|
1481
|
+
responseArrayBuffer.mockRestore();
|
|
1482
|
+
pipeThroughSpy.mockRestore();
|
|
1483
|
+
Object.assign(globalThis, {
|
|
1484
|
+
DecompressionStream: originalDecompressionStream,
|
|
1485
|
+
});
|
|
1486
|
+
});
|
|
1487
|
+
});
|
|
1488
|
+
|
|
1489
|
+
describe("camera framing transitions", () => {
|
|
1490
|
+
it("keeps the initial avatar load camera framing immediate", async () => {
|
|
1491
|
+
const canvas = createMockCanvas();
|
|
1492
|
+
engine.setup(canvas, vi.fn());
|
|
1493
|
+
await waitForEngineReady(engine);
|
|
1494
|
+
|
|
1495
|
+
const engineAny = engine as unknown as {
|
|
1496
|
+
cameraManager: {
|
|
1497
|
+
centerAndFrame: ReturnType<typeof vi.fn>;
|
|
1498
|
+
ensureFacingCamera: ReturnType<typeof vi.fn>;
|
|
1499
|
+
};
|
|
1500
|
+
configureAvatarLookTracking: ReturnType<typeof vi.fn>;
|
|
1501
|
+
loadAndPlayIdle: ReturnType<typeof vi.fn>;
|
|
1502
|
+
playTeleportReveal: ReturnType<typeof vi.fn>;
|
|
1503
|
+
startPendingWorldReveal: ReturnType<typeof vi.fn>;
|
|
1504
|
+
isCameraTransitioning: boolean;
|
|
1505
|
+
transitionDuration: number;
|
|
1506
|
+
};
|
|
1507
|
+
const vrm = createMockLoadedVrm();
|
|
1508
|
+
|
|
1509
|
+
engineAny.cameraManager.centerAndFrame = vi.fn((_vrm, camera) => {
|
|
1510
|
+
camera.fov = 31;
|
|
1511
|
+
});
|
|
1512
|
+
engineAny.cameraManager.ensureFacingCamera = vi.fn();
|
|
1513
|
+
engineAny.configureAvatarLookTracking = vi.fn();
|
|
1514
|
+
engineAny.loadAndPlayIdle = vi.fn().mockResolvedValue(undefined);
|
|
1515
|
+
engineAny.playTeleportReveal = vi.fn().mockResolvedValue(undefined);
|
|
1516
|
+
engineAny.startPendingWorldReveal = vi.fn();
|
|
1517
|
+
hoisted.mockLoaderLoadAsync.mockResolvedValueOnce({ userData: { vrm } });
|
|
1518
|
+
|
|
1519
|
+
await engine.loadVrmFromUrl("http://example.com/model.vrm");
|
|
1520
|
+
|
|
1521
|
+
expect(engineAny.cameraManager.centerAndFrame).toHaveBeenCalledTimes(1);
|
|
1522
|
+
expect(engineAny.isCameraTransitioning).toBe(false);
|
|
1523
|
+
expect(engineAny.transitionDuration).toBe(0.8);
|
|
1524
|
+
});
|
|
1525
|
+
|
|
1526
|
+
it("smoothly transitions the camera when switching avatars", async () => {
|
|
1527
|
+
const canvas = createMockCanvas();
|
|
1528
|
+
engine.setup(canvas, vi.fn());
|
|
1529
|
+
await waitForEngineReady(engine);
|
|
1530
|
+
|
|
1531
|
+
const engineAny = engine as unknown as {
|
|
1532
|
+
vrm: {
|
|
1533
|
+
scene: {
|
|
1534
|
+
parent: { remove: ReturnType<typeof vi.fn> } | null;
|
|
1535
|
+
};
|
|
1536
|
+
} | null;
|
|
1537
|
+
cameraManager: {
|
|
1538
|
+
centerAndFrame: ReturnType<typeof vi.fn>;
|
|
1539
|
+
ensureFacingCamera: ReturnType<typeof vi.fn>;
|
|
1540
|
+
};
|
|
1541
|
+
configureAvatarLookTracking: ReturnType<typeof vi.fn>;
|
|
1542
|
+
loadAndPlayIdle: ReturnType<typeof vi.fn>;
|
|
1543
|
+
playTeleportReveal: ReturnType<typeof vi.fn>;
|
|
1544
|
+
startPendingWorldReveal: ReturnType<typeof vi.fn>;
|
|
1545
|
+
isCameraTransitioning: boolean;
|
|
1546
|
+
transitionDuration: number;
|
|
1547
|
+
};
|
|
1548
|
+
const previousParent = { remove: vi.fn() };
|
|
1549
|
+
const vrm = createMockLoadedVrm();
|
|
1550
|
+
|
|
1551
|
+
engineAny.vrm = {
|
|
1552
|
+
scene: {
|
|
1553
|
+
parent: previousParent,
|
|
1554
|
+
},
|
|
1555
|
+
};
|
|
1556
|
+
engineAny.cameraManager.centerAndFrame = vi.fn((_vrm, camera) => {
|
|
1557
|
+
camera.fov = 36;
|
|
1558
|
+
});
|
|
1559
|
+
engineAny.cameraManager.ensureFacingCamera = vi.fn();
|
|
1560
|
+
engineAny.configureAvatarLookTracking = vi.fn();
|
|
1561
|
+
engineAny.loadAndPlayIdle = vi.fn().mockResolvedValue(undefined);
|
|
1562
|
+
engineAny.playTeleportReveal = vi.fn().mockResolvedValue(undefined);
|
|
1563
|
+
engineAny.startPendingWorldReveal = vi.fn();
|
|
1564
|
+
hoisted.mockLoaderLoadAsync.mockResolvedValueOnce({ userData: { vrm } });
|
|
1565
|
+
|
|
1566
|
+
await engine.loadVrmFromUrl("http://example.com/model.vrm");
|
|
1567
|
+
|
|
1568
|
+
expect(previousParent.remove).toHaveBeenCalledTimes(1);
|
|
1569
|
+
expect(engineAny.cameraManager.centerAndFrame).toHaveBeenCalledTimes(1);
|
|
1570
|
+
expect(engineAny.isCameraTransitioning).toBe(true);
|
|
1571
|
+
expect(engineAny.transitionDuration).toBe(3);
|
|
1572
|
+
});
|
|
1573
|
+
});
|
|
1574
|
+
});
|