@elizaos/app-core 2.0.0-alpha.52 → 2.0.0-alpha.53

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.
Files changed (1108) hide show
  1. package/{dist/actions → actions}/character.d.ts +2 -2
  2. package/{dist/actions → actions}/character.d.ts.map +1 -1
  3. package/{dist/actions → actions}/cloud.d.ts +2 -2
  4. package/{dist/actions → actions}/cloud.d.ts.map +1 -1
  5. package/{dist/actions → actions}/lifecycle.d.ts +3 -3
  6. package/{dist/actions → actions}/lifecycle.d.ts.map +1 -1
  7. package/{dist/actions → actions}/lifecycle.js +1 -1
  8. package/{dist/actions → actions}/triggers.d.ts +2 -2
  9. package/{dist/actions → actions}/triggers.d.ts.map +1 -1
  10. package/{dist/api → api}/client.d.ts +5 -5
  11. package/{dist/api → api}/client.d.ts.map +1 -1
  12. package/{dist/api → api}/client.js +20 -20
  13. package/{dist/bridge → bridge}/capacitor-bridge.d.ts +10 -10
  14. package/{dist/bridge → bridge}/capacitor-bridge.d.ts.map +1 -1
  15. package/{dist/bridge → bridge}/capacitor-bridge.js +7 -7
  16. package/{dist/bridge → bridge}/electrobun-rpc.js +1 -1
  17. package/{dist/bridge → bridge}/plugin-bridge.d.ts +4 -4
  18. package/{dist/bridge → bridge}/plugin-bridge.d.ts.map +1 -1
  19. package/{dist/bridge → bridge}/plugin-bridge.js +1 -1
  20. package/{dist/bridge → bridge}/storage-bridge.js +3 -3
  21. package/{dist/chat → chat}/index.d.ts +1 -1
  22. package/{dist/chat → chat}/index.d.ts.map +1 -1
  23. package/{dist/chat → chat}/index.js +1 -1
  24. package/{dist/components → components}/BugReportModal.js +1 -1
  25. package/{dist/components → components}/CommandPalette.js +1 -1
  26. package/{dist/components → components}/CompanionSceneHost.js +1 -1
  27. package/{dist/components → components}/ElizaCloudDashboard.js +2 -2
  28. package/{dist/components → components}/EmotePicker.js +2 -2
  29. package/{dist/components → components}/GlobalEmoteOverlay.js +4 -4
  30. package/{dist/components → components}/PairingView.js +1 -1
  31. package/{dist/components → components}/ProviderSwitcher.js +16 -16
  32. package/{dist/components → components}/SecretsView.js +1 -1
  33. package/{dist/components → components}/StartupFailureView.js +1 -1
  34. package/{dist/components → components}/StreamView.js +4 -4
  35. package/{dist/components → components}/StripeEmbeddedCheckout.js +2 -2
  36. package/{dist/components → components}/SubscriptionStatus.js +1 -1
  37. package/{dist/components → components}/VoiceConfigView.js +1 -1
  38. package/{dist/components → components}/avatar/VrmEngine.js +1 -1
  39. package/{dist/components → components}/avatar/VrmViewer.d.ts +1 -1
  40. package/{dist/components → components}/avatar/VrmViewer.d.ts.map +1 -1
  41. package/{dist/components → components}/avatar/VrmViewer.js +3 -3
  42. package/{dist/components → components}/companion/walletUtils.d.ts +1 -1
  43. package/{dist/components → components}/companion/walletUtils.d.ts.map +1 -1
  44. package/{dist/components → components}/companion/walletUtils.js +1 -1
  45. package/{dist/components → components}/format.d.ts +1 -1
  46. package/{dist/components → components}/format.js +1 -1
  47. package/{dist/components → components}/permissions/StreamingPermissions.js +1 -1
  48. package/{dist/components → components}/stream/StatusBar.js +2 -2
  49. package/{dist/components → components}/stream/overlays/useOverlayLayout.d.ts +1 -1
  50. package/{dist/components → components}/stream/overlays/useOverlayLayout.js +2 -2
  51. package/events/index.d.ts +42 -0
  52. package/events/index.d.ts.map +1 -0
  53. package/{dist/events → events}/index.js +16 -16
  54. package/{dist/hooks → hooks}/useRetakeCapture.js +1 -1
  55. package/{src/i18n → i18n}/locales/en.json +9 -9
  56. package/{src/i18n → i18n}/locales/es.json +10 -10
  57. package/{src/i18n → i18n}/locales/ko.json +9 -9
  58. package/{src/i18n → i18n}/locales/pt.json +9 -9
  59. package/{src/i18n → i18n}/locales/zh-CN.json +10 -10
  60. package/{dist/navigation → navigation}/index.js +1 -1
  61. package/package.json +142 -52
  62. package/{dist/platform → platform}/browser-launch.js +1 -1
  63. package/{dist/platform → platform}/init.d.ts +1 -1
  64. package/{dist/platform → platform}/init.d.ts.map +1 -1
  65. package/{dist/platform → platform}/init.js +5 -5
  66. package/{dist/platform → platform}/lifo.d.ts +1 -1
  67. package/{dist/platform → platform}/lifo.d.ts.map +1 -1
  68. package/{dist/platform → platform}/lifo.js +1 -1
  69. package/{dist/state → state}/AppContext.js +14 -14
  70. package/{dist/state → state}/onboarding-resume.js +1 -1
  71. package/{dist/state → state}/persistence.js +11 -11
  72. package/{dist/state → state}/vrm.d.ts +1 -1
  73. package/{dist/state → state}/vrm.d.ts.map +1 -1
  74. package/{dist/state → state}/vrm.js +6 -6
  75. package/{dist/utils → utils}/asset-url.d.ts +1 -1
  76. package/{dist/utils → utils}/asset-url.js +2 -2
  77. package/.turbo/turbo-build.log +0 -12
  78. package/LICENSE +0 -21
  79. package/dist/events/index.d.ts +0 -42
  80. package/dist/events/index.d.ts.map +0 -1
  81. package/dist/i18n/locales/en.json +0 -1195
  82. package/dist/i18n/locales/es.json +0 -1195
  83. package/dist/i18n/locales/ko.json +0 -1195
  84. package/dist/i18n/locales/pt.json +0 -1195
  85. package/dist/i18n/locales/zh-CN.json +0 -1195
  86. package/src/App.tsx +0 -498
  87. package/src/actions/character.test.ts +0 -139
  88. package/src/actions/character.ts +0 -152
  89. package/src/actions/chat-helpers.ts +0 -100
  90. package/src/actions/cloud.ts +0 -59
  91. package/src/actions/index.ts +0 -12
  92. package/src/actions/lifecycle.ts +0 -175
  93. package/src/actions/onboarding.ts +0 -42
  94. package/src/actions/triggers.ts +0 -190
  95. package/src/ambient.d.ts +0 -16
  96. package/src/api/client.ts +0 -5339
  97. package/src/api/index.ts +0 -1
  98. package/src/autonomy/index.ts +0 -477
  99. package/src/bridge/capacitor-bridge.ts +0 -295
  100. package/src/bridge/electrobun-rpc.ts +0 -58
  101. package/src/bridge/electrobun-runtime.ts +0 -28
  102. package/src/bridge/index.ts +0 -5
  103. package/src/bridge/native-plugins.ts +0 -134
  104. package/src/bridge/plugin-bridge.ts +0 -352
  105. package/src/bridge/storage-bridge.ts +0 -162
  106. package/src/chat/index.ts +0 -250
  107. package/src/coding/index.ts +0 -43
  108. package/src/components/AdvancedPageView.tsx +0 -362
  109. package/src/components/AgentActivityBox.tsx +0 -49
  110. package/src/components/ApiKeyConfig.tsx +0 -224
  111. package/src/components/AppsPageView.tsx +0 -52
  112. package/src/components/AppsView.tsx +0 -293
  113. package/src/components/AvatarLoader.tsx +0 -92
  114. package/src/components/AvatarSelector.tsx +0 -223
  115. package/src/components/BscTradePanel.tsx +0 -549
  116. package/src/components/BugReportModal.tsx +0 -499
  117. package/src/components/CharacterView.tsx +0 -1814
  118. package/src/components/ChatAvatar.test.ts +0 -97
  119. package/src/components/ChatAvatar.tsx +0 -147
  120. package/src/components/ChatComposer.tsx +0 -330
  121. package/src/components/ChatMessage.tsx +0 -448
  122. package/src/components/ChatModalView.test.tsx +0 -118
  123. package/src/components/ChatModalView.tsx +0 -125
  124. package/src/components/ChatView.tsx +0 -992
  125. package/src/components/CloudSourceControls.tsx +0 -80
  126. package/src/components/CodingAgentSettingsSection.tsx +0 -538
  127. package/src/components/CommandPalette.tsx +0 -284
  128. package/src/components/CompanionSceneHost.tsx +0 -497
  129. package/src/components/CompanionShell.tsx +0 -31
  130. package/src/components/CompanionView.tsx +0 -109
  131. package/src/components/ConfigPageView.tsx +0 -762
  132. package/src/components/ConfigSaveFooter.tsx +0 -41
  133. package/src/components/ConfirmModal.tsx +0 -379
  134. package/src/components/ConnectionFailedBanner.tsx +0 -91
  135. package/src/components/ConnectorsPageView.tsx +0 -13
  136. package/src/components/ConversationsSidebar.tsx +0 -279
  137. package/src/components/CustomActionEditor.tsx +0 -1127
  138. package/src/components/CustomActionsPanel.tsx +0 -288
  139. package/src/components/CustomActionsView.tsx +0 -322
  140. package/src/components/DatabasePageView.tsx +0 -55
  141. package/src/components/DatabaseView.tsx +0 -814
  142. package/src/components/ElizaCloudDashboard.tsx +0 -1696
  143. package/src/components/EmotePicker.tsx +0 -529
  144. package/src/components/ErrorBoundary.tsx +0 -76
  145. package/src/components/FineTuningView.tsx +0 -1080
  146. package/src/components/GameView.tsx +0 -551
  147. package/src/components/GameViewOverlay.tsx +0 -133
  148. package/src/components/GlobalEmoteOverlay.tsx +0 -152
  149. package/src/components/Header.test.tsx +0 -413
  150. package/src/components/Header.tsx +0 -403
  151. package/src/components/HeartbeatsView.tsx +0 -1003
  152. package/src/components/InventoryView.tsx +0 -388
  153. package/src/components/KnowledgeView.tsx +0 -1128
  154. package/src/components/LanguageDropdown.tsx +0 -188
  155. package/src/components/LifoMonitorPanel.tsx +0 -196
  156. package/src/components/LifoSandboxView.tsx +0 -499
  157. package/src/components/LoadingScreen.tsx +0 -112
  158. package/src/components/LogsPageView.tsx +0 -17
  159. package/src/components/LogsView.tsx +0 -239
  160. package/src/components/MediaGalleryView.tsx +0 -433
  161. package/src/components/MediaSettingsSection.tsx +0 -893
  162. package/src/components/MessageContent.tsx +0 -815
  163. package/src/components/OnboardingWizard.test.tsx +0 -104
  164. package/src/components/OnboardingWizard.tsx +0 -206
  165. package/src/components/PairingView.tsx +0 -110
  166. package/src/components/PermissionsSection.tsx +0 -1186
  167. package/src/components/PluginsPageView.tsx +0 -9
  168. package/src/components/PluginsView.tsx +0 -3165
  169. package/src/components/ProviderSwitcher.tsx +0 -905
  170. package/src/components/RestartBanner.tsx +0 -76
  171. package/src/components/RuntimeView.tsx +0 -460
  172. package/src/components/SaveCommandModal.tsx +0 -211
  173. package/src/components/SecretsView.tsx +0 -569
  174. package/src/components/SettingsView.tsx +0 -825
  175. package/src/components/ShellOverlays.tsx +0 -41
  176. package/src/components/ShortcutsOverlay.tsx +0 -155
  177. package/src/components/SkillsView.tsx +0 -1435
  178. package/src/components/StartupFailureView.tsx +0 -63
  179. package/src/components/StreamView.tsx +0 -483
  180. package/src/components/StripeEmbeddedCheckout.tsx +0 -155
  181. package/src/components/SubscriptionStatus.tsx +0 -640
  182. package/src/components/SystemWarningBanner.tsx +0 -71
  183. package/src/components/ThemeToggle.tsx +0 -100
  184. package/src/components/TrajectoriesView.tsx +0 -526
  185. package/src/components/TrajectoryDetailView.tsx +0 -426
  186. package/src/components/TriggersView.tsx +0 -1
  187. package/src/components/VectorBrowserView.tsx +0 -1633
  188. package/src/components/VoiceConfigView.tsx +0 -674
  189. package/src/components/VrmStage.test.ts +0 -219
  190. package/src/components/VrmStage.tsx +0 -432
  191. package/src/components/WhatsAppQrOverlay.tsx +0 -230
  192. package/src/components/__tests__/chainConfig.test.ts +0 -220
  193. package/src/components/apps/AppDetailPane.tsx +0 -242
  194. package/src/components/apps/AppsCatalogGrid.tsx +0 -137
  195. package/src/components/apps/extensions/registry.ts +0 -13
  196. package/src/components/apps/extensions/types.ts +0 -9
  197. package/src/components/apps/helpers.ts +0 -43
  198. package/src/components/avatar/VrmAnimationLoader.test.ts +0 -164
  199. package/src/components/avatar/VrmAnimationLoader.ts +0 -151
  200. package/src/components/avatar/VrmBlinkController.ts +0 -118
  201. package/src/components/avatar/VrmCameraManager.ts +0 -407
  202. package/src/components/avatar/VrmEngine.ts +0 -2696
  203. package/src/components/avatar/VrmFootShadow.ts +0 -96
  204. package/src/components/avatar/VrmViewer.tsx +0 -421
  205. package/src/components/avatar/__tests__/VrmCameraManager.test.ts +0 -168
  206. package/src/components/avatar/__tests__/VrmEngine.test.ts +0 -1574
  207. package/src/components/avatar/mixamoVRMRigMap.ts +0 -62
  208. package/src/components/avatar/retargetMixamoFbxToVrm.ts +0 -144
  209. package/src/components/avatar/retargetMixamoGltfToVrm.ts +0 -119
  210. package/src/components/chainConfig.ts +0 -380
  211. package/src/components/companion/CompanionHeader.tsx +0 -47
  212. package/src/components/companion/CompanionSceneHost.tsx +0 -5
  213. package/src/components/companion/VrmStage.tsx +0 -2
  214. package/src/components/companion/__tests__/walletUtils.test.ts +0 -742
  215. package/src/components/companion/walletUtils.ts +0 -290
  216. package/src/components/companion-shell-styles.test.ts +0 -142
  217. package/src/components/companion-shell-styles.ts +0 -270
  218. package/src/components/confirm-delete-control.tsx +0 -69
  219. package/src/components/conversations/ConversationListItem.tsx +0 -185
  220. package/src/components/conversations/conversation-utils.ts +0 -151
  221. package/src/components/format.ts +0 -131
  222. package/src/components/index.ts +0 -94
  223. package/src/components/inventory/CopyableAddress.tsx +0 -41
  224. package/src/components/inventory/InventoryToolbar.tsx +0 -142
  225. package/src/components/inventory/NftGrid.tsx +0 -99
  226. package/src/components/inventory/TokenLogo.tsx +0 -71
  227. package/src/components/inventory/TokensTable.tsx +0 -216
  228. package/src/components/inventory/constants.ts +0 -170
  229. package/src/components/inventory/index.ts +0 -29
  230. package/src/components/inventory/media-url.test.ts +0 -38
  231. package/src/components/inventory/media-url.ts +0 -36
  232. package/src/components/inventory/useInventoryData.ts +0 -460
  233. package/src/components/knowledge-upload-image.ts +0 -215
  234. package/src/components/labels.ts +0 -46
  235. package/src/components/onboarding/ActivateStep.tsx +0 -30
  236. package/src/components/onboarding/ConnectionStep.tsx +0 -1530
  237. package/src/components/onboarding/IdentityStep.tsx +0 -272
  238. package/src/components/onboarding/OnboardingPanel.tsx +0 -39
  239. package/src/components/onboarding/OnboardingStepNav.tsx +0 -31
  240. package/src/components/onboarding/PermissionsStep.tsx +0 -20
  241. package/src/components/onboarding/RpcStep.tsx +0 -402
  242. package/src/components/permissions/PermissionIcon.tsx +0 -25
  243. package/src/components/permissions/StreamingPermissions.tsx +0 -413
  244. package/src/components/plugins/showcase-data.ts +0 -481
  245. package/src/components/shared/ShellHeaderControls.tsx +0 -193
  246. package/src/components/shared-companion-scene-context.ts +0 -15
  247. package/src/components/skeletons.tsx +0 -88
  248. package/src/components/stream/ActivityFeed.tsx +0 -113
  249. package/src/components/stream/AvatarPip.tsx +0 -10
  250. package/src/components/stream/ChatContent.tsx +0 -126
  251. package/src/components/stream/ChatTicker.tsx +0 -55
  252. package/src/components/stream/IdleContent.tsx +0 -73
  253. package/src/components/stream/StatusBar.tsx +0 -469
  254. package/src/components/stream/StreamSettings.tsx +0 -506
  255. package/src/components/stream/StreamTerminal.tsx +0 -94
  256. package/src/components/stream/StreamVoiceConfig.tsx +0 -160
  257. package/src/components/stream/helpers.ts +0 -134
  258. package/src/components/stream/overlays/OverlayLayer.tsx +0 -75
  259. package/src/components/stream/overlays/built-in/ActionTickerWidget.tsx +0 -64
  260. package/src/components/stream/overlays/built-in/AlertPopupWidget.tsx +0 -87
  261. package/src/components/stream/overlays/built-in/BrandingWidget.tsx +0 -51
  262. package/src/components/stream/overlays/built-in/CustomHtmlWidget.tsx +0 -105
  263. package/src/components/stream/overlays/built-in/PeonGlassWidget.tsx +0 -265
  264. package/src/components/stream/overlays/built-in/PeonHudWidget.tsx +0 -247
  265. package/src/components/stream/overlays/built-in/PeonSakuraWidget.tsx +0 -278
  266. package/src/components/stream/overlays/built-in/ThoughtBubbleWidget.tsx +0 -77
  267. package/src/components/stream/overlays/built-in/ViewerCountWidget.tsx +0 -46
  268. package/src/components/stream/overlays/built-in/index.ts +0 -13
  269. package/src/components/stream/overlays/registry.ts +0 -22
  270. package/src/components/stream/overlays/types.ts +0 -90
  271. package/src/components/stream/overlays/useOverlayLayout.ts +0 -218
  272. package/src/components/trajectory-format.ts +0 -50
  273. package/src/components/ui-badges.tsx +0 -109
  274. package/src/components/ui-switch.tsx +0 -57
  275. package/src/components/vector-browser-three.ts +0 -27
  276. package/src/config/config-catalog.ts +0 -1092
  277. package/src/config/config-field.tsx +0 -1924
  278. package/src/config/config-renderer.tsx +0 -734
  279. package/src/config/index.ts +0 -11
  280. package/src/config/ui-renderer.tsx +0 -1751
  281. package/src/config/ui-spec.ts +0 -256
  282. package/src/events/index.ts +0 -89
  283. package/src/hooks/index.ts +0 -13
  284. package/src/hooks/useBugReport.tsx +0 -43
  285. package/src/hooks/useCanvasWindow.ts +0 -372
  286. package/src/hooks/useChatAvatarVoice.ts +0 -111
  287. package/src/hooks/useContextMenu.ts +0 -127
  288. package/src/hooks/useKeyboardShortcuts.ts +0 -86
  289. package/src/hooks/useLifoSync.ts +0 -143
  290. package/src/hooks/useMemoryMonitor.ts +0 -334
  291. package/src/hooks/useRenderGuard.ts +0 -43
  292. package/src/hooks/useRetakeCapture.ts +0 -67
  293. package/src/hooks/useStreamPopoutNavigation.ts +0 -27
  294. package/src/hooks/useTimeout.ts +0 -37
  295. package/src/hooks/useVoiceChat.ts +0 -1440
  296. package/src/hooks/useWhatsAppPairing.ts +0 -123
  297. package/src/i18n/index.ts +0 -76
  298. package/src/i18n/messages.ts +0 -21
  299. package/src/index.ts +0 -6
  300. package/src/navigation/index.ts +0 -282
  301. package/src/navigation.test.ts +0 -189
  302. package/src/onboarding-config.test.ts +0 -104
  303. package/src/onboarding-config.ts +0 -114
  304. package/src/platform/browser-launch.test.ts +0 -94
  305. package/src/platform/browser-launch.ts +0 -149
  306. package/src/platform/index.ts +0 -58
  307. package/src/platform/init.ts +0 -236
  308. package/src/platform/lifo.ts +0 -225
  309. package/src/providers/index.ts +0 -99
  310. package/src/state/AppContext.tsx +0 -5869
  311. package/src/state/index.ts +0 -6
  312. package/src/state/internal.ts +0 -86
  313. package/src/state/onboarding-resume.test.ts +0 -135
  314. package/src/state/onboarding-resume.ts +0 -263
  315. package/src/state/parsers.test.ts +0 -124
  316. package/src/state/parsers.ts +0 -309
  317. package/src/state/persistence.ts +0 -320
  318. package/src/state/shell-routing.ts +0 -32
  319. package/src/state/types.ts +0 -696
  320. package/src/state/ui-preferences.ts +0 -3
  321. package/src/state/useApp.ts +0 -23
  322. package/src/state/vrm.ts +0 -76
  323. package/src/stories/AppMockProvider.tsx +0 -32
  324. package/src/stories/ChatEmptyState.stories.tsx +0 -27
  325. package/src/stories/ChatMessage.stories.tsx +0 -115
  326. package/src/stories/CompanionHeader.stories.tsx +0 -74
  327. package/src/stories/CompanionView.stories.tsx +0 -33
  328. package/src/stories/ConversationListItem.stories.tsx +0 -102
  329. package/src/stories/TypingIndicator.stories.tsx +0 -28
  330. package/src/types/index.ts +0 -715
  331. package/src/types/react-test-renderer.d.ts +0 -45
  332. package/src/utils/asset-url.ts +0 -110
  333. package/src/utils/assistant-text.ts +0 -172
  334. package/src/utils/clipboard.ts +0 -41
  335. package/src/utils/desktop-dialogs.ts +0 -80
  336. package/src/utils/index.ts +0 -6
  337. package/src/utils/number-parsing.ts +0 -125
  338. package/src/utils/openExternalUrl.ts +0 -20
  339. package/src/utils/spoken-text.ts +0 -65
  340. package/src/utils/streaming-text.ts +0 -120
  341. package/src/voice/index.ts +0 -1
  342. package/src/voice/types.ts +0 -197
  343. package/src/wallet-rpc.ts +0 -176
  344. package/test/app/AppContext.pty-sessions.test.tsx +0 -143
  345. package/test/app/MessageContent.test.tsx +0 -366
  346. package/test/app/PermissionsOnboarding.test.tsx +0 -356
  347. package/test/app/PermissionsSection.test.tsx +0 -573
  348. package/test/app/advanced-trajectory-fine-tuning.e2e.test.ts +0 -397
  349. package/test/app/agent-activity-box.test.tsx +0 -132
  350. package/test/app/agent-transfer-lock.test.ts +0 -274
  351. package/test/app/api-client-electron-fallback.test.ts +0 -139
  352. package/test/app/api-client-timeout.test.ts +0 -75
  353. package/test/app/api-client-ws.test.ts +0 -98
  354. package/test/app/api-client.ws-max-reconnect.test.ts +0 -139
  355. package/test/app/api-client.ws-reconnect.test.ts +0 -157
  356. package/test/app/app-context-autonomy-events.test.ts +0 -478
  357. package/test/app/apps-page-view.test.ts +0 -114
  358. package/test/app/apps-view.test.ts +0 -591
  359. package/test/app/autonomous-workflows.e2e.test.ts +0 -765
  360. package/test/app/autonomy-events.test.ts +0 -150
  361. package/test/app/avatar-selector.test.tsx +0 -52
  362. package/test/app/bsc-trade-panel.test.tsx +0 -134
  363. package/test/app/bug-report-modal.test.tsx +0 -353
  364. package/test/app/character-customization.e2e.test.ts +0 -1199
  365. package/test/app/chat-advanced-features.e2e.test.ts +0 -706
  366. package/test/app/chat-composer.test.tsx +0 -181
  367. package/test/app/chat-language-header.test.ts +0 -64
  368. package/test/app/chat-message.test.tsx +0 -222
  369. package/test/app/chat-modal-view.test.tsx +0 -191
  370. package/test/app/chat-routine-filter.test.ts +0 -96
  371. package/test/app/chat-send-lock.test.ts +0 -1465
  372. package/test/app/chat-stream-api-client.test.tsx +0 -390
  373. package/test/app/chat-view-game-modal.test.tsx +0 -661
  374. package/test/app/chat-view.test.tsx +0 -877
  375. package/test/app/cloud-api.e2e.test.ts +0 -258
  376. package/test/app/cloud-login-flow.e2e.test.ts +0 -494
  377. package/test/app/cloud-login-lock.test.ts +0 -412
  378. package/test/app/command-palette.test.tsx +0 -184
  379. package/test/app/command-registry.test.ts +0 -75
  380. package/test/app/companion-greeting-wave.test.tsx +0 -431
  381. package/test/app/companion-stale-conversation.test.tsx +0 -447
  382. package/test/app/companion-view.test.tsx +0 -690
  383. package/test/app/confirm-delete-control.test.ts +0 -79
  384. package/test/app/confirm-modal.test.tsx +0 -219
  385. package/test/app/connectors-ui.e2e.test.ts +0 -508
  386. package/test/app/conversations-sidebar-game-modal.test.tsx +0 -265
  387. package/test/app/conversations-sidebar.test.tsx +0 -185
  388. package/test/app/custom-actions-smoke.test.ts +0 -387
  389. package/test/app/custom-avatar-api-client.test.ts +0 -207
  390. package/test/app/desktop-utils.test.ts +0 -145
  391. package/test/app/electrobun-rpc-bridge.test.ts +0 -83
  392. package/test/app/events.test.ts +0 -88
  393. package/test/app/export-import-flows.e2e.test.ts +0 -700
  394. package/test/app/fine-tuning-view.test.ts +0 -471
  395. package/test/app/game-view-auth-session.test.tsx +0 -187
  396. package/test/app/game-view.test.ts +0 -444
  397. package/test/app/global-emote-overlay.test.tsx +0 -106
  398. package/test/app/header-status.test.tsx +0 -149
  399. package/test/app/i18n.test.ts +0 -152
  400. package/test/app/inventory-bsc-view.test.ts +0 -940
  401. package/test/app/knowledge-ui.e2e.test.ts +0 -762
  402. package/test/app/knowledge-upload-helpers.test.ts +0 -124
  403. package/test/app/lifecycle-lock.test.ts +0 -267
  404. package/test/app/lifo-popout-utils.test.ts +0 -208
  405. package/test/app/lifo-safe-endpoint.test.ts +0 -34
  406. package/test/app/loading-screen.test.tsx +0 -45
  407. package/test/app/memory-monitor.test.ts +0 -332
  408. package/test/app/navigation.test.tsx +0 -22
  409. package/test/app/onboarding-finish-lock.test.ts +0 -673
  410. package/test/app/onboarding-language.test.tsx +0 -160
  411. package/test/app/onboarding-steps.test.tsx +0 -375
  412. package/test/app/open-external-url.test.ts +0 -65
  413. package/test/app/pages-navigation-smoke.e2e.test.ts +0 -638
  414. package/test/app/pairing-lock.test.ts +0 -260
  415. package/test/app/pairing-view.test.tsx +0 -74
  416. package/test/app/permissions-section.test.ts +0 -432
  417. package/test/app/plugin-bridge.test.ts +0 -109
  418. package/test/app/plugins-ui.e2e.test.ts +0 -605
  419. package/test/app/plugins-view-game-modal.test.tsx +0 -687
  420. package/test/app/plugins-view-toggle-restart.test.ts +0 -129
  421. package/test/app/provider-dropdown-default.test.tsx +0 -300
  422. package/test/app/restart-banner.test.tsx +0 -197
  423. package/test/app/retake-capture.test.ts +0 -84
  424. package/test/app/sandbox-api-client.test.ts +0 -108
  425. package/test/app/save-command-modal.test.tsx +0 -109
  426. package/test/app/secrets-view.test.tsx +0 -92
  427. package/test/app/settings-control-styles.test.tsx +0 -142
  428. package/test/app/settings-reset.e2e.test.ts +0 -726
  429. package/test/app/settings-sections.e2e.test.ts +0 -614
  430. package/test/app/shared-format.test.ts +0 -44
  431. package/test/app/shared-switch.test.ts +0 -69
  432. package/test/app/shell-mode-switching.e2e.test.ts +0 -840
  433. package/test/app/shell-mode-tab-memory.test.tsx +0 -58
  434. package/test/app/shell-overlays.test.tsx +0 -50
  435. package/test/app/shortcuts-overlay.test.tsx +0 -111
  436. package/test/app/sse-interruption.test.ts +0 -122
  437. package/test/app/startup-asset-missing.e2e.test.ts +0 -126
  438. package/test/app/startup-backend-missing.e2e.test.ts +0 -118
  439. package/test/app/startup-chat.e2e.test.ts +0 -322
  440. package/test/app/startup-conversation-restore.test.tsx +0 -381
  441. package/test/app/startup-failure-view.test.tsx +0 -103
  442. package/test/app/startup-onboarding.e2e.test.ts +0 -618
  443. package/test/app/startup-timeout.test.tsx +0 -80
  444. package/test/app/startup-token-401.e2e.test.ts +0 -103
  445. package/test/app/stream-helpers.test.ts +0 -46
  446. package/test/app/stream-popout-navigation.test.tsx +0 -41
  447. package/test/app/stream-status-bar.test.tsx +0 -89
  448. package/test/app/theme-toggle.test.tsx +0 -33
  449. package/test/app/training-api-client.test.ts +0 -128
  450. package/test/app/trajectories-view.test.tsx +0 -220
  451. package/test/app/triggers-api-client.test.ts +0 -77
  452. package/test/app/triggers-navigation.test.ts +0 -113
  453. package/test/app/triggers-view.e2e.test.ts +0 -675
  454. package/test/app/update-channel-lock.test.ts +0 -259
  455. package/test/app/vector-browser.async-cleanup.test.tsx +0 -367
  456. package/test/app/vector-browser.e2e.test.ts +0 -653
  457. package/test/app/vrm-stage.test.tsx +0 -351
  458. package/test/app/vrm-viewer.test.tsx +0 -298
  459. package/test/app/wallet-api-save-lock.test.ts +0 -299
  460. package/test/app/wallet-hooks.test.ts +0 -405
  461. package/test/app/wallet-ui-flows.e2e.test.ts +0 -556
  462. package/test/avatar/asset-url.test.ts +0 -90
  463. package/test/avatar/avatar-selector.test.ts +0 -173
  464. package/test/avatar/mixamo-vrm-rig-map.test.ts +0 -111
  465. package/test/avatar/voice-chat-streaming-text.test.ts +0 -96
  466. package/test/avatar/voice-chat.test.ts +0 -391
  467. package/test/browser-extension/README.md +0 -138
  468. package/test/browser-extension/test-harness.ts +0 -499
  469. package/test/capacitor-plugins.e2e.test.ts +0 -168
  470. package/test/test-types.ts +0 -5
  471. package/test/ui/command-palette-commands.test.ts +0 -57
  472. package/test/ui/ui-renderer.test.ts +0 -39
  473. package/test/utils/assistant-text.test.ts +0 -68
  474. package/test/utils/streaming-text.test.ts +0 -89
  475. package/tsconfig.build.json +0 -19
  476. package/tsconfig.json +0 -20
  477. package/tsconfig.typecheck.json +0 -12
  478. /package/{dist/App.d.ts → App.d.ts} +0 -0
  479. /package/{dist/App.d.ts.map → App.d.ts.map} +0 -0
  480. /package/{dist/App.js → App.js} +0 -0
  481. /package/{dist/actions → actions}/character.js +0 -0
  482. /package/{dist/actions → actions}/chat-helpers.d.ts +0 -0
  483. /package/{dist/actions → actions}/chat-helpers.d.ts.map +0 -0
  484. /package/{dist/actions → actions}/chat-helpers.js +0 -0
  485. /package/{dist/actions → actions}/cloud.js +0 -0
  486. /package/{dist/actions → actions}/index.d.ts +0 -0
  487. /package/{dist/actions → actions}/index.d.ts.map +0 -0
  488. /package/{dist/actions → actions}/index.js +0 -0
  489. /package/{dist/actions → actions}/onboarding.d.ts +0 -0
  490. /package/{dist/actions → actions}/onboarding.d.ts.map +0 -0
  491. /package/{dist/actions → actions}/onboarding.js +0 -0
  492. /package/{dist/actions → actions}/triggers.js +0 -0
  493. /package/{dist/api → api}/index.d.ts +0 -0
  494. /package/{dist/api → api}/index.d.ts.map +0 -0
  495. /package/{dist/api → api}/index.js +0 -0
  496. /package/{dist/autonomy → autonomy}/index.d.ts +0 -0
  497. /package/{dist/autonomy → autonomy}/index.d.ts.map +0 -0
  498. /package/{dist/autonomy → autonomy}/index.js +0 -0
  499. /package/{dist/bridge → bridge}/electrobun-rpc.d.ts +0 -0
  500. /package/{dist/bridge → bridge}/electrobun-rpc.d.ts.map +0 -0
  501. /package/{dist/bridge → bridge}/electrobun-runtime.d.ts +0 -0
  502. /package/{dist/bridge → bridge}/electrobun-runtime.d.ts.map +0 -0
  503. /package/{dist/bridge → bridge}/electrobun-runtime.js +0 -0
  504. /package/{dist/bridge → bridge}/index.d.ts +0 -0
  505. /package/{dist/bridge → bridge}/index.d.ts.map +0 -0
  506. /package/{dist/bridge → bridge}/index.js +0 -0
  507. /package/{dist/bridge → bridge}/native-plugins.d.ts +0 -0
  508. /package/{dist/bridge → bridge}/native-plugins.d.ts.map +0 -0
  509. /package/{dist/bridge → bridge}/native-plugins.js +0 -0
  510. /package/{dist/bridge → bridge}/storage-bridge.d.ts +0 -0
  511. /package/{dist/bridge → bridge}/storage-bridge.d.ts.map +0 -0
  512. /package/{dist/coding → coding}/index.d.ts +0 -0
  513. /package/{dist/coding → coding}/index.d.ts.map +0 -0
  514. /package/{dist/coding → coding}/index.js +0 -0
  515. /package/{dist/components → components}/AdvancedPageView.d.ts +0 -0
  516. /package/{dist/components → components}/AdvancedPageView.d.ts.map +0 -0
  517. /package/{dist/components → components}/AdvancedPageView.js +0 -0
  518. /package/{dist/components → components}/AgentActivityBox.d.ts +0 -0
  519. /package/{dist/components → components}/AgentActivityBox.d.ts.map +0 -0
  520. /package/{dist/components → components}/AgentActivityBox.js +0 -0
  521. /package/{dist/components → components}/ApiKeyConfig.d.ts +0 -0
  522. /package/{dist/components → components}/ApiKeyConfig.d.ts.map +0 -0
  523. /package/{dist/components → components}/ApiKeyConfig.js +0 -0
  524. /package/{dist/components → components}/AppsPageView.d.ts +0 -0
  525. /package/{dist/components → components}/AppsPageView.d.ts.map +0 -0
  526. /package/{dist/components → components}/AppsPageView.js +0 -0
  527. /package/{dist/components → components}/AppsView.d.ts +0 -0
  528. /package/{dist/components → components}/AppsView.d.ts.map +0 -0
  529. /package/{dist/components → components}/AppsView.js +0 -0
  530. /package/{dist/components → components}/AvatarLoader.d.ts +0 -0
  531. /package/{dist/components → components}/AvatarLoader.d.ts.map +0 -0
  532. /package/{dist/components → components}/AvatarLoader.js +0 -0
  533. /package/{dist/components → components}/AvatarSelector.d.ts +0 -0
  534. /package/{dist/components → components}/AvatarSelector.d.ts.map +0 -0
  535. /package/{dist/components → components}/AvatarSelector.js +0 -0
  536. /package/{dist/components → components}/BscTradePanel.d.ts +0 -0
  537. /package/{dist/components → components}/BscTradePanel.d.ts.map +0 -0
  538. /package/{dist/components → components}/BscTradePanel.js +0 -0
  539. /package/{dist/components → components}/BugReportModal.d.ts +0 -0
  540. /package/{dist/components → components}/BugReportModal.d.ts.map +0 -0
  541. /package/{dist/components → components}/CharacterView.d.ts +0 -0
  542. /package/{dist/components → components}/CharacterView.d.ts.map +0 -0
  543. /package/{dist/components → components}/CharacterView.js +0 -0
  544. /package/{dist/components → components}/ChatAvatar.d.ts +0 -0
  545. /package/{dist/components → components}/ChatAvatar.d.ts.map +0 -0
  546. /package/{dist/components → components}/ChatAvatar.js +0 -0
  547. /package/{dist/components → components}/ChatComposer.d.ts +0 -0
  548. /package/{dist/components → components}/ChatComposer.d.ts.map +0 -0
  549. /package/{dist/components → components}/ChatComposer.js +0 -0
  550. /package/{dist/components → components}/ChatMessage.d.ts +0 -0
  551. /package/{dist/components → components}/ChatMessage.d.ts.map +0 -0
  552. /package/{dist/components → components}/ChatMessage.js +0 -0
  553. /package/{dist/components → components}/ChatModalView.d.ts +0 -0
  554. /package/{dist/components → components}/ChatModalView.d.ts.map +0 -0
  555. /package/{dist/components → components}/ChatModalView.js +0 -0
  556. /package/{dist/components → components}/ChatView.d.ts +0 -0
  557. /package/{dist/components → components}/ChatView.d.ts.map +0 -0
  558. /package/{dist/components → components}/ChatView.js +0 -0
  559. /package/{dist/components → components}/CloudSourceControls.d.ts +0 -0
  560. /package/{dist/components → components}/CloudSourceControls.d.ts.map +0 -0
  561. /package/{dist/components → components}/CloudSourceControls.js +0 -0
  562. /package/{dist/components → components}/CodingAgentSettingsSection.d.ts +0 -0
  563. /package/{dist/components → components}/CodingAgentSettingsSection.d.ts.map +0 -0
  564. /package/{dist/components → components}/CodingAgentSettingsSection.js +0 -0
  565. /package/{dist/components → components}/CommandPalette.d.ts +0 -0
  566. /package/{dist/components → components}/CommandPalette.d.ts.map +0 -0
  567. /package/{dist/components → components}/CompanionSceneHost.d.ts +0 -0
  568. /package/{dist/components → components}/CompanionSceneHost.d.ts.map +0 -0
  569. /package/{dist/components → components}/CompanionShell.d.ts +0 -0
  570. /package/{dist/components → components}/CompanionShell.d.ts.map +0 -0
  571. /package/{dist/components → components}/CompanionShell.js +0 -0
  572. /package/{dist/components → components}/CompanionView.d.ts +0 -0
  573. /package/{dist/components → components}/CompanionView.d.ts.map +0 -0
  574. /package/{dist/components → components}/CompanionView.js +0 -0
  575. /package/{dist/components → components}/ConfigPageView.d.ts +0 -0
  576. /package/{dist/components → components}/ConfigPageView.d.ts.map +0 -0
  577. /package/{dist/components → components}/ConfigPageView.js +0 -0
  578. /package/{dist/components → components}/ConfigSaveFooter.d.ts +0 -0
  579. /package/{dist/components → components}/ConfigSaveFooter.d.ts.map +0 -0
  580. /package/{dist/components → components}/ConfigSaveFooter.js +0 -0
  581. /package/{dist/components → components}/ConfirmModal.d.ts +0 -0
  582. /package/{dist/components → components}/ConfirmModal.d.ts.map +0 -0
  583. /package/{dist/components → components}/ConfirmModal.js +0 -0
  584. /package/{dist/components → components}/ConnectionFailedBanner.d.ts +0 -0
  585. /package/{dist/components → components}/ConnectionFailedBanner.d.ts.map +0 -0
  586. /package/{dist/components → components}/ConnectionFailedBanner.js +0 -0
  587. /package/{dist/components → components}/ConnectorsPageView.d.ts +0 -0
  588. /package/{dist/components → components}/ConnectorsPageView.d.ts.map +0 -0
  589. /package/{dist/components → components}/ConnectorsPageView.js +0 -0
  590. /package/{dist/components → components}/ConversationsSidebar.d.ts +0 -0
  591. /package/{dist/components → components}/ConversationsSidebar.d.ts.map +0 -0
  592. /package/{dist/components → components}/ConversationsSidebar.js +0 -0
  593. /package/{dist/components → components}/CustomActionEditor.d.ts +0 -0
  594. /package/{dist/components → components}/CustomActionEditor.d.ts.map +0 -0
  595. /package/{dist/components → components}/CustomActionEditor.js +0 -0
  596. /package/{dist/components → components}/CustomActionsPanel.d.ts +0 -0
  597. /package/{dist/components → components}/CustomActionsPanel.d.ts.map +0 -0
  598. /package/{dist/components → components}/CustomActionsPanel.js +0 -0
  599. /package/{dist/components → components}/CustomActionsView.d.ts +0 -0
  600. /package/{dist/components → components}/CustomActionsView.d.ts.map +0 -0
  601. /package/{dist/components → components}/CustomActionsView.js +0 -0
  602. /package/{dist/components → components}/DatabasePageView.d.ts +0 -0
  603. /package/{dist/components → components}/DatabasePageView.d.ts.map +0 -0
  604. /package/{dist/components → components}/DatabasePageView.js +0 -0
  605. /package/{dist/components → components}/DatabaseView.d.ts +0 -0
  606. /package/{dist/components → components}/DatabaseView.d.ts.map +0 -0
  607. /package/{dist/components → components}/DatabaseView.js +0 -0
  608. /package/{dist/components → components}/ElizaCloudDashboard.d.ts +0 -0
  609. /package/{dist/components → components}/ElizaCloudDashboard.d.ts.map +0 -0
  610. /package/{dist/components → components}/EmotePicker.d.ts +0 -0
  611. /package/{dist/components → components}/EmotePicker.d.ts.map +0 -0
  612. /package/{dist/components → components}/ErrorBoundary.d.ts +0 -0
  613. /package/{dist/components → components}/ErrorBoundary.d.ts.map +0 -0
  614. /package/{dist/components → components}/ErrorBoundary.js +0 -0
  615. /package/{dist/components → components}/FineTuningView.d.ts +0 -0
  616. /package/{dist/components → components}/FineTuningView.d.ts.map +0 -0
  617. /package/{dist/components → components}/FineTuningView.js +0 -0
  618. /package/{dist/components → components}/GameView.d.ts +0 -0
  619. /package/{dist/components → components}/GameView.d.ts.map +0 -0
  620. /package/{dist/components → components}/GameView.js +0 -0
  621. /package/{dist/components → components}/GameViewOverlay.d.ts +0 -0
  622. /package/{dist/components → components}/GameViewOverlay.d.ts.map +0 -0
  623. /package/{dist/components → components}/GameViewOverlay.js +0 -0
  624. /package/{dist/components → components}/GlobalEmoteOverlay.d.ts +0 -0
  625. /package/{dist/components → components}/GlobalEmoteOverlay.d.ts.map +0 -0
  626. /package/{dist/components → components}/Header.d.ts +0 -0
  627. /package/{dist/components → components}/Header.d.ts.map +0 -0
  628. /package/{dist/components → components}/Header.js +0 -0
  629. /package/{dist/components → components}/HeartbeatsView.d.ts +0 -0
  630. /package/{dist/components → components}/HeartbeatsView.d.ts.map +0 -0
  631. /package/{dist/components → components}/HeartbeatsView.js +0 -0
  632. /package/{dist/components → components}/InventoryView.d.ts +0 -0
  633. /package/{dist/components → components}/InventoryView.d.ts.map +0 -0
  634. /package/{dist/components → components}/InventoryView.js +0 -0
  635. /package/{dist/components → components}/KnowledgeView.d.ts +0 -0
  636. /package/{dist/components → components}/KnowledgeView.d.ts.map +0 -0
  637. /package/{dist/components → components}/KnowledgeView.js +0 -0
  638. /package/{dist/components → components}/LanguageDropdown.d.ts +0 -0
  639. /package/{dist/components → components}/LanguageDropdown.d.ts.map +0 -0
  640. /package/{dist/components → components}/LanguageDropdown.js +0 -0
  641. /package/{dist/components → components}/LifoMonitorPanel.d.ts +0 -0
  642. /package/{dist/components → components}/LifoMonitorPanel.d.ts.map +0 -0
  643. /package/{dist/components → components}/LifoMonitorPanel.js +0 -0
  644. /package/{dist/components → components}/LifoSandboxView.d.ts +0 -0
  645. /package/{dist/components → components}/LifoSandboxView.d.ts.map +0 -0
  646. /package/{dist/components → components}/LifoSandboxView.js +0 -0
  647. /package/{dist/components → components}/LoadingScreen.d.ts +0 -0
  648. /package/{dist/components → components}/LoadingScreen.d.ts.map +0 -0
  649. /package/{dist/components → components}/LoadingScreen.js +0 -0
  650. /package/{dist/components → components}/LogsPageView.d.ts +0 -0
  651. /package/{dist/components → components}/LogsPageView.d.ts.map +0 -0
  652. /package/{dist/components → components}/LogsPageView.js +0 -0
  653. /package/{dist/components → components}/LogsView.d.ts +0 -0
  654. /package/{dist/components → components}/LogsView.d.ts.map +0 -0
  655. /package/{dist/components → components}/LogsView.js +0 -0
  656. /package/{dist/components → components}/MediaGalleryView.d.ts +0 -0
  657. /package/{dist/components → components}/MediaGalleryView.d.ts.map +0 -0
  658. /package/{dist/components → components}/MediaGalleryView.js +0 -0
  659. /package/{dist/components → components}/MediaSettingsSection.d.ts +0 -0
  660. /package/{dist/components → components}/MediaSettingsSection.d.ts.map +0 -0
  661. /package/{dist/components → components}/MediaSettingsSection.js +0 -0
  662. /package/{dist/components → components}/MessageContent.d.ts +0 -0
  663. /package/{dist/components → components}/MessageContent.d.ts.map +0 -0
  664. /package/{dist/components → components}/MessageContent.js +0 -0
  665. /package/{dist/components → components}/OnboardingWizard.d.ts +0 -0
  666. /package/{dist/components → components}/OnboardingWizard.d.ts.map +0 -0
  667. /package/{dist/components → components}/OnboardingWizard.js +0 -0
  668. /package/{dist/components → components}/PairingView.d.ts +0 -0
  669. /package/{dist/components → components}/PairingView.d.ts.map +0 -0
  670. /package/{dist/components → components}/PermissionsSection.d.ts +0 -0
  671. /package/{dist/components → components}/PermissionsSection.d.ts.map +0 -0
  672. /package/{dist/components → components}/PermissionsSection.js +0 -0
  673. /package/{dist/components → components}/PluginsPageView.d.ts +0 -0
  674. /package/{dist/components → components}/PluginsPageView.d.ts.map +0 -0
  675. /package/{dist/components → components}/PluginsPageView.js +0 -0
  676. /package/{dist/components → components}/PluginsView.d.ts +0 -0
  677. /package/{dist/components → components}/PluginsView.d.ts.map +0 -0
  678. /package/{dist/components → components}/PluginsView.js +0 -0
  679. /package/{dist/components → components}/ProviderSwitcher.d.ts +0 -0
  680. /package/{dist/components → components}/ProviderSwitcher.d.ts.map +0 -0
  681. /package/{dist/components → components}/RestartBanner.d.ts +0 -0
  682. /package/{dist/components → components}/RestartBanner.d.ts.map +0 -0
  683. /package/{dist/components → components}/RestartBanner.js +0 -0
  684. /package/{dist/components → components}/RuntimeView.d.ts +0 -0
  685. /package/{dist/components → components}/RuntimeView.d.ts.map +0 -0
  686. /package/{dist/components → components}/RuntimeView.js +0 -0
  687. /package/{dist/components → components}/SaveCommandModal.d.ts +0 -0
  688. /package/{dist/components → components}/SaveCommandModal.d.ts.map +0 -0
  689. /package/{dist/components → components}/SaveCommandModal.js +0 -0
  690. /package/{dist/components → components}/SecretsView.d.ts +0 -0
  691. /package/{dist/components → components}/SecretsView.d.ts.map +0 -0
  692. /package/{dist/components → components}/SettingsView.d.ts +0 -0
  693. /package/{dist/components → components}/SettingsView.d.ts.map +0 -0
  694. /package/{dist/components → components}/SettingsView.js +0 -0
  695. /package/{dist/components → components}/ShellOverlays.d.ts +0 -0
  696. /package/{dist/components → components}/ShellOverlays.d.ts.map +0 -0
  697. /package/{dist/components → components}/ShellOverlays.js +0 -0
  698. /package/{dist/components → components}/ShortcutsOverlay.d.ts +0 -0
  699. /package/{dist/components → components}/ShortcutsOverlay.d.ts.map +0 -0
  700. /package/{dist/components → components}/ShortcutsOverlay.js +0 -0
  701. /package/{dist/components → components}/SkillsView.d.ts +0 -0
  702. /package/{dist/components → components}/SkillsView.d.ts.map +0 -0
  703. /package/{dist/components → components}/SkillsView.js +0 -0
  704. /package/{dist/components → components}/StartupFailureView.d.ts +0 -0
  705. /package/{dist/components → components}/StartupFailureView.d.ts.map +0 -0
  706. /package/{dist/components → components}/StreamView.d.ts +0 -0
  707. /package/{dist/components → components}/StreamView.d.ts.map +0 -0
  708. /package/{dist/components → components}/StripeEmbeddedCheckout.d.ts +0 -0
  709. /package/{dist/components → components}/StripeEmbeddedCheckout.d.ts.map +0 -0
  710. /package/{dist/components → components}/SubscriptionStatus.d.ts +0 -0
  711. /package/{dist/components → components}/SubscriptionStatus.d.ts.map +0 -0
  712. /package/{dist/components → components}/SystemWarningBanner.d.ts +0 -0
  713. /package/{dist/components → components}/SystemWarningBanner.d.ts.map +0 -0
  714. /package/{dist/components → components}/SystemWarningBanner.js +0 -0
  715. /package/{dist/components → components}/ThemeToggle.d.ts +0 -0
  716. /package/{dist/components → components}/ThemeToggle.d.ts.map +0 -0
  717. /package/{dist/components → components}/ThemeToggle.js +0 -0
  718. /package/{dist/components → components}/TrajectoriesView.d.ts +0 -0
  719. /package/{dist/components → components}/TrajectoriesView.d.ts.map +0 -0
  720. /package/{dist/components → components}/TrajectoriesView.js +0 -0
  721. /package/{dist/components → components}/TrajectoryDetailView.d.ts +0 -0
  722. /package/{dist/components → components}/TrajectoryDetailView.d.ts.map +0 -0
  723. /package/{dist/components → components}/TrajectoryDetailView.js +0 -0
  724. /package/{dist/components → components}/TriggersView.d.ts +0 -0
  725. /package/{dist/components → components}/TriggersView.d.ts.map +0 -0
  726. /package/{dist/components → components}/TriggersView.js +0 -0
  727. /package/{dist/components → components}/VectorBrowserView.d.ts +0 -0
  728. /package/{dist/components → components}/VectorBrowserView.d.ts.map +0 -0
  729. /package/{dist/components → components}/VectorBrowserView.js +0 -0
  730. /package/{dist/components → components}/VoiceConfigView.d.ts +0 -0
  731. /package/{dist/components → components}/VoiceConfigView.d.ts.map +0 -0
  732. /package/{dist/components → components}/VrmStage.d.ts +0 -0
  733. /package/{dist/components → components}/VrmStage.d.ts.map +0 -0
  734. /package/{dist/components → components}/VrmStage.js +0 -0
  735. /package/{dist/components → components}/WhatsAppQrOverlay.d.ts +0 -0
  736. /package/{dist/components → components}/WhatsAppQrOverlay.d.ts.map +0 -0
  737. /package/{dist/components → components}/WhatsAppQrOverlay.js +0 -0
  738. /package/{dist/components → components}/apps/AppDetailPane.d.ts +0 -0
  739. /package/{dist/components → components}/apps/AppDetailPane.d.ts.map +0 -0
  740. /package/{dist/components → components}/apps/AppDetailPane.js +0 -0
  741. /package/{dist/components → components}/apps/AppsCatalogGrid.d.ts +0 -0
  742. /package/{dist/components → components}/apps/AppsCatalogGrid.d.ts.map +0 -0
  743. /package/{dist/components → components}/apps/AppsCatalogGrid.js +0 -0
  744. /package/{dist/components → components}/apps/extensions/registry.d.ts +0 -0
  745. /package/{dist/components → components}/apps/extensions/registry.d.ts.map +0 -0
  746. /package/{dist/components → components}/apps/extensions/registry.js +0 -0
  747. /package/{dist/components → components}/apps/extensions/types.d.ts +0 -0
  748. /package/{dist/components → components}/apps/extensions/types.d.ts.map +0 -0
  749. /package/{dist/components → components}/apps/extensions/types.js +0 -0
  750. /package/{dist/components → components}/apps/helpers.d.ts +0 -0
  751. /package/{dist/components → components}/apps/helpers.d.ts.map +0 -0
  752. /package/{dist/components → components}/apps/helpers.js +0 -0
  753. /package/{dist/components → components}/avatar/VrmAnimationLoader.d.ts +0 -0
  754. /package/{dist/components → components}/avatar/VrmAnimationLoader.d.ts.map +0 -0
  755. /package/{dist/components → components}/avatar/VrmAnimationLoader.js +0 -0
  756. /package/{dist/components → components}/avatar/VrmBlinkController.d.ts +0 -0
  757. /package/{dist/components → components}/avatar/VrmBlinkController.d.ts.map +0 -0
  758. /package/{dist/components → components}/avatar/VrmBlinkController.js +0 -0
  759. /package/{dist/components → components}/avatar/VrmCameraManager.d.ts +0 -0
  760. /package/{dist/components → components}/avatar/VrmCameraManager.d.ts.map +0 -0
  761. /package/{dist/components → components}/avatar/VrmCameraManager.js +0 -0
  762. /package/{dist/components → components}/avatar/VrmEngine.d.ts +0 -0
  763. /package/{dist/components → components}/avatar/VrmEngine.d.ts.map +0 -0
  764. /package/{dist/components → components}/avatar/VrmFootShadow.d.ts +0 -0
  765. /package/{dist/components → components}/avatar/VrmFootShadow.d.ts.map +0 -0
  766. /package/{dist/components → components}/avatar/VrmFootShadow.js +0 -0
  767. /package/{dist/components → components}/avatar/mixamoVRMRigMap.d.ts +0 -0
  768. /package/{dist/components → components}/avatar/mixamoVRMRigMap.d.ts.map +0 -0
  769. /package/{dist/components → components}/avatar/mixamoVRMRigMap.js +0 -0
  770. /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.d.ts +0 -0
  771. /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.d.ts.map +0 -0
  772. /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.js +0 -0
  773. /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.d.ts +0 -0
  774. /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.d.ts.map +0 -0
  775. /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.js +0 -0
  776. /package/{dist/components → components}/chainConfig.d.ts +0 -0
  777. /package/{dist/components → components}/chainConfig.d.ts.map +0 -0
  778. /package/{dist/components → components}/chainConfig.js +0 -0
  779. /package/{dist/components → components}/companion/CompanionHeader.d.ts +0 -0
  780. /package/{dist/components → components}/companion/CompanionHeader.d.ts.map +0 -0
  781. /package/{dist/components → components}/companion/CompanionHeader.js +0 -0
  782. /package/{dist/components → components}/companion/CompanionSceneHost.d.ts +0 -0
  783. /package/{dist/components → components}/companion/CompanionSceneHost.d.ts.map +0 -0
  784. /package/{dist/components → components}/companion/CompanionSceneHost.js +0 -0
  785. /package/{dist/components → components}/companion/VrmStage.d.ts +0 -0
  786. /package/{dist/components → components}/companion/VrmStage.d.ts.map +0 -0
  787. /package/{dist/components → components}/companion/VrmStage.js +0 -0
  788. /package/{dist/components → components}/companion-shell-styles.d.ts +0 -0
  789. /package/{dist/components → components}/companion-shell-styles.d.ts.map +0 -0
  790. /package/{dist/components → components}/companion-shell-styles.js +0 -0
  791. /package/{dist/components → components}/confirm-delete-control.d.ts +0 -0
  792. /package/{dist/components → components}/confirm-delete-control.d.ts.map +0 -0
  793. /package/{dist/components → components}/confirm-delete-control.js +0 -0
  794. /package/{dist/components → components}/conversations/ConversationListItem.d.ts +0 -0
  795. /package/{dist/components → components}/conversations/ConversationListItem.d.ts.map +0 -0
  796. /package/{dist/components → components}/conversations/ConversationListItem.js +0 -0
  797. /package/{dist/components → components}/conversations/conversation-utils.d.ts +0 -0
  798. /package/{dist/components → components}/conversations/conversation-utils.d.ts.map +0 -0
  799. /package/{dist/components → components}/conversations/conversation-utils.js +0 -0
  800. /package/{dist/components → components}/format.d.ts.map +0 -0
  801. /package/{dist/components → components}/index.d.ts +0 -0
  802. /package/{dist/components → components}/index.d.ts.map +0 -0
  803. /package/{dist/components → components}/index.js +0 -0
  804. /package/{dist/components → components}/inventory/CopyableAddress.d.ts +0 -0
  805. /package/{dist/components → components}/inventory/CopyableAddress.d.ts.map +0 -0
  806. /package/{dist/components → components}/inventory/CopyableAddress.js +0 -0
  807. /package/{dist/components → components}/inventory/InventoryToolbar.d.ts +0 -0
  808. /package/{dist/components → components}/inventory/InventoryToolbar.d.ts.map +0 -0
  809. /package/{dist/components → components}/inventory/InventoryToolbar.js +0 -0
  810. /package/{dist/components → components}/inventory/NftGrid.d.ts +0 -0
  811. /package/{dist/components → components}/inventory/NftGrid.d.ts.map +0 -0
  812. /package/{dist/components → components}/inventory/NftGrid.js +0 -0
  813. /package/{dist/components → components}/inventory/TokenLogo.d.ts +0 -0
  814. /package/{dist/components → components}/inventory/TokenLogo.d.ts.map +0 -0
  815. /package/{dist/components → components}/inventory/TokenLogo.js +0 -0
  816. /package/{dist/components → components}/inventory/TokensTable.d.ts +0 -0
  817. /package/{dist/components → components}/inventory/TokensTable.d.ts.map +0 -0
  818. /package/{dist/components → components}/inventory/TokensTable.js +0 -0
  819. /package/{dist/components → components}/inventory/constants.d.ts +0 -0
  820. /package/{dist/components → components}/inventory/constants.d.ts.map +0 -0
  821. /package/{dist/components → components}/inventory/constants.js +0 -0
  822. /package/{dist/components → components}/inventory/index.d.ts +0 -0
  823. /package/{dist/components → components}/inventory/index.d.ts.map +0 -0
  824. /package/{dist/components → components}/inventory/index.js +0 -0
  825. /package/{dist/components → components}/inventory/media-url.d.ts +0 -0
  826. /package/{dist/components → components}/inventory/media-url.d.ts.map +0 -0
  827. /package/{dist/components → components}/inventory/media-url.js +0 -0
  828. /package/{dist/components → components}/inventory/useInventoryData.d.ts +0 -0
  829. /package/{dist/components → components}/inventory/useInventoryData.d.ts.map +0 -0
  830. /package/{dist/components → components}/inventory/useInventoryData.js +0 -0
  831. /package/{dist/components → components}/knowledge-upload-image.d.ts +0 -0
  832. /package/{dist/components → components}/knowledge-upload-image.d.ts.map +0 -0
  833. /package/{dist/components → components}/knowledge-upload-image.js +0 -0
  834. /package/{dist/components → components}/labels.d.ts +0 -0
  835. /package/{dist/components → components}/labels.d.ts.map +0 -0
  836. /package/{dist/components → components}/labels.js +0 -0
  837. /package/{dist/components → components}/onboarding/ActivateStep.d.ts +0 -0
  838. /package/{dist/components → components}/onboarding/ActivateStep.d.ts.map +0 -0
  839. /package/{dist/components → components}/onboarding/ActivateStep.js +0 -0
  840. /package/{dist/components → components}/onboarding/ConnectionStep.d.ts +0 -0
  841. /package/{dist/components → components}/onboarding/ConnectionStep.d.ts.map +0 -0
  842. /package/{dist/components → components}/onboarding/ConnectionStep.js +0 -0
  843. /package/{dist/components → components}/onboarding/IdentityStep.d.ts +0 -0
  844. /package/{dist/components → components}/onboarding/IdentityStep.d.ts.map +0 -0
  845. /package/{dist/components → components}/onboarding/IdentityStep.js +0 -0
  846. /package/{dist/components → components}/onboarding/OnboardingPanel.d.ts +0 -0
  847. /package/{dist/components → components}/onboarding/OnboardingPanel.d.ts.map +0 -0
  848. /package/{dist/components → components}/onboarding/OnboardingPanel.js +0 -0
  849. /package/{dist/components → components}/onboarding/OnboardingStepNav.d.ts +0 -0
  850. /package/{dist/components → components}/onboarding/OnboardingStepNav.d.ts.map +0 -0
  851. /package/{dist/components → components}/onboarding/OnboardingStepNav.js +0 -0
  852. /package/{dist/components → components}/onboarding/PermissionsStep.d.ts +0 -0
  853. /package/{dist/components → components}/onboarding/PermissionsStep.d.ts.map +0 -0
  854. /package/{dist/components → components}/onboarding/PermissionsStep.js +0 -0
  855. /package/{dist/components → components}/onboarding/RpcStep.d.ts +0 -0
  856. /package/{dist/components → components}/onboarding/RpcStep.d.ts.map +0 -0
  857. /package/{dist/components → components}/onboarding/RpcStep.js +0 -0
  858. /package/{dist/components → components}/permissions/PermissionIcon.d.ts +0 -0
  859. /package/{dist/components → components}/permissions/PermissionIcon.d.ts.map +0 -0
  860. /package/{dist/components → components}/permissions/PermissionIcon.js +0 -0
  861. /package/{dist/components → components}/permissions/StreamingPermissions.d.ts +0 -0
  862. /package/{dist/components → components}/permissions/StreamingPermissions.d.ts.map +0 -0
  863. /package/{dist/components → components}/plugins/showcase-data.d.ts +0 -0
  864. /package/{dist/components → components}/plugins/showcase-data.d.ts.map +0 -0
  865. /package/{dist/components → components}/plugins/showcase-data.js +0 -0
  866. /package/{dist/components → components}/shared/ShellHeaderControls.d.ts +0 -0
  867. /package/{dist/components → components}/shared/ShellHeaderControls.d.ts.map +0 -0
  868. /package/{dist/components → components}/shared/ShellHeaderControls.js +0 -0
  869. /package/{dist/components → components}/shared-companion-scene-context.d.ts +0 -0
  870. /package/{dist/components → components}/shared-companion-scene-context.d.ts.map +0 -0
  871. /package/{dist/components → components}/shared-companion-scene-context.js +0 -0
  872. /package/{dist/components → components}/skeletons.d.ts +0 -0
  873. /package/{dist/components → components}/skeletons.d.ts.map +0 -0
  874. /package/{dist/components → components}/skeletons.js +0 -0
  875. /package/{dist/components → components}/stream/ActivityFeed.d.ts +0 -0
  876. /package/{dist/components → components}/stream/ActivityFeed.d.ts.map +0 -0
  877. /package/{dist/components → components}/stream/ActivityFeed.js +0 -0
  878. /package/{dist/components → components}/stream/AvatarPip.d.ts +0 -0
  879. /package/{dist/components → components}/stream/AvatarPip.d.ts.map +0 -0
  880. /package/{dist/components → components}/stream/AvatarPip.js +0 -0
  881. /package/{dist/components → components}/stream/ChatContent.d.ts +0 -0
  882. /package/{dist/components → components}/stream/ChatContent.d.ts.map +0 -0
  883. /package/{dist/components → components}/stream/ChatContent.js +0 -0
  884. /package/{dist/components → components}/stream/ChatTicker.d.ts +0 -0
  885. /package/{dist/components → components}/stream/ChatTicker.d.ts.map +0 -0
  886. /package/{dist/components → components}/stream/ChatTicker.js +0 -0
  887. /package/{dist/components → components}/stream/IdleContent.d.ts +0 -0
  888. /package/{dist/components → components}/stream/IdleContent.d.ts.map +0 -0
  889. /package/{dist/components → components}/stream/IdleContent.js +0 -0
  890. /package/{dist/components → components}/stream/StatusBar.d.ts +0 -0
  891. /package/{dist/components → components}/stream/StatusBar.d.ts.map +0 -0
  892. /package/{dist/components → components}/stream/StreamSettings.d.ts +0 -0
  893. /package/{dist/components → components}/stream/StreamSettings.d.ts.map +0 -0
  894. /package/{dist/components → components}/stream/StreamSettings.js +0 -0
  895. /package/{dist/components → components}/stream/StreamTerminal.d.ts +0 -0
  896. /package/{dist/components → components}/stream/StreamTerminal.d.ts.map +0 -0
  897. /package/{dist/components → components}/stream/StreamTerminal.js +0 -0
  898. /package/{dist/components → components}/stream/StreamVoiceConfig.d.ts +0 -0
  899. /package/{dist/components → components}/stream/StreamVoiceConfig.d.ts.map +0 -0
  900. /package/{dist/components → components}/stream/StreamVoiceConfig.js +0 -0
  901. /package/{dist/components → components}/stream/helpers.d.ts +0 -0
  902. /package/{dist/components → components}/stream/helpers.d.ts.map +0 -0
  903. /package/{dist/components → components}/stream/helpers.js +0 -0
  904. /package/{dist/components → components}/stream/overlays/OverlayLayer.d.ts +0 -0
  905. /package/{dist/components → components}/stream/overlays/OverlayLayer.d.ts.map +0 -0
  906. /package/{dist/components → components}/stream/overlays/OverlayLayer.js +0 -0
  907. /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.d.ts +0 -0
  908. /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.d.ts.map +0 -0
  909. /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.js +0 -0
  910. /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.d.ts +0 -0
  911. /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.d.ts.map +0 -0
  912. /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.js +0 -0
  913. /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.d.ts +0 -0
  914. /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.d.ts.map +0 -0
  915. /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.js +0 -0
  916. /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.d.ts +0 -0
  917. /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.d.ts.map +0 -0
  918. /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.js +0 -0
  919. /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.d.ts +0 -0
  920. /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.d.ts.map +0 -0
  921. /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.js +0 -0
  922. /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.d.ts +0 -0
  923. /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.d.ts.map +0 -0
  924. /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.js +0 -0
  925. /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.d.ts +0 -0
  926. /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.d.ts.map +0 -0
  927. /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.js +0 -0
  928. /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.d.ts +0 -0
  929. /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.d.ts.map +0 -0
  930. /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.js +0 -0
  931. /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.d.ts +0 -0
  932. /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.d.ts.map +0 -0
  933. /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.js +0 -0
  934. /package/{dist/components → components}/stream/overlays/built-in/index.d.ts +0 -0
  935. /package/{dist/components → components}/stream/overlays/built-in/index.d.ts.map +0 -0
  936. /package/{dist/components → components}/stream/overlays/built-in/index.js +0 -0
  937. /package/{dist/components → components}/stream/overlays/registry.d.ts +0 -0
  938. /package/{dist/components → components}/stream/overlays/registry.d.ts.map +0 -0
  939. /package/{dist/components → components}/stream/overlays/registry.js +0 -0
  940. /package/{dist/components → components}/stream/overlays/types.d.ts +0 -0
  941. /package/{dist/components → components}/stream/overlays/types.d.ts.map +0 -0
  942. /package/{dist/components → components}/stream/overlays/types.js +0 -0
  943. /package/{dist/components → components}/stream/overlays/useOverlayLayout.d.ts.map +0 -0
  944. /package/{dist/components → components}/trajectory-format.d.ts +0 -0
  945. /package/{dist/components → components}/trajectory-format.d.ts.map +0 -0
  946. /package/{dist/components → components}/trajectory-format.js +0 -0
  947. /package/{dist/components → components}/ui-badges.d.ts +0 -0
  948. /package/{dist/components → components}/ui-badges.d.ts.map +0 -0
  949. /package/{dist/components → components}/ui-badges.js +0 -0
  950. /package/{dist/components → components}/ui-switch.d.ts +0 -0
  951. /package/{dist/components → components}/ui-switch.d.ts.map +0 -0
  952. /package/{dist/components → components}/ui-switch.js +0 -0
  953. /package/{dist/components → components}/vector-browser-three.d.ts +0 -0
  954. /package/{dist/components → components}/vector-browser-three.d.ts.map +0 -0
  955. /package/{dist/components → components}/vector-browser-three.js +0 -0
  956. /package/{dist/config → config}/config-catalog.d.ts +0 -0
  957. /package/{dist/config → config}/config-catalog.d.ts.map +0 -0
  958. /package/{dist/config → config}/config-catalog.js +0 -0
  959. /package/{dist/config → config}/config-field.d.ts +0 -0
  960. /package/{dist/config → config}/config-field.d.ts.map +0 -0
  961. /package/{dist/config → config}/config-field.js +0 -0
  962. /package/{dist/config → config}/config-renderer.d.ts +0 -0
  963. /package/{dist/config → config}/config-renderer.d.ts.map +0 -0
  964. /package/{dist/config → config}/config-renderer.js +0 -0
  965. /package/{dist/config → config}/index.d.ts +0 -0
  966. /package/{dist/config → config}/index.d.ts.map +0 -0
  967. /package/{dist/config → config}/index.js +0 -0
  968. /package/{dist/config → config}/ui-renderer.d.ts +0 -0
  969. /package/{dist/config → config}/ui-renderer.d.ts.map +0 -0
  970. /package/{dist/config → config}/ui-renderer.js +0 -0
  971. /package/{dist/config → config}/ui-spec.d.ts +0 -0
  972. /package/{dist/config → config}/ui-spec.d.ts.map +0 -0
  973. /package/{dist/config → config}/ui-spec.js +0 -0
  974. /package/{dist/hooks → hooks}/index.d.ts +0 -0
  975. /package/{dist/hooks → hooks}/index.d.ts.map +0 -0
  976. /package/{dist/hooks → hooks}/index.js +0 -0
  977. /package/{dist/hooks → hooks}/useBugReport.d.ts +0 -0
  978. /package/{dist/hooks → hooks}/useBugReport.d.ts.map +0 -0
  979. /package/{dist/hooks → hooks}/useBugReport.js +0 -0
  980. /package/{dist/hooks → hooks}/useCanvasWindow.d.ts +0 -0
  981. /package/{dist/hooks → hooks}/useCanvasWindow.d.ts.map +0 -0
  982. /package/{dist/hooks → hooks}/useCanvasWindow.js +0 -0
  983. /package/{dist/hooks → hooks}/useChatAvatarVoice.d.ts +0 -0
  984. /package/{dist/hooks → hooks}/useChatAvatarVoice.d.ts.map +0 -0
  985. /package/{dist/hooks → hooks}/useChatAvatarVoice.js +0 -0
  986. /package/{dist/hooks → hooks}/useContextMenu.d.ts +0 -0
  987. /package/{dist/hooks → hooks}/useContextMenu.d.ts.map +0 -0
  988. /package/{dist/hooks → hooks}/useContextMenu.js +0 -0
  989. /package/{dist/hooks → hooks}/useKeyboardShortcuts.d.ts +0 -0
  990. /package/{dist/hooks → hooks}/useKeyboardShortcuts.d.ts.map +0 -0
  991. /package/{dist/hooks → hooks}/useKeyboardShortcuts.js +0 -0
  992. /package/{dist/hooks → hooks}/useLifoSync.d.ts +0 -0
  993. /package/{dist/hooks → hooks}/useLifoSync.d.ts.map +0 -0
  994. /package/{dist/hooks → hooks}/useLifoSync.js +0 -0
  995. /package/{dist/hooks → hooks}/useMemoryMonitor.d.ts +0 -0
  996. /package/{dist/hooks → hooks}/useMemoryMonitor.d.ts.map +0 -0
  997. /package/{dist/hooks → hooks}/useMemoryMonitor.js +0 -0
  998. /package/{dist/hooks → hooks}/useRenderGuard.d.ts +0 -0
  999. /package/{dist/hooks → hooks}/useRenderGuard.d.ts.map +0 -0
  1000. /package/{dist/hooks → hooks}/useRenderGuard.js +0 -0
  1001. /package/{dist/hooks → hooks}/useRetakeCapture.d.ts +0 -0
  1002. /package/{dist/hooks → hooks}/useRetakeCapture.d.ts.map +0 -0
  1003. /package/{dist/hooks → hooks}/useStreamPopoutNavigation.d.ts +0 -0
  1004. /package/{dist/hooks → hooks}/useStreamPopoutNavigation.d.ts.map +0 -0
  1005. /package/{dist/hooks → hooks}/useStreamPopoutNavigation.js +0 -0
  1006. /package/{dist/hooks → hooks}/useTimeout.d.ts +0 -0
  1007. /package/{dist/hooks → hooks}/useTimeout.d.ts.map +0 -0
  1008. /package/{dist/hooks → hooks}/useTimeout.js +0 -0
  1009. /package/{dist/hooks → hooks}/useVoiceChat.d.ts +0 -0
  1010. /package/{dist/hooks → hooks}/useVoiceChat.d.ts.map +0 -0
  1011. /package/{dist/hooks → hooks}/useVoiceChat.js +0 -0
  1012. /package/{dist/hooks → hooks}/useWhatsAppPairing.d.ts +0 -0
  1013. /package/{dist/hooks → hooks}/useWhatsAppPairing.d.ts.map +0 -0
  1014. /package/{dist/hooks → hooks}/useWhatsAppPairing.js +0 -0
  1015. /package/{dist/i18n → i18n}/index.d.ts +0 -0
  1016. /package/{dist/i18n → i18n}/index.d.ts.map +0 -0
  1017. /package/{dist/i18n → i18n}/index.js +0 -0
  1018. /package/{dist/i18n → i18n}/messages.d.ts +0 -0
  1019. /package/{dist/i18n → i18n}/messages.d.ts.map +0 -0
  1020. /package/{dist/i18n → i18n}/messages.js +0 -0
  1021. /package/{dist/index.d.ts → index.d.ts} +0 -0
  1022. /package/{dist/index.d.ts.map → index.d.ts.map} +0 -0
  1023. /package/{dist/index.js → index.js} +0 -0
  1024. /package/{dist/navigation → navigation}/index.d.ts +0 -0
  1025. /package/{dist/navigation → navigation}/index.d.ts.map +0 -0
  1026. /package/{dist/onboarding-config.d.ts → onboarding-config.d.ts} +0 -0
  1027. /package/{dist/onboarding-config.d.ts.map → onboarding-config.d.ts.map} +0 -0
  1028. /package/{dist/onboarding-config.js → onboarding-config.js} +0 -0
  1029. /package/{dist/platform → platform}/browser-launch.d.ts +0 -0
  1030. /package/{dist/platform → platform}/browser-launch.d.ts.map +0 -0
  1031. /package/{dist/platform → platform}/index.d.ts +0 -0
  1032. /package/{dist/platform → platform}/index.d.ts.map +0 -0
  1033. /package/{dist/platform → platform}/index.js +0 -0
  1034. /package/{dist/providers → providers}/index.d.ts +0 -0
  1035. /package/{dist/providers → providers}/index.d.ts.map +0 -0
  1036. /package/{dist/providers → providers}/index.js +0 -0
  1037. /package/{dist/state → state}/AppContext.d.ts +0 -0
  1038. /package/{dist/state → state}/AppContext.d.ts.map +0 -0
  1039. /package/{dist/state → state}/index.d.ts +0 -0
  1040. /package/{dist/state → state}/index.d.ts.map +0 -0
  1041. /package/{dist/state → state}/index.js +0 -0
  1042. /package/{dist/state → state}/internal.d.ts +0 -0
  1043. /package/{dist/state → state}/internal.d.ts.map +0 -0
  1044. /package/{dist/state → state}/internal.js +0 -0
  1045. /package/{dist/state → state}/onboarding-resume.d.ts +0 -0
  1046. /package/{dist/state → state}/onboarding-resume.d.ts.map +0 -0
  1047. /package/{dist/state → state}/parsers.d.ts +0 -0
  1048. /package/{dist/state → state}/parsers.d.ts.map +0 -0
  1049. /package/{dist/state → state}/parsers.js +0 -0
  1050. /package/{dist/state → state}/persistence.d.ts +0 -0
  1051. /package/{dist/state → state}/persistence.d.ts.map +0 -0
  1052. /package/{dist/state → state}/shell-routing.d.ts +0 -0
  1053. /package/{dist/state → state}/shell-routing.d.ts.map +0 -0
  1054. /package/{dist/state → state}/shell-routing.js +0 -0
  1055. /package/{dist/state → state}/types.d.ts +0 -0
  1056. /package/{dist/state → state}/types.d.ts.map +0 -0
  1057. /package/{dist/state → state}/types.js +0 -0
  1058. /package/{dist/state → state}/ui-preferences.d.ts +0 -0
  1059. /package/{dist/state → state}/ui-preferences.d.ts.map +0 -0
  1060. /package/{dist/state → state}/ui-preferences.js +0 -0
  1061. /package/{dist/state → state}/useApp.d.ts +0 -0
  1062. /package/{dist/state → state}/useApp.d.ts.map +0 -0
  1063. /package/{dist/state → state}/useApp.js +0 -0
  1064. /package/{dist/stories → stories}/AppMockProvider.d.ts +0 -0
  1065. /package/{dist/stories → stories}/AppMockProvider.d.ts.map +0 -0
  1066. /package/{dist/stories → stories}/AppMockProvider.js +0 -0
  1067. /package/{src/styles → styles}/anime.css +0 -0
  1068. /package/{src/styles → styles}/base.css +0 -0
  1069. /package/{src/styles → styles}/onboarding-game.css +0 -0
  1070. /package/{src/styles → styles}/styles.css +0 -0
  1071. /package/{src/styles → styles}/xterm.css +0 -0
  1072. /package/{dist/types → types}/index.d.ts +0 -0
  1073. /package/{dist/types → types}/index.d.ts.map +0 -0
  1074. /package/{dist/types → types}/index.js +0 -0
  1075. /package/{dist/utils → utils}/asset-url.d.ts.map +0 -0
  1076. /package/{dist/utils → utils}/assistant-text.d.ts +0 -0
  1077. /package/{dist/utils → utils}/assistant-text.d.ts.map +0 -0
  1078. /package/{dist/utils → utils}/assistant-text.js +0 -0
  1079. /package/{dist/utils → utils}/clipboard.d.ts +0 -0
  1080. /package/{dist/utils → utils}/clipboard.d.ts.map +0 -0
  1081. /package/{dist/utils → utils}/clipboard.js +0 -0
  1082. /package/{dist/utils → utils}/desktop-dialogs.d.ts +0 -0
  1083. /package/{dist/utils → utils}/desktop-dialogs.d.ts.map +0 -0
  1084. /package/{dist/utils → utils}/desktop-dialogs.js +0 -0
  1085. /package/{dist/utils → utils}/index.d.ts +0 -0
  1086. /package/{dist/utils → utils}/index.d.ts.map +0 -0
  1087. /package/{dist/utils → utils}/index.js +0 -0
  1088. /package/{dist/utils → utils}/number-parsing.d.ts +0 -0
  1089. /package/{dist/utils → utils}/number-parsing.d.ts.map +0 -0
  1090. /package/{dist/utils → utils}/number-parsing.js +0 -0
  1091. /package/{dist/utils → utils}/openExternalUrl.d.ts +0 -0
  1092. /package/{dist/utils → utils}/openExternalUrl.d.ts.map +0 -0
  1093. /package/{dist/utils → utils}/openExternalUrl.js +0 -0
  1094. /package/{dist/utils → utils}/spoken-text.d.ts +0 -0
  1095. /package/{dist/utils → utils}/spoken-text.d.ts.map +0 -0
  1096. /package/{dist/utils → utils}/spoken-text.js +0 -0
  1097. /package/{dist/utils → utils}/streaming-text.d.ts +0 -0
  1098. /package/{dist/utils → utils}/streaming-text.d.ts.map +0 -0
  1099. /package/{dist/utils → utils}/streaming-text.js +0 -0
  1100. /package/{dist/voice → voice}/index.d.ts +0 -0
  1101. /package/{dist/voice → voice}/index.d.ts.map +0 -0
  1102. /package/{dist/voice → voice}/index.js +0 -0
  1103. /package/{dist/voice → voice}/types.d.ts +0 -0
  1104. /package/{dist/voice → voice}/types.d.ts.map +0 -0
  1105. /package/{dist/voice → voice}/types.js +0 -0
  1106. /package/{dist/wallet-rpc.d.ts → wallet-rpc.d.ts} +0 -0
  1107. /package/{dist/wallet-rpc.d.ts.map → wallet-rpc.d.ts.map} +0 -0
  1108. /package/{dist/wallet-rpc.js → wallet-rpc.js} +0 -0
