@elizaos/app-core 2.0.0-alpha.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -0
- package/LICENSE +21 -0
- package/dist/App.d.ts +5 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +198 -0
- package/dist/actions/character.d.ts +27 -0
- package/dist/actions/character.d.ts.map +1 -0
- package/dist/actions/character.js +97 -0
- package/dist/actions/chat-helpers.d.ts +47 -0
- package/dist/actions/chat-helpers.d.ts.map +1 -0
- package/dist/actions/chat-helpers.js +79 -0
- package/dist/actions/cloud.d.ts +17 -0
- package/dist/actions/cloud.d.ts.map +1 -0
- package/dist/actions/cloud.js +43 -0
- package/dist/actions/index.d.ts +12 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +11 -0
- package/dist/actions/lifecycle.d.ts +43 -0
- package/dist/actions/lifecycle.d.ts.map +1 -0
- package/dist/actions/lifecycle.js +118 -0
- package/dist/actions/onboarding.d.ts +12 -0
- package/dist/actions/onboarding.d.ts.map +1 -0
- package/dist/actions/onboarding.js +28 -0
- package/dist/actions/triggers.d.ts +23 -0
- package/dist/actions/triggers.d.ts.map +1 -0
- package/dist/actions/triggers.js +148 -0
- package/dist/api/client.d.ts +2823 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +2392 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +1 -0
- package/dist/autonomy/index.d.ts +48 -0
- package/dist/autonomy/index.d.ts.map +1 -0
- package/dist/autonomy/index.js +330 -0
- package/dist/bridge/capacitor-bridge.d.ts +153 -0
- package/dist/bridge/capacitor-bridge.d.ts.map +1 -0
- package/dist/bridge/capacitor-bridge.js +193 -0
- package/dist/bridge/electrobun-rpc.d.ts +19 -0
- package/dist/bridge/electrobun-rpc.d.ts.map +1 -0
- package/dist/bridge/electrobun-rpc.js +27 -0
- package/dist/bridge/electrobun-runtime.d.ts +3 -0
- package/dist/bridge/electrobun-runtime.d.ts.map +1 -0
- package/dist/bridge/electrobun-runtime.js +17 -0
- package/dist/bridge/index.d.ts +6 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +5 -0
- package/dist/bridge/native-plugins.d.ts +82 -0
- package/dist/bridge/native-plugins.d.ts.map +1 -0
- package/dist/bridge/native-plugins.js +39 -0
- package/dist/bridge/plugin-bridge.d.ts +116 -0
- package/dist/bridge/plugin-bridge.d.ts.map +1 -0
- package/dist/bridge/plugin-bridge.js +203 -0
- package/dist/bridge/storage-bridge.d.ts +39 -0
- package/dist/bridge/storage-bridge.d.ts.map +1 -0
- package/dist/bridge/storage-bridge.js +135 -0
- package/dist/chat/index.d.ts +57 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +161 -0
- package/dist/coding/index.d.ts +25 -0
- package/dist/coding/index.d.ts.map +1 -0
- package/dist/coding/index.js +25 -0
- package/dist/components/AdvancedPageView.d.ts +17 -0
- package/dist/components/AdvancedPageView.d.ts.map +1 -0
- package/dist/components/AdvancedPageView.js +137 -0
- package/dist/components/AgentActivityBox.d.ts +7 -0
- package/dist/components/AgentActivityBox.d.ts.map +1 -0
- package/dist/components/AgentActivityBox.js +25 -0
- package/dist/components/ApiKeyConfig.d.ts +26 -0
- package/dist/components/ApiKeyConfig.d.ts.map +1 -0
- package/dist/components/ApiKeyConfig.js +121 -0
- package/dist/components/AppsPageView.d.ts +7 -0
- package/dist/components/AppsPageView.d.ts.map +1 -0
- package/dist/components/AppsPageView.js +31 -0
- package/dist/components/AppsView.d.ts +8 -0
- package/dist/components/AppsView.d.ts.map +1 -0
- package/dist/components/AppsView.js +149 -0
- package/dist/components/AvatarLoader.d.ts +9 -0
- package/dist/components/AvatarLoader.d.ts.map +1 -0
- package/dist/components/AvatarLoader.js +45 -0
- package/dist/components/AvatarSelector.d.ts +23 -0
- package/dist/components/AvatarSelector.d.ts.map +1 -0
- package/dist/components/AvatarSelector.js +105 -0
- package/dist/components/BscTradePanel.d.ts +22 -0
- package/dist/components/BscTradePanel.d.ts.map +1 -0
- package/dist/components/BscTradePanel.js +221 -0
- package/dist/components/BugReportModal.d.ts +2 -0
- package/dist/components/BugReportModal.d.ts.map +1 -0
- package/dist/components/BugReportModal.js +218 -0
- package/dist/components/CharacterView.d.ts +8 -0
- package/dist/components/CharacterView.d.ts.map +1 -0
- package/dist/components/CharacterView.js +703 -0
- package/dist/components/ChatAvatar.d.ts +8 -0
- package/dist/components/ChatAvatar.d.ts.map +1 -0
- package/dist/components/ChatAvatar.js +89 -0
- package/dist/components/ChatComposer.d.ts +37 -0
- package/dist/components/ChatComposer.d.ts.map +1 -0
- package/dist/components/ChatComposer.js +136 -0
- package/dist/components/ChatMessage.d.ts +24 -0
- package/dist/components/ChatMessage.d.ts.map +1 -0
- package/dist/components/ChatMessage.js +167 -0
- package/dist/components/ChatModalView.d.ts +10 -0
- package/dist/components/ChatModalView.d.ts.map +1 -0
- package/dist/components/ChatModalView.js +57 -0
- package/dist/components/ChatView.d.ts +14 -0
- package/dist/components/ChatView.d.ts.map +1 -0
- package/dist/components/ChatView.js +511 -0
- package/dist/components/CloudSourceControls.d.ts +13 -0
- package/dist/components/CloudSourceControls.d.ts.map +1 -0
- package/dist/components/CloudSourceControls.js +14 -0
- package/dist/components/CodingAgentSettingsSection.d.ts +2 -0
- package/dist/components/CodingAgentSettingsSection.d.ts.map +1 -0
- package/dist/components/CodingAgentSettingsSection.js +268 -0
- package/dist/components/CommandPalette.d.ts +2 -0
- package/dist/components/CommandPalette.d.ts.map +1 -0
- package/dist/components/CommandPalette.js +181 -0
- package/dist/components/CompanionSceneHost.d.ts +15 -0
- package/dist/components/CompanionSceneHost.d.ts.map +1 -0
- package/dist/components/CompanionSceneHost.js +343 -0
- package/dist/components/CompanionShell.d.ts +17 -0
- package/dist/components/CompanionShell.d.ts.map +1 -0
- package/dist/components/CompanionShell.js +15 -0
- package/dist/components/CompanionView.d.ts +2 -0
- package/dist/components/CompanionView.d.ts.map +1 -0
- package/dist/components/CompanionView.js +22 -0
- package/dist/components/ConfigPageView.d.ts +11 -0
- package/dist/components/ConfigPageView.d.ts.map +1 -0
- package/dist/components/ConfigPageView.js +275 -0
- package/dist/components/ConfigSaveFooter.d.ts +8 -0
- package/dist/components/ConfigSaveFooter.d.ts.map +1 -0
- package/dist/components/ConfigSaveFooter.js +10 -0
- package/dist/components/ConfirmModal.d.ts +61 -0
- package/dist/components/ConfirmModal.d.ts.map +1 -0
- package/dist/components/ConfirmModal.js +164 -0
- package/dist/components/ConnectionFailedBanner.d.ts +6 -0
- package/dist/components/ConnectionFailedBanner.d.ts.map +1 -0
- package/dist/components/ConnectionFailedBanner.js +22 -0
- package/dist/components/ConnectorsPageView.d.ts +7 -0
- package/dist/components/ConnectorsPageView.d.ts.map +1 -0
- package/dist/components/ConnectorsPageView.js +8 -0
- package/dist/components/ConversationsSidebar.d.ts +9 -0
- package/dist/components/ConversationsSidebar.d.ts.map +1 -0
- package/dist/components/ConversationsSidebar.js +116 -0
- package/dist/components/CustomActionEditor.d.ts +10 -0
- package/dist/components/CustomActionEditor.d.ts.map +1 -0
- package/dist/components/CustomActionEditor.js +578 -0
- package/dist/components/CustomActionsPanel.d.ts +9 -0
- package/dist/components/CustomActionsPanel.d.ts.map +1 -0
- package/dist/components/CustomActionsPanel.js +107 -0
- package/dist/components/CustomActionsView.d.ts +2 -0
- package/dist/components/CustomActionsView.d.ts.map +1 -0
- package/dist/components/CustomActionsView.js +134 -0
- package/dist/components/DatabasePageView.d.ts +5 -0
- package/dist/components/DatabasePageView.d.ts.map +1 -0
- package/dist/components/DatabasePageView.js +28 -0
- package/dist/components/DatabaseView.d.ts +9 -0
- package/dist/components/DatabaseView.d.ts.map +1 -0
- package/dist/components/DatabaseView.js +311 -0
- package/dist/components/ElizaCloudDashboard.d.ts +2 -0
- package/dist/components/ElizaCloudDashboard.d.ts.map +1 -0
- package/dist/components/ElizaCloudDashboard.js +657 -0
- package/dist/components/EmotePicker.d.ts +2 -0
- package/dist/components/EmotePicker.d.ts.map +1 -0
- package/dist/components/EmotePicker.js +343 -0
- package/dist/components/ErrorBoundary.d.ts +22 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.js +31 -0
- package/dist/components/FineTuningView.d.ts +2 -0
- package/dist/components/FineTuningView.d.ts.map +1 -0
- package/dist/components/FineTuningView.js +433 -0
- package/dist/components/GameView.d.ts +11 -0
- package/dist/components/GameView.d.ts.map +1 -0
- package/dist/components/GameView.js +295 -0
- package/dist/components/GameViewOverlay.d.ts +8 -0
- package/dist/components/GameViewOverlay.d.ts.map +1 -0
- package/dist/components/GameViewOverlay.js +70 -0
- package/dist/components/GlobalEmoteOverlay.d.ts +2 -0
- package/dist/components/GlobalEmoteOverlay.d.ts.map +1 -0
- package/dist/components/GlobalEmoteOverlay.js +112 -0
- package/dist/components/Header.d.ts +8 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +121 -0
- package/dist/components/HeartbeatsView.d.ts +2 -0
- package/dist/components/HeartbeatsView.d.ts.map +1 -0
- package/dist/components/HeartbeatsView.js +378 -0
- package/dist/components/InventoryView.d.ts +10 -0
- package/dist/components/InventoryView.d.ts.map +1 -0
- package/dist/components/InventoryView.js +162 -0
- package/dist/components/KnowledgeView.d.ts +20 -0
- package/dist/components/KnowledgeView.d.ts.map +1 -0
- package/dist/components/KnowledgeView.js +480 -0
- package/dist/components/LanguageDropdown.d.ts +30 -0
- package/dist/components/LanguageDropdown.d.ts.map +1 -0
- package/dist/components/LanguageDropdown.js +98 -0
- package/dist/components/LifoMonitorPanel.d.ts +21 -0
- package/dist/components/LifoMonitorPanel.d.ts.map +1 -0
- package/dist/components/LifoMonitorPanel.js +24 -0
- package/dist/components/LifoSandboxView.d.ts +5 -0
- package/dist/components/LifoSandboxView.d.ts.map +1 -0
- package/dist/components/LifoSandboxView.js +333 -0
- package/dist/components/LoadingScreen.d.ts +13 -0
- package/dist/components/LoadingScreen.d.ts.map +1 -0
- package/dist/components/LoadingScreen.js +39 -0
- package/dist/components/LogsPageView.d.ts +2 -0
- package/dist/components/LogsPageView.d.ts.map +1 -0
- package/dist/components/LogsPageView.js +7 -0
- package/dist/components/LogsView.d.ts +5 -0
- package/dist/components/LogsView.d.ts.map +1 -0
- package/dist/components/LogsView.js +71 -0
- package/dist/components/MediaGalleryView.d.ts +9 -0
- package/dist/components/MediaGalleryView.d.ts.map +1 -0
- package/dist/components/MediaGalleryView.js +236 -0
- package/dist/components/MediaSettingsSection.d.ts +11 -0
- package/dist/components/MediaSettingsSection.d.ts.map +1 -0
- package/dist/components/MediaSettingsSection.js +329 -0
- package/dist/components/MessageContent.d.ts +51 -0
- package/dist/components/MessageContent.d.ts.map +1 -0
- package/dist/components/MessageContent.js +553 -0
- package/dist/components/OnboardingWizard.d.ts +2 -0
- package/dist/components/OnboardingWizard.d.ts.map +1 -0
- package/dist/components/OnboardingWizard.js +59 -0
- package/dist/components/PairingView.d.ts +5 -0
- package/dist/components/PairingView.d.ts.map +1 -0
- package/dist/components/PairingView.js +28 -0
- package/dist/components/PermissionsSection.d.ts +20 -0
- package/dist/components/PermissionsSection.d.ts.map +1 -0
- package/dist/components/PermissionsSection.js +368 -0
- package/dist/components/PluginsPageView.d.ts +5 -0
- package/dist/components/PluginsPageView.d.ts.map +1 -0
- package/dist/components/PluginsPageView.js +8 -0
- package/dist/components/PluginsView.d.ts +21 -0
- package/dist/components/PluginsView.d.ts.map +1 -0
- package/dist/components/PluginsView.js +1531 -0
- package/dist/components/ProviderSwitcher.d.ts +42 -0
- package/dist/components/ProviderSwitcher.d.ts.map +1 -0
- package/dist/components/ProviderSwitcher.js +480 -0
- package/dist/components/RestartBanner.d.ts +2 -0
- package/dist/components/RestartBanner.d.ts.map +1 -0
- package/dist/components/RestartBanner.js +36 -0
- package/dist/components/RuntimeView.d.ts +10 -0
- package/dist/components/RuntimeView.d.ts.map +1 -0
- package/dist/components/RuntimeView.js +165 -0
- package/dist/components/SaveCommandModal.d.ts +12 -0
- package/dist/components/SaveCommandModal.d.ts.map +1 -0
- package/dist/components/SaveCommandModal.js +84 -0
- package/dist/components/SecretsView.d.ts +9 -0
- package/dist/components/SecretsView.d.ts.map +1 -0
- package/dist/components/SecretsView.js +249 -0
- package/dist/components/SettingsView.d.ts +9 -0
- package/dist/components/SettingsView.d.ts.map +1 -0
- package/dist/components/SettingsView.js +230 -0
- package/dist/components/ShellOverlays.d.ts +8 -0
- package/dist/components/ShellOverlays.d.ts.map +1 -0
- package/dist/components/ShellOverlays.js +10 -0
- package/dist/components/ShortcutsOverlay.d.ts +2 -0
- package/dist/components/ShortcutsOverlay.d.ts.map +1 -0
- package/dist/components/ShortcutsOverlay.js +79 -0
- package/dist/components/SkillsView.d.ts +11 -0
- package/dist/components/SkillsView.d.ts.map +1 -0
- package/dist/components/SkillsView.js +358 -0
- package/dist/components/StartupFailureView.d.ts +8 -0
- package/dist/components/StartupFailureView.d.ts.map +1 -0
- package/dist/components/StartupFailureView.js +15 -0
- package/dist/components/StreamView.d.ts +16 -0
- package/dist/components/StreamView.d.ts.map +1 -0
- package/dist/components/StreamView.js +300 -0
- package/dist/components/StripeEmbeddedCheckout.d.ts +24 -0
- package/dist/components/StripeEmbeddedCheckout.d.ts.map +1 -0
- package/dist/components/StripeEmbeddedCheckout.js +101 -0
- package/dist/components/SubscriptionStatus.d.ts +22 -0
- package/dist/components/SubscriptionStatus.d.ts.map +1 -0
- package/dist/components/SubscriptionStatus.js +301 -0
- package/dist/components/SystemWarningBanner.d.ts +6 -0
- package/dist/components/SystemWarningBanner.d.ts.map +1 -0
- package/dist/components/SystemWarningBanner.js +46 -0
- package/dist/components/ThemeToggle.d.ts +21 -0
- package/dist/components/ThemeToggle.d.ts.map +1 -0
- package/dist/components/ThemeToggle.js +24 -0
- package/dist/components/TrajectoriesView.d.ts +12 -0
- package/dist/components/TrajectoriesView.d.ts.map +1 -0
- package/dist/components/TrajectoriesView.js +183 -0
- package/dist/components/TrajectoryDetailView.d.ts +13 -0
- package/dist/components/TrajectoryDetailView.d.ts.map +1 -0
- package/dist/components/TrajectoryDetailView.js +112 -0
- package/dist/components/TriggersView.d.ts +2 -0
- package/dist/components/TriggersView.d.ts.map +1 -0
- package/dist/components/TriggersView.js +1 -0
- package/dist/components/VectorBrowserView.d.ts +10 -0
- package/dist/components/VectorBrowserView.d.ts.map +1 -0
- package/dist/components/VectorBrowserView.js +997 -0
- package/dist/components/VoiceConfigView.d.ts +11 -0
- package/dist/components/VoiceConfigView.d.ts.map +1 -0
- package/dist/components/VoiceConfigView.js +329 -0
- package/dist/components/VrmStage.d.ts +21 -0
- package/dist/components/VrmStage.d.ts.map +1 -0
- package/dist/components/VrmStage.js +252 -0
- package/dist/components/WhatsAppQrOverlay.d.ts +8 -0
- package/dist/components/WhatsAppQrOverlay.d.ts.map +1 -0
- package/dist/components/WhatsAppQrOverlay.js +63 -0
- package/dist/components/apps/AppDetailPane.d.ts +15 -0
- package/dist/components/apps/AppDetailPane.d.ts.map +1 -0
- package/dist/components/apps/AppDetailPane.js +13 -0
- package/dist/components/apps/AppsCatalogGrid.d.ts +20 -0
- package/dist/components/apps/AppsCatalogGrid.d.ts.map +1 -0
- package/dist/components/apps/AppsCatalogGrid.js +18 -0
- package/dist/components/apps/extensions/HyperscapeAppDetailPanel.d.ts +3 -0
- package/dist/components/apps/extensions/HyperscapeAppDetailPanel.d.ts.map +1 -0
- package/dist/components/apps/extensions/HyperscapeAppDetailPanel.js +253 -0
- package/dist/components/apps/extensions/registry.d.ts +4 -0
- package/dist/components/apps/extensions/registry.d.ts.map +1 -0
- package/dist/components/apps/extensions/registry.js +10 -0
- package/dist/components/apps/extensions/types.d.ts +7 -0
- package/dist/components/apps/extensions/types.d.ts.map +1 -0
- package/dist/components/apps/extensions/types.js +1 -0
- package/dist/components/apps/helpers.d.ts +7 -0
- package/dist/components/apps/helpers.d.ts.map +1 -0
- package/dist/components/apps/helpers.js +46 -0
- package/dist/components/avatar/VrmAnimationLoader.d.ts +30 -0
- package/dist/components/avatar/VrmAnimationLoader.d.ts.map +1 -0
- package/dist/components/avatar/VrmAnimationLoader.js +99 -0
- package/dist/components/avatar/VrmBlinkController.d.ts +37 -0
- package/dist/components/avatar/VrmBlinkController.d.ts.map +1 -0
- package/dist/components/avatar/VrmBlinkController.js +98 -0
- package/dist/components/avatar/VrmCameraManager.d.ts +57 -0
- package/dist/components/avatar/VrmCameraManager.d.ts.map +1 -0
- package/dist/components/avatar/VrmCameraManager.js +277 -0
- package/dist/components/avatar/VrmEngine.d.ts +229 -0
- package/dist/components/avatar/VrmEngine.d.ts.map +1 -0
- package/dist/components/avatar/VrmEngine.js +1950 -0
- package/dist/components/avatar/VrmFootShadow.d.ts +18 -0
- package/dist/components/avatar/VrmFootShadow.d.ts.map +1 -0
- package/dist/components/avatar/VrmFootShadow.js +83 -0
- package/dist/components/avatar/VrmViewer.d.ts +45 -0
- package/dist/components/avatar/VrmViewer.d.ts.map +1 -0
- package/dist/components/avatar/VrmViewer.js +341 -0
- package/dist/components/avatar/mixamoVRMRigMap.d.ts +3 -0
- package/dist/components/avatar/mixamoVRMRigMap.d.ts.map +1 -0
- package/dist/components/avatar/mixamoVRMRigMap.js +56 -0
- package/dist/components/avatar/retargetMixamoFbxToVrm.d.ts +9 -0
- package/dist/components/avatar/retargetMixamoFbxToVrm.d.ts.map +1 -0
- package/dist/components/avatar/retargetMixamoFbxToVrm.js +88 -0
- package/dist/components/avatar/retargetMixamoGltfToVrm.d.ts +11 -0
- package/dist/components/avatar/retargetMixamoGltfToVrm.d.ts.map +1 -0
- package/dist/components/avatar/retargetMixamoGltfToVrm.js +80 -0
- package/dist/components/chainConfig.d.ts +84 -0
- package/dist/components/chainConfig.d.ts.map +1 -0
- package/dist/components/chainConfig.js +268 -0
- package/dist/components/companion/CompanionHeader.d.ts +15 -0
- package/dist/components/companion/CompanionHeader.d.ts.map +1 -0
- package/dist/components/companion/CompanionHeader.js +7 -0
- package/dist/components/companion/CompanionSceneHost.d.ts +2 -0
- package/dist/components/companion/CompanionSceneHost.d.ts.map +1 -0
- package/dist/components/companion/CompanionSceneHost.js +1 -0
- package/dist/components/companion/VrmStage.d.ts +3 -0
- package/dist/components/companion/VrmStage.d.ts.map +1 -0
- package/dist/components/companion/VrmStage.js +1 -0
- package/dist/components/companion/walletUtils.d.ts +95 -0
- package/dist/components/companion/walletUtils.d.ts.map +1 -0
- package/dist/components/companion/walletUtils.js +167 -0
- package/dist/components/companion-shell-styles.d.ts +38 -0
- package/dist/components/companion-shell-styles.d.ts.map +1 -0
- package/dist/components/companion-shell-styles.js +248 -0
- package/dist/components/confirm-delete-control.d.ts +16 -0
- package/dist/components/confirm-delete-control.d.ts.map +1 -0
- package/dist/components/confirm-delete-control.js +12 -0
- package/dist/components/conversations/ConversationListItem.d.ts +31 -0
- package/dist/components/conversations/ConversationListItem.d.ts.map +1 -0
- package/dist/components/conversations/ConversationListItem.js +52 -0
- package/dist/components/conversations/conversation-utils.d.ts +9 -0
- package/dist/components/conversations/conversation-utils.d.ts.map +1 -0
- package/dist/components/conversations/conversation-utils.js +138 -0
- package/dist/components/format.d.ts +54 -0
- package/dist/components/format.d.ts.map +1 -0
- package/dist/components/format.js +82 -0
- package/dist/components/index.d.ts +93 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +92 -0
- package/dist/components/inventory/CopyableAddress.d.ts +8 -0
- package/dist/components/inventory/CopyableAddress.d.ts.map +1 -0
- package/dist/components/inventory/CopyableAddress.js +18 -0
- package/dist/components/inventory/InventoryToolbar.d.ts +25 -0
- package/dist/components/inventory/InventoryToolbar.d.ts.map +1 -0
- package/dist/components/inventory/InventoryToolbar.js +28 -0
- package/dist/components/inventory/NftGrid.d.ts +13 -0
- package/dist/components/inventory/NftGrid.d.ts.map +1 -0
- package/dist/components/inventory/NftGrid.js +29 -0
- package/dist/components/inventory/TokenLogo.d.ts +12 -0
- package/dist/components/inventory/TokenLogo.d.ts.map +1 -0
- package/dist/components/inventory/TokenLogo.js +33 -0
- package/dist/components/inventory/TokensTable.d.ts +24 -0
- package/dist/components/inventory/TokensTable.d.ts.map +1 -0
- package/dist/components/inventory/TokensTable.js +26 -0
- package/dist/components/inventory/constants.d.ts +52 -0
- package/dist/components/inventory/constants.d.ts.map +1 -0
- package/dist/components/inventory/constants.js +121 -0
- package/dist/components/inventory/index.d.ts +9 -0
- package/dist/components/inventory/index.d.ts.map +1 -0
- package/dist/components/inventory/index.js +8 -0
- package/dist/components/inventory/media-url.d.ts +6 -0
- package/dist/components/inventory/media-url.d.ts.map +1 -0
- package/dist/components/inventory/media-url.js +28 -0
- package/dist/components/inventory/useInventoryData.d.ts +53 -0
- package/dist/components/inventory/useInventoryData.d.ts.map +1 -0
- package/dist/components/inventory/useInventoryData.js +332 -0
- package/dist/components/knowledge-upload-image.d.ts +27 -0
- package/dist/components/knowledge-upload-image.d.ts.map +1 -0
- package/dist/components/knowledge-upload-image.js +146 -0
- package/dist/components/labels.d.ts +6 -0
- package/dist/components/labels.d.ts.map +1 -0
- package/dist/components/labels.js +40 -0
- package/dist/components/onboarding/ActivateStep.d.ts +2 -0
- package/dist/components/onboarding/ActivateStep.d.ts.map +1 -0
- package/dist/components/onboarding/ActivateStep.js +6 -0
- package/dist/components/onboarding/ConnectionStep.d.ts +2 -0
- package/dist/components/onboarding/ConnectionStep.d.ts.map +1 -0
- package/dist/components/onboarding/ConnectionStep.js +552 -0
- package/dist/components/onboarding/OnboardingPanel.d.ts +9 -0
- package/dist/components/onboarding/OnboardingPanel.d.ts.map +1 -0
- package/dist/components/onboarding/OnboardingPanel.js +24 -0
- package/dist/components/onboarding/OnboardingStepNav.d.ts +2 -0
- package/dist/components/onboarding/OnboardingStepNav.d.ts.map +1 -0
- package/dist/components/onboarding/OnboardingStepNav.js +14 -0
- package/dist/components/onboarding/PermissionsStep.d.ts +2 -0
- package/dist/components/onboarding/PermissionsStep.d.ts.map +1 -0
- package/dist/components/onboarding/PermissionsStep.js +7 -0
- package/dist/components/onboarding/RpcStep.d.ts +2 -0
- package/dist/components/onboarding/RpcStep.d.ts.map +1 -0
- package/dist/components/onboarding/RpcStep.js +125 -0
- package/dist/components/onboarding/WakeUpStep.d.ts +2 -0
- package/dist/components/onboarding/WakeUpStep.d.ts.map +1 -0
- package/dist/components/onboarding/WakeUpStep.js +82 -0
- package/dist/components/permissions/PermissionIcon.d.ts +4 -0
- package/dist/components/permissions/PermissionIcon.d.ts.map +1 -0
- package/dist/components/permissions/PermissionIcon.js +12 -0
- package/dist/components/permissions/StreamingPermissions.d.ts +20 -0
- package/dist/components/permissions/StreamingPermissions.d.ts.map +1 -0
- package/dist/components/permissions/StreamingPermissions.js +173 -0
- package/dist/components/plugins/showcase-data.d.ts +7 -0
- package/dist/components/plugins/showcase-data.d.ts.map +1 -0
- package/dist/components/plugins/showcase-data.js +464 -0
- package/dist/components/shared/ShellHeaderControls.d.ts +27 -0
- package/dist/components/shared/ShellHeaderControls.d.ts.map +1 -0
- package/dist/components/shared/ShellHeaderControls.js +60 -0
- package/dist/components/skeletons.d.ts +17 -0
- package/dist/components/skeletons.d.ts.map +1 -0
- package/dist/components/skeletons.js +22 -0
- package/dist/components/stream/ActivityFeed.d.ts +5 -0
- package/dist/components/stream/ActivityFeed.d.ts.map +1 -0
- package/dist/components/stream/ActivityFeed.js +57 -0
- package/dist/components/stream/AvatarPip.d.ts +5 -0
- package/dist/components/stream/AvatarPip.d.ts.map +1 -0
- package/dist/components/stream/AvatarPip.js +6 -0
- package/dist/components/stream/ChatContent.d.ts +6 -0
- package/dist/components/stream/ChatContent.d.ts.map +1 -0
- package/dist/components/stream/ChatContent.js +69 -0
- package/dist/components/stream/ChatTicker.d.ts +5 -0
- package/dist/components/stream/ChatTicker.d.ts.map +1 -0
- package/dist/components/stream/ChatTicker.js +34 -0
- package/dist/components/stream/IdleContent.d.ts +5 -0
- package/dist/components/stream/IdleContent.d.ts.map +1 -0
- package/dist/components/stream/IdleContent.js +17 -0
- package/dist/components/stream/StatusBar.d.ts +36 -0
- package/dist/components/stream/StatusBar.d.ts.map +1 -0
- package/dist/components/stream/StatusBar.js +140 -0
- package/dist/components/stream/StreamSettings.d.ts +33 -0
- package/dist/components/stream/StreamSettings.d.ts.map +1 -0
- package/dist/components/stream/StreamSettings.js +99 -0
- package/dist/components/stream/StreamTerminal.d.ts +2 -0
- package/dist/components/stream/StreamTerminal.d.ts.map +1 -0
- package/dist/components/stream/StreamTerminal.js +52 -0
- package/dist/components/stream/StreamVoiceConfig.d.ts +10 -0
- package/dist/components/stream/StreamVoiceConfig.d.ts.map +1 -0
- package/dist/components/stream/StreamVoiceConfig.js +88 -0
- package/dist/components/stream/helpers.d.ts +32 -0
- package/dist/components/stream/helpers.d.ts.map +1 -0
- package/dist/components/stream/helpers.js +110 -0
- package/dist/components/stream/overlays/OverlayLayer.d.ts +20 -0
- package/dist/components/stream/overlays/OverlayLayer.d.ts.map +1 -0
- package/dist/components/stream/overlays/OverlayLayer.js +24 -0
- package/dist/components/stream/overlays/built-in/ActionTickerWidget.d.ts +8 -0
- package/dist/components/stream/overlays/built-in/ActionTickerWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/ActionTickerWidget.js +44 -0
- package/dist/components/stream/overlays/built-in/AlertPopupWidget.d.ts +7 -0
- package/dist/components/stream/overlays/built-in/AlertPopupWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/AlertPopupWidget.js +62 -0
- package/dist/components/stream/overlays/built-in/BrandingWidget.d.ts +7 -0
- package/dist/components/stream/overlays/built-in/BrandingWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/BrandingWidget.js +36 -0
- package/dist/components/stream/overlays/built-in/CustomHtmlWidget.d.ts +26 -0
- package/dist/components/stream/overlays/built-in/CustomHtmlWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/CustomHtmlWidget.js +78 -0
- package/dist/components/stream/overlays/built-in/PeonGlassWidget.d.ts +11 -0
- package/dist/components/stream/overlays/built-in/PeonGlassWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/PeonGlassWidget.js +188 -0
- package/dist/components/stream/overlays/built-in/PeonHudWidget.d.ts +10 -0
- package/dist/components/stream/overlays/built-in/PeonHudWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/PeonHudWidget.js +168 -0
- package/dist/components/stream/overlays/built-in/PeonSakuraWidget.d.ts +11 -0
- package/dist/components/stream/overlays/built-in/PeonSakuraWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/PeonSakuraWidget.js +213 -0
- package/dist/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts +8 -0
- package/dist/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/ThoughtBubbleWidget.js +59 -0
- package/dist/components/stream/overlays/built-in/ViewerCountWidget.d.ts +7 -0
- package/dist/components/stream/overlays/built-in/ViewerCountWidget.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/ViewerCountWidget.js +34 -0
- package/dist/components/stream/overlays/built-in/index.d.ts +13 -0
- package/dist/components/stream/overlays/built-in/index.d.ts.map +1 -0
- package/dist/components/stream/overlays/built-in/index.js +12 -0
- package/dist/components/stream/overlays/registry.d.ts +11 -0
- package/dist/components/stream/overlays/registry.d.ts.map +1 -0
- package/dist/components/stream/overlays/registry.js +16 -0
- package/dist/components/stream/overlays/types.d.ts +67 -0
- package/dist/components/stream/overlays/types.d.ts.map +1 -0
- package/dist/components/stream/overlays/types.js +7 -0
- package/dist/components/stream/overlays/useOverlayLayout.d.ts +27 -0
- package/dist/components/stream/overlays/useOverlayLayout.d.ts.map +1 -0
- package/dist/components/stream/overlays/useOverlayLayout.js +162 -0
- package/dist/components/trajectory-format.d.ts +6 -0
- package/dist/components/trajectory-format.d.ts.map +1 -0
- package/dist/components/trajectory-format.js +43 -0
- package/dist/components/ui-badges.d.ts +23 -0
- package/dist/components/ui-badges.d.ts.map +1 -0
- package/dist/components/ui-badges.js +38 -0
- package/dist/components/ui-switch.d.ts +14 -0
- package/dist/components/ui-switch.d.ts.map +1 -0
- package/dist/components/ui-switch.js +15 -0
- package/dist/components/vector-browser-three.d.ts +4 -0
- package/dist/components/vector-browser-three.d.ts.map +1 -0
- package/dist/components/vector-browser-three.js +19 -0
- package/dist/config/config-catalog.d.ts +376 -0
- package/dist/config/config-catalog.d.ts.map +1 -0
- package/dist/config/config-catalog.js +724 -0
- package/dist/config/config-field.d.ts +68 -0
- package/dist/config/config-field.d.ts.map +1 -0
- package/dist/config/config-field.js +821 -0
- package/dist/config/config-renderer.d.ts +176 -0
- package/dist/config/config-renderer.d.ts.map +1 -0
- package/dist/config/config-renderer.js +403 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/ui-renderer.d.ts +26 -0
- package/dist/config/ui-renderer.d.ts.map +1 -0
- package/dist/config/ui-renderer.js +815 -0
- package/dist/config/ui-spec.d.ts +164 -0
- package/dist/config/ui-spec.d.ts.map +1 -0
- package/dist/config/ui-spec.js +13 -0
- package/dist/events/index.d.ts +42 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +41 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/useBugReport.d.ts +14 -0
- package/dist/hooks/useBugReport.d.ts.map +1 -0
- package/dist/hooks/useBugReport.js +18 -0
- package/dist/hooks/useCanvasWindow.d.ts +38 -0
- package/dist/hooks/useCanvasWindow.d.ts.map +1 -0
- package/dist/hooks/useCanvasWindow.js +273 -0
- package/dist/hooks/useChatAvatarVoice.d.ts +10 -0
- package/dist/hooks/useChatAvatarVoice.d.ts.map +1 -0
- package/dist/hooks/useChatAvatarVoice.js +71 -0
- package/dist/hooks/useContextMenu.d.ts +17 -0
- package/dist/hooks/useContextMenu.d.ts.map +1 -0
- package/dist/hooks/useContextMenu.js +100 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +17 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.js +67 -0
- package/dist/hooks/useLifoSync.d.ts +18 -0
- package/dist/hooks/useLifoSync.d.ts.map +1 -0
- package/dist/hooks/useLifoSync.js +113 -0
- package/dist/hooks/useMemoryMonitor.d.ts +87 -0
- package/dist/hooks/useMemoryMonitor.d.ts.map +1 -0
- package/dist/hooks/useMemoryMonitor.js +210 -0
- package/dist/hooks/useRenderGuard.d.ts +17 -0
- package/dist/hooks/useRenderGuard.d.ts.map +1 -0
- package/dist/hooks/useRenderGuard.js +36 -0
- package/dist/hooks/useRetakeCapture.d.ts +12 -0
- package/dist/hooks/useRetakeCapture.d.ts.map +1 -0
- package/dist/hooks/useRetakeCapture.js +59 -0
- package/dist/hooks/useStreamPopoutNavigation.d.ts +3 -0
- package/dist/hooks/useStreamPopoutNavigation.d.ts.map +1 -0
- package/dist/hooks/useStreamPopoutNavigation.js +17 -0
- package/dist/hooks/useTimeout.d.ts +11 -0
- package/dist/hooks/useTimeout.d.ts.map +1 -0
- package/dist/hooks/useTimeout.js +32 -0
- package/dist/hooks/useVoiceChat.d.ts +129 -0
- package/dist/hooks/useVoiceChat.d.ts.map +1 -0
- package/dist/hooks/useVoiceChat.js +1071 -0
- package/dist/hooks/useWhatsAppPairing.d.ts +11 -0
- package/dist/hooks/useWhatsAppPairing.d.ts.map +1 -0
- package/dist/hooks/useWhatsAppPairing.js +95 -0
- package/dist/i18n/index.d.ts +7 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +53 -0
- package/dist/i18n/locales/en.json +1196 -0
- package/dist/i18n/locales/es.json +1196 -0
- package/dist/i18n/locales/ko.json +1196 -0
- package/dist/i18n/locales/pt.json +1196 -0
- package/dist/i18n/locales/zh-CN.json +1196 -0
- package/dist/i18n/messages.d.ts +6 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +14 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/navigation/index.d.ts +27 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +230 -0
- package/dist/package.json +161 -0
- package/dist/platform/browser-launch.d.ts +2 -0
- package/dist/platform/browser-launch.d.ts.map +1 -0
- package/dist/platform/browser-launch.js +109 -0
- package/dist/platform/index.d.ts +64 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +155 -0
- package/dist/platform/init.d.ts +40 -0
- package/dist/platform/init.d.ts.map +1 -0
- package/dist/platform/init.js +158 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +72 -0
- package/dist/state/AppContext.d.ts +11 -0
- package/dist/state/AppContext.d.ts.map +1 -0
- package/dist/state/AppContext.js +4496 -0
- package/dist/state/index.d.ts +7 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +6 -0
- package/dist/state/internal.d.ts +6 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +5 -0
- package/dist/state/parsers.d.ts +26 -0
- package/dist/state/parsers.d.ts.map +1 -0
- package/dist/state/parsers.js +255 -0
- package/dist/state/persistence.d.ts +36 -0
- package/dist/state/persistence.d.ts.map +1 -0
- package/dist/state/persistence.js +254 -0
- package/dist/state/types.d.ts +402 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +70 -0
- package/dist/state/ui-preferences.d.ts +3 -0
- package/dist/state/ui-preferences.d.ts.map +1 -0
- package/dist/state/ui-preferences.js +1 -0
- package/dist/state/useApp.d.ts +4 -0
- package/dist/state/useApp.d.ts.map +1 -0
- package/dist/state/useApp.js +22 -0
- package/dist/state/vrm.d.ts +19 -0
- package/dist/state/vrm.d.ts.map +1 -0
- package/dist/state/vrm.js +65 -0
- package/dist/stories/AppMockProvider.d.ts +15 -0
- package/dist/stories/AppMockProvider.d.ts.map +1 -0
- package/dist/stories/AppMockProvider.js +14 -0
- package/dist/styles/anime.css +6324 -0
- package/dist/styles/base.css +196 -0
- package/dist/styles/onboarding-game.css +716 -0
- package/dist/styles/styles.css +2085 -0
- package/dist/styles/xterm.css +241 -0
- package/dist/types/index.d.ts +657 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/asset-url.d.ts +26 -0
- package/dist/utils/asset-url.d.ts.map +1 -0
- package/dist/utils/asset-url.js +99 -0
- package/dist/utils/assistant-text.d.ts +2 -0
- package/dist/utils/assistant-text.d.ts.map +1 -0
- package/dist/utils/assistant-text.js +161 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +38 -0
- package/dist/utils/desktop-dialogs.d.ts +19 -0
- package/dist/utils/desktop-dialogs.d.ts.map +1 -0
- package/dist/utils/desktop-dialogs.js +50 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/number-parsing.d.ts +44 -0
- package/dist/utils/number-parsing.d.ts.map +1 -0
- package/dist/utils/number-parsing.js +56 -0
- package/dist/utils/openExternalUrl.d.ts +2 -0
- package/dist/utils/openExternalUrl.d.ts.map +1 -0
- package/dist/utils/openExternalUrl.js +17 -0
- package/dist/utils/spoken-text.d.ts +2 -0
- package/dist/utils/spoken-text.d.ts.map +1 -0
- package/dist/utils/spoken-text.js +56 -0
- package/dist/utils/streaming-text.d.ts +3 -0
- package/dist/utils/streaming-text.d.ts.map +1 -0
- package/dist/utils/streaming-text.js +87 -0
- package/dist/voice/index.d.ts +2 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +1 -0
- package/dist/voice/types.d.ts +25 -0
- package/dist/voice/types.d.ts.map +1 -0
- package/dist/voice/types.js +166 -0
- package/package.json +86 -0
- package/src/App.tsx +469 -0
- package/src/actions/character.ts +113 -0
- package/src/actions/chat-helpers.ts +100 -0
- package/src/actions/cloud.ts +59 -0
- package/src/actions/index.ts +12 -0
- package/src/actions/lifecycle.ts +175 -0
- package/src/actions/onboarding.ts +46 -0
- package/src/actions/triggers.ts +190 -0
- package/src/ambient.d.ts +16 -0
- package/src/api/client.ts +5616 -0
- package/src/api/index.ts +1 -0
- package/src/autonomy/index.ts +477 -0
- package/src/bridge/capacitor-bridge.ts +295 -0
- package/src/bridge/electrobun-rpc.ts +58 -0
- package/src/bridge/electrobun-runtime.ts +28 -0
- package/src/bridge/index.ts +5 -0
- package/src/bridge/native-plugins.ts +134 -0
- package/src/bridge/plugin-bridge.ts +352 -0
- package/src/bridge/storage-bridge.ts +162 -0
- package/src/chat/index.ts +251 -0
- package/src/coding/index.ts +43 -0
- package/src/components/AdvancedPageView.tsx +362 -0
- package/src/components/AgentActivityBox.tsx +49 -0
- package/src/components/ApiKeyConfig.tsx +224 -0
- package/src/components/AppsPageView.tsx +52 -0
- package/src/components/AppsView.tsx +293 -0
- package/src/components/AvatarLoader.tsx +86 -0
- package/src/components/AvatarSelector.tsx +223 -0
- package/src/components/BscTradePanel.tsx +549 -0
- package/src/components/BugReportModal.tsx +499 -0
- package/src/components/CharacterView.tsx +1623 -0
- package/src/components/ChatAvatar.test.ts +96 -0
- package/src/components/ChatAvatar.tsx +147 -0
- package/src/components/ChatComposer.tsx +330 -0
- package/src/components/ChatMessage.tsx +448 -0
- package/src/components/ChatModalView.test.tsx +118 -0
- package/src/components/ChatModalView.tsx +125 -0
- package/src/components/ChatView.tsx +999 -0
- package/src/components/CloudSourceControls.tsx +80 -0
- package/src/components/CodingAgentSettingsSection.tsx +536 -0
- package/src/components/CommandPalette.tsx +284 -0
- package/src/components/CompanionSceneHost.tsx +498 -0
- package/src/components/CompanionShell.tsx +31 -0
- package/src/components/CompanionView.tsx +109 -0
- package/src/components/ConfigPageView.tsx +722 -0
- package/src/components/ConfigSaveFooter.tsx +41 -0
- package/src/components/ConfirmModal.tsx +379 -0
- package/src/components/ConnectionFailedBanner.tsx +91 -0
- package/src/components/ConnectorsPageView.tsx +13 -0
- package/src/components/ConversationsSidebar.tsx +279 -0
- package/src/components/CustomActionEditor.tsx +1125 -0
- package/src/components/CustomActionsPanel.tsx +288 -0
- package/src/components/CustomActionsView.tsx +322 -0
- package/src/components/DatabasePageView.tsx +55 -0
- package/src/components/DatabaseView.tsx +814 -0
- package/src/components/ElizaCloudDashboard.tsx +1696 -0
- package/src/components/EmotePicker.tsx +529 -0
- package/src/components/ErrorBoundary.tsx +76 -0
- package/src/components/FineTuningView.tsx +1080 -0
- package/src/components/GameView.tsx +551 -0
- package/src/components/GameViewOverlay.tsx +133 -0
- package/src/components/GlobalEmoteOverlay.tsx +152 -0
- package/src/components/Header.test.tsx +413 -0
- package/src/components/Header.tsx +400 -0
- package/src/components/HeartbeatsView.tsx +1002 -0
- package/src/components/InventoryView.tsx +372 -0
- package/src/components/KnowledgeView.tsx +1128 -0
- package/src/components/LanguageDropdown.tsx +187 -0
- package/src/components/LifoMonitorPanel.tsx +196 -0
- package/src/components/LifoSandboxView.tsx +499 -0
- package/src/components/LoadingScreen.tsx +77 -0
- package/src/components/LogsPageView.tsx +17 -0
- package/src/components/LogsView.tsx +239 -0
- package/src/components/MediaGalleryView.tsx +432 -0
- package/src/components/MediaSettingsSection.tsx +893 -0
- package/src/components/MessageContent.tsx +815 -0
- package/src/components/OnboardingWizard.test.tsx +107 -0
- package/src/components/OnboardingWizard.tsx +186 -0
- package/src/components/PairingView.tsx +110 -0
- package/src/components/PermissionsSection.tsx +818 -0
- package/src/components/PluginsPageView.tsx +9 -0
- package/src/components/PluginsView.tsx +3152 -0
- package/src/components/ProviderSwitcher.tsx +874 -0
- package/src/components/RestartBanner.tsx +76 -0
- package/src/components/RuntimeView.tsx +460 -0
- package/src/components/SaveCommandModal.tsx +211 -0
- package/src/components/SecretsView.tsx +569 -0
- package/src/components/SettingsView.tsx +825 -0
- package/src/components/ShellOverlays.tsx +41 -0
- package/src/components/ShortcutsOverlay.tsx +155 -0
- package/src/components/SkillsView.tsx +1435 -0
- package/src/components/StartupFailureView.tsx +63 -0
- package/src/components/StreamView.tsx +483 -0
- package/src/components/StripeEmbeddedCheckout.tsx +155 -0
- package/src/components/SubscriptionStatus.tsx +634 -0
- package/src/components/SystemWarningBanner.tsx +71 -0
- package/src/components/ThemeToggle.tsx +100 -0
- package/src/components/TrajectoriesView.tsx +526 -0
- package/src/components/TrajectoryDetailView.tsx +426 -0
- package/src/components/TriggersView.tsx +1 -0
- package/src/components/VectorBrowserView.tsx +1633 -0
- package/src/components/VoiceConfigView.tsx +674 -0
- package/src/components/VrmStage.test.ts +219 -0
- package/src/components/VrmStage.tsx +432 -0
- package/src/components/WhatsAppQrOverlay.tsx +230 -0
- package/src/components/__tests__/chainConfig.test.ts +220 -0
- package/src/components/apps/AppDetailPane.tsx +242 -0
- package/src/components/apps/AppsCatalogGrid.tsx +137 -0
- package/src/components/apps/extensions/HyperscapeAppDetailPanel.tsx +577 -0
- package/src/components/apps/extensions/registry.ts +16 -0
- package/src/components/apps/extensions/types.ts +9 -0
- package/src/components/apps/helpers.ts +44 -0
- package/src/components/avatar/VrmAnimationLoader.test.ts +164 -0
- package/src/components/avatar/VrmAnimationLoader.ts +151 -0
- package/src/components/avatar/VrmBlinkController.ts +118 -0
- package/src/components/avatar/VrmCameraManager.ts +407 -0
- package/src/components/avatar/VrmEngine.ts +2678 -0
- package/src/components/avatar/VrmFootShadow.ts +96 -0
- package/src/components/avatar/VrmViewer.tsx +421 -0
- package/src/components/avatar/__tests__/VrmCameraManager.test.ts +168 -0
- package/src/components/avatar/__tests__/VrmEngine.test.ts +1574 -0
- package/src/components/avatar/mixamoVRMRigMap.ts +62 -0
- package/src/components/avatar/retargetMixamoFbxToVrm.ts +144 -0
- package/src/components/avatar/retargetMixamoGltfToVrm.ts +119 -0
- package/src/components/chainConfig.ts +380 -0
- package/src/components/companion/CompanionHeader.tsx +47 -0
- package/src/components/companion/CompanionSceneHost.tsx +5 -0
- package/src/components/companion/VrmStage.tsx +2 -0
- package/src/components/companion/__tests__/walletUtils.test.ts +742 -0
- package/src/components/companion/walletUtils.ts +290 -0
- package/src/components/companion-shell-styles.test.ts +146 -0
- package/src/components/companion-shell-styles.ts +270 -0
- package/src/components/confirm-delete-control.tsx +69 -0
- package/src/components/conversations/ConversationListItem.tsx +185 -0
- package/src/components/conversations/conversation-utils.ts +151 -0
- package/src/components/format.ts +131 -0
- package/src/components/index.ts +92 -0
- package/src/components/inventory/CopyableAddress.tsx +41 -0
- package/src/components/inventory/InventoryToolbar.tsx +142 -0
- package/src/components/inventory/NftGrid.tsx +99 -0
- package/src/components/inventory/TokenLogo.tsx +71 -0
- package/src/components/inventory/TokensTable.tsx +216 -0
- package/src/components/inventory/constants.ts +170 -0
- package/src/components/inventory/index.ts +29 -0
- package/src/components/inventory/media-url.test.ts +38 -0
- package/src/components/inventory/media-url.ts +36 -0
- package/src/components/inventory/useInventoryData.ts +460 -0
- package/src/components/knowledge-upload-image.ts +215 -0
- package/src/components/labels.ts +46 -0
- package/src/components/onboarding/ActivateStep.tsx +30 -0
- package/src/components/onboarding/ConnectionStep.tsx +1530 -0
- package/src/components/onboarding/OnboardingPanel.tsx +39 -0
- package/src/components/onboarding/OnboardingStepNav.tsx +31 -0
- package/src/components/onboarding/PermissionsStep.tsx +20 -0
- package/src/components/onboarding/RpcStep.tsx +402 -0
- package/src/components/onboarding/WakeUpStep.tsx +184 -0
- package/src/components/permissions/PermissionIcon.tsx +25 -0
- package/src/components/permissions/StreamingPermissions.tsx +376 -0
- package/src/components/plugins/showcase-data.ts +481 -0
- package/src/components/shared/ShellHeaderControls.tsx +193 -0
- package/src/components/skeletons.tsx +88 -0
- package/src/components/stream/ActivityFeed.tsx +113 -0
- package/src/components/stream/AvatarPip.tsx +10 -0
- package/src/components/stream/ChatContent.tsx +126 -0
- package/src/components/stream/ChatTicker.tsx +55 -0
- package/src/components/stream/IdleContent.tsx +73 -0
- package/src/components/stream/StatusBar.tsx +469 -0
- package/src/components/stream/StreamSettings.tsx +506 -0
- package/src/components/stream/StreamTerminal.tsx +94 -0
- package/src/components/stream/StreamVoiceConfig.tsx +160 -0
- package/src/components/stream/helpers.ts +134 -0
- package/src/components/stream/overlays/OverlayLayer.tsx +75 -0
- package/src/components/stream/overlays/built-in/ActionTickerWidget.tsx +64 -0
- package/src/components/stream/overlays/built-in/AlertPopupWidget.tsx +87 -0
- package/src/components/stream/overlays/built-in/BrandingWidget.tsx +51 -0
- package/src/components/stream/overlays/built-in/CustomHtmlWidget.tsx +105 -0
- package/src/components/stream/overlays/built-in/PeonGlassWidget.tsx +265 -0
- package/src/components/stream/overlays/built-in/PeonHudWidget.tsx +247 -0
- package/src/components/stream/overlays/built-in/PeonSakuraWidget.tsx +278 -0
- package/src/components/stream/overlays/built-in/ThoughtBubbleWidget.tsx +77 -0
- package/src/components/stream/overlays/built-in/ViewerCountWidget.tsx +46 -0
- package/src/components/stream/overlays/built-in/index.ts +13 -0
- package/src/components/stream/overlays/registry.ts +22 -0
- package/src/components/stream/overlays/types.ts +90 -0
- package/src/components/stream/overlays/useOverlayLayout.ts +218 -0
- package/src/components/trajectory-format.ts +50 -0
- package/src/components/ui-badges.tsx +109 -0
- package/src/components/ui-switch.tsx +57 -0
- package/src/components/vector-browser-three.ts +27 -0
- package/src/config/config-catalog.ts +1092 -0
- package/src/config/config-field.tsx +1900 -0
- package/src/config/config-renderer.tsx +730 -0
- package/src/config/index.ts +11 -0
- package/src/config/ui-renderer.tsx +1751 -0
- package/src/config/ui-spec.ts +256 -0
- package/src/events/index.ts +89 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useBugReport.tsx +43 -0
- package/src/hooks/useCanvasWindow.ts +372 -0
- package/src/hooks/useChatAvatarVoice.ts +111 -0
- package/src/hooks/useContextMenu.ts +127 -0
- package/src/hooks/useKeyboardShortcuts.ts +86 -0
- package/src/hooks/useLifoSync.ts +143 -0
- package/src/hooks/useMemoryMonitor.ts +335 -0
- package/src/hooks/useRenderGuard.ts +43 -0
- package/src/hooks/useRetakeCapture.ts +67 -0
- package/src/hooks/useStreamPopoutNavigation.ts +27 -0
- package/src/hooks/useTimeout.ts +37 -0
- package/src/hooks/useVoiceChat.ts +1443 -0
- package/src/hooks/useWhatsAppPairing.ts +123 -0
- package/src/i18n/index.ts +76 -0
- package/src/i18n/locales/en.json +1196 -0
- package/src/i18n/locales/es.json +1196 -0
- package/src/i18n/locales/ko.json +1196 -0
- package/src/i18n/locales/pt.json +1196 -0
- package/src/i18n/locales/zh-CN.json +1196 -0
- package/src/i18n/messages.ts +21 -0
- package/src/index.ts +6 -0
- package/src/navigation/index.ts +282 -0
- package/src/navigation.test.ts +189 -0
- package/src/platform/browser-launch.test.ts +94 -0
- package/src/platform/browser-launch.ts +149 -0
- package/src/platform/index.ts +261 -0
- package/src/platform/init.ts +236 -0
- package/src/providers/index.ts +82 -0
- package/src/state/AppContext.tsx +5737 -0
- package/src/state/index.ts +6 -0
- package/src/state/internal.ts +77 -0
- package/src/state/parsers.test.ts +124 -0
- package/src/state/parsers.ts +309 -0
- package/src/state/persistence.ts +278 -0
- package/src/state/types.ts +694 -0
- package/src/state/ui-preferences.ts +3 -0
- package/src/state/useApp.ts +23 -0
- package/src/state/vrm.ts +76 -0
- package/src/stories/AppMockProvider.tsx +32 -0
- package/src/stories/ChatEmptyState.stories.tsx +27 -0
- package/src/stories/ChatMessage.stories.tsx +115 -0
- package/src/stories/CompanionHeader.stories.tsx +74 -0
- package/src/stories/CompanionView.stories.tsx +33 -0
- package/src/stories/ConversationListItem.stories.tsx +102 -0
- package/src/stories/TypingIndicator.stories.tsx +28 -0
- package/src/styles/anime.css +6324 -0
- package/src/styles/base.css +196 -0
- package/src/styles/onboarding-game.css +716 -0
- package/src/styles/styles.css +2085 -0
- package/src/styles/xterm.css +241 -0
- package/src/types/index.ts +715 -0
- package/src/types/react-test-renderer.d.ts +45 -0
- package/src/utils/asset-url.ts +110 -0
- package/src/utils/assistant-text.ts +172 -0
- package/src/utils/clipboard.ts +41 -0
- package/src/utils/desktop-dialogs.ts +80 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/number-parsing.ts +125 -0
- package/src/utils/openExternalUrl.ts +20 -0
- package/src/utils/spoken-text.ts +65 -0
- package/src/utils/streaming-text.ts +120 -0
- package/src/voice/index.ts +1 -0
- package/src/voice/types.ts +197 -0
- package/test/app/AppContext.pty-sessions.test.tsx +143 -0
- package/test/app/MessageContent.test.tsx +326 -0
- package/test/app/PermissionsOnboarding.test.tsx +216 -0
- package/test/app/PermissionsSection.test.tsx +186 -0
- package/test/app/advanced-trajectory-fine-tuning.e2e.test.ts +397 -0
- package/test/app/agent-activity-box.test.tsx +132 -0
- package/test/app/agent-transfer-lock.test.ts +274 -0
- package/test/app/api-client-electron-fallback.test.ts +139 -0
- package/test/app/api-client-timeout.test.ts +75 -0
- package/test/app/api-client-ws.test.ts +98 -0
- package/test/app/api-client.ws-max-reconnect.test.ts +139 -0
- package/test/app/api-client.ws-reconnect.test.ts +157 -0
- package/test/app/app-context-autonomy-events.test.ts +478 -0
- package/test/app/apps-page-view.test.ts +114 -0
- package/test/app/apps-view.test.ts +769 -0
- package/test/app/autonomous-workflows.e2e.test.ts +765 -0
- package/test/app/autonomy-events.test.ts +150 -0
- package/test/app/avatar-selector.test.tsx +52 -0
- package/test/app/bsc-trade-panel.test.tsx +134 -0
- package/test/app/bug-report-modal.test.tsx +353 -0
- package/test/app/character-customization.e2e.test.ts +1168 -0
- package/test/app/chat-advanced-features.e2e.test.ts +706 -0
- package/test/app/chat-composer.test.tsx +181 -0
- package/test/app/chat-language-header.test.ts +64 -0
- package/test/app/chat-message.test.tsx +222 -0
- package/test/app/chat-modal-view.test.tsx +191 -0
- package/test/app/chat-routine-filter.test.ts +96 -0
- package/test/app/chat-send-lock.test.ts +1302 -0
- package/test/app/chat-stream-api-client.test.tsx +390 -0
- package/test/app/chat-view-game-modal.test.tsx +661 -0
- package/test/app/chat-view.test.tsx +877 -0
- package/test/app/cloud-api.e2e.test.ts +258 -0
- package/test/app/cloud-login-flow.e2e.test.ts +494 -0
- package/test/app/cloud-login-lock.test.ts +411 -0
- package/test/app/command-palette.test.tsx +184 -0
- package/test/app/command-registry.test.ts +75 -0
- package/test/app/companion-greeting-wave.test.tsx +443 -0
- package/test/app/companion-stale-conversation.test.tsx +424 -0
- package/test/app/companion-view.test.tsx +686 -0
- package/test/app/confirm-delete-control.test.ts +79 -0
- package/test/app/confirm-modal.test.tsx +219 -0
- package/test/app/connectors-ui.e2e.test.ts +508 -0
- package/test/app/conversations-sidebar-game-modal.test.tsx +260 -0
- package/test/app/conversations-sidebar.test.tsx +160 -0
- package/test/app/custom-actions-smoke.test.ts +387 -0
- package/test/app/custom-avatar-api-client.test.ts +207 -0
- package/test/app/desktop-utils.test.ts +145 -0
- package/test/app/electrobun-rpc-bridge.test.ts +83 -0
- package/test/app/events.test.ts +88 -0
- package/test/app/export-import-flows.e2e.test.ts +700 -0
- package/test/app/fine-tuning-view.test.ts +471 -0
- package/test/app/game-view-auth-session.test.tsx +186 -0
- package/test/app/game-view.test.ts +444 -0
- package/test/app/global-emote-overlay.test.tsx +106 -0
- package/test/app/header-status.test.tsx +149 -0
- package/test/app/i18n.test.ts +152 -0
- package/test/app/inventory-bsc-view.test.ts +908 -0
- package/test/app/knowledge-ui.e2e.test.ts +762 -0
- package/test/app/knowledge-upload-helpers.test.ts +124 -0
- package/test/app/lifecycle-lock.test.ts +267 -0
- package/test/app/lifo-popout-utils.test.ts +208 -0
- package/test/app/lifo-safe-endpoint.test.ts +34 -0
- package/test/app/loading-screen.test.tsx +45 -0
- package/test/app/memory-monitor.test.ts +332 -0
- package/test/app/navigation.test.tsx +29 -0
- package/test/app/onboarding-finish-lock.test.ts +500 -0
- package/test/app/onboarding-language.test.tsx +161 -0
- package/test/app/onboarding-steps.test.tsx +371 -0
- package/test/app/open-external-url.test.ts +65 -0
- package/test/app/pages-navigation-smoke.e2e.test.ts +633 -0
- package/test/app/pairing-lock.test.ts +260 -0
- package/test/app/pairing-view.test.tsx +74 -0
- package/test/app/permissions-section.test.ts +432 -0
- package/test/app/plugin-bridge.test.ts +109 -0
- package/test/app/plugins-ui.e2e.test.ts +605 -0
- package/test/app/plugins-view-game-modal.test.tsx +650 -0
- package/test/app/plugins-view-toggle-restart.test.ts +129 -0
- package/test/app/provider-dropdown-default.test.tsx +164 -0
- package/test/app/restart-banner.test.tsx +197 -0
- package/test/app/retake-capture.test.ts +84 -0
- package/test/app/sandbox-api-client.test.ts +108 -0
- package/test/app/save-command-modal.test.tsx +109 -0
- package/test/app/secrets-view.test.tsx +92 -0
- package/test/app/settings-control-styles.test.tsx +142 -0
- package/test/app/settings-reset.e2e.test.ts +728 -0
- package/test/app/settings-sections.e2e.test.ts +614 -0
- package/test/app/shared-format.test.ts +44 -0
- package/test/app/shared-switch.test.ts +69 -0
- package/test/app/shell-mode-switching.e2e.test.ts +829 -0
- package/test/app/shell-mode-tab-memory.test.tsx +283 -0
- package/test/app/shell-overlays.test.tsx +50 -0
- package/test/app/shortcuts-overlay.test.tsx +111 -0
- package/test/app/sse-interruption.test.ts +122 -0
- package/test/app/startup-asset-missing.e2e.test.ts +126 -0
- package/test/app/startup-backend-missing.e2e.test.ts +118 -0
- package/test/app/startup-chat.e2e.test.ts +305 -0
- package/test/app/startup-conversation-restore.test.tsx +344 -0
- package/test/app/startup-failure-view.test.tsx +103 -0
- package/test/app/startup-onboarding.e2e.test.ts +612 -0
- package/test/app/startup-timeout.test.tsx +80 -0
- package/test/app/startup-token-401.e2e.test.ts +103 -0
- package/test/app/stream-helpers.test.ts +46 -0
- package/test/app/stream-popout-navigation.test.tsx +41 -0
- package/test/app/stream-status-bar.test.tsx +89 -0
- package/test/app/theme-toggle.test.tsx +33 -0
- package/test/app/training-api-client.test.ts +128 -0
- package/test/app/trajectories-view.test.tsx +220 -0
- package/test/app/triggers-api-client.test.ts +77 -0
- package/test/app/triggers-navigation.test.ts +118 -0
- package/test/app/triggers-view.e2e.test.ts +674 -0
- package/test/app/update-channel-lock.test.ts +259 -0
- package/test/app/vector-browser.async-cleanup.test.tsx +367 -0
- package/test/app/vector-browser.e2e.test.ts +653 -0
- package/test/app/vrm-stage.test.tsx +351 -0
- package/test/app/vrm-viewer.test.tsx +298 -0
- package/test/app/wallet-api-save-lock.test.ts +277 -0
- package/test/app/wallet-hooks.test.ts +405 -0
- package/test/app/wallet-ui-flows.e2e.test.ts +556 -0
- package/test/avatar/asset-url.test.ts +90 -0
- package/test/avatar/avatar-selector.test.ts +173 -0
- package/test/avatar/mixamo-vrm-rig-map.test.ts +111 -0
- package/test/avatar/voice-chat-streaming-text.test.ts +96 -0
- package/test/avatar/voice-chat.test.ts +391 -0
- package/test/ui/command-palette-commands.test.ts +57 -0
- package/test/ui/ui-renderer.test.ts +39 -0
- package/tsconfig.build.json +19 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,997 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Vector Browser — explore agent memories and embeddings.
|
|
4
|
+
*
|
|
5
|
+
* Reads from the memories table (or similar vector-storage tables) using
|
|
6
|
+
* the generic database APIs. Shows paginated memory records with content,
|
|
7
|
+
* metadata, and embedding previews. Click any card to see full details.
|
|
8
|
+
* Toggle to a 2D scatter-plot graph view of embeddings.
|
|
9
|
+
*/
|
|
10
|
+
import { Button, Input } from "@elizaos/ui";
|
|
11
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
+
import { client } from "../api";
|
|
13
|
+
import { useApp } from "../state";
|
|
14
|
+
import { createVectorBrowserRenderer, THREE } from "./vector-browser-three";
|
|
15
|
+
const PAGE_SIZE = 25;
|
|
16
|
+
const MAX_THREE_PIXEL_RATIO = 2;
|
|
17
|
+
/** The dimension columns in the elizaOS `embeddings` table. */
|
|
18
|
+
const DIM_COLUMNS = [
|
|
19
|
+
"dim_384",
|
|
20
|
+
"dim_512",
|
|
21
|
+
"dim_768",
|
|
22
|
+
"dim_1024",
|
|
23
|
+
"dim_1536",
|
|
24
|
+
"dim_3072",
|
|
25
|
+
];
|
|
26
|
+
function hasEmbedding(memory) {
|
|
27
|
+
return memory.embedding !== null;
|
|
28
|
+
}
|
|
29
|
+
const VECTOR_GRAPH_2D_PALETTE = [
|
|
30
|
+
"#6cf",
|
|
31
|
+
"#f59e0b",
|
|
32
|
+
"#10b981",
|
|
33
|
+
"#ef4444",
|
|
34
|
+
"#8b5cf6",
|
|
35
|
+
"#ec4899",
|
|
36
|
+
"#06b6d4",
|
|
37
|
+
"#84cc16",
|
|
38
|
+
];
|
|
39
|
+
/** Try to parse a JSON content field, returning the text content or the raw string. */
|
|
40
|
+
function parseContent(val) {
|
|
41
|
+
if (typeof val !== "string")
|
|
42
|
+
return String(val ?? "");
|
|
43
|
+
if (val.startsWith("{")) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = JSON.parse(val);
|
|
46
|
+
if (parsed.text)
|
|
47
|
+
return String(parsed.text);
|
|
48
|
+
return val;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return val;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return val;
|
|
55
|
+
}
|
|
56
|
+
/** Parse an embedding from various storage formats (pgvector text, JSON, typed arrays). */
|
|
57
|
+
function parseEmbedding(val) {
|
|
58
|
+
if (!val)
|
|
59
|
+
return null;
|
|
60
|
+
if (Array.isArray(val))
|
|
61
|
+
return val;
|
|
62
|
+
// Handle typed arrays (Float32Array, Float64Array, Uint8Array etc.)
|
|
63
|
+
if (ArrayBuffer.isView(val)) {
|
|
64
|
+
return Array.from(val);
|
|
65
|
+
}
|
|
66
|
+
if (typeof val === "string" && val.length > 2) {
|
|
67
|
+
const trimmed = val.trim();
|
|
68
|
+
// pgvector text format: [0.1,0.2,0.3] — also valid JSON
|
|
69
|
+
// Also handle without brackets: 0.1,0.2,0.3
|
|
70
|
+
const inner = trimmed.startsWith("[") && trimmed.endsWith("]")
|
|
71
|
+
? trimmed.slice(1, -1)
|
|
72
|
+
: trimmed;
|
|
73
|
+
if (!inner)
|
|
74
|
+
return null;
|
|
75
|
+
// Fast path: split by comma and parse floats
|
|
76
|
+
const parts = inner.split(",");
|
|
77
|
+
if (parts.length < 2)
|
|
78
|
+
return null;
|
|
79
|
+
const nums = [];
|
|
80
|
+
for (const p of parts) {
|
|
81
|
+
const n = Number.parseFloat(p);
|
|
82
|
+
if (Number.isNaN(n))
|
|
83
|
+
return null;
|
|
84
|
+
nums.push(n);
|
|
85
|
+
}
|
|
86
|
+
return nums;
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function rowToMemory(row) {
|
|
91
|
+
// Try explicit embedding/vector column first, then check elizaOS dim_* columns
|
|
92
|
+
let embeddingVal = row.embedding ?? row.vector ?? row.embeddings;
|
|
93
|
+
if (!embeddingVal) {
|
|
94
|
+
for (const dim of DIM_COLUMNS) {
|
|
95
|
+
if (row[dim]) {
|
|
96
|
+
embeddingVal = row[dim];
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
id: String(row.id ?? row.ID ?? row.memory_id ?? ""),
|
|
103
|
+
content: parseContent(row.content ?? row.body ?? row.text ?? ""),
|
|
104
|
+
roomId: String(row.roomId ?? row.room_id ?? row.roomID ?? ""),
|
|
105
|
+
entityId: String(row.entityId ??
|
|
106
|
+
row.entity_id ??
|
|
107
|
+
row.entityID ??
|
|
108
|
+
row.userId ??
|
|
109
|
+
row.user_id ??
|
|
110
|
+
""),
|
|
111
|
+
type: String(row.type ?? row.memoryType ?? row.memory_type ?? ""),
|
|
112
|
+
createdAt: String(row.createdAt ?? row.created_at ?? row.timestamp ?? ""),
|
|
113
|
+
unique: row.unique === true || row.unique === 1 || row.isUnique === true,
|
|
114
|
+
embedding: parseEmbedding(embeddingVal),
|
|
115
|
+
raw: row,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function buildVectorGraph2DLayout(memories) {
|
|
119
|
+
const withEmbeddings = memories.filter(hasEmbedding);
|
|
120
|
+
if (withEmbeddings.length < 2) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const points = projectTo2D(withEmbeddings.map((memory) => memory.embedding));
|
|
124
|
+
let minX = Infinity;
|
|
125
|
+
let maxX = -Infinity;
|
|
126
|
+
let minY = Infinity;
|
|
127
|
+
let maxY = -Infinity;
|
|
128
|
+
for (const [x, y] of points) {
|
|
129
|
+
if (x < minX)
|
|
130
|
+
minX = x;
|
|
131
|
+
if (x > maxX)
|
|
132
|
+
maxX = x;
|
|
133
|
+
if (y < minY)
|
|
134
|
+
minY = y;
|
|
135
|
+
if (y > maxY)
|
|
136
|
+
maxY = y;
|
|
137
|
+
}
|
|
138
|
+
const typeColors = {};
|
|
139
|
+
const types = [...new Set(withEmbeddings.map((memory) => memory.type))];
|
|
140
|
+
for (let index = 0; index < types.length; index += 1) {
|
|
141
|
+
typeColors[types[index]] =
|
|
142
|
+
VECTOR_GRAPH_2D_PALETTE[index % VECTOR_GRAPH_2D_PALETTE.length];
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
bounds: {
|
|
146
|
+
minX,
|
|
147
|
+
minY,
|
|
148
|
+
rangeX: maxX - minX || 1,
|
|
149
|
+
rangeY: maxY - minY || 1,
|
|
150
|
+
},
|
|
151
|
+
points,
|
|
152
|
+
typeColors,
|
|
153
|
+
withEmbeddings,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function toVectorGraph2DScreenX(x, width, padding, bounds) {
|
|
157
|
+
return padding + ((x - bounds.minX) / bounds.rangeX) * (width - 2 * padding);
|
|
158
|
+
}
|
|
159
|
+
function toVectorGraph2DScreenY(y, height, padding, bounds) {
|
|
160
|
+
return padding + ((y - bounds.minY) / bounds.rangeY) * (height - 2 * padding);
|
|
161
|
+
}
|
|
162
|
+
// ── PCA projection utilities ───────────────────────────────────────────
|
|
163
|
+
function dot(a, b) {
|
|
164
|
+
let s = 0;
|
|
165
|
+
for (let i = 0; i < a.length; i++)
|
|
166
|
+
s += a[i] * (b[i] ?? 0);
|
|
167
|
+
return s;
|
|
168
|
+
}
|
|
169
|
+
function powerIteration(data, dims, iters = 30) {
|
|
170
|
+
const v = new Float64Array(dims);
|
|
171
|
+
// Random init
|
|
172
|
+
for (let d = 0; d < dims; d++)
|
|
173
|
+
v[d] = Math.random() - 0.5;
|
|
174
|
+
normalize(v);
|
|
175
|
+
for (let iter = 0; iter < iters; iter++) {
|
|
176
|
+
const w = new Float64Array(dims);
|
|
177
|
+
for (const row of data) {
|
|
178
|
+
const d = dot(row, v);
|
|
179
|
+
for (let j = 0; j < dims; j++)
|
|
180
|
+
w[j] += d * row[j];
|
|
181
|
+
}
|
|
182
|
+
normalize(w);
|
|
183
|
+
for (let d = 0; d < dims; d++)
|
|
184
|
+
v[d] = w[d];
|
|
185
|
+
}
|
|
186
|
+
return v;
|
|
187
|
+
}
|
|
188
|
+
function normalize(v) {
|
|
189
|
+
let len = 0;
|
|
190
|
+
for (let i = 0; i < v.length; i++)
|
|
191
|
+
len += v[i] * v[i];
|
|
192
|
+
len = Math.sqrt(len) || 1;
|
|
193
|
+
for (let i = 0; i < v.length; i++)
|
|
194
|
+
v[i] /= len;
|
|
195
|
+
}
|
|
196
|
+
/** Compute mean and center data for PCA. */
|
|
197
|
+
function centerData(vectors) {
|
|
198
|
+
const dims = vectors[0].length;
|
|
199
|
+
const n = vectors.length;
|
|
200
|
+
const mean = new Float64Array(dims);
|
|
201
|
+
for (const v of vectors) {
|
|
202
|
+
for (let d = 0; d < dims; d++)
|
|
203
|
+
mean[d] += v[d];
|
|
204
|
+
}
|
|
205
|
+
for (let d = 0; d < dims; d++)
|
|
206
|
+
mean[d] /= n;
|
|
207
|
+
const centered = vectors.map((v) => v.map((x, d) => x - mean[d]));
|
|
208
|
+
return { centered, mean };
|
|
209
|
+
}
|
|
210
|
+
/** Deflate data by removing projection onto a principal component. */
|
|
211
|
+
function deflate(data, pc) {
|
|
212
|
+
const proj = data.map((v) => dot(v, pc));
|
|
213
|
+
return data.map((v, i) => v.map((x, d) => x - proj[i] * pc[d]));
|
|
214
|
+
}
|
|
215
|
+
/** Project high-dimensional vectors to 2D using the first two principal axes. */
|
|
216
|
+
function projectTo2D(vectors) {
|
|
217
|
+
if (vectors.length === 0)
|
|
218
|
+
return [];
|
|
219
|
+
const dims = vectors[0].length;
|
|
220
|
+
const { centered } = centerData(vectors);
|
|
221
|
+
const pc1 = powerIteration(centered, dims);
|
|
222
|
+
const deflated1 = deflate(centered, pc1);
|
|
223
|
+
const pc2 = powerIteration(deflated1, dims);
|
|
224
|
+
return centered.map((v) => [dot(v, pc1), dot(v, pc2)]);
|
|
225
|
+
}
|
|
226
|
+
/** Project high-dimensional vectors to 3D using the first three principal axes. */
|
|
227
|
+
function projectTo3D(vectors) {
|
|
228
|
+
if (vectors.length === 0)
|
|
229
|
+
return [];
|
|
230
|
+
const dims = vectors[0].length;
|
|
231
|
+
const { centered } = centerData(vectors);
|
|
232
|
+
const pc1 = powerIteration(centered, dims);
|
|
233
|
+
const deflated1 = deflate(centered, pc1);
|
|
234
|
+
const pc2 = powerIteration(deflated1, dims);
|
|
235
|
+
const deflated2 = deflate(deflated1, pc2);
|
|
236
|
+
const pc3 = powerIteration(deflated2, dims);
|
|
237
|
+
return centered.map((v) => [dot(v, pc1), dot(v, pc2), dot(v, pc3)]);
|
|
238
|
+
}
|
|
239
|
+
// ── Graph sub-component ────────────────────────────────────────────────
|
|
240
|
+
function VectorGraph({ memories, onSelect, }) {
|
|
241
|
+
const { t } = useApp();
|
|
242
|
+
const canvasRef = useRef(null);
|
|
243
|
+
const containerRef = useRef(null);
|
|
244
|
+
const [hoveredIdx, setHoveredIdx] = useState(null);
|
|
245
|
+
const graph = useMemo(() => buildVectorGraph2DLayout(memories), [memories]);
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
const canvas = canvasRef.current;
|
|
248
|
+
const container = containerRef.current;
|
|
249
|
+
if (!canvas || !container || !graph)
|
|
250
|
+
return;
|
|
251
|
+
const rect = container.getBoundingClientRect();
|
|
252
|
+
const W = rect.width;
|
|
253
|
+
const H = 500;
|
|
254
|
+
const dpr = window.devicePixelRatio || 1;
|
|
255
|
+
canvas.width = W * dpr;
|
|
256
|
+
canvas.height = H * dpr;
|
|
257
|
+
canvas.style.width = `${W}px`;
|
|
258
|
+
canvas.style.height = `${H}px`;
|
|
259
|
+
const ctx = canvas.getContext("2d");
|
|
260
|
+
if (!ctx)
|
|
261
|
+
return;
|
|
262
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
263
|
+
const pad = 40;
|
|
264
|
+
// Background
|
|
265
|
+
const style = getComputedStyle(document.documentElement);
|
|
266
|
+
const bgColor = style.getPropertyValue("--bg").trim() || "#111";
|
|
267
|
+
const borderColor = style.getPropertyValue("--border").trim() || "#333";
|
|
268
|
+
const accentColor = style.getPropertyValue("--accent").trim() || "#6cf";
|
|
269
|
+
const mutedColor = style.getPropertyValue("--muted").trim() || "#888";
|
|
270
|
+
ctx.fillStyle = bgColor;
|
|
271
|
+
ctx.fillRect(0, 0, W, H);
|
|
272
|
+
// Grid lines
|
|
273
|
+
ctx.strokeStyle = borderColor;
|
|
274
|
+
ctx.lineWidth = 0.5;
|
|
275
|
+
for (let i = 0; i <= 4; i++) {
|
|
276
|
+
const x = pad + (i / 4) * (W - 2 * pad);
|
|
277
|
+
const y = pad + (i / 4) * (H - 2 * pad);
|
|
278
|
+
ctx.beginPath();
|
|
279
|
+
ctx.moveTo(x, pad);
|
|
280
|
+
ctx.lineTo(x, H - pad);
|
|
281
|
+
ctx.stroke();
|
|
282
|
+
ctx.beginPath();
|
|
283
|
+
ctx.moveTo(pad, y);
|
|
284
|
+
ctx.lineTo(W - pad, y);
|
|
285
|
+
ctx.stroke();
|
|
286
|
+
}
|
|
287
|
+
// Axis labels
|
|
288
|
+
ctx.fillStyle = mutedColor;
|
|
289
|
+
ctx.font = "10px monospace";
|
|
290
|
+
ctx.textAlign = "center";
|
|
291
|
+
ctx.fillText("PC1", W / 2, H - 8);
|
|
292
|
+
ctx.save();
|
|
293
|
+
ctx.translate(12, H / 2);
|
|
294
|
+
ctx.rotate(-Math.PI / 2);
|
|
295
|
+
ctx.fillText("PC2", 0, 0);
|
|
296
|
+
ctx.restore();
|
|
297
|
+
// Draw points
|
|
298
|
+
for (let i = 0; i < graph.points.length; i++) {
|
|
299
|
+
const sx = toVectorGraph2DScreenX(graph.points[i][0], W, pad, graph.bounds);
|
|
300
|
+
const sy = toVectorGraph2DScreenY(graph.points[i][1], H, pad, graph.bounds);
|
|
301
|
+
const memory = graph.withEmbeddings[i];
|
|
302
|
+
const color = graph.typeColors[memory.type] || accentColor;
|
|
303
|
+
const isHovered = hoveredIdx === i;
|
|
304
|
+
ctx.beginPath();
|
|
305
|
+
ctx.arc(sx, sy, isHovered ? 6 : 4, 0, Math.PI * 2);
|
|
306
|
+
ctx.fillStyle = color;
|
|
307
|
+
ctx.globalAlpha = isHovered ? 1 : 0.7;
|
|
308
|
+
ctx.fill();
|
|
309
|
+
ctx.globalAlpha = 1;
|
|
310
|
+
if (isHovered) {
|
|
311
|
+
ctx.strokeStyle = "#fff";
|
|
312
|
+
ctx.lineWidth = 1.5;
|
|
313
|
+
ctx.stroke();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// Tooltip for hovered point
|
|
317
|
+
if (hoveredIdx !== null && hoveredIdx < graph.points.length) {
|
|
318
|
+
const sx = toVectorGraph2DScreenX(graph.points[hoveredIdx][0], W, pad, graph.bounds);
|
|
319
|
+
const sy = toVectorGraph2DScreenY(graph.points[hoveredIdx][1], H, pad, graph.bounds);
|
|
320
|
+
const memory = graph.withEmbeddings[hoveredIdx];
|
|
321
|
+
const label = memory.content.slice(0, 60) + (memory.content.length > 60 ? "..." : "");
|
|
322
|
+
ctx.font = "11px sans-serif";
|
|
323
|
+
const metrics = ctx.measureText(label);
|
|
324
|
+
const tw = metrics.width + 12;
|
|
325
|
+
const th = 22;
|
|
326
|
+
let tx = sx + 10;
|
|
327
|
+
let ty = sy - 10 - th;
|
|
328
|
+
if (tx + tw > W)
|
|
329
|
+
tx = sx - tw - 10;
|
|
330
|
+
if (ty < 0)
|
|
331
|
+
ty = sy + 10;
|
|
332
|
+
ctx.fillStyle = "rgba(0,0,0,0.85)";
|
|
333
|
+
ctx.fillRect(tx, ty, tw, th);
|
|
334
|
+
ctx.fillStyle = "#fff";
|
|
335
|
+
ctx.textAlign = "left";
|
|
336
|
+
ctx.fillText(label, tx + 6, ty + 15);
|
|
337
|
+
}
|
|
338
|
+
// Legend
|
|
339
|
+
const types = Object.keys(graph.typeColors);
|
|
340
|
+
if (types.length > 1) {
|
|
341
|
+
let lx = pad;
|
|
342
|
+
const ly = H - 4;
|
|
343
|
+
ctx.font = "10px sans-serif";
|
|
344
|
+
ctx.textAlign = "left";
|
|
345
|
+
for (const type of types) {
|
|
346
|
+
if (!type || type === "undefined")
|
|
347
|
+
continue;
|
|
348
|
+
ctx.fillStyle = graph.typeColors[type];
|
|
349
|
+
ctx.fillRect(lx, ly - 8, 8, 8);
|
|
350
|
+
ctx.fillStyle = mutedColor;
|
|
351
|
+
ctx.fillText(type, lx + 11, ly);
|
|
352
|
+
lx += ctx.measureText(type).width + 24;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}, [graph, hoveredIdx]);
|
|
356
|
+
// Mouse interaction
|
|
357
|
+
const handleMouseMove = useCallback((e) => {
|
|
358
|
+
const canvas = canvasRef.current;
|
|
359
|
+
if (!canvas || !graph)
|
|
360
|
+
return;
|
|
361
|
+
const rect = canvas.getBoundingClientRect();
|
|
362
|
+
const mx = e.clientX - rect.left;
|
|
363
|
+
const my = e.clientY - rect.top;
|
|
364
|
+
const W = rect.width;
|
|
365
|
+
const H = rect.height;
|
|
366
|
+
const pad = 40;
|
|
367
|
+
let closest = -1;
|
|
368
|
+
let closestDist = 15; // max pixel distance
|
|
369
|
+
for (let i = 0; i < graph.points.length; i++) {
|
|
370
|
+
const sx = toVectorGraph2DScreenX(graph.points[i][0], W, pad, graph.bounds);
|
|
371
|
+
const sy = toVectorGraph2DScreenY(graph.points[i][1], H, pad, graph.bounds);
|
|
372
|
+
const dist = Math.sqrt((mx - sx) ** 2 + (my - sy) ** 2);
|
|
373
|
+
if (dist < closestDist) {
|
|
374
|
+
closestDist = dist;
|
|
375
|
+
closest = i;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
setHoveredIdx(closest >= 0 ? closest : null);
|
|
379
|
+
}, [graph]);
|
|
380
|
+
const handleClick = useCallback(() => {
|
|
381
|
+
if (graph &&
|
|
382
|
+
hoveredIdx !== null &&
|
|
383
|
+
hoveredIdx < graph.withEmbeddings.length) {
|
|
384
|
+
onSelect(graph.withEmbeddings[hoveredIdx]);
|
|
385
|
+
}
|
|
386
|
+
}, [graph, hoveredIdx, onSelect]);
|
|
387
|
+
if (!graph) {
|
|
388
|
+
const withEmbeddings = memories.filter(hasEmbedding);
|
|
389
|
+
return (_jsxs("div", { className: "text-center py-16", children: [_jsx("div", { className: "text-[var(--muted)] text-sm mb-2", children: t("vectorbrowserview.NotEnoughEmbedding") }), _jsxs("div", { className: "text-[var(--muted)] text-xs", children: [t("vectorbrowserview.NeedAtLeast2Memo"), " ", withEmbeddings.length, "."] })] }));
|
|
390
|
+
}
|
|
391
|
+
return (_jsxs("div", { ref: containerRef, className: "w-full", children: [_jsxs("div", { className: "text-[11px] text-[var(--muted)] mb-2", children: [graph.withEmbeddings.length, " ", t("vectorbrowserview.vectorsProjectedTo")] }), _jsx("canvas", { ref: canvasRef, className: "w-full border border-[var(--border)] cursor-crosshair", style: { height: 500 }, onMouseMove: handleMouseMove, onMouseLeave: () => setHoveredIdx(null), onClick: handleClick })] }));
|
|
392
|
+
}
|
|
393
|
+
// ── 3D Graph sub-component (Three.js) ──────────────────────────────────
|
|
394
|
+
function VectorGraph3D({ memories, onSelect, }) {
|
|
395
|
+
const { t } = useApp();
|
|
396
|
+
const containerRef = useRef(null);
|
|
397
|
+
const rendererRef = useRef(null);
|
|
398
|
+
const sceneRef = useRef(null);
|
|
399
|
+
const cameraRef = useRef(null);
|
|
400
|
+
const spheresRef = useRef([]);
|
|
401
|
+
const animationRef = useRef(0);
|
|
402
|
+
const [hoveredIdx, setHoveredIdx] = useState(null);
|
|
403
|
+
const [tooltipPos, setTooltipPos] = useState(null);
|
|
404
|
+
const [rendererUnavailable, setRendererUnavailable] = useState(false);
|
|
405
|
+
const isDraggingRef = useRef(false);
|
|
406
|
+
const mouseDownPosRef = useRef(null);
|
|
407
|
+
const cleanupRef = useRef(null);
|
|
408
|
+
const withEmbeddings = useMemo(() => memories.filter(hasEmbedding), [memories]);
|
|
409
|
+
const points3D = useMemo(() => {
|
|
410
|
+
if (withEmbeddings.length < 2)
|
|
411
|
+
return [];
|
|
412
|
+
const vecs = withEmbeddings.map((m) => m.embedding);
|
|
413
|
+
return projectTo3D(vecs);
|
|
414
|
+
}, [withEmbeddings]);
|
|
415
|
+
// Color palette for types
|
|
416
|
+
const typeColors = useMemo(() => {
|
|
417
|
+
const types = [...new Set(withEmbeddings.map((m) => m.type))];
|
|
418
|
+
const palette = [
|
|
419
|
+
0x6699ff, 0xf59e0b, 0x10b981, 0xef4444, 0x8b5cf6, 0xec4899, 0x06b6d4,
|
|
420
|
+
0x84cc16,
|
|
421
|
+
];
|
|
422
|
+
const map = {};
|
|
423
|
+
types.forEach((t, i) => {
|
|
424
|
+
map[t] = palette[i % palette.length];
|
|
425
|
+
});
|
|
426
|
+
return map;
|
|
427
|
+
}, [withEmbeddings]);
|
|
428
|
+
// Initialize Three.js scene
|
|
429
|
+
useEffect(() => {
|
|
430
|
+
const container = containerRef.current;
|
|
431
|
+
if (!container || points3D.length === 0)
|
|
432
|
+
return;
|
|
433
|
+
let cancelled = false;
|
|
434
|
+
cleanupRef.current = null;
|
|
435
|
+
setRendererUnavailable(false);
|
|
436
|
+
// Async renderer creation — tries WebGPU, falls back to WebGL.
|
|
437
|
+
// All scene setup runs inside this async IIFE so the useEffect callback
|
|
438
|
+
// itself remains synchronous (required for React cleanup return).
|
|
439
|
+
void (async () => {
|
|
440
|
+
const W = container.clientWidth;
|
|
441
|
+
const H = 550;
|
|
442
|
+
// Scene
|
|
443
|
+
const scene = new THREE.Scene();
|
|
444
|
+
scene.background = new THREE.Color(0x111111);
|
|
445
|
+
sceneRef.current = scene;
|
|
446
|
+
// Camera
|
|
447
|
+
const camera = new THREE.PerspectiveCamera(60, W / H, 0.1, 1000);
|
|
448
|
+
camera.position.set(0, 0, 5);
|
|
449
|
+
cameraRef.current = camera;
|
|
450
|
+
let renderer;
|
|
451
|
+
try {
|
|
452
|
+
renderer = await createVectorBrowserRenderer();
|
|
453
|
+
}
|
|
454
|
+
catch {
|
|
455
|
+
if (!cancelled) {
|
|
456
|
+
setRendererUnavailable(true);
|
|
457
|
+
}
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
// Guard: if the effect was cleaned up while awaiting WebGPU init, abort.
|
|
461
|
+
if (cancelled) {
|
|
462
|
+
renderer.dispose();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const raycaster = new THREE.Raycaster();
|
|
466
|
+
const pointer = new THREE.Vector2();
|
|
467
|
+
const geometry = new THREE.SphereGeometry(0.06, 16, 16);
|
|
468
|
+
const spheres = [];
|
|
469
|
+
let gridHelper = null;
|
|
470
|
+
let axisGeom = null;
|
|
471
|
+
let axisMat = null;
|
|
472
|
+
let onMouseDown = null;
|
|
473
|
+
let onMouseUp = null;
|
|
474
|
+
let onMouseMove = null;
|
|
475
|
+
let onClick = null;
|
|
476
|
+
let onWheel = null;
|
|
477
|
+
let onMouseLeave = null;
|
|
478
|
+
let handleResize = null;
|
|
479
|
+
let cleanedUp = false;
|
|
480
|
+
cleanupRef.current = () => {
|
|
481
|
+
if (cleanedUp)
|
|
482
|
+
return;
|
|
483
|
+
cleanedUp = true;
|
|
484
|
+
cancelAnimationFrame(animationRef.current);
|
|
485
|
+
if (handleResize) {
|
|
486
|
+
window.removeEventListener("resize", handleResize);
|
|
487
|
+
}
|
|
488
|
+
if (onMouseDown) {
|
|
489
|
+
renderer.domElement.removeEventListener("mousedown", onMouseDown);
|
|
490
|
+
}
|
|
491
|
+
if (onMouseUp) {
|
|
492
|
+
renderer.domElement.removeEventListener("mouseup", onMouseUp);
|
|
493
|
+
}
|
|
494
|
+
if (onMouseMove) {
|
|
495
|
+
renderer.domElement.removeEventListener("mousemove", onMouseMove);
|
|
496
|
+
}
|
|
497
|
+
if (onClick) {
|
|
498
|
+
renderer.domElement.removeEventListener("click", onClick);
|
|
499
|
+
}
|
|
500
|
+
if (onWheel) {
|
|
501
|
+
renderer.domElement.removeEventListener("wheel", onWheel);
|
|
502
|
+
}
|
|
503
|
+
if (onMouseLeave) {
|
|
504
|
+
renderer.domElement.removeEventListener("mouseleave", onMouseLeave);
|
|
505
|
+
}
|
|
506
|
+
geometry.dispose();
|
|
507
|
+
axisGeom?.dispose();
|
|
508
|
+
axisMat?.dispose();
|
|
509
|
+
if (gridHelper) {
|
|
510
|
+
const gridMaterial = Array.isArray(gridHelper.material)
|
|
511
|
+
? gridHelper.material
|
|
512
|
+
: [gridHelper.material];
|
|
513
|
+
for (const material of gridMaterial) {
|
|
514
|
+
material.dispose();
|
|
515
|
+
}
|
|
516
|
+
gridHelper.geometry.dispose();
|
|
517
|
+
}
|
|
518
|
+
for (const sphere of spheres) {
|
|
519
|
+
const material = sphere.material;
|
|
520
|
+
if (Array.isArray(material)) {
|
|
521
|
+
for (const entry of material) {
|
|
522
|
+
entry.dispose();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
material.dispose();
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
renderer.dispose();
|
|
530
|
+
rendererRef.current = null;
|
|
531
|
+
sceneRef.current = null;
|
|
532
|
+
cameraRef.current = null;
|
|
533
|
+
spheresRef.current = [];
|
|
534
|
+
if (container.contains(renderer.domElement)) {
|
|
535
|
+
container.removeChild(renderer.domElement);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
renderer.setSize(W, H);
|
|
539
|
+
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, MAX_THREE_PIXEL_RATIO));
|
|
540
|
+
container.appendChild(renderer.domElement);
|
|
541
|
+
rendererRef.current = renderer;
|
|
542
|
+
if (cancelled) {
|
|
543
|
+
cleanupRef.current?.();
|
|
544
|
+
cleanupRef.current = null;
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
// Compute bounds for scaling
|
|
548
|
+
let minX = Infinity, maxX = -Infinity;
|
|
549
|
+
let minY = Infinity, maxY = -Infinity;
|
|
550
|
+
let minZ = Infinity, maxZ = -Infinity;
|
|
551
|
+
for (const [x, y, z] of points3D) {
|
|
552
|
+
if (x < minX)
|
|
553
|
+
minX = x;
|
|
554
|
+
if (x > maxX)
|
|
555
|
+
maxX = x;
|
|
556
|
+
if (y < minY)
|
|
557
|
+
minY = y;
|
|
558
|
+
if (y > maxY)
|
|
559
|
+
maxY = y;
|
|
560
|
+
if (z < minZ)
|
|
561
|
+
minZ = z;
|
|
562
|
+
if (z > maxZ)
|
|
563
|
+
maxZ = z;
|
|
564
|
+
}
|
|
565
|
+
const rangeX = maxX - minX || 1;
|
|
566
|
+
const rangeY = maxY - minY || 1;
|
|
567
|
+
const rangeZ = maxZ - minZ || 1;
|
|
568
|
+
const maxRange = Math.max(rangeX, rangeY, rangeZ);
|
|
569
|
+
const scale = 3 / maxRange;
|
|
570
|
+
const centerX = (minX + maxX) / 2;
|
|
571
|
+
const centerY = (minY + maxY) / 2;
|
|
572
|
+
const centerZ = (minZ + maxZ) / 2;
|
|
573
|
+
for (let i = 0; i < points3D.length; i++) {
|
|
574
|
+
const [x, y, z] = points3D[i];
|
|
575
|
+
const mem = withEmbeddings[i];
|
|
576
|
+
const color = typeColors[mem.type] ?? 0x6699ff;
|
|
577
|
+
const material = new THREE.MeshBasicMaterial({
|
|
578
|
+
color,
|
|
579
|
+
transparent: true,
|
|
580
|
+
opacity: 0.85,
|
|
581
|
+
});
|
|
582
|
+
const sphere = new THREE.Mesh(geometry, material);
|
|
583
|
+
sphere.position.set((x - centerX) * scale, (y - centerY) * scale, (z - centerZ) * scale);
|
|
584
|
+
sphere.userData = { index: i };
|
|
585
|
+
scene.add(sphere);
|
|
586
|
+
spheres.push(sphere);
|
|
587
|
+
}
|
|
588
|
+
spheresRef.current = spheres;
|
|
589
|
+
// Add subtle grid helper
|
|
590
|
+
gridHelper = new THREE.GridHelper(6, 12, 0x333333, 0x222222);
|
|
591
|
+
gridHelper.position.y = -2;
|
|
592
|
+
scene.add(gridHelper);
|
|
593
|
+
// Add axis lines
|
|
594
|
+
const axisLength = 2.5;
|
|
595
|
+
axisGeom = new THREE.BufferGeometry();
|
|
596
|
+
const axisPositions = new Float32Array([
|
|
597
|
+
-axisLength,
|
|
598
|
+
0,
|
|
599
|
+
0,
|
|
600
|
+
axisLength,
|
|
601
|
+
0,
|
|
602
|
+
0, // X axis
|
|
603
|
+
0,
|
|
604
|
+
-axisLength,
|
|
605
|
+
0,
|
|
606
|
+
0,
|
|
607
|
+
axisLength,
|
|
608
|
+
0, // Y axis
|
|
609
|
+
0,
|
|
610
|
+
0,
|
|
611
|
+
-axisLength,
|
|
612
|
+
0,
|
|
613
|
+
0,
|
|
614
|
+
axisLength, // Z axis
|
|
615
|
+
]);
|
|
616
|
+
axisGeom.setAttribute("position", new THREE.BufferAttribute(axisPositions, 3));
|
|
617
|
+
axisMat = new THREE.LineBasicMaterial({ color: 0x444444 });
|
|
618
|
+
const axisLines = new THREE.LineSegments(axisGeom, axisMat);
|
|
619
|
+
scene.add(axisLines);
|
|
620
|
+
// Simple orbit controls (manual implementation)
|
|
621
|
+
let theta = 0;
|
|
622
|
+
let phi = Math.PI / 4;
|
|
623
|
+
let radius = 5;
|
|
624
|
+
let targetTheta = theta;
|
|
625
|
+
let targetPhi = phi;
|
|
626
|
+
let targetRadius = radius;
|
|
627
|
+
const updatePointerFromEvent = (e) => {
|
|
628
|
+
const rect = renderer.domElement.getBoundingClientRect();
|
|
629
|
+
pointer.set(((e.clientX - rect.left) / rect.width) * 2 - 1, -((e.clientY - rect.top) / rect.height) * 2 + 1);
|
|
630
|
+
return rect;
|
|
631
|
+
};
|
|
632
|
+
const updateCamera = () => {
|
|
633
|
+
theta += (targetTheta - theta) * 0.1;
|
|
634
|
+
phi += (targetPhi - phi) * 0.1;
|
|
635
|
+
radius += (targetRadius - radius) * 0.1;
|
|
636
|
+
phi = Math.max(0.1, Math.min(Math.PI - 0.1, phi));
|
|
637
|
+
camera.position.x = radius * Math.sin(phi) * Math.cos(theta);
|
|
638
|
+
camera.position.y = radius * Math.cos(phi);
|
|
639
|
+
camera.position.z = radius * Math.sin(phi) * Math.sin(theta);
|
|
640
|
+
camera.lookAt(0, 0, 0);
|
|
641
|
+
};
|
|
642
|
+
onMouseDown = (e) => {
|
|
643
|
+
isDraggingRef.current = true;
|
|
644
|
+
mouseDownPosRef.current = { x: e.clientX, y: e.clientY };
|
|
645
|
+
};
|
|
646
|
+
onMouseUp = () => {
|
|
647
|
+
isDraggingRef.current = false;
|
|
648
|
+
mouseDownPosRef.current = null;
|
|
649
|
+
};
|
|
650
|
+
onMouseMove = (e) => {
|
|
651
|
+
if (isDraggingRef.current) {
|
|
652
|
+
targetTheta -= e.movementX * 0.01;
|
|
653
|
+
targetPhi -= e.movementY * 0.01;
|
|
654
|
+
}
|
|
655
|
+
// Raycasting for hover
|
|
656
|
+
const rect = updatePointerFromEvent(e);
|
|
657
|
+
raycaster.setFromCamera(pointer, camera);
|
|
658
|
+
const intersects = raycaster.intersectObjects(spheres);
|
|
659
|
+
if (intersects.length > 0) {
|
|
660
|
+
const idx = intersects[0].object.userData.index;
|
|
661
|
+
setHoveredIdx(idx);
|
|
662
|
+
setTooltipPos({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
|
663
|
+
// Highlight hovered sphere
|
|
664
|
+
spheres.forEach((s, i) => {
|
|
665
|
+
const mat = s.material;
|
|
666
|
+
mat.opacity = i === idx ? 1 : 0.5;
|
|
667
|
+
s.scale.setScalar(i === idx ? 1.5 : 1);
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
setHoveredIdx(null);
|
|
672
|
+
setTooltipPos(null);
|
|
673
|
+
spheres.forEach((s) => {
|
|
674
|
+
const mat = s.material;
|
|
675
|
+
mat.opacity = 0.85;
|
|
676
|
+
s.scale.setScalar(1);
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
onClick = (e) => {
|
|
681
|
+
// Only trigger click if we didn't drag much
|
|
682
|
+
if (mouseDownPosRef.current) {
|
|
683
|
+
const dx = Math.abs(e.clientX - mouseDownPosRef.current.x);
|
|
684
|
+
const dy = Math.abs(e.clientY - mouseDownPosRef.current.y);
|
|
685
|
+
if (dx > 5 || dy > 5)
|
|
686
|
+
return; // Was a drag, not a click
|
|
687
|
+
}
|
|
688
|
+
updatePointerFromEvent(e);
|
|
689
|
+
raycaster.setFromCamera(pointer, camera);
|
|
690
|
+
const intersects = raycaster.intersectObjects(spheres);
|
|
691
|
+
if (intersects.length > 0) {
|
|
692
|
+
const idx = intersects[0].object.userData.index;
|
|
693
|
+
if (idx < withEmbeddings.length) {
|
|
694
|
+
onSelect(withEmbeddings[idx]);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
onWheel = (e) => {
|
|
699
|
+
e.preventDefault();
|
|
700
|
+
targetRadius += e.deltaY * 0.005;
|
|
701
|
+
targetRadius = Math.max(2, Math.min(15, targetRadius));
|
|
702
|
+
};
|
|
703
|
+
onMouseLeave = () => {
|
|
704
|
+
isDraggingRef.current = false;
|
|
705
|
+
setHoveredIdx(null);
|
|
706
|
+
setTooltipPos(null);
|
|
707
|
+
};
|
|
708
|
+
renderer.domElement.addEventListener("mousedown", onMouseDown);
|
|
709
|
+
renderer.domElement.addEventListener("mouseup", onMouseUp);
|
|
710
|
+
renderer.domElement.addEventListener("mousemove", onMouseMove);
|
|
711
|
+
renderer.domElement.addEventListener("click", onClick);
|
|
712
|
+
renderer.domElement.addEventListener("wheel", onWheel, {
|
|
713
|
+
passive: false,
|
|
714
|
+
});
|
|
715
|
+
renderer.domElement.addEventListener("mouseleave", onMouseLeave);
|
|
716
|
+
if (cancelled) {
|
|
717
|
+
cleanupRef.current?.();
|
|
718
|
+
cleanupRef.current = null;
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
// Animation loop
|
|
722
|
+
const animate = () => {
|
|
723
|
+
updateCamera();
|
|
724
|
+
renderer.render(scene, camera);
|
|
725
|
+
animationRef.current = requestAnimationFrame(animate);
|
|
726
|
+
};
|
|
727
|
+
animate();
|
|
728
|
+
// Resize handler
|
|
729
|
+
handleResize = () => {
|
|
730
|
+
const newW = container.clientWidth;
|
|
731
|
+
camera.aspect = newW / H;
|
|
732
|
+
camera.updateProjectionMatrix();
|
|
733
|
+
renderer.setSize(newW, H);
|
|
734
|
+
};
|
|
735
|
+
window.addEventListener("resize", handleResize);
|
|
736
|
+
})(); // end async IIFE
|
|
737
|
+
return () => {
|
|
738
|
+
cancelled = true;
|
|
739
|
+
cleanupRef.current?.();
|
|
740
|
+
cleanupRef.current = null;
|
|
741
|
+
};
|
|
742
|
+
}, [points3D, withEmbeddings, typeColors, onSelect]);
|
|
743
|
+
if (withEmbeddings.length < 2) {
|
|
744
|
+
return (_jsxs("div", { className: "text-center py-16", children: [_jsx("div", { className: "text-[var(--muted)] text-sm mb-2", children: t("vectorbrowserview.NotEnoughEmbedding1") }), _jsxs("div", { className: "text-[var(--muted)] text-xs", children: [t("vectorbrowserview.NeedAtLeast2Memo"), " ", withEmbeddings.length, "."] })] }));
|
|
745
|
+
}
|
|
746
|
+
if (rendererUnavailable) {
|
|
747
|
+
return (_jsxs("div", { className: "border border-[var(--border)] bg-[var(--card)] px-4 py-10 text-center", children: [_jsx("div", { className: "text-sm text-[var(--txt)]", children: "3D view unavailable in this environment." }), _jsx("div", { className: "mt-2 text-xs text-[var(--muted)]", children: "The current runtime could not initialize a renderer." })] }));
|
|
748
|
+
}
|
|
749
|
+
const hoveredMem = hoveredIdx !== null ? withEmbeddings[hoveredIdx] : null;
|
|
750
|
+
return (_jsxs("div", { className: "relative", children: [_jsxs("div", { className: "text-[11px] text-[var(--muted)] mb-2", children: [withEmbeddings.length, " ", t("vectorbrowserview.vectorsProjectedTo1")] }), _jsx("div", { ref: containerRef, className: "w-full border border-[var(--border)] cursor-grab active:cursor-grabbing", style: { height: 550 } }), hoveredMem && tooltipPos && (_jsxs("div", { className: "absolute pointer-events-none bg-black/90 text-white text-[11px] px-3 py-2 max-w-[300px] z-10", style: {
|
|
751
|
+
left: tooltipPos.x + 15,
|
|
752
|
+
top: tooltipPos.y + 15,
|
|
753
|
+
transform: tooltipPos.x > 400 ? "translateX(-100%)" : undefined,
|
|
754
|
+
}, children: [_jsxs("div", { className: "font-medium mb-1 truncate", children: [hoveredMem.type && hoveredMem.type !== "undefined" && (_jsx("span", { className: "px-1.5 py-0.5 bg-[var(--accent)]/30 text-[var(--accent)] mr-2 text-[10px]", children: hoveredMem.type })), hoveredMem.id.slice(0, 12), "..."] }), _jsxs("div", { className: "text-[var(--muted)] line-clamp-3", children: [hoveredMem.content.slice(0, 150), hoveredMem.content.length > 150 ? "..." : ""] })] })), _jsx("div", { className: "flex flex-wrap gap-3 mt-2 text-[10px]", children: Object.entries(typeColors).map(([type, color]) => type &&
|
|
755
|
+
type !== "undefined" && (_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("div", { className: "w-3 h-3 rounded-full", style: {
|
|
756
|
+
backgroundColor: `#${color.toString(16).padStart(6, "0")}`,
|
|
757
|
+
} }), _jsx("span", { className: "text-[var(--muted)]", children: type })] }, type))) })] }));
|
|
758
|
+
}
|
|
759
|
+
// ── Detail modal ───────────────────────────────────────────────────────
|
|
760
|
+
function MemoryDetailModal({ memory, onClose, }) {
|
|
761
|
+
const { t } = useApp();
|
|
762
|
+
return (_jsx("div", { className: "fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-8", onClick: (e) => {
|
|
763
|
+
if (e.target === e.currentTarget)
|
|
764
|
+
onClose();
|
|
765
|
+
}, onKeyDown: (e) => {
|
|
766
|
+
if (e.key === "Escape" || e.key === "Enter" || e.key === " ") {
|
|
767
|
+
e.preventDefault();
|
|
768
|
+
onClose();
|
|
769
|
+
}
|
|
770
|
+
}, role: "dialog", "aria-modal": "true", children: _jsxs("div", { className: "bg-[var(--card)] border border-[var(--border)] max-w-[700px] w-full max-h-[90vh] overflow-auto", children: [_jsxs("div", { className: "flex items-center justify-between p-3 border-b border-[var(--border)]", children: [_jsx("div", { className: "text-xs font-medium text-[var(--txt)]", children: t("vectorbrowserview.MemoryDetail") }), _jsx(Button, { variant: "ghost", size: "icon", className: "text-[var(--muted)] hover:text-[var(--txt)] hover:bg-transparent h-6 w-6 text-lg", onClick: onClose, children: "\u00D7" })] }), _jsxs("div", { className: "p-4", children: [_jsx("div", { className: "text-[11px] text-[var(--muted)] mb-1 uppercase font-bold", children: t("vectorbrowserview.Content") }), _jsx("div", { className: "text-xs text-[var(--txt)] whitespace-pre-wrap break-words mb-4 p-2 bg-[var(--bg)] border border-[var(--border)] max-h-[200px] overflow-auto", children: memory.content || "(empty)" }), _jsx("div", { className: "text-[11px] text-[var(--muted)] mb-1 uppercase font-bold", children: t("vectorbrowserview.Metadata") }), _jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-1 text-xs mb-4", children: [_jsx("span", { className: "text-[var(--muted)]", children: "ID" }), _jsx("span", { className: "text-[var(--txt)] font-mono truncate", children: memory.id || "—" }), _jsx("span", { className: "text-[var(--muted)]", children: t("vectorbrowserview.Type") }), _jsx("span", { className: "text-[var(--txt)]", children: memory.type || "—" }), _jsx("span", { className: "text-[var(--muted)]", children: t("vectorbrowserview.Room") }), _jsx("span", { className: "text-[var(--txt)] font-mono truncate", children: memory.roomId || "—" }), _jsx("span", { className: "text-[var(--muted)]", children: t("vectorbrowserview.Entity") }), _jsx("span", { className: "text-[var(--txt)] font-mono truncate", children: memory.entityId || "—" }), _jsx("span", { className: "text-[var(--muted)]", children: t("vectorbrowserview.Created") }), _jsx("span", { className: "text-[var(--txt)]", children: memory.createdAt || "—" }), _jsx("span", { className: "text-[var(--muted)]", children: t("vectorbrowserview.Unique") }), _jsx("span", { className: "text-[var(--txt)]", children: memory.unique ? "Yes" : "No" })] }), memory.embedding && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "text-[11px] text-[var(--muted)] mb-1 uppercase font-bold", children: [t("vectorbrowserview.Embedding"), memory.embedding.length, " ", t("vectorbrowserview.dimensions")] }), _jsxs("div", { className: "p-2 bg-[var(--bg)] border border-[var(--border)] text-[10px] font-mono text-[var(--muted)] max-h-[150px] overflow-auto break-all mb-4", children: ["[", memory.embedding.map((v) => v.toFixed(6)).join(", "), "]"] })] })), _jsxs("details", { children: [_jsx("summary", { className: "text-[11px] text-[var(--muted)] cursor-pointer hover:text-[var(--txt)] uppercase font-bold mb-1", children: t("vectorbrowserview.RawRecord") }), _jsx("div", { className: "p-2 bg-[var(--bg)] border border-[var(--border)] text-[10px] font-mono text-[var(--muted)] max-h-[200px] overflow-auto break-all", children: JSON.stringify(memory.raw, null, 2) })] })] })] }) }));
|
|
771
|
+
}
|
|
772
|
+
// ── Main component ─────────────────────────────────────────────────────
|
|
773
|
+
export function VectorBrowserView() {
|
|
774
|
+
const { t } = useApp();
|
|
775
|
+
const [tables, setTables] = useState([]);
|
|
776
|
+
const [selectedTable, setSelectedTable] = useState("");
|
|
777
|
+
const [memories, setMemories] = useState([]);
|
|
778
|
+
const [totalCount, setTotalCount] = useState(0);
|
|
779
|
+
const [page, setPage] = useState(0);
|
|
780
|
+
const [loading, setLoading] = useState(true);
|
|
781
|
+
const [error, setError] = useState("");
|
|
782
|
+
const [search, setSearch] = useState("");
|
|
783
|
+
const [searchInput, setSearchInput] = useState("");
|
|
784
|
+
const [selectedMemory, setSelectedMemory] = useState(null);
|
|
785
|
+
const [viewMode, setViewMode] = useState("list");
|
|
786
|
+
const [graphMemories, setGraphMemories] = useState([]);
|
|
787
|
+
const [graphLoading, setGraphLoading] = useState(false);
|
|
788
|
+
const [stats, setStats] = useState(null);
|
|
789
|
+
// Track whether the `embeddings` table exists for JOIN queries
|
|
790
|
+
const [hasEmbeddingsTable, setHasEmbeddingsTable] = useState(false);
|
|
791
|
+
// Discover vector/memory tables
|
|
792
|
+
const loadTables = useCallback(async () => {
|
|
793
|
+
try {
|
|
794
|
+
const { tables: allTables } = await client.getDatabaseTables();
|
|
795
|
+
const vectorTables = allTables.filter((t) => {
|
|
796
|
+
const n = t.name.toLowerCase();
|
|
797
|
+
return (n.includes("memor") ||
|
|
798
|
+
n.includes("embed") ||
|
|
799
|
+
n.includes("vector") ||
|
|
800
|
+
n.includes("knowledge"));
|
|
801
|
+
});
|
|
802
|
+
const available = vectorTables.length > 0 ? vectorTables : allTables;
|
|
803
|
+
setTables(available);
|
|
804
|
+
// Check for separate embeddings table (elizaOS stores vectors there)
|
|
805
|
+
const embTbl = allTables.find((t) => t.name === "embeddings");
|
|
806
|
+
setHasEmbeddingsTable(!!embTbl);
|
|
807
|
+
if (available.length > 0 && !selectedTable) {
|
|
808
|
+
const preferred = available.find((t) => t.name.toLowerCase() === "memories") ??
|
|
809
|
+
available.find((t) => t.name.toLowerCase().includes("memor"));
|
|
810
|
+
setSelectedTable(preferred?.name ?? available[0].name);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
catch (err) {
|
|
814
|
+
const msg = err instanceof Error ? err.message : "error";
|
|
815
|
+
if (msg === "Failed to fetch" || msg.includes("fetch")) {
|
|
816
|
+
setError("Cannot connect to database. Make sure the agent is running.");
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
setError(`Failed to load tables: ${msg}`);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}, [selectedTable]);
|
|
823
|
+
// Build a SELECT that casts any vector/embedding column to text so the raw
|
|
824
|
+
// driver returns a parseable string instead of a binary blob.
|
|
825
|
+
const buildSelect = useCallback(async (table) => {
|
|
826
|
+
try {
|
|
827
|
+
const colResult = await client.executeDatabaseQuery(`SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '${table.replace(/'/g, "''")}' AND table_schema NOT IN ('pg_catalog','information_schema') ORDER BY ordinal_position`);
|
|
828
|
+
const cols = colResult.rows.map((r) => {
|
|
829
|
+
const name = String(r.column_name);
|
|
830
|
+
const dtype = String(r.data_type).toLowerCase();
|
|
831
|
+
// Cast USER-DEFINED types (pgvector) and bytea to text
|
|
832
|
+
if (dtype === "user-defined" ||
|
|
833
|
+
dtype === "bytea" ||
|
|
834
|
+
dtype === "vector") {
|
|
835
|
+
return `"${name}"::text AS "${name}"`;
|
|
836
|
+
}
|
|
837
|
+
return `"${name}"`;
|
|
838
|
+
});
|
|
839
|
+
if (cols.length > 0)
|
|
840
|
+
return cols.join(", ");
|
|
841
|
+
}
|
|
842
|
+
catch {
|
|
843
|
+
// fall through to SELECT *
|
|
844
|
+
}
|
|
845
|
+
return "*";
|
|
846
|
+
}, []);
|
|
847
|
+
/**
|
|
848
|
+
* Build a query that JOINs memories with the embeddings table when applicable.
|
|
849
|
+
* The embeddings table stores vectors in dim_* columns (pgvector), which we
|
|
850
|
+
* cast to ::text so the driver returns a parseable string.
|
|
851
|
+
*/
|
|
852
|
+
const buildJoinQuery = useCallback((opts) => {
|
|
853
|
+
const isMemories = selectedTable === "memories" && hasEmbeddingsTable;
|
|
854
|
+
const { where, limit, offset } = opts;
|
|
855
|
+
if (isMemories) {
|
|
856
|
+
// Build dim column selects with ::text cast
|
|
857
|
+
const dimCols = DIM_COLUMNS.map((d) => `e."${d}"::text AS "${d}"`).join(", ");
|
|
858
|
+
return [
|
|
859
|
+
`SELECT m.*, ${dimCols}`,
|
|
860
|
+
`FROM "memories" m`,
|
|
861
|
+
`LEFT JOIN "embeddings" e ON e."memory_id" = m."id"`,
|
|
862
|
+
where ? `WHERE ${where}` : "",
|
|
863
|
+
`ORDER BY m."created_at" DESC`,
|
|
864
|
+
`LIMIT ${limit}`,
|
|
865
|
+
offset ? `OFFSET ${offset}` : "",
|
|
866
|
+
]
|
|
867
|
+
.filter(Boolean)
|
|
868
|
+
.join(" ");
|
|
869
|
+
}
|
|
870
|
+
// For other tables, use buildSelect to cast any vector columns
|
|
871
|
+
return ""; // signal to caller to use the old path
|
|
872
|
+
}, [selectedTable, hasEmbeddingsTable]);
|
|
873
|
+
// Load memory records for list view
|
|
874
|
+
const loadMemories = useCallback(async () => {
|
|
875
|
+
if (!selectedTable)
|
|
876
|
+
return;
|
|
877
|
+
setLoading(true);
|
|
878
|
+
setError("");
|
|
879
|
+
try {
|
|
880
|
+
const offset = page * PAGE_SIZE;
|
|
881
|
+
const searchEscaped = search.replace(/'/g, "''");
|
|
882
|
+
const countWhere = search
|
|
883
|
+
? ` WHERE "content"::text LIKE '%${searchEscaped}%'`
|
|
884
|
+
: "";
|
|
885
|
+
const joinWhere = search
|
|
886
|
+
? `m."content"::text LIKE '%${searchEscaped}%'`
|
|
887
|
+
: undefined;
|
|
888
|
+
const countResult = await client.executeDatabaseQuery(`SELECT COUNT(*) as cnt FROM "${selectedTable}"${countWhere}`);
|
|
889
|
+
const total = Number(countResult.rows[0]?.cnt ?? 0);
|
|
890
|
+
setTotalCount(total);
|
|
891
|
+
// Try JOIN path for memories + embeddings
|
|
892
|
+
const joinSql = buildJoinQuery({
|
|
893
|
+
where: joinWhere,
|
|
894
|
+
limit: PAGE_SIZE,
|
|
895
|
+
offset,
|
|
896
|
+
});
|
|
897
|
+
let result;
|
|
898
|
+
if (joinSql) {
|
|
899
|
+
result = await client.executeDatabaseQuery(joinSql);
|
|
900
|
+
}
|
|
901
|
+
else {
|
|
902
|
+
const selectCols = await buildSelect(selectedTable);
|
|
903
|
+
const plainWhere = search
|
|
904
|
+
? ` WHERE "content"::text LIKE '%${searchEscaped}%'`
|
|
905
|
+
: "";
|
|
906
|
+
result = await client.executeDatabaseQuery(`SELECT ${selectCols} FROM "${selectedTable}"${plainWhere} LIMIT ${PAGE_SIZE} OFFSET ${offset}`);
|
|
907
|
+
}
|
|
908
|
+
setMemories(result.rows.map(rowToMemory));
|
|
909
|
+
// Stats on first load
|
|
910
|
+
if (page === 0 && !search) {
|
|
911
|
+
let dims = 0;
|
|
912
|
+
let uniqueCount = 0;
|
|
913
|
+
if (result.rows.length > 0) {
|
|
914
|
+
const sample = rowToMemory(result.rows[0]);
|
|
915
|
+
if (sample.embedding)
|
|
916
|
+
dims = sample.embedding.length;
|
|
917
|
+
}
|
|
918
|
+
try {
|
|
919
|
+
const uniqueResult = await client.executeDatabaseQuery(`SELECT COUNT(*) as cnt FROM "${selectedTable}" WHERE "unique" = true OR "unique" = 1`);
|
|
920
|
+
uniqueCount = Number(uniqueResult.rows[0]?.cnt ?? 0);
|
|
921
|
+
}
|
|
922
|
+
catch {
|
|
923
|
+
// column might not exist
|
|
924
|
+
}
|
|
925
|
+
setStats({ total, dimensions: dims, uniqueCount });
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
catch (err) {
|
|
929
|
+
setError(`Failed to load memories: ${err instanceof Error ? err.message : "error"}`);
|
|
930
|
+
}
|
|
931
|
+
setLoading(false);
|
|
932
|
+
}, [selectedTable, page, search, buildSelect, buildJoinQuery]);
|
|
933
|
+
// Load embeddings for graph view (fetch more rows to make graph useful)
|
|
934
|
+
// Only include rows that actually have embeddings (INNER JOIN or filter).
|
|
935
|
+
const loadGraphData = useCallback(async () => {
|
|
936
|
+
if (!selectedTable)
|
|
937
|
+
return;
|
|
938
|
+
setGraphLoading(true);
|
|
939
|
+
try {
|
|
940
|
+
const isMemories = selectedTable === "memories" && hasEmbeddingsTable;
|
|
941
|
+
let result;
|
|
942
|
+
if (isMemories) {
|
|
943
|
+
// INNER JOIN ensures only rows with embeddings are returned
|
|
944
|
+
const dimCols = DIM_COLUMNS.map((d) => `e."${d}"::text AS "${d}"`).join(", ");
|
|
945
|
+
result = await client.executeDatabaseQuery(`SELECT m.*, ${dimCols} FROM "memories" m INNER JOIN "embeddings" e ON e."memory_id" = m."id" ORDER BY m."created_at" DESC LIMIT 500`);
|
|
946
|
+
}
|
|
947
|
+
else {
|
|
948
|
+
const selectCols = await buildSelect(selectedTable);
|
|
949
|
+
result = await client.executeDatabaseQuery(`SELECT ${selectCols} FROM "${selectedTable}" LIMIT 500`);
|
|
950
|
+
}
|
|
951
|
+
setGraphMemories(result.rows.map(rowToMemory));
|
|
952
|
+
}
|
|
953
|
+
catch (err) {
|
|
954
|
+
setError(`Failed to load graph data: ${err instanceof Error ? err.message : "error"}`);
|
|
955
|
+
}
|
|
956
|
+
setGraphLoading(false);
|
|
957
|
+
}, [selectedTable, buildSelect, hasEmbeddingsTable]);
|
|
958
|
+
useEffect(() => {
|
|
959
|
+
loadTables();
|
|
960
|
+
}, [loadTables]);
|
|
961
|
+
useEffect(() => {
|
|
962
|
+
if (viewMode === "list")
|
|
963
|
+
loadMemories();
|
|
964
|
+
}, [loadMemories, viewMode]);
|
|
965
|
+
useEffect(() => {
|
|
966
|
+
if (viewMode === "graph" || viewMode === "3d")
|
|
967
|
+
loadGraphData();
|
|
968
|
+
}, [loadGraphData, viewMode]);
|
|
969
|
+
const handleSearch = () => {
|
|
970
|
+
setSearch(searchInput);
|
|
971
|
+
setPage(0);
|
|
972
|
+
};
|
|
973
|
+
const totalPages = Math.ceil(totalCount / PAGE_SIZE);
|
|
974
|
+
// Show connection error state prominently
|
|
975
|
+
const isConnectionError = error?.includes("agent is running");
|
|
976
|
+
return (_jsxs("div", { children: [stats && !isConnectionError && (_jsxs("div", { className: "flex gap-4 mb-4 text-[11px] text-[var(--muted)]", children: [_jsxs("span", { children: [Number(stats.total).toLocaleString(), " ", t("vectorbrowserview.memories")] }), Number(stats.uniqueCount) > 0 && (_jsxs("span", { children: [Number(stats.uniqueCount).toLocaleString(), " ", t("vectorbrowserview.unique")] })), Number(stats.dimensions) > 0 && (_jsxs("span", { children: [stats.dimensions, " ", t("vectorbrowserview.dimensions1")] }))] })), !isConnectionError && (_jsxs("div", { className: "flex flex-wrap items-center gap-3 mb-4", children: [viewMode === "list" && (_jsxs("div", { className: "flex gap-1", children: [_jsx(Input, { type: "text", placeholder: t("vectorbrowserview.SearchContent"), value: searchInput, onChange: (e) => setSearchInput(e.target.value), onKeyDown: (e) => e.key === "Enter" && handleSearch(), className: "w-[220px] bg-card text-xs" }), _jsx(Button, { variant: "default", size: "sm", onClick: handleSearch, children: t("vectorbrowserview.Search") })] })), tables.length > 1 && (_jsx("select", { value: selectedTable, onChange: (e) => {
|
|
977
|
+
setSelectedTable(e.target.value);
|
|
978
|
+
setPage(0);
|
|
979
|
+
setSearch("");
|
|
980
|
+
setSearchInput("");
|
|
981
|
+
}, className: "px-2 py-1.5 border border-[var(--border)] bg-[var(--card)] text-[var(--txt)] text-xs", children: tables.map((t) => (_jsxs("option", { value: t.name, children: [t.name, " (", typeof t.rowCount === "object"
|
|
982
|
+
? JSON.stringify(t.rowCount)
|
|
983
|
+
: t.rowCount, ")"] }, t.name))) })), _jsxs("div", { className: "flex gap-1 ml-auto", children: [_jsx(Button, { variant: viewMode === "list" ? "default" : "outline", size: "sm", onClick: () => setViewMode("list"), children: t("vectorbrowserview.List") }), _jsx(Button, { variant: viewMode === "graph" ? "default" : "outline", size: "sm", onClick: () => setViewMode("graph"), children: "2D" }), _jsx(Button, { variant: viewMode === "3d" ? "default" : "outline", size: "sm", onClick: () => setViewMode("3d"), children: "3D" })] }), viewMode === "list" && (_jsx("span", { className: "text-[11px] text-[var(--muted)]", children: Number(totalCount) > 0
|
|
984
|
+
? `${page * PAGE_SIZE + 1}-${Math.min((page + 1) * PAGE_SIZE, Number(totalCount))} of ${Number(totalCount).toLocaleString()}`
|
|
985
|
+
: "" }))] })), error &&
|
|
986
|
+
(error.includes("agent is running") ? (_jsxs("div", { className: "text-center py-16", children: [_jsx("div", { className: "text-[var(--muted)] text-sm mb-2", children: t("vectorbrowserview.DatabaseNotAvailab") }), _jsx("div", { className: "text-[var(--muted)] text-xs mb-4", children: t("vectorbrowserview.StartTheAgentToB") }), _jsx(Button, { variant: "default", size: "sm", onClick: () => {
|
|
987
|
+
setError("");
|
|
988
|
+
loadTables();
|
|
989
|
+
}, children: t("vectorbrowserview.RetryConnection") })] })) : (_jsx("div", { className: "p-2.5 border border-[var(--danger)] text-[var(--danger)] text-xs mb-3", children: error }))), viewMode === "graph" &&
|
|
990
|
+
(graphLoading ? (_jsx("div", { className: "text-center py-16 text-[var(--muted)] text-sm italic", children: t("vectorbrowserview.LoadingEmbeddings") })) : (_jsx(VectorGraph, { memories: graphMemories, onSelect: setSelectedMemory }))), viewMode === "3d" &&
|
|
991
|
+
(graphLoading ? (_jsx("div", { className: "text-center py-16 text-[var(--muted)] text-sm italic", children: t("vectorbrowserview.LoadingEmbeddings") })) : (_jsx(VectorGraph3D, { memories: graphMemories, onSelect: setSelectedMemory }))), viewMode === "list" &&
|
|
992
|
+
(loading ? (_jsx("div", { className: "text-center py-16 text-[var(--muted)] text-sm italic", children: t("vectorbrowserview.LoadingMemories") })) : memories.length === 0 ? (_jsxs("div", { className: "text-center py-16", children: [_jsx("div", { className: "text-[var(--muted)] text-sm mb-2", children: t("vectorbrowserview.NoMemoriesFound") }), _jsx("div", { className: "text-[var(--muted)] text-xs", children: search
|
|
993
|
+
? "No records match your search query."
|
|
994
|
+
: "No memory records detected in the database." })] })) : (_jsx("div", { className: "flex flex-col gap-2", children: memories.map((mem) => (_jsxs(Button, { variant: "outline", className: "justify-start items-start text-left h-auto p-3 hover:border-accent w-full flex flex-col", onClick: () => setSelectedMemory(mem), children: [_jsx("div", { className: "text-xs text-[var(--txt)] mb-2 whitespace-pre-wrap break-words", children: mem.content.length > 200
|
|
995
|
+
? `${mem.content.slice(0, 200)}...`
|
|
996
|
+
: mem.content }), _jsxs("div", { className: "flex flex-wrap items-center gap-3 text-[10px] text-[var(--muted)]", children: [mem.type && mem.type !== "undefined" && (_jsx("span", { className: "px-1.5 py-0.5 bg-[var(--accent)]/10 text-[var(--accent)]", children: mem.type })), mem.roomId && mem.roomId !== "undefined" && (_jsxs("span", { children: [t("vectorbrowserview.Room1"), " ", mem.roomId.slice(0, 12)] })), mem.entityId && mem.entityId !== "undefined" && (_jsxs("span", { children: [t("vectorbrowserview.Entity1"), " ", mem.entityId.slice(0, 12)] })), mem.createdAt && mem.createdAt !== "undefined" && (_jsx("span", { children: mem.createdAt })), mem.unique && (_jsx("span", { className: "px-1.5 py-0.5 bg-green-500/20 text-green-400 font-bold", children: t("vectorbrowserview.unique") })), mem.embedding && (_jsxs("span", { className: "font-mono", children: ["[", mem.embedding.length, "d]"] }))] })] }, mem.id || `${mem.content.slice(0, 30)}-${mem.createdAt}`))) }))), viewMode === "list" && totalPages > 1 && (_jsxs("div", { className: "flex items-center justify-center gap-3 mt-4 pb-4", children: [_jsx(Button, { variant: "default", size: "sm", disabled: page === 0, onClick: () => setPage((p) => p - 1), children: t("vectorbrowserview.Prev") }), _jsxs("span", { className: "text-[11px] text-[var(--muted)]", children: [t("vectorbrowserview.Page"), " ", page + 1, " of ", totalPages] }), _jsx(Button, { variant: "default", size: "sm", disabled: page >= totalPages - 1, onClick: () => setPage((p) => p + 1), children: t("vectorbrowserview.Next") })] })), selectedMemory && (_jsx(MemoryDetailModal, { memory: selectedMemory, onClose: () => setSelectedMemory(null) }))] }));
|
|
997
|
+
}
|