@@ -1,2696 +0,0 @@
1
- import { resolveAppAssetUrl } from "@elizaos/app-core/utils";
2
- import {
3
- MToonMaterialLoaderPlugin,
4
- type VRM,
5
- VRMLoaderPlugin,
6
- VRMUtils,
7
- } from "@pixiv/three-vrm";
8
- import type {
9
- SparkRenderer as SparkRendererType,
10
- SplatMesh as SparkSplatMesh,
11
- } from "@sparkjsdev/spark";
12
- import * as THREE from "three";
13
-
14
- /** Three.js NodeMaterial exposes emissiveNode/opacityNode but they are not in public MeshStandardMaterial types. */
15
- interface MeshStandardMaterialWithNodeProps {
16
- // biome-ignore lint/suspicious/noExplicitAny: THREE node types are not in public @types/three
17
- emissiveNode?: any;
18
- // biome-ignore lint/suspicious/noExplicitAny: THREE node types are not in public @types/three
19
- opacityNode?: any;
20
- }
21
-
22
- import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
23
- import { MeshoptDecoder } from "three/examples/jsm/libs/meshopt_decoder.module.js";
24
- import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
25
- import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
26
- import {
27
- type AnimationLoaderContext,
28
- loadEmoteClip,
29
- loadIdleClip,
30
- } from "./VrmAnimationLoader";
31
- import { VrmBlinkController } from "./VrmBlinkController";
32
- import {
33
- type CameraAnimationConfig,
34
- type CameraProfile,
35
- type InteractionMode,
36
- VrmCameraManager,
37
- } from "./VrmCameraManager";
38
-
39
- export type { CameraAnimationConfig, CameraProfile, InteractionMode };
40
-
41
- export type VrmEngineState = {
42
- vrmLoaded: boolean;
43
- vrmName: string | null;
44
- loadError: string | null;
45
- idlePlaying: boolean;
46
- idleTime: number;
47
- idleTracks: number;
48
- revealStarted: boolean;
49
- };
50
-
51
- type DebugVector3 = {
52
- x: number;
53
- y: number;
54
- z: number;
55
- };
56
-
57
- type DebugBounds = {
58
- min: DebugVector3;
59
- max: DebugVector3;
60
- center: DebugVector3;
61
- size: DebugVector3;
62
- };
63
-
64
- export type VrmEngineDebugInfo = {
65
- initialized: boolean;
66
- rendererBackend: RendererBackend;
67
- cameraProfile: CameraProfile;
68
- worldUrl: string | null;
69
- sceneChildren: string[];
70
- camera: {
71
- parentName: string | null;
72
- position: DebugVector3 | null;
73
- rotation: DebugVector3 | null;
74
- fov: number | null;
75
- lookAtTarget: DebugVector3;
76
- };
77
- avatar: {
78
- loaded: boolean;
79
- ready: boolean;
80
- parentName: string | null;
81
- position: DebugVector3 | null;
82
- scale: DebugVector3 | null;
83
- bounds: DebugBounds | null;
84
- };
85
- world: {
86
- loaded: boolean;
87
- parentName: string | null;
88
- position: DebugVector3 | null;
89
- scale: DebugVector3 | null;
90
- bounds: DebugBounds | null;
91
- rawBounds: DebugBounds | null;
92
- };
93
- spark: {
94
- attached: boolean;
95
- parentName: string | null;
96
- renderOrder: number | null;
97
- };
98
- };
99
-
100
- type UpdateCallback = () => void;
101
- type RendererBackend = "webgl" | "webgpu";
102
- type RendererPreference = "auto" | "webgl";
103
- type AnimationMixerFinishedEvent = {
104
- type: "finished";
105
- action: THREE.AnimationAction;
106
- direction: number;
107
- };
108
- type ElectrobunRuntimeWindow = Window & {
109
- __electrobunWindowId?: number;
110
- __electrobunWebviewId?: number;
111
- };
112
- type RendererLike = Pick<
113
- THREE.WebGLRenderer,
114
- | "dispose"
115
- | "domElement"
116
- | "render"
117
- | "setClearColor"
118
- | "setPixelRatio"
119
- | "setSize"
120
- > & {
121
- forceContextLoss?: () => void;
122
- outputColorSpace?: string;
123
- shadowMap?: {
124
- enabled: boolean;
125
- type: THREE.ShadowMapType;
126
- };
127
- toneMapping?: THREE.ToneMapping;
128
- toneMappingExposure?: number;
129
- };
130
-
131
- type TeleportFallbackShader = {
132
- uniforms: {
133
- uTeleportProgress: { value: number };
134
- };
135
- };
136
-
137
- type WorldRevealController = {
138
- mesh: SparkSplatMesh;
139
- progressUniform: { value: number };
140
- mode: "reveal" | "hide";
141
- radius: number;
142
- };
143
-
144
- type WorldRevealState = {
145
- controller: WorldRevealController;
146
- incoming: WorldRevealController;
147
- outgoing: WorldRevealController | null;
148
- progress: number;
149
- duration: number;
150
- waitingForVrm: boolean;
151
- syncToTeleport: boolean;
152
- };
153
-
154
- type TeleportSparkleParticle = {
155
- sprite: THREE.Sprite;
156
- material: THREE.SpriteMaterial;
157
- baseAngle: number;
158
- baseRadius: number;
159
- height: number;
160
- start: number;
161
- duration: number;
162
- spin: number;
163
- wobble: number;
164
- wobbleSpeed: number;
165
- baseSize: number;
166
- };
167
-
168
- type TeleportSparkleSystem = {
169
- group: THREE.Group;
170
- particles: TeleportSparkleParticle[];
171
- };
172
-
173
- const DEFAULT_CAMERA_ANIMATION: CameraAnimationConfig = {
174
- enabled: false,
175
- swayAmplitude: 0.06,
176
- bobAmplitude: 0.03,
177
- rotationAmplitude: 0.01,
178
- speed: 0.8,
179
- };
180
- const CAMERA_PROFILE_TRANSITION_DURATION_SECONDS = 0.8;
181
- const AVATAR_SWITCH_CAMERA_TRANSITION_DURATION_SECONDS = 3;
182
- const COMPANION_WORLD_SCALE = 2.5;
183
- const COMPANION_DARK_WORLD_FLOOR_OFFSET_Y = -0.95;
184
- const COMPANION_LIGHT_WORLD_FLOOR_OFFSET_Y = -0.35;
185
- const COMPANION_WORLD_REVEAL_DURATION = 5.4;
186
- const COMPANION_WORLD_REVEAL_EDGE = 0.28;
187
- const COMPANION_WORLD_REVEAL_EASE_EXPONENT = 2;
188
- const COMPANION_WORLD_REVEAL_START_OFFSET = 0.7;
189
- const TELEPORT_DISSOLVE_START_Y = -1.2;
190
- const TELEPORT_DISSOLVE_END_Y = 1.0;
191
- const TELEPORT_SPARKLE_PARTICLE_COUNT = 28;
192
- const TELEPORT_SPARKLE_RING_RADIUS = 0.52;
193
- const TELEPORT_SPARKLE_MIN_SIZE = 0.055;
194
- const TELEPORT_SPARKLE_MAX_SIZE = 0.13;
195
- const COMPANION_DOF_APERTURE_SIZE = 0.028;
196
- const COMPANION_DOF_NEAR_ZOOM_APERTURE_FACTOR = 0.4;
197
- const COMPANION_ZOOM_NEAR_FACTOR = 0.25;
198
- const COMPANION_ZOOM_MIN_RADIUS = 1.2;
199
- const SPARK_CLIP_XY = 1.08;
200
- const SPARK_MAX_STD_DEV = 2.35;
201
- const SPARK_MAX_STD_DEV_NEAR = 1.9;
202
- const SPARK_MIN_ALPHA = 0.0016;
203
- const SPARK_MIN_ALPHA_NEAR = 0.0024;
204
- const SPARK_SORT_DISTANCE = 0.035;
205
- const SPARK_SORT_DISTANCE_NEAR = 0.05;
206
- const SPARK_MAX_PIXEL_RADIUS = 96;
207
- const SPARK_MAX_PIXEL_RADIUS_NEAR = 28;
208
- const MAX_RENDERER_PIXEL_RATIO = 2;
209
- const AVATAR_RENDERER_OVERRIDE_KEY = "milady.avatarRenderer";
210
- const KNOWN_VRM_WEBGPU_WARNING =
211
- 'TSL: "transformedNormalView" is deprecated. Use "normalView" instead.';
212
-
213
- let knownVrmWebGpuWarningFilterRefs = 0;
214
- let releaseKnownVrmWebGpuWarningFilterGlobal: (() => void) | null = null;
215
- let sharedDracoLoader: DRACOLoader | null = null;
216
- let teleportSparkleTexture: THREE.CanvasTexture | null = null;
217
- const DRACO_DECODER_PATH = resolveAppAssetUrl("vrm-decoders/draco/");
218
-
219
- function getRendererPixelRatio(sparkOptimized = false): number {
220
- if (typeof window === "undefined") return 1;
221
- if (sparkOptimized) return 1;
222
- return Math.min(
223
- Math.max(window.devicePixelRatio || 1, 1),
224
- MAX_RENDERER_PIXEL_RATIO,
225
- );
226
- }
227
-
228
- function isElectrobunAvatarRuntime(): boolean {
229
- if (typeof window === "undefined") return false;
230
- const runtimeWindow = window as ElectrobunRuntimeWindow;
231
- return (
232
- typeof runtimeWindow.__electrobunWindowId === "number" ||
233
- typeof runtimeWindow.__electrobunWebviewId === "number"
234
- );
235
- }
236
-
237
- function getPreferredAvatarRendererBackend(): RendererBackend {
238
- if (typeof window === "undefined") return "webgl";
239
- const override = (() => {
240
- try {
241
- return window.localStorage.getItem(AVATAR_RENDERER_OVERRIDE_KEY);
242
- } catch {
243
- return null;
244
- }
245
- })();
246
- const normalizedOverride = override?.trim().toLowerCase();
247
- if (normalizedOverride === "webgpu" || normalizedOverride === "webgl") {
248
- return normalizedOverride;
249
- }
250
- return isElectrobunAvatarRuntime() ? "webgpu" : "webgl";
251
- }
252
-
253
- function installKnownVrmWebGpuWarningFilter(): () => void {
254
- knownVrmWebGpuWarningFilterRefs += 1;
255
-
256
- if (!releaseKnownVrmWebGpuWarningFilterGlobal) {
257
- const originalWarn = console.warn.bind(console);
258
- console.warn = (...args: Parameters<typeof console.warn>) => {
259
- if (
260
- typeof args[0] === "string" &&
261
- args[0].includes(KNOWN_VRM_WEBGPU_WARNING)
262
- ) {
263
- return;
264
- }
265
- originalWarn(...args);
266
- };
267
- releaseKnownVrmWebGpuWarningFilterGlobal = () => {
268
- knownVrmWebGpuWarningFilterRefs = Math.max(
269
- 0,
270
- knownVrmWebGpuWarningFilterRefs - 1,
271
- );
272
- if (knownVrmWebGpuWarningFilterRefs === 0) {
273
- console.warn = originalWarn;
274
- releaseKnownVrmWebGpuWarningFilterGlobal = null;
275
- }
276
- };
277
- }
278
-
279
- return () => {
280
- releaseKnownVrmWebGpuWarningFilterGlobal?.();
281
- };
282
- }
283
-
284
- function getSharedDracoLoader(): DRACOLoader {
285
- if (!sharedDracoLoader) {
286
- sharedDracoLoader = new DRACOLoader();
287
- sharedDracoLoader.setDecoderConfig({ type: "wasm" });
288
- sharedDracoLoader.setDecoderPath(DRACO_DECODER_PATH);
289
- sharedDracoLoader.preload();
290
- }
291
- return sharedDracoLoader;
292
- }
293
-
294
- function configureVrmGltfLoader(loader: GLTFLoader): void {
295
- loader.setMeshoptDecoder(MeshoptDecoder);
296
- loader.setDRACOLoader(getSharedDracoLoader());
297
- }
298
-
299
- function getTeleportSparkleTexture(): THREE.CanvasTexture {
300
- if (teleportSparkleTexture) return teleportSparkleTexture;
301
- const canvas = document.createElement("canvas");
302
- canvas.width = 128;
303
- canvas.height = 128;
304
- const context = canvas.getContext("2d");
305
- if (!context) {
306
- teleportSparkleTexture = new THREE.CanvasTexture(canvas);
307
- return teleportSparkleTexture;
308
- }
309
-
310
- const gradient = context.createRadialGradient(64, 64, 6, 64, 64, 64);
311
- gradient.addColorStop(0.0, "rgba(255,255,255,1)");
312
- gradient.addColorStop(0.2, "rgba(190,245,255,0.95)");
313
- gradient.addColorStop(0.55, "rgba(112,214,255,0.48)");
314
- gradient.addColorStop(1.0, "rgba(112,214,255,0)");
315
- context.fillStyle = gradient;
316
- context.fillRect(0, 0, 128, 128);
317
-
318
- teleportSparkleTexture = new THREE.CanvasTexture(canvas);
319
- teleportSparkleTexture.needsUpdate = true;
320
- return teleportSparkleTexture;
321
- }
322
-
323
- function quantileSorted(values: number[], percentile: number): number {
324
- if (values.length === 0) return 0;
325
- const index = Math.min(
326
- values.length - 1,
327
- Math.max(0, Math.floor((values.length - 1) * percentile)),
328
- );
329
- return values[index] ?? 0;
330
- }
331
-
332
- function getRobustPackedSplatAnchor(splatSource: {
333
- numSplats?: number;
334
- forEachSplat: SparkSplatMesh["forEachSplat"];
335
- }): THREE.Vector3 {
336
- const maxSamples = 4096;
337
- const xSamples: number[] = [];
338
- const ySamples: number[] = [];
339
- const zSamples: number[] = [];
340
- const splatCount = splatSource.numSplats ?? maxSamples;
341
- const sampleStep =
342
- splatCount > maxSamples
343
- ? Math.max(1, Math.floor(splatCount / maxSamples))
344
- : 1;
345
-
346
- splatSource.forEachSplat((index, center) => {
347
- if (sampleStep > 1 && index % sampleStep !== 0) return;
348
- xSamples.push(center.x);
349
- ySamples.push(center.y);
350
- zSamples.push(center.z);
351
- });
352
-
353
- if (xSamples.length === 0) {
354
- return new THREE.Vector3(0, 0, 0);
355
- }
356
-
357
- xSamples.sort((a, b) => a - b);
358
- ySamples.sort((a, b) => a - b);
359
- zSamples.sort((a, b) => a - b);
360
-
361
- return new THREE.Vector3(
362
- quantileSorted(xSamples, 0.5),
363
- quantileSorted(ySamples, 0.05),
364
- quantileSorted(zSamples, 0.5),
365
- );
366
- }
367
-
368
- function getRobustSplatAnchor(splat: SparkSplatMesh): THREE.Vector3 {
369
- return getRobustPackedSplatAnchor({
370
- numSplats: (
371
- splat as unknown as {
372
- packedSplats?: { numSplats?: number };
373
- }
374
- ).packedSplats?.numSplats,
375
- forEachSplat: splat.forEachSplat.bind(splat),
376
- });
377
- }
378
-
379
- function getRobustPackedSplatRadialExtent(
380
- splatSource: {
381
- numSplats?: number;
382
- forEachSplat: SparkSplatMesh["forEachSplat"];
383
- },
384
- anchor: THREE.Vector3,
385
- ): number {
386
- const maxSamples = 4096;
387
- const radialSamples: number[] = [];
388
- const splatCount = splatSource.numSplats ?? maxSamples;
389
- const sampleStep =
390
- splatCount > maxSamples
391
- ? Math.max(1, Math.floor(splatCount / maxSamples))
392
- : 1;
393
-
394
- splatSource.forEachSplat((index, center) => {
395
- if (sampleStep > 1 && index % sampleStep !== 0) return;
396
- radialSamples.push(Math.hypot(center.x - anchor.x, center.z - anchor.z));
397
- });
398
-
399
- if (radialSamples.length === 0) {
400
- return 1;
401
- }
402
-
403
- radialSamples.sort((a, b) => a - b);
404
- return Math.max(1, quantileSorted(radialSamples, 0.985));
405
- }
406
-
407
- function getRobustSplatRadialExtent(
408
- splat: SparkSplatMesh,
409
- anchor: THREE.Vector3,
410
- ): number {
411
- return getRobustPackedSplatRadialExtent(
412
- {
413
- numSplats: (
414
- splat as unknown as {
415
- packedSplats?: { numSplats?: number };
416
- }
417
- ).packedSplats?.numSplats,
418
- forEachSplat: splat.forEachSplat.bind(splat),
419
- },
420
- anchor,
421
- );
422
- }
423
-
424
- function getCompanionWorldFloorOffsetY(url: string): number {
425
- const normalizedUrl = url.toLowerCase();
426
- return normalizedUrl.includes("night") ||
427
- normalizedUrl.includes("dark") ||
428
- normalizedUrl.includes("lunarpunk")
429
- ? COMPANION_DARK_WORLD_FLOOR_OFFSET_Y
430
- : COMPANION_LIGHT_WORLD_FLOOR_OFFSET_Y;
431
- }
432
-
433
- function isGzipBuffer(buffer: ArrayBuffer): boolean {
434
- if (buffer.byteLength < 2) return false;
435
- const bytes = new Uint8Array(buffer, 0, 2);
436
- return bytes[0] === 0x1f && bytes[1] === 0x8b;
437
- }
438
-
439
- async function decompressGzipBuffer(buffer: ArrayBuffer): Promise<ArrayBuffer> {
440
- if (typeof DecompressionStream !== "function") {
441
- throw new Error(
442
- "This runtime does not support gzip-compressed VRM assets.",
443
- );
444
- }
445
- const stream = new Blob([buffer])
446
- .stream()
447
- .pipeThrough(new DecompressionStream("gzip"));
448
- return await new Response(stream).arrayBuffer();
449
- }
450
-
451
- async function loadGltfAsset(
452
- loader: GLTFLoader,
453
- url: string,
454
- ): Promise<Awaited<ReturnType<GLTFLoader["loadAsync"]>>> {
455
- const response = await fetch(url);
456
- if (!response.ok) {
457
- throw new Error(`Failed to fetch VRM asset: ${response.status}`);
458
- }
459
- let buffer = await response.arrayBuffer();
460
- if (!isGzipBuffer(buffer)) {
461
- return await loader.loadAsync(url);
462
- }
463
- buffer = await decompressGzipBuffer(buffer);
464
- const objectUrl = URL.createObjectURL(
465
- new Blob([buffer], { type: "model/gltf-binary" }),
466
- );
467
- try {
468
- return await loader.loadAsync(objectUrl);
469
- } finally {
470
- URL.revokeObjectURL(objectUrl);
471
- }
472
- }
473
-
474
- /**
475
- * Create the best available renderer for the current platform.
476
- * Electrobun's CEF desktop shell expects WebGPU for the avatar stage, while the
477
- * browser dev shell stays on WebGL by default to avoid upstream TSL noise.
478
- * A localStorage override can force either backend for debugging.
479
- * THREE.WebGPURenderer is async-init and requires await renderer.init().
480
- */
481
- async function createRenderer(
482
- canvas: HTMLCanvasElement,
483
- preference: RendererPreference = "auto",
484
- sparkOptimized = false,
485
- ): Promise<{ backend: RendererBackend; renderer: RendererLike }> {
486
- if (
487
- preference !== "webgl" &&
488
- getPreferredAvatarRendererBackend() === "webgpu" &&
489
- typeof navigator !== "undefined" &&
490
- navigator.gpu
491
- ) {
492
- try {
493
- const { WebGPURenderer } = await import("three/webgpu");
494
- const renderer = new WebGPURenderer({
495
- canvas,
496
- alpha: true,
497
- antialias: !sparkOptimized,
498
- }) as unknown as RendererLike & { init?: () => Promise<unknown> };
499
- await renderer.init?.();
500
- console.info("[VrmEngine] Using WebGPURenderer");
501
- return { backend: "webgpu", renderer };
502
- } catch (err) {
503
- console.warn(
504
- "[VrmEngine] WebGPURenderer failed, falling back to WebGL:",
505
- err,
506
- );
507
- }
508
- }
509
- const renderer = new THREE.WebGLRenderer({
510
- canvas,
511
- alpha: true,
512
- antialias: !sparkOptimized,
513
- powerPreference: sparkOptimized ? "high-performance" : "default",
514
- }) as unknown as RendererLike;
515
- console.info("[VrmEngine] Using WebGLRenderer");
516
- return { backend: "webgl", renderer };
517
- }
518
-
519
- export class VrmEngine {
520
- private static sparkModulePromise: Promise<
521
- typeof import("@sparkjsdev/spark")
522
- > | null = null;
523
- private renderer: RendererLike | null = null;
524
- private rendererBackend: RendererBackend = "webgl";
525
- private rendererPreference: RendererPreference = "auto";
526
- private scene: THREE.Scene | null = null;
527
- private avatarRoot: THREE.Group | null = null;
528
- private camera: THREE.PerspectiveCamera | null = null;
529
- private clock = new THREE.Clock();
530
- private vrm: VRM | null = null;
531
- private mixer: THREE.AnimationMixer | null = null;
532
- private idleAction: THREE.AnimationAction | null = null;
533
- private idleLoadPromise: Promise<THREE.AnimationAction | null> | null = null;
534
- private animationFrameId: number | null = null;
535
- private onUpdate: UpdateCallback | null = null;
536
- private initialized = false;
537
- private loadingAborted = false;
538
- private vrmLoadRequestId = 0;
539
- private vrmReady = false;
540
- private lastLoadError: string | null = null;
541
- private teleportProgress = 1.0;
542
- private teleportProgressUniform: { value: number } | null = null;
543
- private teleportDissolvedMaterials: THREE.Material[] = [];
544
- private teleportFallbackShaders: TeleportFallbackShader[] = [];
545
- private teleportSparkles: TeleportSparkleSystem | null = null;
546
- private revealStarted = false;
547
- private mouthValue = 0;
548
- private mouthSmoothed = 0;
549
- private vrmName: string | null = null;
550
- private lookAtTarget = new THREE.Vector3(0, 0.5, 0);
551
- private readonly idleGlbUrl = resolveAppAssetUrl("animations/idle.glb.gz");
552
- private cameraAnimation: CameraAnimationConfig = {
553
- ...DEFAULT_CAMERA_ANIMATION,
554
- };
555
- private baseCameraPosition = new THREE.Vector3();
556
- private elapsedTime = 0;
557
- private speaking = false;
558
- private speakingStartTime = 0;
559
- private readonly blinkController = new VrmBlinkController();
560
- private readonly cameraManager = new VrmCameraManager();
561
- private emoteAction: THREE.AnimationAction | null = null;
562
- private emoteTimeout: ReturnType<typeof setTimeout> | null = null;
563
- private emoteCompletionCleanup: (() => void) | null = null;
564
- private emoteClipCache = new Map<string, THREE.AnimationClip>();
565
- private emoteRequestId = 0;
566
- private controls: OrbitControls | null = null;
567
- private paused = false;
568
- private interactionEnabled = false;
569
- private interactionMode: InteractionMode = "free";
570
- private cameraProfile: CameraProfile = "chat";
571
- private worldUrl: string | null = null;
572
- private worldMesh: SparkSplatMesh | null = null;
573
- private worldReveal: WorldRevealState | null = null;
574
- private sparkRenderer: SparkRendererType | null = null;
575
- private worldLoadRequestId = 0;
576
- private pointerParallaxEnabled = false;
577
- private pointerParallaxTarget = new THREE.Vector2();
578
- private pointerParallaxCurrent = new THREE.Vector2();
579
- private pointerParallaxPosition = new THREE.Vector3();
580
- private pointerParallaxLookAt = new THREE.Vector3();
581
- private dragOrbitTarget = new THREE.Vector2();
582
- private dragOrbitCurrent = new THREE.Vector2();
583
- private companionZoomTarget = 0;
584
- private companionZoomCurrent = 0;
585
- private avatarLookTarget: THREE.Group | null = null;
586
- private headLookTarget = new THREE.Vector2();
587
- private headLookCurrent = new THREE.Vector2();
588
-
589
- private clearEmoteTimeout(): void {
590
- if (this.emoteTimeout !== null) {
591
- clearTimeout(this.emoteTimeout);
592
- this.emoteTimeout = null;
593
- }
594
- }
595
-
596
- private clearEmoteCompletionCleanup(): void {
597
- this.emoteCompletionCleanup?.();
598
- this.emoteCompletionCleanup = null;
599
- }
600
-
601
- private clearPendingEmoteCompletion(): void {
602
- this.clearEmoteTimeout();
603
- this.clearEmoteCompletionCleanup();
604
- }
605
-
606
- private watchOneShotEmoteCompletion(
607
- mixer: THREE.AnimationMixer,
608
- action: THREE.AnimationAction,
609
- requestId: number,
610
- fallbackDurationSeconds: number,
611
- ): void {
612
- const handleFinished = (event: AnimationMixerFinishedEvent): void => {
613
- if (event.action !== action) return;
614
- if (this.emoteRequestId !== requestId || this.emoteAction !== action) {
615
- return;
616
- }
617
- this.stopEmote();
618
- };
619
-
620
- mixer.addEventListener("finished", handleFinished);
621
- this.emoteCompletionCleanup = () => {
622
- mixer.removeEventListener("finished", handleFinished);
623
- };
624
-
625
- const safeDuration =
626
- Number.isFinite(fallbackDurationSeconds) && fallbackDurationSeconds > 0
627
- ? fallbackDurationSeconds
628
- : 3;
629
-
630
- // Keep a timer fallback in case the mixer completion event is missed.
631
- this.emoteTimeout = setTimeout(
632
- () => {
633
- if (this.emoteRequestId !== requestId || this.emoteAction !== action) {
634
- return;
635
- }
636
- this.stopEmote();
637
- },
638
- Math.max(0.25, safeDuration + 0.1) * 1000,
639
- );
640
- }
641
-
642
- private activateAction(action: THREE.AnimationAction): void {
643
- action.enabled = true;
644
- action.paused = false;
645
- action.setEffectiveTimeScale(1);
646
- action.setEffectiveWeight(1);
647
- action.play();
648
- }
649
-
650
- private playActionWithBlend(
651
- action: THREE.AnimationAction,
652
- fromAction: THREE.AnimationAction | null,
653
- fadeDuration: number,
654
- ): void {
655
- action.reset();
656
- this.activateAction(action);
657
- if (fromAction && fromAction !== action) {
658
- this.activateAction(fromAction);
659
- action.crossFadeFrom(fromAction, fadeDuration, false);
660
- return;
661
- }
662
- action.fadeIn(fadeDuration);
663
- }
664
-
665
- private async ensureIdleAction(
666
- vrm: VRM,
667
- mixer: THREE.AnimationMixer,
668
- ): Promise<THREE.AnimationAction | null> {
669
- if (this.idleAction) return this.idleAction;
670
- if (this.idleLoadPromise) return this.idleLoadPromise;
671
-
672
- this.idleLoadPromise = (async () => {
673
- const clip = await loadIdleClip(
674
- vrm,
675
- this.idleGlbUrl,
676
- this.animationLoaderContext,
677
- );
678
- if (!clip || this.loadingAborted || this.vrm !== vrm) {
679
- return null;
680
- }
681
- const activeMixer = this.mixer ?? mixer;
682
- if (!activeMixer || this.vrm !== vrm) {
683
- return null;
684
- }
685
- const action = activeMixer.clipAction(clip);
686
- action.reset();
687
- action.setLoop(THREE.LoopRepeat, Infinity);
688
- action.timeScale = 1.0;
689
- this.idleAction = action;
690
- activeMixer.update(1 / 60);
691
- return action;
692
- })().finally(() => {
693
- this.idleLoadPromise = null;
694
- });
695
-
696
- return this.idleLoadPromise;
697
- }
698
-
699
- private restoreIdleAfterEmote(
700
- activeEmote: THREE.AnimationAction | null,
701
- fadeDuration: number,
702
- vrm: VRM,
703
- mixer: THREE.AnimationMixer,
704
- ): void {
705
- void this.ensureIdleAction(vrm, mixer).then((idleAction) => {
706
- if (!idleAction || this.loadingAborted || this.vrm !== vrm) {
707
- activeEmote?.fadeOut(fadeDuration);
708
- return;
709
- }
710
- this.activateAction(idleAction);
711
- if (activeEmote && activeEmote !== idleAction) {
712
- idleAction.crossFadeFrom(activeEmote, fadeDuration, false);
713
- } else {
714
- idleAction.fadeIn(fadeDuration);
715
- }
716
- });
717
- }
718
- private avatarLookRig: {
719
- headBone: THREE.Object3D | null;
720
- neckBone: THREE.Object3D | null;
721
- spineBone: THREE.Object3D | null;
722
- } = {
723
- headBone: null,
724
- neckBone: null,
725
- spineBone: null,
726
- };
727
- private readonly tempCameraOrbitOffset = new THREE.Vector3();
728
- private readonly tempCameraSpherical = new THREE.Spherical();
729
- private readonly tempAvatarLookTarget = new THREE.Vector3();
730
- private readonly tempAvatarLocalTarget = new THREE.Vector3();
731
- private readonly tempAvatarLocalAnchor = new THREE.Vector3();
732
- private readonly tempAvatarHeadWorld = new THREE.Vector3();
733
- private readyPromise: Promise<void> = Promise.resolve();
734
- private resolveReady: (() => void) | null = null;
735
- private rejectReady: ((error?: unknown) => void) | null = null;
736
- private releaseKnownWebGpuWarningFilter: (() => void) | null = null;
737
-
738
- // Transition state
739
- private isCameraTransitioning = false;
740
- private transitionStartFov = 0;
741
- private transitionTargetFov = 0;
742
- private transitionStartPos = new THREE.Vector3();
743
- private transitionTargetPos = new THREE.Vector3();
744
- private transitionStartLookAt = new THREE.Vector3();
745
- private transitionTargetLookAt = new THREE.Vector3();
746
- private transitionProgress = 0;
747
- private transitionDuration = CAMERA_PROFILE_TRANSITION_DURATION_SECONDS;
748
-
749
- private handleControlStart = (): void => {
750
- if (!this.interactionEnabled) return;
751
- };
752
- private handleControlEnd = (): void => {
753
- if (!this.interactionEnabled) return;
754
- if (this.camera) {
755
- this.baseCameraPosition.copy(this.camera.position);
756
- }
757
- if (this.controls) {
758
- this.lookAtTarget.copy(this.controls.target);
759
- }
760
- };
761
-
762
- private scheduleNextFrame(): void {
763
- if (!this.initialized || this.paused || this.animationFrameId !== null) {
764
- return;
765
- }
766
- this.animationFrameId = requestAnimationFrame(() => {
767
- this.animationFrameId = null;
768
- this.loop();
769
- });
770
- }
771
-
772
- private stopLoop(): void {
773
- if (this.animationFrameId !== null) {
774
- cancelAnimationFrame(this.animationFrameId);
775
- this.animationFrameId = null;
776
- }
777
- this.clock.stop();
778
- }
779
-
780
- private resumeLoop(): void {
781
- if (!this.initialized || this.paused) return;
782
- this.clock.start();
783
- this.scheduleNextFrame();
784
- }
785
-
786
- private async loadSparkModule(): Promise<typeof import("@sparkjsdev/spark")> {
787
- if (!VrmEngine.sparkModulePromise) {
788
- VrmEngine.sparkModulePromise = import("@sparkjsdev/spark");
789
- }
790
- return VrmEngine.sparkModulePromise;
791
- }
792
-
793
- private async ensureSparkRenderer(): Promise<void> {
794
- if (this.sparkRenderer || this.rendererBackend !== "webgl") return;
795
- if (!this.scene || !this.renderer) return;
796
-
797
- const { SparkRenderer } = await this.loadSparkModule();
798
- const sparkRenderer = new SparkRenderer({
799
- renderer: this.renderer as THREE.WebGLRenderer,
800
- apertureAngle: 0.0,
801
- focalDistance: 5.0,
802
- originDistance: 1,
803
- clipXY: SPARK_CLIP_XY,
804
- maxStdDev: SPARK_MAX_STD_DEV,
805
- maxPixelRadius: SPARK_MAX_PIXEL_RADIUS,
806
- minAlpha: SPARK_MIN_ALPHA,
807
- view: {
808
- depthBias: 1,
809
- sortDistance: SPARK_SORT_DISTANCE,
810
- sortRadial: true,
811
- sort360: false,
812
- },
813
- });
814
- sparkRenderer.renderOrder = 9998;
815
- this.scene.add(sparkRenderer);
816
- this.sparkRenderer = sparkRenderer;
817
- }
818
-
819
- private updateSparkPerformanceProfile(): void {
820
- const sparkRenderer = this.sparkRenderer;
821
- if (!sparkRenderer) return;
822
- if (!this.worldMesh) {
823
- sparkRenderer.maxPixelRadius = SPARK_MAX_PIXEL_RADIUS;
824
- sparkRenderer.maxStdDev = SPARK_MAX_STD_DEV;
825
- sparkRenderer.minAlpha = SPARK_MIN_ALPHA;
826
- sparkRenderer.clipXY = SPARK_CLIP_XY;
827
- sparkRenderer.defaultView.sortDistance = SPARK_SORT_DISTANCE;
828
- return;
829
- }
830
- const isCompanionProfile =
831
- this.cameraProfile === "companion" ||
832
- this.cameraProfile === "companion_close";
833
- const closeZoomFactor = isCompanionProfile
834
- ? THREE.MathUtils.smoothstep(this.companionZoomCurrent, 0.3, 1)
835
- : 0;
836
-
837
- sparkRenderer.maxPixelRadius = THREE.MathUtils.lerp(
838
- SPARK_MAX_PIXEL_RADIUS,
839
- SPARK_MAX_PIXEL_RADIUS_NEAR,
840
- closeZoomFactor,
841
- );
842
- sparkRenderer.maxStdDev = THREE.MathUtils.lerp(
843
- SPARK_MAX_STD_DEV,
844
- SPARK_MAX_STD_DEV_NEAR,
845
- closeZoomFactor,
846
- );
847
- sparkRenderer.minAlpha = THREE.MathUtils.lerp(
848
- SPARK_MIN_ALPHA,
849
- SPARK_MIN_ALPHA_NEAR,
850
- closeZoomFactor,
851
- );
852
- sparkRenderer.clipXY = THREE.MathUtils.lerp(
853
- SPARK_CLIP_XY,
854
- 1.03,
855
- closeZoomFactor,
856
- );
857
- sparkRenderer.defaultView.sortDistance = THREE.MathUtils.lerp(
858
- SPARK_SORT_DISTANCE,
859
- SPARK_SORT_DISTANCE_NEAR,
860
- closeZoomFactor,
861
- );
862
- }
863
-
864
- private createWorldRevealController(
865
- spark: typeof import("@sparkjsdev/spark"),
866
- mesh: SparkSplatMesh,
867
- reveal: { origin: THREE.Vector3; radius: number },
868
- mode: "reveal" | "hide",
869
- ): WorldRevealController | null {
870
- const dyno = (
871
- "dyno" in spark ? Reflect.get(spark as object, "dyno") : undefined
872
- ) as
873
- | {
874
- Gsplat: unknown;
875
- dynoBlock: (
876
- inTypes: Record<string, unknown>,
877
- outTypes: Record<string, unknown>,
878
- construct: (
879
- inputs: Record<string, unknown>,
880
- ) => Record<string, unknown>,
881
- ) => unknown;
882
- dynoFloat: (value?: number, key?: string) => { value: number };
883
- dynoVec3: (
884
- value?: THREE.Vector3,
885
- key?: string,
886
- ) => { value: THREE.Vector3 };
887
- dynoConst: (type: string, value: number) => unknown;
888
- splitGsplat: (gsplat: unknown) => {
889
- outputs: {
890
- center: unknown;
891
- scales: unknown;
892
- rgb: unknown;
893
- opacity: unknown;
894
- };
895
- };
896
- combineGsplat: (value: Record<string, unknown>) => unknown;
897
- add: (a: unknown, b: unknown) => unknown;
898
- sub: (a: unknown, b: unknown) => unknown;
899
- mul: (a: unknown, b: unknown) => unknown;
900
- div: (a: unknown, b: unknown) => unknown;
901
- abs: (a: unknown) => unknown;
902
- clamp: (a: unknown, min: unknown, max: unknown) => unknown;
903
- max: (a: unknown, b: unknown) => unknown;
904
- mix: (a: unknown, b: unknown, t: unknown) => unknown;
905
- smoothstep: (edge0: unknown, edge1: unknown, x: unknown) => unknown;
906
- pow: (a: unknown, b: unknown) => unknown;
907
- length: (a: unknown) => unknown;
908
- swizzle: (a: unknown, select: string) => unknown;
909
- }
910
- | undefined;
911
- if (
912
- !dyno?.Gsplat ||
913
- !dyno.dynoBlock ||
914
- !dyno.dynoFloat ||
915
- !dyno.dynoVec3 ||
916
- !dyno.dynoConst ||
917
- !dyno.splitGsplat ||
918
- !dyno.combineGsplat ||
919
- !dyno.add ||
920
- !dyno.sub ||
921
- !dyno.mul ||
922
- !dyno.div ||
923
- !dyno.abs ||
924
- !dyno.clamp ||
925
- !dyno.max ||
926
- !dyno.mix ||
927
- !dyno.smoothstep ||
928
- !dyno.pow ||
929
- !dyno.length ||
930
- !dyno.swizzle
931
- ) {
932
- return null;
933
- }
934
-
935
- const originUniform = dyno.dynoVec3(reveal.origin, "uWorldRevealOrigin");
936
- const resolvedRadius = Math.max(
937
- reveal.radius,
938
- COMPANION_WORLD_REVEAL_EDGE * 2,
939
- );
940
- const radiusUniform = dyno.dynoFloat(resolvedRadius, "uWorldRevealRadius");
941
- const edgeUniform = dyno.dynoFloat(
942
- COMPANION_WORLD_REVEAL_EDGE,
943
- "uWorldRevealEdge",
944
- );
945
- const progressUniform = dyno.dynoFloat(0, "uWorldRevealProgress");
946
- const wireScaleUniform = dyno.dynoVec3(
947
- new THREE.Vector3(0.004, 0.004, 0.004),
948
- "uWorldRevealWireScale",
949
- );
950
- const wireAlphaUniform = dyno.dynoFloat(0.42, "uWorldRevealWireAlpha");
951
- const wireBoostUniform = dyno.dynoFloat(0.3, "uWorldRevealWireBoost");
952
- const zero = dyno.dynoConst("float", 0);
953
- const one = dyno.dynoConst("float", 1);
954
- const two = dyno.dynoConst("float", 2);
955
- const startOffset = dyno.dynoConst(
956
- "float",
957
- -COMPANION_WORLD_REVEAL_START_OFFSET,
958
- );
959
-
960
- const modifier = dyno.dynoBlock(
961
- { gsplat: dyno.Gsplat },
962
- { gsplat: dyno.Gsplat },
963
- ({ gsplat }) => {
964
- if (!gsplat) {
965
- throw new Error("Missing gsplat input for world reveal");
966
- }
967
- const { center, scales, rgb, opacity } =
968
- dyno.splitGsplat(gsplat).outputs;
969
- const radialDistance = dyno.length(
970
- dyno.swizzle(dyno.sub(center, originUniform), "xz"),
971
- );
972
- const currentRadius = dyno.add(
973
- dyno.mul(radiusUniform, progressUniform),
974
- startOffset,
975
- );
976
- const bodyMask = dyno.sub(
977
- one,
978
- dyno.smoothstep(
979
- dyno.sub(currentRadius, edgeUniform),
980
- dyno.add(currentRadius, edgeUniform),
981
- radialDistance,
982
- ),
983
- );
984
- const ringDistance = dyno.abs(dyno.sub(radialDistance, currentRadius));
985
- const ringMask = dyno.pow(
986
- dyno.sub(
987
- one,
988
- dyno.smoothstep(zero, dyno.mul(edgeUniform, two), ringDistance),
989
- ),
990
- two,
991
- );
992
- const visibleMask =
993
- mode === "hide" ? dyno.sub(one, bodyMask) : bodyMask;
994
- const wireFactor = dyno.clamp(
995
- dyno.max(visibleMask, dyno.mul(ringMask, wireAlphaUniform)),
996
- zero,
997
- one,
998
- );
999
- const brightenedRgb = dyno.mul(
1000
- rgb,
1001
- dyno.add(one, dyno.mul(ringMask, wireBoostUniform)),
1002
- );
1003
- return {
1004
- gsplat: dyno.combineGsplat({
1005
- gsplat,
1006
- scales: dyno.mix(wireScaleUniform, scales, wireFactor),
1007
- rgb: dyno.mix(brightenedRgb, rgb, visibleMask),
1008
- opacity: dyno.mul(opacity, wireFactor),
1009
- }),
1010
- };
1011
- },
1012
- );
1013
-
1014
- mesh.objectModifier = modifier as SparkSplatMesh["objectModifier"];
1015
- this.refreshSplatMesh(mesh);
1016
-
1017
- return {
1018
- mesh,
1019
- progressUniform,
1020
- mode,
1021
- radius: resolvedRadius,
1022
- };
1023
- }
1024
-
1025
- private refreshSplatMesh(mesh: SparkSplatMesh): void {
1026
- mesh.updateGenerator();
1027
- const refreshableMesh = mesh as SparkSplatMesh & {
1028
- updateVersion?: () => void;
1029
- };
1030
- refreshableMesh.updateVersion?.();
1031
- }
1032
-
1033
- private setWorldRevealProgress(
1034
- controller: WorldRevealController,
1035
- progress: number,
1036
- ): void {
1037
- controller.progressUniform.value = THREE.MathUtils.clamp(progress, 0, 1);
1038
- const refreshableMesh = controller.mesh as SparkSplatMesh & {
1039
- updateVersion?: () => void;
1040
- };
1041
- refreshableMesh.updateVersion?.();
1042
- }
1043
-
1044
- private queueWorldReveal(
1045
- incoming: WorldRevealController,
1046
- options: {
1047
- outgoing?: WorldRevealController | null;
1048
- duration?: number;
1049
- waitingForVrm?: boolean;
1050
- syncToTeleport?: boolean;
1051
- initialProgress?: number;
1052
- } = {},
1053
- ): void {
1054
- const reveal: WorldRevealState = {
1055
- controller: incoming,
1056
- incoming,
1057
- outgoing: options.outgoing ?? null,
1058
- progress: THREE.MathUtils.clamp(options.initialProgress ?? 0, 0, 1),
1059
- duration: options.duration ?? COMPANION_WORLD_REVEAL_DURATION,
1060
- waitingForVrm: options.waitingForVrm ?? false,
1061
- syncToTeleport: options.syncToTeleport ?? false,
1062
- };
1063
- incoming.mesh.opacity = 1;
1064
- if (reveal.outgoing) {
1065
- reveal.outgoing.mesh.opacity = 1;
1066
- }
1067
- this.worldReveal = reveal;
1068
- this.setWorldRevealProgress(incoming, reveal.progress);
1069
- if (reveal.outgoing) {
1070
- this.setWorldRevealProgress(reveal.outgoing, reveal.progress);
1071
- }
1072
- }
1073
-
1074
- private disposeSplatMesh(mesh: SparkSplatMesh | null): void {
1075
- if (!mesh) return;
1076
- mesh.parent?.remove(mesh);
1077
- mesh.dispose();
1078
- }
1079
-
1080
- private completeWorldReveal(reveal: WorldRevealState): void {
1081
- this.setWorldRevealProgress(reveal.incoming, 1);
1082
- reveal.incoming.mesh.opacity = 1;
1083
- reveal.incoming.mesh.objectModifier = undefined;
1084
- this.refreshSplatMesh(reveal.incoming.mesh);
1085
- if (reveal.outgoing) {
1086
- reveal.outgoing.mesh.objectModifier = undefined;
1087
- this.disposeSplatMesh(reveal.outgoing.mesh);
1088
- }
1089
- if (this.worldReveal === reveal) {
1090
- this.worldReveal = null;
1091
- }
1092
- }
1093
-
1094
- private cancelWorldReveal(): void {
1095
- if (!this.worldReveal) return;
1096
- this.completeWorldReveal(this.worldReveal);
1097
- }
1098
-
1099
- private startPendingWorldReveal(syncToTeleport: boolean): void {
1100
- const reveal = this.worldReveal;
1101
- if (!reveal || !reveal.waitingForVrm) return;
1102
- reveal.waitingForVrm = false;
1103
- reveal.syncToTeleport = syncToTeleport;
1104
- reveal.progress = syncToTeleport ? this.teleportProgress : 0;
1105
- this.setWorldRevealProgress(reveal.incoming, reveal.progress);
1106
- if (reveal.outgoing) {
1107
- this.setWorldRevealProgress(reveal.outgoing, reveal.progress);
1108
- }
1109
- }
1110
-
1111
- private updateWorldReveal(stableDelta: number): void {
1112
- const reveal = this.worldReveal;
1113
- if (!reveal || reveal.waitingForVrm) return;
1114
- const avatarRevealActive =
1115
- this.revealStarted && this.teleportProgress < 0.999;
1116
-
1117
- const nextProgress =
1118
- reveal.syncToTeleport && avatarRevealActive
1119
- ? this.teleportProgress
1120
- : Math.min(1, reveal.progress + stableDelta / reveal.duration);
1121
- const appliedProgress =
1122
- reveal.syncToTeleport && avatarRevealActive
1123
- ? nextProgress
1124
- : nextProgress ** COMPANION_WORLD_REVEAL_EASE_EXPONENT;
1125
-
1126
- reveal.progress = nextProgress;
1127
- this.setWorldRevealProgress(reveal.incoming, appliedProgress);
1128
- if (reveal.outgoing) {
1129
- this.setWorldRevealProgress(reveal.outgoing, appliedProgress);
1130
- }
1131
-
1132
- if (nextProgress >= 1) {
1133
- this.completeWorldReveal(reveal);
1134
- }
1135
- }
1136
-
1137
- private updateSparkDepthOfField(camera: THREE.PerspectiveCamera): void {
1138
- const sparkRenderer = this.sparkRenderer;
1139
- if (!sparkRenderer) return;
1140
- if (!this.worldMesh) {
1141
- sparkRenderer.apertureAngle = 0;
1142
- return;
1143
- }
1144
-
1145
- const focalDistance = Math.max(
1146
- 0.5,
1147
- camera.position.distanceTo(this.pointerParallaxLookAt),
1148
- );
1149
- const isCompanionProfile =
1150
- this.cameraProfile === "companion" ||
1151
- this.cameraProfile === "companion_close";
1152
- const closeZoomFactor = isCompanionProfile
1153
- ? THREE.MathUtils.smoothstep(this.companionZoomCurrent, 0.3, 1)
1154
- : 0;
1155
- const apertureSize = THREE.MathUtils.lerp(
1156
- COMPANION_DOF_APERTURE_SIZE,
1157
- COMPANION_DOF_APERTURE_SIZE * COMPANION_DOF_NEAR_ZOOM_APERTURE_FACTOR,
1158
- closeZoomFactor,
1159
- );
1160
- sparkRenderer.focalDistance = focalDistance;
1161
- sparkRenderer.apertureAngle =
1162
- 2 * Math.atan((0.5 * apertureSize) / sparkRenderer.focalDistance);
1163
- }
1164
-
1165
- private applyCompanionZoom(
1166
- camera: THREE.PerspectiveCamera,
1167
- stableDelta: number,
1168
- ): void {
1169
- const isCompanionProfile =
1170
- this.cameraProfile === "companion" ||
1171
- this.cameraProfile === "companion_close";
1172
- const follow = Math.min(1, stableDelta * 10);
1173
- const targetZoom = isCompanionProfile ? this.companionZoomTarget : 0;
1174
- this.companionZoomCurrent = THREE.MathUtils.lerp(
1175
- this.companionZoomCurrent,
1176
- targetZoom,
1177
- follow,
1178
- );
1179
- if (this.companionZoomCurrent < 1e-4) return;
1180
-
1181
- const baseRadius = this.baseCameraPosition.distanceTo(this.lookAtTarget);
1182
- if (!Number.isFinite(baseRadius) || baseRadius < 1e-4) return;
1183
-
1184
- const orbitOffset = this.tempCameraOrbitOffset
1185
- .copy(camera.position)
1186
- .sub(this.lookAtTarget);
1187
- if (orbitOffset.lengthSq() < 1e-6) return;
1188
-
1189
- const spherical = this.tempCameraSpherical.setFromVector3(orbitOffset);
1190
- const nearRadius = Math.max(
1191
- COMPANION_ZOOM_MIN_RADIUS,
1192
- baseRadius * COMPANION_ZOOM_NEAR_FACTOR,
1193
- );
1194
- spherical.radius = THREE.MathUtils.lerp(
1195
- baseRadius,
1196
- nearRadius,
1197
- this.companionZoomCurrent,
1198
- );
1199
- camera.position
1200
- .copy(this.lookAtTarget)
1201
- .add(orbitOffset.setFromSpherical(spherical));
1202
- }
1203
-
1204
- private configureAvatarLookTracking(vrm: VRM): void {
1205
- const target = this.avatarLookTarget;
1206
- if (target) {
1207
- target.position.set(0, 1.5, 2);
1208
- target.updateMatrixWorld(true);
1209
- }
1210
- if (vrm.lookAt && target) {
1211
- vrm.lookAt.autoUpdate = true;
1212
- vrm.lookAt.target = target;
1213
- }
1214
-
1215
- const headBone = vrm.humanoid?.getRawBoneNode("head") ?? null;
1216
- const neckBone = vrm.humanoid?.getRawBoneNode("neck") ?? null;
1217
- const spineBone =
1218
- vrm.humanoid?.getRawBoneNode("upperChest") ??
1219
- vrm.humanoid?.getRawBoneNode("chest") ??
1220
- vrm.humanoid?.getRawBoneNode("spine") ??
1221
- null;
1222
-
1223
- this.avatarLookRig = {
1224
- headBone,
1225
- neckBone,
1226
- spineBone,
1227
- };
1228
- this.headLookTarget.set(0, 0);
1229
- this.headLookCurrent.set(0, 0);
1230
- }
1231
-
1232
- private updateAvatarLookTarget(
1233
- camera: THREE.PerspectiveCamera,
1234
- stableDelta: number,
1235
- ): void {
1236
- const target = this.avatarLookTarget;
1237
- if (!target) return;
1238
- this.tempAvatarLookTarget.copy(camera.position);
1239
- const follow = Math.min(1, stableDelta * 24);
1240
- target.position.lerp(this.tempAvatarLookTarget, follow);
1241
- target.updateMatrixWorld(true);
1242
- }
1243
-
1244
- private refreshAvatarEyeTracking(): void {
1245
- const vrm = this.vrm;
1246
- if (!vrm?.lookAt || !this.avatarLookTarget) return;
1247
- vrm.lookAt.update(0);
1248
- vrm.expressionManager?.update();
1249
- }
1250
-
1251
- private applyAvatarHeadTracking(
1252
- camera: THREE.PerspectiveCamera,
1253
- stableDelta: number,
1254
- ): void {
1255
- const vrm = this.vrm;
1256
- const { headBone, neckBone, spineBone } = this.avatarLookRig;
1257
- if (!vrm || !headBone) return;
1258
- const headParent = headBone.parent;
1259
- if (!headParent || typeof headParent.worldToLocal !== "function") return;
1260
- if (
1261
- typeof THREE.Euler !== "function" ||
1262
- typeof THREE.Quaternion !== "function" ||
1263
- typeof headBone.quaternion.clone !== "function"
1264
- ) {
1265
- return;
1266
- }
1267
- const lookAtState = vrm.lookAt as
1268
- | ({ _yaw?: number; _pitch?: number } & object)
1269
- | null
1270
- | undefined;
1271
- const lookAtYawDegrees = lookAtState?._yaw;
1272
- const lookAtPitchDegrees = lookAtState?._pitch;
1273
-
1274
- if (
1275
- Number.isFinite(lookAtYawDegrees) &&
1276
- Number.isFinite(lookAtPitchDegrees)
1277
- ) {
1278
- this.headLookTarget.set(
1279
- THREE.MathUtils.clamp(
1280
- THREE.MathUtils.degToRad(lookAtYawDegrees || 0),
1281
- -0.55,
1282
- 0.55,
1283
- ),
1284
- THREE.MathUtils.clamp(
1285
- THREE.MathUtils.degToRad(lookAtPitchDegrees || 0),
1286
- -0.3,
1287
- 0.24,
1288
- ),
1289
- );
1290
- } else {
1291
- headBone.getWorldPosition(this.tempAvatarHeadWorld);
1292
- this.tempAvatarLocalTarget.copy(camera.position);
1293
- this.tempAvatarLocalTarget.y -= 0.04;
1294
- headParent.worldToLocal(this.tempAvatarLocalTarget);
1295
- headParent.worldToLocal(
1296
- this.tempAvatarLocalAnchor.copy(this.tempAvatarHeadWorld),
1297
- );
1298
- this.tempAvatarLocalTarget.sub(this.tempAvatarLocalAnchor);
1299
-
1300
- const planarDistance = Math.max(
1301
- 1e-4,
1302
- Math.hypot(this.tempAvatarLocalTarget.x, this.tempAvatarLocalTarget.z),
1303
- );
1304
- this.headLookTarget.set(
1305
- THREE.MathUtils.clamp(
1306
- Math.atan2(
1307
- -this.tempAvatarLocalTarget.x,
1308
- Math.max(-this.tempAvatarLocalTarget.z, 1e-4),
1309
- ),
1310
- -0.55,
1311
- 0.55,
1312
- ),
1313
- THREE.MathUtils.clamp(
1314
- Math.atan2(this.tempAvatarLocalTarget.y, planarDistance),
1315
- -0.3,
1316
- 0.24,
1317
- ),
1318
- );
1319
- }
1320
- this.headLookCurrent.lerp(
1321
- this.headLookTarget,
1322
- Math.min(1, stableDelta * 4.5),
1323
- );
1324
-
1325
- const applyTrackedBone = (
1326
- bone: THREE.Object3D | null,
1327
- yawWeight: number,
1328
- pitchWeight: number,
1329
- ) => {
1330
- if (
1331
- !bone ||
1332
- !bone.quaternion ||
1333
- typeof bone.quaternion.clone !== "function"
1334
- ) {
1335
- return;
1336
- }
1337
- const offsetEuler = new THREE.Euler(
1338
- this.headLookCurrent.y * pitchWeight,
1339
- this.headLookCurrent.x * yawWeight,
1340
- 0,
1341
- "YXZ",
1342
- );
1343
- const offsetQuaternion = new THREE.Quaternion().setFromEuler(offsetEuler);
1344
- const animatedPose = bone.quaternion.clone();
1345
- bone.quaternion.copy(animatedPose).multiply(offsetQuaternion);
1346
- };
1347
-
1348
- applyTrackedBone(spineBone, 0.12, 0.06);
1349
- applyTrackedBone(neckBone, 0.3, 0.18);
1350
- applyTrackedBone(headBone, 0.52, 0.28);
1351
- }
1352
-
1353
- private toDebugVector3(vector: THREE.Vector3 | null): DebugVector3 | null {
1354
- if (!vector) return null;
1355
- return {
1356
- x: Number(vector.x.toFixed(4)),
1357
- y: Number(vector.y.toFixed(4)),
1358
- z: Number(vector.z.toFixed(4)),
1359
- };
1360
- }
1361
-
1362
- private toDebugBounds(object: THREE.Object3D | null): DebugBounds | null {
1363
- if (!object) return null;
1364
- const bounds = new THREE.Box3().setFromObject(object);
1365
- if (bounds.isEmpty()) return null;
1366
- return this.toDebugBoundsFromBox(bounds);
1367
- }
1368
-
1369
- private toDebugBoundsFromBox(bounds: THREE.Box3 | null): DebugBounds | null {
1370
- if (!bounds || bounds.isEmpty()) return null;
1371
- const center = bounds.getCenter(new THREE.Vector3());
1372
- const size = bounds.getSize(new THREE.Vector3());
1373
- const min = this.toDebugVector3(bounds.min.clone());
1374
- const max = this.toDebugVector3(bounds.max.clone());
1375
- const centerVector = this.toDebugVector3(center);
1376
- const sizeVector = this.toDebugVector3(size);
1377
- if (!min || !max || !centerVector || !sizeVector) return null;
1378
- return {
1379
- min,
1380
- max,
1381
- center: centerVector,
1382
- size: sizeVector,
1383
- };
1384
- }
1385
-
1386
- getDebugInfo(): VrmEngineDebugInfo {
1387
- this.scene?.updateMatrixWorld(true);
1388
- this.vrm?.scene.updateMatrixWorld(true);
1389
- this.worldMesh?.updateMatrixWorld(true);
1390
-
1391
- const cameraRotation = this.camera
1392
- ? new THREE.Vector3(
1393
- this.camera.rotation.x,
1394
- this.camera.rotation.y,
1395
- this.camera.rotation.z,
1396
- )
1397
- : null;
1398
- const lookAtTarget =
1399
- this.toDebugVector3(this.lookAtTarget) ??
1400
- ({ x: 0, y: 0, z: 0 } satisfies DebugVector3);
1401
-
1402
- return {
1403
- initialized: this.initialized,
1404
- rendererBackend: this.rendererBackend,
1405
- cameraProfile: this.cameraProfile,
1406
- worldUrl: this.worldUrl,
1407
- sceneChildren:
1408
- this.scene?.children.map((child) => child.name || child.type) ?? [],
1409
- camera: {
1410
- parentName: this.camera?.parent?.name ?? null,
1411
- position: this.toDebugVector3(this.camera?.position ?? null),
1412
- rotation: this.toDebugVector3(cameraRotation),
1413
- fov: this.camera?.fov ?? null,
1414
- lookAtTarget,
1415
- },
1416
- avatar: {
1417
- loaded: this.vrm !== null,
1418
- ready: this.vrmReady,
1419
- parentName: this.vrm?.scene.parent?.name ?? null,
1420
- position: this.toDebugVector3(this.vrm?.scene.position ?? null),
1421
- scale: this.toDebugVector3(this.vrm?.scene.scale ?? null),
1422
- bounds: this.toDebugBounds(this.vrm?.scene ?? null),
1423
- },
1424
- world: {
1425
- loaded: this.worldMesh !== null,
1426
- parentName: this.worldMesh?.parent?.name ?? null,
1427
- position: this.toDebugVector3(this.worldMesh?.position ?? null),
1428
- scale: this.toDebugVector3(this.worldMesh?.scale ?? null),
1429
- bounds: this.toDebugBounds(this.worldMesh ?? null),
1430
- rawBounds: this.worldMesh
1431
- ? this.toDebugBoundsFromBox(this.worldMesh.getBoundingBox(true))
1432
- : null,
1433
- },
1434
- spark: {
1435
- attached: this.sparkRenderer !== null,
1436
- parentName: this.sparkRenderer?.parent?.name ?? null,
1437
- renderOrder: this.sparkRenderer?.renderOrder ?? null,
1438
- },
1439
- };
1440
- }
1441
-
1442
- setDebugAvatarVisible(visible: boolean): void {
1443
- if (!this.vrm) return;
1444
- this.vrm.scene.visible = visible;
1445
- }
1446
-
1447
- setDebugWorldPosition(x: number, y: number, z: number): void {
1448
- if (!this.worldMesh) return;
1449
- this.worldMesh.position.set(x, y, z);
1450
- }
1451
-
1452
- setDebugWorldQuaternion(x: number, y: number, z: number, w: number): void {
1453
- if (!this.worldMesh) return;
1454
- this.worldMesh.quaternion.set(x, y, z, w);
1455
- }
1456
-
1457
- setDebugCamera(position: THREE.Vector3, target: THREE.Vector3): void {
1458
- if (!this.camera) return;
1459
- this.isCameraTransitioning = false;
1460
- this.camera.position.copy(position);
1461
- this.baseCameraPosition.copy(position);
1462
- this.lookAtTarget.copy(target);
1463
- this.controls?.target.copy(target);
1464
- this.controls?.update();
1465
- this.camera.lookAt(target);
1466
- }
1467
-
1468
- private startCameraTransition(
1469
- startPos: THREE.Vector3,
1470
- startLookAt: THREE.Vector3,
1471
- startFov: number,
1472
- targetPos: THREE.Vector3,
1473
- targetLookAt: THREE.Vector3,
1474
- targetFov: number,
1475
- durationSeconds: number,
1476
- ): void {
1477
- if (!this.camera) return;
1478
-
1479
- this.transitionStartFov = startFov;
1480
- this.transitionTargetFov = targetFov;
1481
- this.transitionStartPos.copy(startPos);
1482
- this.transitionTargetPos.copy(targetPos);
1483
- this.transitionStartLookAt.copy(startLookAt);
1484
- this.transitionTargetLookAt.copy(targetLookAt);
1485
- this.transitionDuration = Math.max(0.01, durationSeconds);
1486
-
1487
- this.camera.fov = startFov;
1488
- this.camera.position.copy(startPos);
1489
- this.camera.updateProjectionMatrix();
1490
- this.baseCameraPosition.copy(startPos);
1491
- this.lookAtTarget.copy(startLookAt);
1492
- if (this.controls) {
1493
- this.controls.target.copy(startLookAt);
1494
- this.controls.update();
1495
- }
1496
- this.camera.lookAt(startLookAt);
1497
- this.isCameraTransitioning = true;
1498
- this.transitionProgress = 0;
1499
- }
1500
-
1501
- private transitionCameraToFramedAvatar(
1502
- vrm: VRM,
1503
- durationSeconds: number,
1504
- ): void {
1505
- if (!this.camera) return;
1506
-
1507
- const startPos = new THREE.Vector3().copy(this.camera.position);
1508
- const startLookAt = new THREE.Vector3().copy(this.lookAtTarget);
1509
- const startFov = this.camera.fov;
1510
- const targetLookAt = new THREE.Vector3();
1511
- const targetPos = new THREE.Vector3();
1512
-
1513
- this.cameraManager.centerAndFrame(
1514
- vrm,
1515
- this.camera,
1516
- this.controls,
1517
- this.cameraProfile,
1518
- targetLookAt,
1519
- targetPos,
1520
- (c) => this.cameraManager.applyInteractionMode(c, this.interactionMode),
1521
- );
1522
-
1523
- this.startCameraTransition(
1524
- startPos,
1525
- startLookAt,
1526
- startFov,
1527
- targetPos,
1528
- targetLookAt,
1529
- this.camera.fov,
1530
- durationSeconds,
1531
- );
1532
- }
1533
-
1534
- whenReady(): Promise<void> {
1535
- return this.readyPromise;
1536
- }
1537
-
1538
- private resetReadyPromise(): void {
1539
- this.readyPromise = new Promise<void>((resolve, reject) => {
1540
- this.resolveReady = resolve;
1541
- this.rejectReady = reject;
1542
- });
1543
- }
1544
-
1545
- private settleReady(error?: unknown): void {
1546
- if (error) {
1547
- this.rejectReady?.(error);
1548
- } else {
1549
- this.resolveReady?.();
1550
- }
1551
- this.resolveReady = null;
1552
- this.rejectReady = null;
1553
- }
1554
-
1555
- setup(
1556
- canvas: HTMLCanvasElement,
1557
- onUpdate: UpdateCallback,
1558
- options?: {
1559
- rendererPreference?: RendererPreference;
1560
- sparkOptimized?: boolean;
1561
- },
1562
- ): void {
1563
- if (this.initialized && this.renderer?.domElement === canvas) {
1564
- this.onUpdate = onUpdate;
1565
- return;
1566
- }
1567
- if (this.initialized) this.dispose();
1568
- this.onUpdate = onUpdate;
1569
- this.loadingAborted = false;
1570
- this.rendererPreference = options?.rendererPreference ?? "auto";
1571
- this.resetReadyPromise();
1572
- // Async renderer creation: tries WebGPU, falls back to WebGL.
1573
- // setup() remains synchronous for callers; the loop starts after init resolves.
1574
- void (async () => {
1575
- try {
1576
- const { backend, renderer } = await createRenderer(
1577
- canvas,
1578
- this.rendererPreference,
1579
- options?.sparkOptimized ?? false,
1580
- );
1581
- const releaseKnownWebGpuWarningFilter =
1582
- backend === "webgpu" ? installKnownVrmWebGpuWarningFilter() : null;
1583
- // Guard: if dispose() was called while we were awaiting, abort.
1584
- if (this.loadingAborted) {
1585
- releaseKnownWebGpuWarningFilter?.();
1586
- renderer.dispose();
1587
- this.settleReady();
1588
- return;
1589
- }
1590
- this.releaseKnownWebGpuWarningFilter = releaseKnownWebGpuWarningFilter;
1591
- renderer.setPixelRatio(
1592
- getRendererPixelRatio(options?.sparkOptimized ?? false),
1593
- );
1594
- renderer.setClearColor(0x000000, 0);
1595
- if (backend === "webgl") {
1596
- const webglRenderer = renderer as THREE.WebGLRenderer;
1597
- webglRenderer.shadowMap.enabled = true;
1598
- webglRenderer.shadowMap.type = THREE.PCFSoftShadowMap;
1599
- webglRenderer.toneMapping = THREE.NoToneMapping;
1600
- webglRenderer.toneMappingExposure = 1.0;
1601
- webglRenderer.outputColorSpace = THREE.SRGBColorSpace;
1602
- }
1603
- this.renderer = renderer;
1604
- this.rendererBackend = backend;
1605
- const scene = new THREE.Scene();
1606
- this.scene = scene;
1607
- const avatarRoot = new THREE.Group();
1608
- avatarRoot.name = "AvatarRoot";
1609
- scene.add(avatarRoot);
1610
- this.avatarRoot = avatarRoot;
1611
- const avatarLookTarget = new THREE.Group();
1612
- avatarLookTarget.name = "AvatarLookTarget";
1613
- scene.add(avatarLookTarget);
1614
- this.avatarLookTarget = avatarLookTarget;
1615
- const cameraRig = new THREE.Group();
1616
- cameraRig.name = "AvatarCameraRig";
1617
- scene.add(cameraRig);
1618
- const camera = new THREE.PerspectiveCamera(30, 1, 0.1, 20);
1619
- camera.position.set(0, 1.2, 5.0);
1620
- cameraRig.add(camera);
1621
- this.camera = camera;
1622
- const controls = new OrbitControls(camera, renderer.domElement);
1623
- controls.enableDamping = false;
1624
- controls.target.copy(this.lookAtTarget);
1625
- controls.addEventListener("start", this.handleControlStart);
1626
- controls.addEventListener("end", this.handleControlEnd);
1627
- this.cameraManager.applyInteractionMode(controls, this.interactionMode);
1628
- controls.update();
1629
- this.controls = controls;
1630
- this.setInteractionEnabled(this.interactionEnabled);
1631
- const ambient = new THREE.AmbientLight(0xffffff, 0.8);
1632
- scene.add(ambient);
1633
- const keyLight = new THREE.DirectionalLight(0xffffff, 1.2);
1634
- keyLight.position.set(1, 1, 1).normalize();
1635
- keyLight.castShadow = true;
1636
- keyLight.shadow.mapSize.setScalar(1024);
1637
- scene.add(keyLight);
1638
- const fillLight = new THREE.DirectionalLight(0xffffff, 0.4);
1639
- fillLight.position.set(-1, 0.5, -1).normalize();
1640
- scene.add(fillLight);
1641
- this.resize(canvas.clientWidth, canvas.clientHeight);
1642
- this.initialized = true;
1643
- this.resumeLoop();
1644
- this.settleReady();
1645
- } catch (error) {
1646
- this.initialized = false;
1647
- this.releaseKnownWebGpuWarningFilter?.();
1648
- this.releaseKnownWebGpuWarningFilter = null;
1649
- this.renderer = null;
1650
- this.rendererBackend = "webgl";
1651
- this.scene = null;
1652
- this.camera = null;
1653
- this.controls = null;
1654
- console.error("[VrmEngine] Failed to initialize renderer:", error);
1655
- this.settleReady(error);
1656
- }
1657
- })();
1658
- }
1659
-
1660
- isInitialized(): boolean {
1661
- return this.initialized && this.renderer !== null;
1662
- }
1663
- dispose(): void {
1664
- this.loadingAborted = true;
1665
- this.initialized = false;
1666
- this.settleReady();
1667
- this.releaseKnownWebGpuWarningFilter?.();
1668
- this.releaseKnownWebGpuWarningFilter = null;
1669
- if (this.animationFrameId !== null) {
1670
- cancelAnimationFrame(this.animationFrameId);
1671
- this.animationFrameId = null;
1672
- }
1673
- if (this.vrm?.scene.parent) {
1674
- this.vrm.scene.parent.remove(this.vrm.scene);
1675
- VRMUtils.deepDispose(this.vrm.scene);
1676
- }
1677
- if (this.controls) {
1678
- this.controls.removeEventListener("start", this.handleControlStart);
1679
- this.controls.removeEventListener("end", this.handleControlEnd);
1680
- this.controls.dispose();
1681
- this.controls = null;
1682
- }
1683
- this.vrm = null;
1684
- this.vrmReady = false;
1685
- this.vrmName = null;
1686
- this.lastLoadError = null;
1687
- this.mixer = null;
1688
- this.idleAction = null;
1689
- this.idleLoadPromise = null;
1690
- this.clearPendingEmoteCompletion();
1691
- this.emoteAction = null;
1692
- this.emoteClipCache.clear();
1693
- this.teleportProgress = 1.0;
1694
- this.cleanupTeleportDissolve();
1695
- this.cleanupTeleportSparkles();
1696
- this.disposeWorld();
1697
- this.avatarLookTarget?.parent?.remove(this.avatarLookTarget);
1698
- this.avatarLookTarget = null;
1699
- this.avatarLookRig = {
1700
- headBone: null,
1701
- neckBone: null,
1702
- spineBone: null,
1703
- };
1704
- this.headLookTarget.set(0, 0);
1705
- this.headLookCurrent.set(0, 0);
1706
- if (this.sparkRenderer) {
1707
- this.sparkRenderer.apertureAngle = 0;
1708
- this.sparkRenderer.removeFromParent();
1709
- this.sparkRenderer = null;
1710
- }
1711
- if (this.renderer) {
1712
- this.renderer.dispose();
1713
- }
1714
- this.renderer = null;
1715
- this.rendererBackend = "webgl";
1716
- this.scene = null;
1717
- this.avatarRoot = null;
1718
- this.camera = null;
1719
- this.onUpdate = null;
1720
- this.paused = false;
1721
- }
1722
- setPaused(paused: boolean): void {
1723
- if (this.paused === paused) return;
1724
- this.paused = paused;
1725
- if (paused) {
1726
- this.stopLoop();
1727
- return;
1728
- }
1729
- this.resumeLoop();
1730
- }
1731
- setInteractionEnabled(enabled: boolean): void {
1732
- this.interactionEnabled = enabled;
1733
- if (this.controls) {
1734
- this.controls.enabled = enabled;
1735
- }
1736
- }
1737
- setInteractionMode(mode: InteractionMode): void {
1738
- this.interactionMode = mode;
1739
- if (this.controls) {
1740
- this.cameraManager.applyInteractionMode(this.controls, mode);
1741
- this.controls.update();
1742
- }
1743
- }
1744
- setCameraProfile(profile: CameraProfile): void {
1745
- if (this.cameraProfile === profile) return;
1746
-
1747
- if (this.camera) {
1748
- const startFov = this.camera.fov;
1749
- const startPos = new THREE.Vector3().copy(this.camera.position);
1750
- const startLookAt = new THREE.Vector3().copy(this.lookAtTarget);
1751
-
1752
- this.cameraProfile = profile;
1753
-
1754
- const targetLookAt = new THREE.Vector3().copy(this.lookAtTarget);
1755
- const targetPos = new THREE.Vector3().copy(this.camera.position);
1756
-
1757
- if (this.vrm) {
1758
- this.cameraManager.centerAndFrame(
1759
- this.vrm,
1760
- this.camera,
1761
- this.controls,
1762
- this.cameraProfile,
1763
- targetLookAt,
1764
- targetPos,
1765
- (c) =>
1766
- this.cameraManager.applyInteractionMode(c, this.interactionMode),
1767
- );
1768
- } else {
1769
- this.cameraManager.applyCameraProfileToCamera(
1770
- this.camera,
1771
- this.controls,
1772
- this.cameraProfile,
1773
- );
1774
- targetPos.copy(this.camera.position);
1775
- if (this.controls) {
1776
- targetLookAt.copy(this.controls.target);
1777
- }
1778
- }
1779
-
1780
- this.startCameraTransition(
1781
- startPos,
1782
- startLookAt,
1783
- startFov,
1784
- targetPos,
1785
- targetLookAt,
1786
- this.camera.fov,
1787
- CAMERA_PROFILE_TRANSITION_DURATION_SECONDS,
1788
- );
1789
- } else {
1790
- this.cameraProfile = profile;
1791
- }
1792
- }
1793
- resize(width: number, height: number): void {
1794
- if (!this.renderer || !this.camera) return;
1795
- if (width <= 0 || height <= 0) return;
1796
- const aspect = width / height;
1797
- if (!Number.isFinite(aspect) || aspect <= 0) return;
1798
- this.renderer.setSize(width, height, false);
1799
- this.camera.aspect = aspect;
1800
- this.camera.updateProjectionMatrix();
1801
- }
1802
- getState(): VrmEngineState {
1803
- const idlePlaying = this.idleAction?.isRunning() ?? false;
1804
- return {
1805
- vrmLoaded: this.vrm !== null && this.vrmReady,
1806
- vrmName: this.vrmName,
1807
- loadError: this.lastLoadError,
1808
- idlePlaying,
1809
- idleTime: this.idleAction?.time ?? 0,
1810
- idleTracks: this.idleAction?.getClip()?.tracks.length ?? 0,
1811
- revealStarted: this.revealStarted,
1812
- };
1813
- }
1814
- setMouthOpen(value: number): void {
1815
- this.mouthValue = Math.max(0, Math.min(1, value));
1816
- }
1817
- setSpeaking(speaking: boolean): void {
1818
- if (speaking && !this.speaking) {
1819
- this.speakingStartTime = this.elapsedTime;
1820
- }
1821
- this.speaking = speaking;
1822
- }
1823
- setCameraAnimation(config: Partial<CameraAnimationConfig>): void {
1824
- this.cameraAnimation = { ...this.cameraAnimation, ...config };
1825
- }
1826
- setPointerParallaxEnabled(enabled: boolean): void {
1827
- this.pointerParallaxEnabled = enabled;
1828
- if (!enabled) {
1829
- this.pointerParallaxTarget.set(0, 0);
1830
- }
1831
- }
1832
- setPointerParallaxTarget(x: number, y: number): void {
1833
- this.pointerParallaxTarget.set(
1834
- THREE.MathUtils.clamp(x, -1, 1),
1835
- THREE.MathUtils.clamp(y, -1, 1),
1836
- );
1837
- }
1838
- resetPointerParallax(): void {
1839
- this.pointerParallaxTarget.set(0, 0);
1840
- }
1841
- setDragOrbitTarget(yaw: number, pitch: number): void {
1842
- this.dragOrbitTarget.set(
1843
- THREE.MathUtils.clamp(yaw, -0.6, 0.6),
1844
- THREE.MathUtils.clamp(pitch, -0.35, 0.35),
1845
- );
1846
- }
1847
- resetDragOrbit(): void {
1848
- this.dragOrbitTarget.set(0, 0);
1849
- }
1850
- setCompanionZoomNormalized(value: number): void {
1851
- this.companionZoomTarget = THREE.MathUtils.clamp(value, 0, 1);
1852
- }
1853
-
1854
- async setWorldUrl(url: string | null): Promise<void> {
1855
- await this.whenReady();
1856
- if (!this.scene) return;
1857
- const normalizedUrl = url?.trim() ? url : null;
1858
- if (this.worldUrl === normalizedUrl && this.worldMesh) return;
1859
-
1860
- const requestId = ++this.worldLoadRequestId;
1861
- this.worldUrl = normalizedUrl;
1862
- this.cancelWorldReveal();
1863
- const outgoingWorld = this.worldMesh;
1864
- if (!normalizedUrl) {
1865
- this.disposeWorld();
1866
- return;
1867
- }
1868
-
1869
- await this.ensureSparkRenderer();
1870
- const spark = await this.loadSparkModule();
1871
- const { SplatMesh } = spark;
1872
- let worldAnchor = new THREE.Vector3(0, 0, 0);
1873
- let worldRevealRadius = 1;
1874
- const splat = new SplatMesh({
1875
- url: normalizedUrl,
1876
- constructSplats: (packedSplats) => {
1877
- worldAnchor = getRobustPackedSplatAnchor(packedSplats);
1878
- worldRevealRadius = getRobustPackedSplatRadialExtent(
1879
- packedSplats,
1880
- worldAnchor,
1881
- );
1882
- },
1883
- });
1884
- splat.frustumCulled = false;
1885
- splat.quaternion.identity();
1886
- splat.position.set(0, 0, 0);
1887
- splat.scale.setScalar(COMPANION_WORLD_SCALE);
1888
- this.scene.add(splat);
1889
-
1890
- await splat.initialized;
1891
-
1892
- if (
1893
- this.loadingAborted ||
1894
- !this.scene ||
1895
- requestId !== this.worldLoadRequestId
1896
- ) {
1897
- splat.parent?.remove(splat);
1898
- splat.dispose();
1899
- return;
1900
- }
1901
-
1902
- const worldCenterBottom =
1903
- worldAnchor.lengthSq() > 0 ? worldAnchor : getRobustSplatAnchor(splat);
1904
- const worldFloorOffsetY = getCompanionWorldFloorOffsetY(normalizedUrl);
1905
- splat.position.set(
1906
- -worldCenterBottom.x * COMPANION_WORLD_SCALE,
1907
- -worldCenterBottom.y * COMPANION_WORLD_SCALE + worldFloorOffsetY,
1908
- -worldCenterBottom.z * COMPANION_WORLD_SCALE,
1909
- );
1910
- const syncToTeleport = this.revealStarted && this.teleportProgress < 0.999;
1911
- const waitingForVrm = !outgoingWorld && !this.vrmReady;
1912
- const incomingRevealRadius = Math.max(
1913
- worldRevealRadius * COMPANION_WORLD_SCALE,
1914
- getRobustSplatRadialExtent(splat, worldCenterBottom) *
1915
- COMPANION_WORLD_SCALE,
1916
- );
1917
- let outgoingAnchor: THREE.Vector3 | null = null;
1918
- let sharedRevealRadius = incomingRevealRadius;
1919
- if (outgoingWorld && !waitingForVrm) {
1920
- outgoingAnchor = getRobustSplatAnchor(outgoingWorld);
1921
- sharedRevealRadius = Math.max(
1922
- sharedRevealRadius,
1923
- getRobustSplatRadialExtent(outgoingWorld, outgoingAnchor) *
1924
- COMPANION_WORLD_SCALE,
1925
- );
1926
- }
1927
-
1928
- const worldReveal = this.createWorldRevealController(
1929
- spark,
1930
- splat,
1931
- {
1932
- origin: worldCenterBottom,
1933
- radius: sharedRevealRadius,
1934
- },
1935
- "reveal",
1936
- );
1937
- this.worldMesh = splat;
1938
- if (worldReveal) {
1939
- let outgoingReveal: WorldRevealController | null = null;
1940
- if (outgoingWorld && outgoingAnchor && !waitingForVrm) {
1941
- outgoingReveal = this.createWorldRevealController(
1942
- spark,
1943
- outgoingWorld,
1944
- {
1945
- origin: outgoingAnchor,
1946
- radius: sharedRevealRadius,
1947
- },
1948
- "hide",
1949
- );
1950
- if (!outgoingReveal) {
1951
- this.disposeSplatMesh(outgoingWorld);
1952
- }
1953
- }
1954
- this.queueWorldReveal(worldReveal, {
1955
- outgoing: outgoingReveal,
1956
- duration: COMPANION_WORLD_REVEAL_DURATION,
1957
- waitingForVrm,
1958
- syncToTeleport,
1959
- initialProgress: syncToTeleport ? this.teleportProgress : 0,
1960
- });
1961
- } else {
1962
- this.disposeSplatMesh(outgoingWorld);
1963
- }
1964
- }
1965
- async playEmote(
1966
- path: string,
1967
- duration: number,
1968
- loop: boolean,
1969
- ): Promise<void> {
1970
- const vrm = this.vrm;
1971
- const mixer = this.mixer;
1972
- if (!vrm || !mixer) return;
1973
- this.clearPendingEmoteCompletion();
1974
- this.emoteRequestId++;
1975
- const requestId = this.emoteRequestId;
1976
- const currentAction = this.emoteAction;
1977
- const blendSource = currentAction ?? this.idleAction;
1978
- const clip = await this.loadEmoteClipCached(path, vrm);
1979
- if (!clip || this.vrm !== vrm || this.mixer !== mixer) return;
1980
- if (this.emoteRequestId !== requestId) return;
1981
- const action = mixer.clipAction(clip);
1982
- action.setLoop(
1983
- loop ? THREE.LoopRepeat : THREE.LoopOnce,
1984
- loop ? Infinity : 1,
1985
- );
1986
- action.clampWhenFinished = !loop;
1987
- const fadeDuration = 0.4;
1988
- this.playActionWithBlend(action, blendSource, fadeDuration);
1989
- this.emoteAction = action;
1990
- if (!loop) {
1991
- const clipDuration =
1992
- Number.isFinite(duration) && duration > 0 ? duration : clip.duration;
1993
- this.watchOneShotEmoteCompletion(mixer, action, requestId, clipDuration);
1994
- }
1995
- }
1996
- stopEmote(): void {
1997
- this.clearPendingEmoteCompletion();
1998
- const fadeDuration = 0.4;
1999
- const activeEmote = this.emoteAction;
2000
- this.emoteAction = null;
2001
- if (this.idleAction) {
2002
- this.activateAction(this.idleAction);
2003
- if (activeEmote && activeEmote !== this.idleAction) {
2004
- this.idleAction.crossFadeFrom(activeEmote, fadeDuration, false);
2005
- } else {
2006
- this.idleAction.fadeIn(fadeDuration);
2007
- }
2008
- return;
2009
- }
2010
- if (this.vrm && this.mixer) {
2011
- this.restoreIdleAfterEmote(
2012
- activeEmote,
2013
- fadeDuration,
2014
- this.vrm,
2015
- this.mixer,
2016
- );
2017
- return;
2018
- }
2019
- activeEmote?.fadeOut(fadeDuration);
2020
- }
2021
-
2022
- /** Play a one-shot wave greeting after the VRM becomes visible. */
2023
- playWaveGreeting(): void {
2024
- this.playEmote("animations/emotes/waving-both-hands.glb.gz", 3, false);
2025
- }
2026
-
2027
- async loadVrmFromUrl(url: string, name?: string): Promise<void> {
2028
- await this.whenReady();
2029
- if (!this.scene) throw new Error("VrmEngine not initialized");
2030
- if (!this.camera) throw new Error("VrmEngine not initialized");
2031
- if (this.loadingAborted) return;
2032
- const requestId = ++this.vrmLoadRequestId;
2033
- const hadPreviousVrm = this.vrm !== null;
2034
- if (this.vrm) {
2035
- this.vrm.scene.parent?.remove(this.vrm.scene);
2036
- VRMUtils.deepDispose(this.vrm.scene);
2037
- this.vrm = null;
2038
- this.vrmReady = false;
2039
- this.vrmName = null;
2040
- this.mixer = null;
2041
- this.idleAction = null;
2042
- this.idleLoadPromise = null;
2043
- this.revealStarted = false;
2044
- this.cleanupTeleportSparkles();
2045
- this.stopEmote();
2046
- this.emoteClipCache.clear();
2047
- }
2048
- this.lastLoadError = null;
2049
- const loader = new GLTFLoader();
2050
- configureVrmGltfLoader(loader);
2051
- const webGpuNodes =
2052
- this.rendererBackend === "webgpu"
2053
- ? await import("@pixiv/three-vrm/nodes")
2054
- : null;
2055
- loader.register((parser) => {
2056
- if (webGpuNodes) {
2057
- const mtoonMaterialPlugin = new MToonMaterialLoaderPlugin(parser, {
2058
- materialType: webGpuNodes.MToonNodeMaterial,
2059
- });
2060
- return new VRMLoaderPlugin(parser, { mtoonMaterialPlugin });
2061
- }
2062
- return new VRMLoaderPlugin(parser);
2063
- });
2064
- let gltf: Awaited<ReturnType<GLTFLoader["loadAsync"]>>;
2065
- try {
2066
- gltf = await loadGltfAsset(loader, url);
2067
- } catch (error) {
2068
- if (!this.loadingAborted && requestId === this.vrmLoadRequestId) {
2069
- this.lastLoadError =
2070
- error instanceof Error ? error.message : String(error);
2071
- this.onUpdate?.();
2072
- }
2073
- throw error;
2074
- }
2075
- if (
2076
- this.loadingAborted ||
2077
- !this.scene ||
2078
- requestId !== this.vrmLoadRequestId
2079
- ) {
2080
- const staleVrm = gltf.userData.vrm as VRM | undefined;
2081
- if (staleVrm) VRMUtils.deepDispose(staleVrm.scene);
2082
- return;
2083
- }
2084
- const vrm = gltf.userData.vrm as VRM | undefined;
2085
- if (!vrm) throw new Error("Loaded asset is not a VRM");
2086
- VRMUtils.removeUnnecessaryVertices(vrm.scene);
2087
- if (this.camera) {
2088
- if (hadPreviousVrm) {
2089
- this.transitionCameraToFramedAvatar(
2090
- vrm,
2091
- AVATAR_SWITCH_CAMERA_TRANSITION_DURATION_SECONDS,
2092
- );
2093
- } else {
2094
- this.cameraManager.centerAndFrame(
2095
- vrm,
2096
- this.camera,
2097
- this.controls,
2098
- this.cameraProfile,
2099
- this.lookAtTarget,
2100
- this.baseCameraPosition,
2101
- (c) =>
2102
- this.cameraManager.applyInteractionMode(c, this.interactionMode),
2103
- );
2104
- }
2105
- }
2106
- try {
2107
- VRMUtils.rotateVRM0(vrm);
2108
- } catch {
2109
- /* optional in some versions */
2110
- }
2111
- this.cameraManager.ensureFacingCamera(vrm, this.camera);
2112
- this.configureAvatarLookTracking(vrm);
2113
- if (
2114
- this.loadingAborted ||
2115
- !this.scene ||
2116
- requestId !== this.vrmLoadRequestId
2117
- ) {
2118
- VRMUtils.deepDispose(vrm.scene);
2119
- return;
2120
- }
2121
- vrm.scene.visible = false;
2122
- vrm.scene.traverse((obj) => {
2123
- obj.frustumCulled = false;
2124
- });
2125
- const avatarParent = this.avatarRoot ?? this.scene;
2126
- avatarParent.add(vrm.scene);
2127
- this.vrm = vrm;
2128
- this.vrmName = name ?? null;
2129
- this.lastLoadError = null;
2130
- vrm.springBoneManager?.reset?.();
2131
- this.blinkController.reset();
2132
-
2133
- try {
2134
- await this.loadAndPlayIdle(vrm);
2135
- if (!this.loadingAborted && this.vrm === vrm) {
2136
- this.vrmReady = true;
2137
- // Let the idle animation settle into a natural pose before revealing
2138
- await new Promise((resolve) => setTimeout(resolve, 300));
2139
- if (this.loadingAborted || this.vrm !== vrm) return;
2140
- await this.playTeleportReveal(vrm);
2141
- vrm.scene.visible = true;
2142
- this.startPendingWorldReveal(true);
2143
- this.playWaveGreeting();
2144
- }
2145
- } catch {
2146
- if (!this.loadingAborted && this.vrm === vrm) {
2147
- this.vrmReady = true;
2148
- vrm.scene.visible = true;
2149
- this.startPendingWorldReveal(false);
2150
- }
2151
- }
2152
- }
2153
-
2154
- private async playTeleportReveal(vrm: VRM): Promise<void> {
2155
- this.teleportProgress = 0.0;
2156
- this.revealStarted = true;
2157
- this.cleanupTeleportDissolve();
2158
- this.startTeleportSparkles(vrm);
2159
- let appliedNodeDissolve = false;
2160
-
2161
- try {
2162
- const tsl = await import("three/tsl");
2163
-
2164
- const uProgress = tsl.uniform(0.0);
2165
- this.teleportProgressUniform = uProgress;
2166
-
2167
- vrm.scene.traverse((obj: THREE.Object3D) => {
2168
- if (!(obj instanceof THREE.Mesh)) return;
2169
- const mats = Array.isArray(obj.material)
2170
- ? obj.material
2171
- : [obj.material];
2172
- for (const mat of mats) {
2173
- if (!mat.isNodeMaterial || mat.userData._dissolveApplied) continue;
2174
- appliedNodeDissolve = true;
2175
- mat.userData._dissolveApplied = true;
2176
- mat.userData._origOpacityNode = mat.opacityNode ?? null;
2177
- mat.userData._origEmissiveNode =
2178
- (mat as MeshStandardMaterialWithNodeProps).emissiveNode ?? null;
2179
- mat.userData._origAlphaTest = mat.alphaTest;
2180
-
2181
- // World-space Y from TSL
2182
- const worldY = tsl.positionWorld.y;
2183
-
2184
- // Sweep threshold starts 1m lower than before.
2185
- const threshold = uProgress
2186
- .mul(TELEPORT_DISSOLVE_END_Y - TELEPORT_DISSOLVE_START_Y)
2187
- .add(TELEPORT_DISSOLVE_START_Y);
2188
-
2189
- // Distance above dissolve line
2190
- const diff = worldY.sub(threshold);
2191
-
2192
- // Dither noise using a hash of world position
2193
- const noiseCoord = tsl.vec2(
2194
- worldY.mul(40.0),
2195
- tsl.positionWorld.x.add(tsl.positionWorld.z).mul(30.0),
2196
- );
2197
- const noise = tsl.fract(
2198
- tsl
2199
- .sin(tsl.dot(noiseCoord, tsl.vec2(12.9898, 78.233)))
2200
- .mul(43758.5453),
2201
- );
2202
-
2203
- // Ratio: 0 = fully visible, 1 = fully hidden (wider zone = 0.3)
2204
- const ratio = diff.div(0.3).clamp(0.0, 1.0);
2205
-
2206
- // Dithered alpha: visible when noise >= ratio
2207
- const dissolveAlpha = tsl.step(ratio, noise);
2208
-
2209
- // --- Holographic glow at the dissolve edge ---
2210
- // Glow is strongest right at the dissolve boundary
2211
- const edgeDist = diff.abs();
2212
- const glowWidth = tsl.float(0.15);
2213
- const glowIntensity = tsl
2214
- .float(1.0)
2215
- .sub(edgeDist.div(glowWidth).clamp(0.0, 1.0));
2216
- // Holographic color: cyan-magenta shift based on world position
2217
- const hueShift = tsl.fract(worldY.mul(3.0).add(uProgress.mul(2.0)));
2218
- const holoR = tsl
2219
- .smoothstep(tsl.float(0.3), tsl.float(0.7), hueShift)
2220
- .mul(0.8)
2221
- .add(0.2);
2222
- const holoG = tsl.float(0.9);
2223
- const holoB = tsl
2224
- .smoothstep(tsl.float(0.7), tsl.float(0.3), hueShift)
2225
- .mul(0.8)
2226
- .add(0.2);
2227
- const holoColor = tsl.vec3(holoR, holoG, holoB);
2228
-
2229
- // Only show glow when dissolve is active and fragment is visible
2230
- const glowActive = tsl
2231
- .step(tsl.float(0.001), uProgress)
2232
- .mul(tsl.float(1.0).sub(tsl.step(tsl.float(0.999), uProgress)));
2233
- const emissiveBoost = holoColor.mul(
2234
- glowIntensity.mul(3.0).mul(glowActive).mul(dissolveAlpha),
2235
- );
2236
-
2237
- // Compose with existing nodes
2238
- const origOpacity = mat.opacityNode;
2239
- mat.opacityNode = origOpacity
2240
- ? origOpacity.mul(dissolveAlpha)
2241
- : dissolveAlpha;
2242
-
2243
- const matWithEmissive = mat as MeshStandardMaterialWithNodeProps;
2244
- const origEmissive = matWithEmissive.emissiveNode;
2245
- matWithEmissive.emissiveNode = origEmissive
2246
- ? origEmissive.add(emissiveBoost)
2247
- : emissiveBoost;
2248
-
2249
- mat.alphaTest = 0.01;
2250
- mat.transparent = true;
2251
- mat.needsUpdate = true;
2252
- this.teleportDissolvedMaterials.push(mat);
2253
- }
2254
- });
2255
- } catch (err) {
2256
- console.warn(
2257
- "[VrmEngine] TSL dissolve unavailable, showing instantly:",
2258
- err,
2259
- );
2260
- }
2261
-
2262
- if (!appliedNodeDissolve) {
2263
- this.applyTeleportFallbackDissolve(vrm);
2264
- }
2265
- }
2266
-
2267
- private applyTeleportFallbackDissolve(vrm: VRM): void {
2268
- vrm.scene.traverse((obj: THREE.Object3D) => {
2269
- if (!(obj instanceof THREE.Mesh)) return;
2270
- const mats = Array.isArray(obj.material) ? obj.material : [obj.material];
2271
- for (const mat of mats) {
2272
- if (mat.userData._dissolveApplied) continue;
2273
- mat.userData._dissolveApplied = true;
2274
- mat.userData._origTransparent = mat.transparent;
2275
- mat.userData._origAlphaTest = mat.alphaTest;
2276
- mat.userData._origOnBeforeCompile = mat.onBeforeCompile;
2277
- mat.userData._origCustomProgramCacheKey = mat.customProgramCacheKey;
2278
-
2279
- const shaderRef: TeleportFallbackShader = {
2280
- uniforms: { uTeleportProgress: { value: this.teleportProgress } },
2281
- };
2282
- this.teleportFallbackShaders.push(shaderRef);
2283
-
2284
- mat.transparent = true;
2285
- mat.alphaTest = Math.max(mat.alphaTest ?? 0, 0.01);
2286
- mat.onBeforeCompile = (
2287
- shader: Parameters<THREE.Material["onBeforeCompile"]>[0],
2288
- ) => {
2289
- shader.uniforms.uTeleportProgress =
2290
- shaderRef.uniforms.uTeleportProgress;
2291
- shader.vertexShader = `
2292
- varying vec3 vTeleportWorldPosition;
2293
- ${shader.vertexShader}
2294
- `.replace(
2295
- "#include <worldpos_vertex>",
2296
- `#include <worldpos_vertex>
2297
- vTeleportWorldPosition = worldPosition.xyz;`,
2298
- );
2299
- shader.fragmentShader = `
2300
- uniform float uTeleportProgress;
2301
- varying vec3 vTeleportWorldPosition;
2302
- float teleportNoiseHash(vec2 p) {
2303
- return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
2304
- }
2305
- ${shader.fragmentShader}
2306
- `.replace(
2307
- "#include <alphatest_fragment>",
2308
- `float teleportThreshold = mix(${TELEPORT_DISSOLVE_START_Y.toFixed(1)}, ${TELEPORT_DISSOLVE_END_Y.toFixed(1)}, uTeleportProgress);
2309
- float teleportDiff = vTeleportWorldPosition.y - teleportThreshold;
2310
- float teleportRatio = clamp(teleportDiff / 0.3, 0.0, 1.0);
2311
- float teleportNoise = teleportNoiseHash(vec2(
2312
- vTeleportWorldPosition.y * 40.0,
2313
- (vTeleportWorldPosition.x + vTeleportWorldPosition.z) * 30.0
2314
- ));
2315
- if (teleportNoise < teleportRatio) discard;
2316
- #include <alphatest_fragment>`,
2317
- );
2318
-
2319
- const originalOnBeforeCompile = mat.userData._origOnBeforeCompile;
2320
- if (typeof originalOnBeforeCompile === "function") {
2321
- originalOnBeforeCompile(shader, this.renderer as never);
2322
- }
2323
- };
2324
- mat.customProgramCacheKey = () =>
2325
- `${mat.type}:teleport-dissolve-fallback`;
2326
- mat.needsUpdate = true;
2327
- this.teleportDissolvedMaterials.push(mat);
2328
- }
2329
- });
2330
- }
2331
-
2332
- private startTeleportSparkles(vrm: VRM): void {
2333
- const parent = this.avatarRoot ?? this.scene;
2334
- if (!parent) return;
2335
-
2336
- this.cleanupTeleportSparkles();
2337
-
2338
- const bounds = new THREE.Box3().setFromObject(vrm.scene);
2339
- const center = bounds.getCenter(new THREE.Vector3());
2340
- const size = bounds.getSize(new THREE.Vector3());
2341
- const sparkleGroup = new THREE.Group();
2342
- sparkleGroup.position.set(center.x, bounds.min.y + 0.06, center.z);
2343
- parent.add(sparkleGroup);
2344
-
2345
- const texture = getTeleportSparkleTexture();
2346
- const particleHeight = THREE.MathUtils.clamp(size.y * 0.82, 0.95, 1.75);
2347
- const particles: TeleportSparkleParticle[] = [];
2348
-
2349
- for (let index = 0; index < TELEPORT_SPARKLE_PARTICLE_COUNT; index += 1) {
2350
- const hue = 0.52 + Math.random() * 0.08;
2351
- const material = new THREE.SpriteMaterial({
2352
- map: texture,
2353
- color: new THREE.Color().setHSL(hue, 0.85, 0.72),
2354
- transparent: true,
2355
- opacity: 0,
2356
- depthWrite: false,
2357
- blending: THREE.AdditiveBlending,
2358
- });
2359
- const sprite = new THREE.Sprite(material);
2360
- sprite.visible = false;
2361
- sparkleGroup.add(sprite);
2362
-
2363
- const duration = 0.3 + Math.random() * 0.32;
2364
- const maxStart = Math.max(0.02, 0.92 - duration);
2365
- particles.push({
2366
- sprite,
2367
- material,
2368
- baseAngle:
2369
- (index / TELEPORT_SPARKLE_PARTICLE_COUNT) * Math.PI * 2 +
2370
- (Math.random() - 0.5) * 0.55,
2371
- baseRadius:
2372
- (0.18 + Math.random() * 0.82) * TELEPORT_SPARKLE_RING_RADIUS,
2373
- height: particleHeight * (0.55 + Math.random() * 0.55),
2374
- start: Math.random() * maxStart,
2375
- duration,
2376
- spin: (1.8 + Math.random() * 3.6) * (Math.random() > 0.5 ? 1 : -1),
2377
- wobble: 0.02 + Math.random() * 0.08,
2378
- wobbleSpeed: 8 + Math.random() * 12,
2379
- baseSize:
2380
- TELEPORT_SPARKLE_MIN_SIZE +
2381
- Math.random() *
2382
- (TELEPORT_SPARKLE_MAX_SIZE - TELEPORT_SPARKLE_MIN_SIZE),
2383
- });
2384
- }
2385
-
2386
- this.teleportSparkles = {
2387
- group: sparkleGroup,
2388
- particles,
2389
- };
2390
- this.updateTeleportSparkles();
2391
- }
2392
-
2393
- private updateTeleportSparkles(): void {
2394
- const system = this.teleportSparkles;
2395
- if (!system) return;
2396
-
2397
- const progress = THREE.MathUtils.clamp(this.teleportProgress, 0, 1);
2398
- let anyVisible = false;
2399
-
2400
- for (const particle of system.particles) {
2401
- const localProgress = THREE.MathUtils.clamp(
2402
- (progress - particle.start) / particle.duration,
2403
- 0,
2404
- 1,
2405
- );
2406
-
2407
- if (localProgress <= 0 || localProgress >= 1) {
2408
- particle.material.opacity = 0;
2409
- particle.sprite.visible = false;
2410
- continue;
2411
- }
2412
-
2413
- anyVisible = true;
2414
- const rise = 1 - (1 - localProgress) ** 2;
2415
- const angle = particle.baseAngle + progress * Math.PI * 2 * particle.spin;
2416
- const wobblePhase = progress * particle.wobbleSpeed + particle.baseAngle;
2417
- const wobbleOffset = Math.sin(wobblePhase) * particle.wobble;
2418
- const radial = particle.baseRadius * (1 - 0.48 * rise);
2419
- const x = Math.cos(angle) * radial + wobbleOffset;
2420
- const z =
2421
- Math.sin(angle) * radial + Math.cos(wobblePhase) * particle.wobble;
2422
- const y =
2423
- 0.08 +
2424
- particle.height * rise +
2425
- Math.sin(progress * 10 + particle.baseAngle * 3) * 0.04;
2426
- const opacity =
2427
- Math.sin(localProgress * Math.PI) *
2428
- (0.72 + 0.28 * Math.sin(progress * 22 + particle.baseAngle * 5));
2429
- const scale = particle.baseSize * (0.7 + (1 - localProgress) * 1.15);
2430
-
2431
- particle.sprite.visible = opacity > 0.01;
2432
- particle.sprite.position.set(x, y, z);
2433
- particle.sprite.scale.setScalar(scale);
2434
- particle.material.opacity = opacity;
2435
- }
2436
-
2437
- if (!anyVisible && progress >= 1) {
2438
- this.cleanupTeleportSparkles();
2439
- }
2440
- }
2441
-
2442
- private cleanupTeleportDissolve(): void {
2443
- for (const mat of this.teleportDissolvedMaterials) {
2444
- if (mat.userData._dissolveApplied) {
2445
- if (mat.userData._origOpacityNode !== undefined) {
2446
- (mat as unknown as Record<string, unknown>).opacityNode =
2447
- mat.userData._origOpacityNode ?? null;
2448
- }
2449
- if (mat.userData._origEmissiveNode !== undefined) {
2450
- (mat as MeshStandardMaterialWithNodeProps).emissiveNode =
2451
- mat.userData._origEmissiveNode ?? null;
2452
- }
2453
- mat.alphaTest = mat.userData._origAlphaTest ?? 0;
2454
- mat.transparent = mat.userData._origTransparent ?? mat.transparent;
2455
- mat.onBeforeCompile =
2456
- mat.userData._origOnBeforeCompile ?? mat.onBeforeCompile;
2457
- mat.customProgramCacheKey =
2458
- mat.userData._origCustomProgramCacheKey ?? mat.customProgramCacheKey;
2459
- delete mat.userData._dissolveApplied;
2460
- delete mat.userData._origOpacityNode;
2461
- delete mat.userData._origEmissiveNode;
2462
- delete mat.userData._origAlphaTest;
2463
- delete mat.userData._origTransparent;
2464
- delete mat.userData._origOnBeforeCompile;
2465
- delete mat.userData._origCustomProgramCacheKey;
2466
- mat.needsUpdate = true;
2467
- }
2468
- }
2469
- this.teleportDissolvedMaterials = [];
2470
- this.teleportProgressUniform = null;
2471
- this.teleportFallbackShaders = [];
2472
- }
2473
-
2474
- private cleanupTeleportSparkles(): void {
2475
- if (!this.teleportSparkles) return;
2476
- for (const particle of this.teleportSparkles.particles) {
2477
- particle.sprite.parent?.remove(particle.sprite);
2478
- particle.material.dispose();
2479
- }
2480
- this.teleportSparkles.group.parent?.remove(this.teleportSparkles.group);
2481
- this.teleportSparkles = null;
2482
- }
2483
- private get animationLoaderContext(): AnimationLoaderContext {
2484
- return {
2485
- isAborted: () => this.loadingAborted,
2486
- isCurrentVrm: (vrm: VRM) => this.vrm === vrm,
2487
- };
2488
- }
2489
- private loop(): void {
2490
- if (this.paused) return;
2491
- this.scheduleNextFrame();
2492
- const renderer = this.renderer;
2493
- const scene = this.scene;
2494
- const camera = this.camera;
2495
- if (!renderer || !scene || !camera) return;
2496
- const rawDelta = this.clock.getDelta();
2497
- const stableDelta = Math.min(rawDelta, 1 / 30);
2498
- this.elapsedTime += rawDelta;
2499
- this.mixer?.update(rawDelta);
2500
- if (this.vrm) {
2501
- if (this.teleportProgress < 1.0) {
2502
- this.teleportProgress += stableDelta * 2.0; // ~0.5 seconds duration
2503
- if (this.teleportProgress > 1.0) this.teleportProgress = 1.0;
2504
-
2505
- if (this.teleportProgressUniform) {
2506
- this.teleportProgressUniform.value = this.teleportProgress;
2507
- }
2508
- for (const shader of this.teleportFallbackShaders) {
2509
- shader.uniforms.uTeleportProgress.value = this.teleportProgress;
2510
- }
2511
-
2512
- if (this.teleportProgress >= 1.0) {
2513
- this.cleanupTeleportDissolve();
2514
- this.cleanupTeleportSparkles();
2515
- }
2516
- }
2517
- this.updateTeleportSparkles();
2518
-
2519
- this.applyMouthToVrm(this.vrm);
2520
- const blinkValue = this.blinkController.update(rawDelta);
2521
- this.vrm.expressionManager?.setValue("blink", blinkValue);
2522
- }
2523
- this.updateWorldReveal(stableDelta);
2524
-
2525
- // Process camera transition
2526
- if (this.isCameraTransitioning) {
2527
- this.transitionProgress += stableDelta / this.transitionDuration;
2528
- let finished = false;
2529
- if (this.transitionProgress >= 1.0) {
2530
- this.transitionProgress = 1.0;
2531
- this.isCameraTransitioning = false;
2532
- finished = true;
2533
- }
2534
-
2535
- // Smooth step easing
2536
- const t = this.transitionProgress;
2537
- const ease = t * t * (3.0 - 2.0 * t);
2538
-
2539
- camera.position.lerpVectors(
2540
- this.transitionStartPos,
2541
- this.transitionTargetPos,
2542
- ease,
2543
- );
2544
- this.baseCameraPosition.copy(camera.position);
2545
-
2546
- this.lookAtTarget.lerpVectors(
2547
- this.transitionStartLookAt,
2548
- this.transitionTargetLookAt,
2549
- ease,
2550
- );
2551
-
2552
- camera.fov = THREE.MathUtils.lerp(
2553
- this.transitionStartFov,
2554
- this.transitionTargetFov,
2555
- ease,
2556
- );
2557
- camera.updateProjectionMatrix();
2558
-
2559
- if (this.controls) {
2560
- this.controls.target.copy(this.lookAtTarget);
2561
- if (finished) {
2562
- this.controls.update(); // Sync once at the very end when bounds match
2563
- }
2564
- }
2565
- }
2566
-
2567
- const manualCameraActive = this.interactionEnabled;
2568
- if (
2569
- !manualCameraActive &&
2570
- this.cameraAnimation.enabled &&
2571
- this.baseCameraPosition.length() > 0 &&
2572
- !this.isCameraTransitioning
2573
- ) {
2574
- this.cameraManager.applyCameraMotion(
2575
- camera,
2576
- this.baseCameraPosition,
2577
- this.lookAtTarget,
2578
- this.cameraAnimation,
2579
- this.elapsedTime,
2580
- );
2581
- }
2582
- const dragOrbitFollow = Math.min(1, stableDelta * 9);
2583
- this.dragOrbitCurrent.lerp(this.dragOrbitTarget, dragOrbitFollow);
2584
- if (
2585
- this.dragOrbitCurrent.lengthSq() > 1e-6 &&
2586
- this.baseCameraPosition.lengthSq() > 1e-6
2587
- ) {
2588
- const orbitOffset = this.tempCameraOrbitOffset
2589
- .copy(camera.position)
2590
- .sub(this.lookAtTarget);
2591
- if (orbitOffset.lengthSq() > 1e-6) {
2592
- const spherical = this.tempCameraSpherical.setFromVector3(orbitOffset);
2593
- spherical.theta += this.dragOrbitCurrent.x;
2594
- spherical.phi = THREE.MathUtils.clamp(
2595
- spherical.phi + this.dragOrbitCurrent.y,
2596
- 0.2,
2597
- Math.PI - 0.2,
2598
- );
2599
- orbitOffset.setFromSpherical(spherical);
2600
- camera.position.copy(this.lookAtTarget).add(orbitOffset);
2601
- }
2602
- }
2603
- this.applyCompanionZoom(camera, stableDelta);
2604
- this.updateSparkPerformanceProfile();
2605
- if (this.pointerParallaxEnabled) {
2606
- const follow = Math.min(1, stableDelta * 7.5);
2607
- this.pointerParallaxCurrent.lerp(this.pointerParallaxTarget, follow);
2608
- this.pointerParallaxPosition.set(
2609
- this.pointerParallaxCurrent.x * 0.18,
2610
- this.pointerParallaxCurrent.y * 0.12,
2611
- 0,
2612
- );
2613
- camera.position.add(this.pointerParallaxPosition);
2614
- this.pointerParallaxLookAt
2615
- .copy(this.lookAtTarget)
2616
- .add(
2617
- new THREE.Vector3(
2618
- this.pointerParallaxCurrent.x * 0.08,
2619
- this.pointerParallaxCurrent.y * 0.05,
2620
- 0,
2621
- ),
2622
- );
2623
- } else {
2624
- this.pointerParallaxCurrent.lerp(this.pointerParallaxTarget, 0.12);
2625
- this.pointerParallaxLookAt.copy(this.lookAtTarget);
2626
- }
2627
- if (this.controls) {
2628
- if (manualCameraActive && !this.isCameraTransitioning) {
2629
- this.controls.update();
2630
- this.lookAtTarget.copy(this.controls.target);
2631
- } else if (!this.isCameraTransitioning) {
2632
- this.controls.target.copy(this.lookAtTarget);
2633
- }
2634
- }
2635
- if (!manualCameraActive || this.isCameraTransitioning) {
2636
- camera.lookAt(this.pointerParallaxLookAt);
2637
- }
2638
- if (this.vrm) {
2639
- this.updateAvatarLookTarget(camera, stableDelta);
2640
- this.vrm.update(stableDelta);
2641
- this.applyAvatarHeadTracking(camera, stableDelta);
2642
- this.refreshAvatarEyeTracking();
2643
- }
2644
- this.updateSparkDepthOfField(camera);
2645
- renderer.render(scene, camera);
2646
- this.onUpdate?.();
2647
- }
2648
- private disposeWorld(): void {
2649
- if (this.sparkRenderer) {
2650
- this.sparkRenderer.apertureAngle = 0;
2651
- }
2652
- this.cancelWorldReveal();
2653
- this.disposeSplatMesh(this.worldMesh);
2654
- this.worldMesh = null;
2655
- }
2656
- private async loadAndPlayIdle(vrm: VRM): Promise<void> {
2657
- if (this.loadingAborted) return;
2658
- const mixer = this.mixer ?? new THREE.AnimationMixer(vrm.scene);
2659
- this.mixer = mixer;
2660
- const action = await this.ensureIdleAction(vrm, mixer);
2661
- if (!action) return;
2662
- action.fadeIn(0.25);
2663
- action.play();
2664
- mixer.update(1 / 60);
2665
- }
2666
- private async loadEmoteClipCached(
2667
- path: string,
2668
- vrm: VRM,
2669
- ): Promise<THREE.AnimationClip | null> {
2670
- const cached = this.emoteClipCache.get(path);
2671
- if (cached) return cached;
2672
- const clip = await loadEmoteClip(path, vrm, this.animationLoaderContext);
2673
- if (clip) {
2674
- this.emoteClipCache.set(path, clip);
2675
- }
2676
- return clip;
2677
- }
2678
- private applyMouthToVrm(vrm: VRM): void {
2679
- const manager = vrm.expressionManager;
2680
- if (!manager) return;
2681
- let target: number;
2682
- if (this.speaking) {
2683
- const elapsed = this.elapsedTime - this.speakingStartTime;
2684
- const base = Math.sin(elapsed * 12) * 0.3 + 0.4;
2685
- const detail = Math.sin(elapsed * 18.7) * 0.15;
2686
- const slow = Math.sin(elapsed * 4.2) * 0.1;
2687
- target = Math.max(0, Math.min(1, base + detail + slow));
2688
- } else {
2689
- target = this.mouthValue;
2690
- }
2691
- const next = Math.max(0, Math.min(1, target));
2692
- const alpha = next > this.mouthSmoothed ? 0.3 : 0.2;
2693
- this.mouthSmoothed = this.mouthSmoothed * (1 - alpha) + next * alpha;
2694
- manager.setValue("aa", this.mouthSmoothed);
2695
- }
2696
- }