@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,3152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugins view — tag-filtered plugin management.
|
|
3
|
+
*
|
|
4
|
+
* Renders a unified plugin list with searchable/filterable cards and per-plugin settings.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Button, Input } from "@elizaos/ui";
|
|
8
|
+
import type { LucideIcon } from "lucide-react";
|
|
9
|
+
import {
|
|
10
|
+
Binary,
|
|
11
|
+
BookOpen,
|
|
12
|
+
Bot,
|
|
13
|
+
Brain,
|
|
14
|
+
BrickWall,
|
|
15
|
+
Briefcase,
|
|
16
|
+
Calendar,
|
|
17
|
+
ChevronRight,
|
|
18
|
+
Chrome,
|
|
19
|
+
Circle,
|
|
20
|
+
CircleDashed,
|
|
21
|
+
CircleDot,
|
|
22
|
+
ClipboardList,
|
|
23
|
+
Clock,
|
|
24
|
+
Cloud,
|
|
25
|
+
Command,
|
|
26
|
+
Construction,
|
|
27
|
+
CreditCard,
|
|
28
|
+
Diamond,
|
|
29
|
+
Dna,
|
|
30
|
+
Droplets,
|
|
31
|
+
Eye,
|
|
32
|
+
Feather,
|
|
33
|
+
FileKey,
|
|
34
|
+
FileText,
|
|
35
|
+
Fingerprint,
|
|
36
|
+
Gamepad,
|
|
37
|
+
Gamepad2,
|
|
38
|
+
Github,
|
|
39
|
+
Handshake,
|
|
40
|
+
Hash,
|
|
41
|
+
Layers,
|
|
42
|
+
Leaf,
|
|
43
|
+
Link,
|
|
44
|
+
Lock,
|
|
45
|
+
LockKeyhole,
|
|
46
|
+
Mail,
|
|
47
|
+
MessageCircle,
|
|
48
|
+
MessageSquare,
|
|
49
|
+
MessagesSquare,
|
|
50
|
+
Mic,
|
|
51
|
+
Monitor,
|
|
52
|
+
MousePointer2,
|
|
53
|
+
Package,
|
|
54
|
+
PenTool,
|
|
55
|
+
Phone,
|
|
56
|
+
Pickaxe,
|
|
57
|
+
Puzzle,
|
|
58
|
+
RefreshCw,
|
|
59
|
+
Rss,
|
|
60
|
+
ScrollText,
|
|
61
|
+
Send,
|
|
62
|
+
Server,
|
|
63
|
+
Settings,
|
|
64
|
+
Shell,
|
|
65
|
+
Shuffle,
|
|
66
|
+
Smartphone,
|
|
67
|
+
Sparkle,
|
|
68
|
+
Sparkles,
|
|
69
|
+
Square,
|
|
70
|
+
Star,
|
|
71
|
+
StickyNote,
|
|
72
|
+
Target,
|
|
73
|
+
Tornado,
|
|
74
|
+
TrendingDown,
|
|
75
|
+
Triangle,
|
|
76
|
+
Twitter,
|
|
77
|
+
Video,
|
|
78
|
+
Volume2,
|
|
79
|
+
Wallet,
|
|
80
|
+
Webhook,
|
|
81
|
+
Wrench,
|
|
82
|
+
Zap,
|
|
83
|
+
} from "lucide-react";
|
|
84
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
85
|
+
import type { PluginInfo, PluginParamDef } from "../api";
|
|
86
|
+
import { client } from "../api";
|
|
87
|
+
import {
|
|
88
|
+
ConfigRenderer,
|
|
89
|
+
defaultRegistry,
|
|
90
|
+
type JsonSchemaObject,
|
|
91
|
+
} from "../config";
|
|
92
|
+
import { useApp } from "../state";
|
|
93
|
+
import type { ConfigUiHint } from "../types";
|
|
94
|
+
import { openExternalUrl, resolveAppAssetUrl } from "../utils";
|
|
95
|
+
import { autoLabel } from "./labels";
|
|
96
|
+
import { SHOWCASE_PLUGIN } from "./plugins/showcase-data";
|
|
97
|
+
import { WhatsAppQrOverlay } from "./WhatsAppQrOverlay";
|
|
98
|
+
|
|
99
|
+
/* ── Always-on plugins (hidden from all views) ────────────────────────── */
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Plugin IDs hidden from Features/Connectors views.
|
|
103
|
+
* Core plugins are visible in Admin > Plugins instead.
|
|
104
|
+
*/
|
|
105
|
+
const ALWAYS_ON_PLUGIN_IDS = new Set([
|
|
106
|
+
// Core (always loaded)
|
|
107
|
+
"sql",
|
|
108
|
+
"local-embedding",
|
|
109
|
+
"knowledge",
|
|
110
|
+
"agent-skills",
|
|
111
|
+
"directives",
|
|
112
|
+
"commands",
|
|
113
|
+
"personality",
|
|
114
|
+
"experience",
|
|
115
|
+
// Optional core (shown in admin)
|
|
116
|
+
"agent-orchestrator",
|
|
117
|
+
"shell",
|
|
118
|
+
"plugin-manager",
|
|
119
|
+
"cli",
|
|
120
|
+
"code",
|
|
121
|
+
"edge-tts",
|
|
122
|
+
"pdf",
|
|
123
|
+
"scratchpad",
|
|
124
|
+
"secrets-manager",
|
|
125
|
+
"todo",
|
|
126
|
+
"trust",
|
|
127
|
+
"form",
|
|
128
|
+
"goals",
|
|
129
|
+
"scheduling",
|
|
130
|
+
// Internal / infrastructure
|
|
131
|
+
"elizacloud",
|
|
132
|
+
"evm",
|
|
133
|
+
"memory",
|
|
134
|
+
"rolodex",
|
|
135
|
+
"tts",
|
|
136
|
+
"elevenlabs",
|
|
137
|
+
"cron",
|
|
138
|
+
"webhooks",
|
|
139
|
+
"browser",
|
|
140
|
+
"vision",
|
|
141
|
+
"computeruse",
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
/* ── Helpers ────────────────────────────────────────────────────────── */
|
|
145
|
+
|
|
146
|
+
/** Detect advanced / debug parameters that should be collapsed by default. */
|
|
147
|
+
function isAdvancedParam(param: PluginParamDef): boolean {
|
|
148
|
+
const k = param.key.toUpperCase();
|
|
149
|
+
const d = (param.description ?? "").toLowerCase();
|
|
150
|
+
return (
|
|
151
|
+
k.includes("EXPERIMENTAL") ||
|
|
152
|
+
k.includes("DEBUG") ||
|
|
153
|
+
k.includes("VERBOSE") ||
|
|
154
|
+
k.includes("TELEMETRY") ||
|
|
155
|
+
k.includes("BROWSER_BASE") ||
|
|
156
|
+
d.includes("experimental") ||
|
|
157
|
+
d.includes("advanced") ||
|
|
158
|
+
d.includes("debug")
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Convert PluginParamDef[] to a JSON Schema + ConfigUiHints for ConfigRenderer. */
|
|
163
|
+
export function paramsToSchema(
|
|
164
|
+
params: PluginParamDef[],
|
|
165
|
+
pluginId: string,
|
|
166
|
+
): {
|
|
167
|
+
schema: JsonSchemaObject;
|
|
168
|
+
hints: Record<string, ConfigUiHint>;
|
|
169
|
+
} {
|
|
170
|
+
const properties: Record<string, Record<string, unknown>> = {};
|
|
171
|
+
const required: string[] = [];
|
|
172
|
+
const hints: Record<string, ConfigUiHint> = {};
|
|
173
|
+
|
|
174
|
+
for (const p of params) {
|
|
175
|
+
// Build JSON Schema property
|
|
176
|
+
const prop: Record<string, unknown> = {};
|
|
177
|
+
if (p.type === "boolean") {
|
|
178
|
+
prop.type = "boolean";
|
|
179
|
+
} else if (p.type === "number") {
|
|
180
|
+
prop.type = "number";
|
|
181
|
+
} else {
|
|
182
|
+
prop.type = "string";
|
|
183
|
+
}
|
|
184
|
+
if (p.description) prop.description = p.description;
|
|
185
|
+
if (p.default != null) prop.default = p.default;
|
|
186
|
+
if (p.options?.length) {
|
|
187
|
+
prop.enum = p.options;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Auto-detect format from key name
|
|
191
|
+
const keyUpper = p.key.toUpperCase();
|
|
192
|
+
if (
|
|
193
|
+
keyUpper.includes("URL") ||
|
|
194
|
+
keyUpper.includes("ENDPOINT") ||
|
|
195
|
+
keyUpper.includes("BASE_URL")
|
|
196
|
+
) {
|
|
197
|
+
prop.format = "uri";
|
|
198
|
+
} else if (keyUpper.includes("EMAIL")) {
|
|
199
|
+
prop.format = "email";
|
|
200
|
+
} else if (
|
|
201
|
+
keyUpper.includes("_DATE") ||
|
|
202
|
+
keyUpper.includes("_SINCE") ||
|
|
203
|
+
keyUpper.includes("_UNTIL")
|
|
204
|
+
) {
|
|
205
|
+
prop.format = "date";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Auto-detect number types from key patterns
|
|
209
|
+
if (keyUpper.includes("PORT") && prop.type === "string") {
|
|
210
|
+
prop.type = "number";
|
|
211
|
+
} else if (
|
|
212
|
+
(keyUpper.includes("TIMEOUT") ||
|
|
213
|
+
keyUpper.includes("INTERVAL") ||
|
|
214
|
+
keyUpper.includes("_MS")) &&
|
|
215
|
+
prop.type === "string"
|
|
216
|
+
) {
|
|
217
|
+
prop.type = "number";
|
|
218
|
+
} else if (
|
|
219
|
+
(keyUpper.includes("COUNT") ||
|
|
220
|
+
keyUpper.includes("LIMIT") ||
|
|
221
|
+
keyUpper.startsWith("MAX_")) &&
|
|
222
|
+
prop.type === "string"
|
|
223
|
+
) {
|
|
224
|
+
prop.type = "number";
|
|
225
|
+
} else if (
|
|
226
|
+
(keyUpper.includes("RETRY") || keyUpper.includes("RETRIES")) &&
|
|
227
|
+
prop.type === "string"
|
|
228
|
+
) {
|
|
229
|
+
prop.type = "number";
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Auto-detect boolean from key patterns
|
|
233
|
+
if (
|
|
234
|
+
prop.type === "string" &&
|
|
235
|
+
(keyUpper.includes("SHOULD_") ||
|
|
236
|
+
keyUpper.endsWith("_ENABLED") ||
|
|
237
|
+
keyUpper.endsWith("_DISABLED") ||
|
|
238
|
+
keyUpper.startsWith("USE_") ||
|
|
239
|
+
keyUpper.startsWith("ALLOW_") ||
|
|
240
|
+
keyUpper.startsWith("IS_") ||
|
|
241
|
+
keyUpper.startsWith("ENABLE_") ||
|
|
242
|
+
keyUpper.startsWith("DISABLE_") ||
|
|
243
|
+
keyUpper.startsWith("FORCE_") ||
|
|
244
|
+
keyUpper.endsWith("_AUTONOMOUS_MODE"))
|
|
245
|
+
) {
|
|
246
|
+
prop.type = "boolean";
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Auto-detect number from key patterns (RATE, DELAY, THRESHOLD, SIZE, TEMPERATURE)
|
|
250
|
+
if (
|
|
251
|
+
prop.type === "string" &&
|
|
252
|
+
(keyUpper.includes("_RATE") ||
|
|
253
|
+
keyUpper.includes("DELAY") ||
|
|
254
|
+
keyUpper.includes("THRESHOLD") ||
|
|
255
|
+
keyUpper.includes("_SIZE") ||
|
|
256
|
+
keyUpper.includes("TEMPERATURE") ||
|
|
257
|
+
keyUpper.includes("_DEPTH") ||
|
|
258
|
+
keyUpper.includes("_PERCENT") ||
|
|
259
|
+
keyUpper.includes("_RATIO"))
|
|
260
|
+
) {
|
|
261
|
+
prop.type = "number";
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Auto-detect comma-separated lists → array renderer
|
|
265
|
+
if (prop.type === "string" && !prop.enum) {
|
|
266
|
+
const descLower = (p.description || "").toLowerCase();
|
|
267
|
+
const isCommaSep =
|
|
268
|
+
descLower.includes("comma-separated") ||
|
|
269
|
+
descLower.includes("comma separated");
|
|
270
|
+
const isListSuffix =
|
|
271
|
+
keyUpper.endsWith("_IDS") ||
|
|
272
|
+
keyUpper.endsWith("_CHANNELS") ||
|
|
273
|
+
keyUpper.endsWith("_ROOMS") ||
|
|
274
|
+
keyUpper.endsWith("_RELAYS") ||
|
|
275
|
+
keyUpper.endsWith("_FEEDS") ||
|
|
276
|
+
keyUpper.endsWith("_DEXES") ||
|
|
277
|
+
keyUpper.endsWith("_WHITELIST") ||
|
|
278
|
+
keyUpper.endsWith("_BLACKLIST") ||
|
|
279
|
+
keyUpper.endsWith("_ALLOWLIST") ||
|
|
280
|
+
keyUpper.endsWith("_SPACES") ||
|
|
281
|
+
keyUpper.endsWith("_THREADS") ||
|
|
282
|
+
keyUpper.endsWith("_ROLES") ||
|
|
283
|
+
keyUpper.endsWith("_TENANTS") ||
|
|
284
|
+
keyUpper.endsWith("_DIRS");
|
|
285
|
+
if (isCommaSep || isListSuffix) {
|
|
286
|
+
prop.type = "array";
|
|
287
|
+
prop.items = { type: "string" };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Auto-detect textarea (prompts, instructions, templates, greetings)
|
|
292
|
+
if (prop.type === "string" && !prop.enum && !keyUpper.includes("MODEL")) {
|
|
293
|
+
if (
|
|
294
|
+
keyUpper.includes("INSTRUCTIONS") ||
|
|
295
|
+
keyUpper.includes("_GREETING") ||
|
|
296
|
+
keyUpper.endsWith("_PROMPT") ||
|
|
297
|
+
keyUpper.endsWith("_TEMPLATE") ||
|
|
298
|
+
keyUpper.includes("SYSTEM_MESSAGE")
|
|
299
|
+
) {
|
|
300
|
+
prop.maxLength = 999;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Auto-detect JSON fields (json-encoded or serialized values)
|
|
305
|
+
if (prop.type === "string" && !p.sensitive) {
|
|
306
|
+
const descLower = (p.description || "").toLowerCase();
|
|
307
|
+
if (
|
|
308
|
+
descLower.includes("json-encoded") ||
|
|
309
|
+
descLower.includes("json array") ||
|
|
310
|
+
descLower.includes("serialized") ||
|
|
311
|
+
descLower.includes("json format")
|
|
312
|
+
) {
|
|
313
|
+
(prop as Record<string, unknown>).__jsonHint = true;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Auto-detect file/directory paths → file renderer
|
|
318
|
+
if (prop.type === "string") {
|
|
319
|
+
if (
|
|
320
|
+
(keyUpper.endsWith("_PATH") && !keyUpper.includes("WEBHOOK")) ||
|
|
321
|
+
keyUpper.endsWith("_DIR") ||
|
|
322
|
+
keyUpper.endsWith("_DIRECTORY") ||
|
|
323
|
+
keyUpper.endsWith("_FOLDER") ||
|
|
324
|
+
keyUpper.endsWith("_FILE")
|
|
325
|
+
) {
|
|
326
|
+
(prop as Record<string, unknown>).__fileHint = true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Auto-detect textarea from long descriptions
|
|
331
|
+
if (p.description && p.description.length > 200) {
|
|
332
|
+
prop.maxLength = 999;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
properties[p.key] = prop;
|
|
336
|
+
|
|
337
|
+
if (p.required) required.push(p.key);
|
|
338
|
+
|
|
339
|
+
// Build UI hint
|
|
340
|
+
const hint: ConfigUiHint = {
|
|
341
|
+
label: autoLabel(p.key, pluginId),
|
|
342
|
+
sensitive: p.sensitive ?? false,
|
|
343
|
+
advanced: isAdvancedParam(p),
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// Port numbers — constrain range
|
|
347
|
+
if (keyUpper.includes("PORT")) {
|
|
348
|
+
hint.min = 1;
|
|
349
|
+
hint.max = 65535;
|
|
350
|
+
prop.minimum = 1;
|
|
351
|
+
prop.maximum = 65535;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Timeout/interval — show unit
|
|
355
|
+
if (
|
|
356
|
+
keyUpper.includes("TIMEOUT") ||
|
|
357
|
+
keyUpper.includes("INTERVAL") ||
|
|
358
|
+
keyUpper.includes("_MS")
|
|
359
|
+
) {
|
|
360
|
+
hint.unit = "ms";
|
|
361
|
+
prop.minimum = 0;
|
|
362
|
+
hint.min = 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Count/limit — non-negative
|
|
366
|
+
if (
|
|
367
|
+
keyUpper.includes("COUNT") ||
|
|
368
|
+
keyUpper.includes("LIMIT") ||
|
|
369
|
+
keyUpper.startsWith("MAX_")
|
|
370
|
+
) {
|
|
371
|
+
hint.min = 0;
|
|
372
|
+
prop.minimum = 0;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Retry — bounded range
|
|
376
|
+
if (keyUpper.includes("RETRY") || keyUpper.includes("RETRIES")) {
|
|
377
|
+
hint.min = 0;
|
|
378
|
+
hint.max = 100;
|
|
379
|
+
prop.minimum = 0;
|
|
380
|
+
prop.maximum = 100;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Debug/verbose/enabled — mark as advanced
|
|
384
|
+
if (
|
|
385
|
+
keyUpper.includes("DEBUG") ||
|
|
386
|
+
keyUpper.includes("VERBOSE") ||
|
|
387
|
+
keyUpper.includes("ENABLED")
|
|
388
|
+
) {
|
|
389
|
+
hint.advanced = true;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Model selection — NOT advanced (important user-facing choice)
|
|
393
|
+
if (keyUpper.includes("MODEL") && p.options?.length) {
|
|
394
|
+
hint.advanced = false;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Region/zone — suggest common cloud regions when no options provided
|
|
398
|
+
if (
|
|
399
|
+
(keyUpper.includes("REGION") || keyUpper.includes("ZONE")) &&
|
|
400
|
+
!p.options?.length
|
|
401
|
+
) {
|
|
402
|
+
hint.type = "select";
|
|
403
|
+
hint.options = [
|
|
404
|
+
{ value: "us-east-1", label: "US East (N. Virginia)" },
|
|
405
|
+
{ value: "us-west-2", label: "US West (Oregon)" },
|
|
406
|
+
{ value: "eu-west-1", label: "EU (Ireland)" },
|
|
407
|
+
{ value: "eu-central-1", label: "EU (Frankfurt)" },
|
|
408
|
+
{ value: "ap-southeast-1", label: "Asia Pacific (Singapore)" },
|
|
409
|
+
{ value: "ap-northeast-1", label: "Asia Pacific (Tokyo)" },
|
|
410
|
+
];
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// File/directory path → file renderer
|
|
414
|
+
if ((prop as Record<string, unknown>).__fileHint) {
|
|
415
|
+
hint.type = "file";
|
|
416
|
+
delete (prop as Record<string, unknown>).__fileHint;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// JSON-encoded value → json renderer
|
|
420
|
+
if ((prop as Record<string, unknown>).__jsonHint) {
|
|
421
|
+
hint.type = "json";
|
|
422
|
+
delete (prop as Record<string, unknown>).__jsonHint;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Model name fields — helpful placeholder (overridden by server-provided model options via configUiHints)
|
|
426
|
+
if (
|
|
427
|
+
keyUpper.includes("MODEL") &&
|
|
428
|
+
prop.type === "string" &&
|
|
429
|
+
!p.options?.length
|
|
430
|
+
) {
|
|
431
|
+
if (!hint.placeholder) {
|
|
432
|
+
if (keyUpper.includes("EMBEDDING")) {
|
|
433
|
+
hint.placeholder = "e.g., text-embedding-3-small";
|
|
434
|
+
} else if (keyUpper.includes("TTS")) {
|
|
435
|
+
hint.placeholder = "e.g., tts-1, eleven_multilingual_v2";
|
|
436
|
+
} else if (keyUpper.includes("STT")) {
|
|
437
|
+
hint.placeholder = "e.g., whisper-1";
|
|
438
|
+
} else if (keyUpper.includes("IMAGE")) {
|
|
439
|
+
hint.placeholder = "e.g., dall-e-3, gpt-4o";
|
|
440
|
+
} else {
|
|
441
|
+
hint.placeholder = "e.g., gpt-4o, claude-sonnet-4-20250514";
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Mode/strategy fields — extract options from description if available
|
|
447
|
+
if (
|
|
448
|
+
prop.type === "string" &&
|
|
449
|
+
!prop.enum &&
|
|
450
|
+
!p.sensitive &&
|
|
451
|
+
(keyUpper.endsWith("_MODE") || keyUpper.endsWith("_STRATEGY"))
|
|
452
|
+
) {
|
|
453
|
+
const desc = p.description ?? "";
|
|
454
|
+
// Match "auto | local | mcp" or "filesystem|in-context|sqlite"
|
|
455
|
+
const pipeMatch =
|
|
456
|
+
desc.match(/:\s*([a-z0-9_-]+(?:\s*[|/]\s*[a-z0-9_-]+)+)/i) ??
|
|
457
|
+
desc.match(/\(([a-z0-9_-]+(?:\s*[|/,]\s*[a-z0-9_-]+)+)\)/i);
|
|
458
|
+
if (pipeMatch) {
|
|
459
|
+
const opts = pipeMatch[1]
|
|
460
|
+
.split(/[|/,]/)
|
|
461
|
+
.map((s) => s.trim())
|
|
462
|
+
.filter(Boolean);
|
|
463
|
+
const safeOpts = opts.filter((v) => /^[a-z0-9_-]+$/i.test(v));
|
|
464
|
+
if (safeOpts.length >= 2 && safeOpts.length <= 10) {
|
|
465
|
+
hint.type = "select";
|
|
466
|
+
hint.options = safeOpts.map((v) => ({ value: v, label: v }));
|
|
467
|
+
}
|
|
468
|
+
} else {
|
|
469
|
+
// Match 'polling' or 'webhook' -or- 'env', 'oauth', or 'bearer' style
|
|
470
|
+
const quotedOpts = [...desc.matchAll(/'([a-z0-9_-]+)'/gi)].map(
|
|
471
|
+
(m) => m[1],
|
|
472
|
+
);
|
|
473
|
+
const safeQuoted = quotedOpts.filter((v) => /^[a-z0-9_-]+$/i.test(v));
|
|
474
|
+
if (safeQuoted.length >= 2 && safeQuoted.length <= 10) {
|
|
475
|
+
// Radio for 2 options, select for 3+
|
|
476
|
+
hint.type = safeQuoted.length === 2 ? "radio" : "select";
|
|
477
|
+
hint.options = safeQuoted.map((v) => ({ value: v, label: v }));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (p.description) {
|
|
483
|
+
hint.help = p.description;
|
|
484
|
+
if (p.default != null) hint.help += ` (default: ${String(p.default)})`;
|
|
485
|
+
}
|
|
486
|
+
if (p.sensitive)
|
|
487
|
+
hint.placeholder = p.isSet ? "******** (already set)" : "Enter value...";
|
|
488
|
+
else if (p.default) hint.placeholder = `Default: ${String(p.default)}`;
|
|
489
|
+
hints[p.key] = hint;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return {
|
|
493
|
+
schema: { type: "object", properties, required } as JsonSchemaObject,
|
|
494
|
+
hints,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/* ── PluginConfigForm bridge ─────────────────────────────────────────── */
|
|
499
|
+
|
|
500
|
+
function PluginConfigForm({
|
|
501
|
+
plugin,
|
|
502
|
+
pluginConfigs,
|
|
503
|
+
onParamChange,
|
|
504
|
+
}: {
|
|
505
|
+
plugin: PluginInfo;
|
|
506
|
+
pluginConfigs: Record<string, Record<string, string>>;
|
|
507
|
+
onParamChange: (pluginId: string, paramKey: string, value: string) => void;
|
|
508
|
+
}) {
|
|
509
|
+
const params = plugin.parameters ?? [];
|
|
510
|
+
const { schema, hints: autoHints } = useMemo(
|
|
511
|
+
() => paramsToSchema(params, plugin.id),
|
|
512
|
+
[params, plugin.id],
|
|
513
|
+
);
|
|
514
|
+
|
|
515
|
+
// Merge server-provided configUiHints over auto-generated hints.
|
|
516
|
+
// Server hints take priority (override auto-generated ones).
|
|
517
|
+
const hints = useMemo(() => {
|
|
518
|
+
const serverHints = plugin.configUiHints;
|
|
519
|
+
if (!serverHints || Object.keys(serverHints).length === 0) return autoHints;
|
|
520
|
+
const merged: Record<string, ConfigUiHint> = { ...autoHints };
|
|
521
|
+
for (const [key, serverHint] of Object.entries(serverHints)) {
|
|
522
|
+
merged[key] = { ...merged[key], ...serverHint };
|
|
523
|
+
}
|
|
524
|
+
return merged;
|
|
525
|
+
}, [autoHints, plugin.configUiHints]);
|
|
526
|
+
|
|
527
|
+
// Build values from current config state + existing server values.
|
|
528
|
+
// Array-typed fields need comma-separated strings parsed into arrays.
|
|
529
|
+
const values = useMemo(() => {
|
|
530
|
+
const v: Record<string, unknown> = {};
|
|
531
|
+
const props = (schema.properties ?? {}) as Record<
|
|
532
|
+
string,
|
|
533
|
+
Record<string, unknown>
|
|
534
|
+
>;
|
|
535
|
+
for (const p of params) {
|
|
536
|
+
const isArrayField = props[p.key]?.type === "array";
|
|
537
|
+
const configValue = pluginConfigs[plugin.id]?.[p.key];
|
|
538
|
+
if (configValue !== undefined) {
|
|
539
|
+
if (isArrayField && typeof configValue === "string") {
|
|
540
|
+
v[p.key] = configValue
|
|
541
|
+
? configValue
|
|
542
|
+
.split(",")
|
|
543
|
+
.map((s: string) => s.trim())
|
|
544
|
+
.filter(Boolean)
|
|
545
|
+
: [];
|
|
546
|
+
} else {
|
|
547
|
+
v[p.key] = configValue;
|
|
548
|
+
}
|
|
549
|
+
} else if (p.isSet && !p.sensitive && p.currentValue != null) {
|
|
550
|
+
if (isArrayField && typeof p.currentValue === "string") {
|
|
551
|
+
v[p.key] = String(p.currentValue)
|
|
552
|
+
? String(p.currentValue)
|
|
553
|
+
.split(",")
|
|
554
|
+
.map((s: string) => s.trim())
|
|
555
|
+
.filter(Boolean)
|
|
556
|
+
: [];
|
|
557
|
+
} else {
|
|
558
|
+
v[p.key] = p.currentValue;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return v;
|
|
563
|
+
}, [params, plugin.id, pluginConfigs, schema]);
|
|
564
|
+
|
|
565
|
+
const setKeys = useMemo(
|
|
566
|
+
() =>
|
|
567
|
+
new Set(
|
|
568
|
+
params
|
|
569
|
+
.filter((p: PluginParamDef) => p.isSet)
|
|
570
|
+
.map((p: PluginParamDef) => p.key),
|
|
571
|
+
),
|
|
572
|
+
[params],
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
const handleChange = useCallback(
|
|
576
|
+
(key: string, value: unknown) => {
|
|
577
|
+
// Join array values back to comma-separated strings for env var storage
|
|
578
|
+
const stringValue = Array.isArray(value)
|
|
579
|
+
? value.join(", ")
|
|
580
|
+
: String(value ?? "");
|
|
581
|
+
onParamChange(plugin.id, key, stringValue);
|
|
582
|
+
},
|
|
583
|
+
[plugin.id, onParamChange],
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
return (
|
|
587
|
+
<ConfigRenderer
|
|
588
|
+
schema={schema}
|
|
589
|
+
hints={hints}
|
|
590
|
+
values={values}
|
|
591
|
+
setKeys={setKeys}
|
|
592
|
+
registry={defaultRegistry}
|
|
593
|
+
pluginId={plugin.id}
|
|
594
|
+
onChange={handleChange}
|
|
595
|
+
/>
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/* ── Default Icons ─────────────────────────────────────────────────── */
|
|
600
|
+
|
|
601
|
+
const DEFAULT_ICONS: Record<string, LucideIcon> = {
|
|
602
|
+
// AI Providers
|
|
603
|
+
anthropic: Brain,
|
|
604
|
+
"google-genai": Sparkles,
|
|
605
|
+
groq: Zap,
|
|
606
|
+
"local-ai": Monitor,
|
|
607
|
+
ollama: Bot,
|
|
608
|
+
openai: CircleDashed,
|
|
609
|
+
openrouter: Shuffle,
|
|
610
|
+
"vercel-ai-gateway": Triangle,
|
|
611
|
+
xai: Hash,
|
|
612
|
+
// Connectors — chat & social
|
|
613
|
+
discord: MessageCircle,
|
|
614
|
+
telegram: Send,
|
|
615
|
+
slack: Briefcase,
|
|
616
|
+
twitter: Twitter,
|
|
617
|
+
whatsapp: Smartphone,
|
|
618
|
+
signal: Lock,
|
|
619
|
+
imessage: MessageSquare,
|
|
620
|
+
bluebubbles: Droplets,
|
|
621
|
+
bluesky: Leaf,
|
|
622
|
+
farcaster: Circle,
|
|
623
|
+
instagram: Video,
|
|
624
|
+
nostr: Fingerprint,
|
|
625
|
+
twitch: Gamepad2,
|
|
626
|
+
matrix: Link,
|
|
627
|
+
mattermost: Diamond,
|
|
628
|
+
msteams: Square,
|
|
629
|
+
"google-chat": MessagesSquare,
|
|
630
|
+
feishu: Feather,
|
|
631
|
+
line: Circle,
|
|
632
|
+
"nextcloud-talk": Cloud,
|
|
633
|
+
tlon: Tornado,
|
|
634
|
+
zalo: Circle,
|
|
635
|
+
zalouser: Circle,
|
|
636
|
+
// Features — voice & audio
|
|
637
|
+
"edge-tts": Volume2,
|
|
638
|
+
elevenlabs: Mic,
|
|
639
|
+
tts: Volume2,
|
|
640
|
+
"simple-voice": Mic,
|
|
641
|
+
"robot-voice": Bot,
|
|
642
|
+
// Features — blockchain & finance
|
|
643
|
+
evm: Link,
|
|
644
|
+
solana: CircleDot,
|
|
645
|
+
"auto-trader": TrendingDown,
|
|
646
|
+
"lp-manager": Wallet,
|
|
647
|
+
"social-alpha": Layers,
|
|
648
|
+
polymarket: Gamepad2,
|
|
649
|
+
x402: CreditCard,
|
|
650
|
+
trust: Handshake,
|
|
651
|
+
iq: Puzzle,
|
|
652
|
+
// Features — dev tools & infra
|
|
653
|
+
cli: Hash,
|
|
654
|
+
code: Puzzle,
|
|
655
|
+
shell: Shell,
|
|
656
|
+
github: Github,
|
|
657
|
+
linear: Square,
|
|
658
|
+
mcp: Puzzle,
|
|
659
|
+
browser: Chrome,
|
|
660
|
+
computeruse: MousePointer2,
|
|
661
|
+
n8n: Settings,
|
|
662
|
+
webhooks: Webhook,
|
|
663
|
+
// Features — knowledge & memory
|
|
664
|
+
knowledge: BookOpen,
|
|
665
|
+
memory: Dna,
|
|
666
|
+
"local-embedding": Binary,
|
|
667
|
+
pdf: FileText,
|
|
668
|
+
"secrets-manager": FileKey,
|
|
669
|
+
scratchpad: StickyNote,
|
|
670
|
+
rlm: RefreshCw,
|
|
671
|
+
// Features — agents & orchestration
|
|
672
|
+
"agent-orchestrator": Target,
|
|
673
|
+
"agent-skills": Wrench,
|
|
674
|
+
"plugin-manager": Package,
|
|
675
|
+
"copilot-proxy": Handshake,
|
|
676
|
+
directives: ClipboardList,
|
|
677
|
+
goals: Target,
|
|
678
|
+
"eliza-classic": Bot,
|
|
679
|
+
// Features — media & content
|
|
680
|
+
vision: Eye,
|
|
681
|
+
rss: Rss,
|
|
682
|
+
"gmail-watch": Mail,
|
|
683
|
+
prose: PenTool,
|
|
684
|
+
form: ClipboardList,
|
|
685
|
+
// Features — scheduling & automation
|
|
686
|
+
cron: Clock,
|
|
687
|
+
scheduling: Calendar,
|
|
688
|
+
todo: ClipboardList,
|
|
689
|
+
commands: Command,
|
|
690
|
+
// Features — storage & logging
|
|
691
|
+
"s3-storage": Server,
|
|
692
|
+
"trajectory-logger": TrendingDown,
|
|
693
|
+
experience: Star,
|
|
694
|
+
// Features — gaming & misc
|
|
695
|
+
minecraft: Pickaxe,
|
|
696
|
+
roblox: BrickWall,
|
|
697
|
+
babylon: Gamepad,
|
|
698
|
+
mysticism: Sparkle,
|
|
699
|
+
personality: Target,
|
|
700
|
+
moltbook: ScrollText,
|
|
701
|
+
tee: LockKeyhole,
|
|
702
|
+
blooio: Circle,
|
|
703
|
+
acp: Construction,
|
|
704
|
+
elizacloud: Cloud,
|
|
705
|
+
twilio: Phone,
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
/** Resolve display icon: explicit plugin.icon, fallback to default map, or null. */
|
|
709
|
+
function resolveIcon(p: PluginInfo): LucideIcon | string | null {
|
|
710
|
+
if (p.icon) return p.icon;
|
|
711
|
+
return DEFAULT_ICONS[p.id] ?? null;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function iconImageSource(icon: string): string | null {
|
|
715
|
+
const value = icon.trim();
|
|
716
|
+
if (!value) return null;
|
|
717
|
+
if (
|
|
718
|
+
/^(https?:|data:image\/|blob:|file:|capacitor:|capacitor-electron:|app:|\/|\.\/|\.\.\/)/i.test(
|
|
719
|
+
value,
|
|
720
|
+
)
|
|
721
|
+
) {
|
|
722
|
+
return resolveAppAssetUrl(value);
|
|
723
|
+
}
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function getPluginResourceLinks(
|
|
728
|
+
plugin: Pick<PluginInfo, "setupGuideUrl" | "homepage" | "repository">,
|
|
729
|
+
): Array<{ key: string; label: string; url: string }> {
|
|
730
|
+
const seen = new Set<string>();
|
|
731
|
+
const ordered = [
|
|
732
|
+
{ key: "guide", label: "Setup guide", url: plugin.setupGuideUrl },
|
|
733
|
+
{ key: "official", label: "Official", url: plugin.homepage },
|
|
734
|
+
{ key: "source", label: "Source", url: plugin.repository },
|
|
735
|
+
];
|
|
736
|
+
return ordered.flatMap((item) => {
|
|
737
|
+
const url = item.url?.trim();
|
|
738
|
+
if (!url || seen.has(url)) return [];
|
|
739
|
+
seen.add(url);
|
|
740
|
+
return [{ key: item.key, label: item.label, url }];
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/* ── Sub-group Classification ──────────────────────────────────────── */
|
|
745
|
+
|
|
746
|
+
/** Map plugin IDs to fine-grained sub-groups for the "Feature" category. */
|
|
747
|
+
const FEATURE_SUBGROUP: Record<string, string> = {
|
|
748
|
+
// Voice & Audio
|
|
749
|
+
"edge-tts": "voice",
|
|
750
|
+
elevenlabs: "voice",
|
|
751
|
+
tts: "voice",
|
|
752
|
+
"simple-voice": "voice",
|
|
753
|
+
"robot-voice": "voice",
|
|
754
|
+
// Blockchain & Finance
|
|
755
|
+
evm: "blockchain",
|
|
756
|
+
solana: "blockchain",
|
|
757
|
+
"auto-trader": "blockchain",
|
|
758
|
+
"lp-manager": "blockchain",
|
|
759
|
+
"social-alpha": "blockchain",
|
|
760
|
+
polymarket: "blockchain",
|
|
761
|
+
x402: "blockchain",
|
|
762
|
+
trust: "blockchain",
|
|
763
|
+
iq: "blockchain",
|
|
764
|
+
// Dev Tools & Infrastructure
|
|
765
|
+
cli: "devtools",
|
|
766
|
+
code: "devtools",
|
|
767
|
+
shell: "devtools",
|
|
768
|
+
github: "devtools",
|
|
769
|
+
linear: "devtools",
|
|
770
|
+
mcp: "devtools",
|
|
771
|
+
browser: "devtools",
|
|
772
|
+
computeruse: "devtools",
|
|
773
|
+
n8n: "devtools",
|
|
774
|
+
webhooks: "devtools",
|
|
775
|
+
// Knowledge & Memory
|
|
776
|
+
knowledge: "knowledge",
|
|
777
|
+
memory: "knowledge",
|
|
778
|
+
"local-embedding": "knowledge",
|
|
779
|
+
pdf: "knowledge",
|
|
780
|
+
"secrets-manager": "knowledge",
|
|
781
|
+
scratchpad: "knowledge",
|
|
782
|
+
rlm: "knowledge",
|
|
783
|
+
// Agents & Orchestration
|
|
784
|
+
"agent-orchestrator": "agents",
|
|
785
|
+
"agent-skills": "agents",
|
|
786
|
+
"plugin-manager": "agents",
|
|
787
|
+
"copilot-proxy": "agents",
|
|
788
|
+
directives: "agents",
|
|
789
|
+
goals: "agents",
|
|
790
|
+
"eliza-classic": "agents",
|
|
791
|
+
// Media & Content
|
|
792
|
+
vision: "media",
|
|
793
|
+
rss: "media",
|
|
794
|
+
"gmail-watch": "media",
|
|
795
|
+
prose: "media",
|
|
796
|
+
form: "media",
|
|
797
|
+
// Scheduling & Automation
|
|
798
|
+
cron: "automation",
|
|
799
|
+
scheduling: "automation",
|
|
800
|
+
todo: "automation",
|
|
801
|
+
commands: "automation",
|
|
802
|
+
// Storage & Logging
|
|
803
|
+
"s3-storage": "storage",
|
|
804
|
+
"trajectory-logger": "storage",
|
|
805
|
+
experience: "storage",
|
|
806
|
+
// Gaming & Creative
|
|
807
|
+
minecraft: "gaming",
|
|
808
|
+
roblox: "gaming",
|
|
809
|
+
babylon: "gaming",
|
|
810
|
+
mysticism: "gaming",
|
|
811
|
+
personality: "gaming",
|
|
812
|
+
moltbook: "gaming",
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
const SUBGROUP_DISPLAY_ORDER = [
|
|
816
|
+
"ai-provider",
|
|
817
|
+
"connector",
|
|
818
|
+
"streaming",
|
|
819
|
+
"voice",
|
|
820
|
+
"blockchain",
|
|
821
|
+
"devtools",
|
|
822
|
+
"knowledge",
|
|
823
|
+
"agents",
|
|
824
|
+
"media",
|
|
825
|
+
"automation",
|
|
826
|
+
"storage",
|
|
827
|
+
"gaming",
|
|
828
|
+
"feature-other",
|
|
829
|
+
"showcase",
|
|
830
|
+
] as const;
|
|
831
|
+
|
|
832
|
+
const SUBGROUP_LABELS: Record<string, string> = {
|
|
833
|
+
"ai-provider": "AI Providers",
|
|
834
|
+
connector: "Connectors",
|
|
835
|
+
voice: "Voice & Audio",
|
|
836
|
+
blockchain: "Blockchain & Finance",
|
|
837
|
+
devtools: "Dev Tools & Infrastructure",
|
|
838
|
+
knowledge: "Knowledge & Memory",
|
|
839
|
+
agents: "Agents & Orchestration",
|
|
840
|
+
media: "Media & Content",
|
|
841
|
+
automation: "Scheduling & Automation",
|
|
842
|
+
storage: "Storage & Logging",
|
|
843
|
+
gaming: "Gaming & Creative",
|
|
844
|
+
"feature-other": "Other Features",
|
|
845
|
+
streaming: "Streaming Destinations",
|
|
846
|
+
showcase: "Showcase",
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
const SUBGROUP_NAV_ICONS: Record<string, LucideIcon> = {
|
|
850
|
+
all: Package,
|
|
851
|
+
"ai-provider": Brain,
|
|
852
|
+
connector: MessageCircle,
|
|
853
|
+
streaming: Video,
|
|
854
|
+
voice: Mic,
|
|
855
|
+
blockchain: Wallet,
|
|
856
|
+
devtools: Shell,
|
|
857
|
+
knowledge: BookOpen,
|
|
858
|
+
agents: Target,
|
|
859
|
+
media: Eye,
|
|
860
|
+
automation: Calendar,
|
|
861
|
+
storage: Server,
|
|
862
|
+
gaming: Gamepad2,
|
|
863
|
+
"feature-other": Puzzle,
|
|
864
|
+
showcase: Sparkles,
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
function subgroupForPlugin(plugin: PluginInfo): string {
|
|
868
|
+
if (plugin.id === "__ui-showcase__") return "showcase";
|
|
869
|
+
if (plugin.category === "ai-provider") return "ai-provider";
|
|
870
|
+
if (plugin.category === "connector") return "connector";
|
|
871
|
+
if (plugin.category === "streaming") return "streaming";
|
|
872
|
+
return FEATURE_SUBGROUP[plugin.id] ?? "feature-other";
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
type StatusFilter = "all" | "enabled" | "disabled";
|
|
876
|
+
type PluginsViewMode = "all" | "connectors" | "streaming" | "social";
|
|
877
|
+
type SubgroupTag = { id: string; label: string; count: number };
|
|
878
|
+
|
|
879
|
+
function comparePlugins(left: PluginInfo, right: PluginInfo): number {
|
|
880
|
+
if (left.enabled !== right.enabled) return left.enabled ? -1 : 1;
|
|
881
|
+
if (left.enabled && right.enabled) {
|
|
882
|
+
const leftNeedsConfig =
|
|
883
|
+
left.parameters?.some(
|
|
884
|
+
(param: PluginParamDef) => param.required && !param.isSet,
|
|
885
|
+
) ?? false;
|
|
886
|
+
const rightNeedsConfig =
|
|
887
|
+
right.parameters?.some(
|
|
888
|
+
(param: PluginParamDef) => param.required && !param.isSet,
|
|
889
|
+
) ?? false;
|
|
890
|
+
if (leftNeedsConfig !== rightNeedsConfig) {
|
|
891
|
+
return leftNeedsConfig ? -1 : 1;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return (left.name ?? "").localeCompare(right.name ?? "");
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
function matchesPluginFilters(
|
|
898
|
+
plugin: PluginInfo,
|
|
899
|
+
searchLower: string,
|
|
900
|
+
statusFilter: StatusFilter,
|
|
901
|
+
): boolean {
|
|
902
|
+
const matchesStatus =
|
|
903
|
+
statusFilter === "all" ||
|
|
904
|
+
(statusFilter === "enabled" && plugin.enabled) ||
|
|
905
|
+
(statusFilter === "disabled" && !plugin.enabled);
|
|
906
|
+
const matchesSearch =
|
|
907
|
+
!searchLower ||
|
|
908
|
+
(plugin.name ?? "").toLowerCase().includes(searchLower) ||
|
|
909
|
+
(plugin.description ?? "").toLowerCase().includes(searchLower) ||
|
|
910
|
+
(plugin.tags ?? []).some((tag) =>
|
|
911
|
+
(tag ?? "").toLowerCase().includes(searchLower),
|
|
912
|
+
) ||
|
|
913
|
+
plugin.id.toLowerCase().includes(searchLower);
|
|
914
|
+
return matchesStatus && matchesSearch;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
function sortPlugins(
|
|
918
|
+
filteredPlugins: PluginInfo[],
|
|
919
|
+
pluginOrder: string[],
|
|
920
|
+
allowCustomOrder: boolean,
|
|
921
|
+
): PluginInfo[] {
|
|
922
|
+
if (!allowCustomOrder || pluginOrder.length === 0) {
|
|
923
|
+
return [...filteredPlugins].sort(comparePlugins);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
const orderMap = new Map(pluginOrder.map((id, index) => [id, index]));
|
|
927
|
+
return [...filteredPlugins].sort((left, right) => {
|
|
928
|
+
const leftIndex = orderMap.get(left.id);
|
|
929
|
+
const rightIndex = orderMap.get(right.id);
|
|
930
|
+
if (leftIndex != null && rightIndex != null) return leftIndex - rightIndex;
|
|
931
|
+
if (leftIndex != null) return -1;
|
|
932
|
+
if (rightIndex != null) return 1;
|
|
933
|
+
return comparePlugins(left, right);
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function buildPluginListState(options: {
|
|
938
|
+
allowCustomOrder: boolean;
|
|
939
|
+
effectiveSearch: string;
|
|
940
|
+
effectiveStatusFilter: StatusFilter;
|
|
941
|
+
isConnectorLikeMode: boolean;
|
|
942
|
+
mode: PluginsViewMode;
|
|
943
|
+
pluginOrder: string[];
|
|
944
|
+
plugins: PluginInfo[];
|
|
945
|
+
showSubgroupFilters: boolean;
|
|
946
|
+
subgroupFilter: string;
|
|
947
|
+
}): {
|
|
948
|
+
categoryPlugins: PluginInfo[];
|
|
949
|
+
enabledCount: number;
|
|
950
|
+
nonDbPlugins: PluginInfo[];
|
|
951
|
+
sorted: PluginInfo[];
|
|
952
|
+
subgroupTags: SubgroupTag[];
|
|
953
|
+
visiblePlugins: PluginInfo[];
|
|
954
|
+
} {
|
|
955
|
+
const {
|
|
956
|
+
allowCustomOrder,
|
|
957
|
+
effectiveSearch,
|
|
958
|
+
effectiveStatusFilter,
|
|
959
|
+
isConnectorLikeMode,
|
|
960
|
+
mode,
|
|
961
|
+
pluginOrder,
|
|
962
|
+
plugins,
|
|
963
|
+
showSubgroupFilters,
|
|
964
|
+
subgroupFilter,
|
|
965
|
+
} = options;
|
|
966
|
+
const categoryPlugins = plugins.filter(
|
|
967
|
+
(plugin) =>
|
|
968
|
+
plugin.category !== "database" &&
|
|
969
|
+
!ALWAYS_ON_PLUGIN_IDS.has(plugin.id) &&
|
|
970
|
+
(!isConnectorLikeMode || plugin.category === "connector") &&
|
|
971
|
+
(mode !== "streaming" || plugin.category === "streaming"),
|
|
972
|
+
);
|
|
973
|
+
const nonDbPlugins = [SHOWCASE_PLUGIN, ...categoryPlugins];
|
|
974
|
+
const searchLower = effectiveSearch.toLowerCase();
|
|
975
|
+
const sorted = sortPlugins(
|
|
976
|
+
categoryPlugins.filter((plugin) =>
|
|
977
|
+
matchesPluginFilters(plugin, searchLower, effectiveStatusFilter),
|
|
978
|
+
),
|
|
979
|
+
pluginOrder,
|
|
980
|
+
allowCustomOrder,
|
|
981
|
+
);
|
|
982
|
+
const enabledCount = categoryPlugins.filter(
|
|
983
|
+
(plugin) => plugin.enabled,
|
|
984
|
+
).length;
|
|
985
|
+
|
|
986
|
+
const subgroupCounts: Record<string, number> = {};
|
|
987
|
+
const visiblePlugins: PluginInfo[] = [];
|
|
988
|
+
for (const plugin of sorted) {
|
|
989
|
+
const subgroup = subgroupForPlugin(plugin);
|
|
990
|
+
subgroupCounts[subgroup] = (subgroupCounts[subgroup] ?? 0) + 1;
|
|
991
|
+
if (
|
|
992
|
+
!showSubgroupFilters ||
|
|
993
|
+
subgroupFilter === "all" ||
|
|
994
|
+
subgroup === subgroupFilter
|
|
995
|
+
) {
|
|
996
|
+
visiblePlugins.push(plugin);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
const subgroupTags = [
|
|
1001
|
+
{ id: "all", label: "All", count: sorted.length },
|
|
1002
|
+
...SUBGROUP_DISPLAY_ORDER.filter(
|
|
1003
|
+
(subgroupId) => (subgroupCounts[subgroupId] ?? 0) > 0,
|
|
1004
|
+
).map((subgroupId) => ({
|
|
1005
|
+
id: subgroupId,
|
|
1006
|
+
label: SUBGROUP_LABELS[subgroupId],
|
|
1007
|
+
count: subgroupCounts[subgroupId] ?? 0,
|
|
1008
|
+
})),
|
|
1009
|
+
];
|
|
1010
|
+
|
|
1011
|
+
return {
|
|
1012
|
+
categoryPlugins,
|
|
1013
|
+
enabledCount,
|
|
1014
|
+
nonDbPlugins,
|
|
1015
|
+
sorted,
|
|
1016
|
+
subgroupTags,
|
|
1017
|
+
visiblePlugins,
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/* ── Shared PluginListView ─────────────────────────────────────────── */
|
|
1022
|
+
|
|
1023
|
+
interface PluginListViewProps {
|
|
1024
|
+
/** Label used in search placeholder and empty state messages. */
|
|
1025
|
+
label: string;
|
|
1026
|
+
/** Optional list mode for pre-filtered views like Connectors. */
|
|
1027
|
+
mode?: PluginsViewMode;
|
|
1028
|
+
/** Whether the view is rendered in a full-screen gamified modal. */
|
|
1029
|
+
inModal?: boolean;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function PluginListView({ label, mode = "all", inModal }: PluginListViewProps) {
|
|
1033
|
+
const {
|
|
1034
|
+
plugins,
|
|
1035
|
+
pluginStatusFilter,
|
|
1036
|
+
pluginSearch,
|
|
1037
|
+
pluginSettingsOpen,
|
|
1038
|
+
pluginSaving,
|
|
1039
|
+
pluginSaveSuccess,
|
|
1040
|
+
loadPlugins,
|
|
1041
|
+
handlePluginToggle,
|
|
1042
|
+
handlePluginConfigSave,
|
|
1043
|
+
setActionNotice,
|
|
1044
|
+
setState,
|
|
1045
|
+
t,
|
|
1046
|
+
} = useApp();
|
|
1047
|
+
|
|
1048
|
+
const [pluginConfigs, setPluginConfigs] = useState<
|
|
1049
|
+
Record<string, Record<string, string>>
|
|
1050
|
+
>({});
|
|
1051
|
+
const [testResults, setTestResults] = useState<
|
|
1052
|
+
Map<
|
|
1053
|
+
string,
|
|
1054
|
+
{
|
|
1055
|
+
success: boolean;
|
|
1056
|
+
message?: string;
|
|
1057
|
+
error?: string;
|
|
1058
|
+
durationMs: number;
|
|
1059
|
+
loading: boolean;
|
|
1060
|
+
}
|
|
1061
|
+
>
|
|
1062
|
+
>(new Map());
|
|
1063
|
+
const [addDirOpen, setAddDirOpen] = useState(false);
|
|
1064
|
+
const [addDirPath, setAddDirPath] = useState("");
|
|
1065
|
+
const [addDirLoading, setAddDirLoading] = useState(false);
|
|
1066
|
+
const [installingPlugins, setInstallingPlugins] = useState<Set<string>>(
|
|
1067
|
+
new Set(),
|
|
1068
|
+
);
|
|
1069
|
+
const [installProgress, setInstallProgress] = useState<
|
|
1070
|
+
Map<string, { phase: string; message: string }>
|
|
1071
|
+
>(new Map());
|
|
1072
|
+
const [togglingPlugins, setTogglingPlugins] = useState<Set<string>>(
|
|
1073
|
+
new Set(),
|
|
1074
|
+
);
|
|
1075
|
+
const hasPluginToggleInFlight = togglingPlugins.size > 0;
|
|
1076
|
+
|
|
1077
|
+
// ── Drag-to-reorder state ────────────────────────────────────────
|
|
1078
|
+
const [pluginOrder, setPluginOrder] = useState<string[]>(() => {
|
|
1079
|
+
try {
|
|
1080
|
+
const stored = localStorage.getItem("pluginOrder");
|
|
1081
|
+
return stored ? JSON.parse(stored) : [];
|
|
1082
|
+
} catch {
|
|
1083
|
+
return [];
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
const [draggingId, setDraggingId] = useState<string | null>(null);
|
|
1087
|
+
const [dragOverId, setDragOverId] = useState<string | null>(null);
|
|
1088
|
+
const dragRef = useRef<string | null>(null);
|
|
1089
|
+
const isSocialMode = mode === "social";
|
|
1090
|
+
const isConnectorLikeMode = mode === "connectors" || mode === "social";
|
|
1091
|
+
const resultLabel = isSocialMode ? "connectors" : label.toLowerCase();
|
|
1092
|
+
const searchPlaceholder = isSocialMode
|
|
1093
|
+
? "Search..."
|
|
1094
|
+
: `Search ${label.toLowerCase()}...`;
|
|
1095
|
+
const effectiveStatusFilter: StatusFilter =
|
|
1096
|
+
isSocialMode && pluginStatusFilter === "disabled"
|
|
1097
|
+
? "all"
|
|
1098
|
+
: pluginStatusFilter;
|
|
1099
|
+
const effectiveSearch = pluginSearch;
|
|
1100
|
+
const showToolbar = true;
|
|
1101
|
+
const allowCustomOrder = !isSocialMode;
|
|
1102
|
+
const showPluginManagementActions = !isSocialMode;
|
|
1103
|
+
|
|
1104
|
+
// Load plugins on mount
|
|
1105
|
+
useEffect(() => {
|
|
1106
|
+
void loadPlugins();
|
|
1107
|
+
}, [loadPlugins]);
|
|
1108
|
+
|
|
1109
|
+
// Listen for install progress events via WebSocket
|
|
1110
|
+
useEffect(() => {
|
|
1111
|
+
const unbind = client.onWsEvent(
|
|
1112
|
+
"install-progress",
|
|
1113
|
+
(data: Record<string, unknown>) => {
|
|
1114
|
+
const pluginName = data.pluginName as string;
|
|
1115
|
+
const phase = data.phase as string;
|
|
1116
|
+
const message = data.message as string;
|
|
1117
|
+
if (!pluginName) return;
|
|
1118
|
+
if (phase === "complete" || phase === "error") {
|
|
1119
|
+
setInstallProgress((prev) => {
|
|
1120
|
+
const next = new Map(prev);
|
|
1121
|
+
next.delete(pluginName);
|
|
1122
|
+
return next;
|
|
1123
|
+
});
|
|
1124
|
+
} else {
|
|
1125
|
+
setInstallProgress((prev) =>
|
|
1126
|
+
new Map(prev).set(pluginName, { phase, message }),
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
);
|
|
1131
|
+
return unbind;
|
|
1132
|
+
}, []);
|
|
1133
|
+
|
|
1134
|
+
// Persist custom order
|
|
1135
|
+
useEffect(() => {
|
|
1136
|
+
if (pluginOrder.length > 0) {
|
|
1137
|
+
localStorage.setItem("pluginOrder", JSON.stringify(pluginOrder));
|
|
1138
|
+
}
|
|
1139
|
+
}, [pluginOrder]);
|
|
1140
|
+
|
|
1141
|
+
const [subgroupFilter, setSubgroupFilter] = useState<string>("all");
|
|
1142
|
+
const showSubgroupFilters =
|
|
1143
|
+
mode !== "connectors" && mode !== "streaming" && mode !== "social";
|
|
1144
|
+
const showDesktopSubgroupSidebar = showSubgroupFilters;
|
|
1145
|
+
const {
|
|
1146
|
+
categoryPlugins,
|
|
1147
|
+
enabledCount,
|
|
1148
|
+
nonDbPlugins,
|
|
1149
|
+
sorted,
|
|
1150
|
+
subgroupTags,
|
|
1151
|
+
visiblePlugins,
|
|
1152
|
+
} = useMemo(
|
|
1153
|
+
() =>
|
|
1154
|
+
buildPluginListState({
|
|
1155
|
+
allowCustomOrder,
|
|
1156
|
+
effectiveSearch,
|
|
1157
|
+
effectiveStatusFilter,
|
|
1158
|
+
isConnectorLikeMode,
|
|
1159
|
+
mode,
|
|
1160
|
+
pluginOrder,
|
|
1161
|
+
plugins,
|
|
1162
|
+
showSubgroupFilters,
|
|
1163
|
+
subgroupFilter,
|
|
1164
|
+
}),
|
|
1165
|
+
[
|
|
1166
|
+
allowCustomOrder,
|
|
1167
|
+
effectiveSearch,
|
|
1168
|
+
effectiveStatusFilter,
|
|
1169
|
+
isConnectorLikeMode,
|
|
1170
|
+
mode,
|
|
1171
|
+
pluginOrder,
|
|
1172
|
+
plugins,
|
|
1173
|
+
showSubgroupFilters,
|
|
1174
|
+
subgroupFilter,
|
|
1175
|
+
],
|
|
1176
|
+
);
|
|
1177
|
+
|
|
1178
|
+
useEffect(() => {
|
|
1179
|
+
if (!showSubgroupFilters) return;
|
|
1180
|
+
if (subgroupFilter === "all") return;
|
|
1181
|
+
if (!subgroupTags.some((tag) => tag.id === subgroupFilter)) {
|
|
1182
|
+
setSubgroupFilter("all");
|
|
1183
|
+
}
|
|
1184
|
+
}, [showSubgroupFilters, subgroupFilter, subgroupTags]);
|
|
1185
|
+
|
|
1186
|
+
const renderSubgroupFilterButton = useCallback(
|
|
1187
|
+
(
|
|
1188
|
+
tag: { id: string; label: string; count: number },
|
|
1189
|
+
options?: { sidebar?: boolean },
|
|
1190
|
+
) => {
|
|
1191
|
+
const isActive = subgroupFilter === tag.id;
|
|
1192
|
+
if (options?.sidebar) {
|
|
1193
|
+
const Icon = SUBGROUP_NAV_ICONS[tag.id] ?? Package;
|
|
1194
|
+
return (
|
|
1195
|
+
<button
|
|
1196
|
+
key={tag.id}
|
|
1197
|
+
type="button"
|
|
1198
|
+
onClick={() => setSubgroupFilter(tag.id)}
|
|
1199
|
+
aria-current={isActive ? "page" : undefined}
|
|
1200
|
+
className={`flex w-full items-center gap-3 rounded-2xl border px-4 py-3 text-left transition-all duration-200 ${
|
|
1201
|
+
isActive
|
|
1202
|
+
? "border-accent/40 bg-accent/12 text-txt shadow-[0_10px_30px_rgba(var(--accent),0.08)]"
|
|
1203
|
+
: "border-transparent text-muted hover:border-border/60 hover:bg-card/55 hover:text-txt"
|
|
1204
|
+
}`}
|
|
1205
|
+
>
|
|
1206
|
+
<span
|
|
1207
|
+
className={`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border ${
|
|
1208
|
+
isActive
|
|
1209
|
+
? "border-accent/30 bg-accent/18 text-txt-strong"
|
|
1210
|
+
: "border-border/50 bg-bg-accent/80 text-muted"
|
|
1211
|
+
}`}
|
|
1212
|
+
>
|
|
1213
|
+
<Icon className="w-4 h-4" />
|
|
1214
|
+
</span>
|
|
1215
|
+
<span className="min-w-0 flex-1">
|
|
1216
|
+
<span className="block text-sm font-semibold leading-snug text-current">
|
|
1217
|
+
{tag.label}
|
|
1218
|
+
</span>
|
|
1219
|
+
</span>
|
|
1220
|
+
<span
|
|
1221
|
+
className={`rounded-full border px-2 py-0.5 text-[10px] font-mono leading-none ${
|
|
1222
|
+
isActive
|
|
1223
|
+
? "border-accent/20 bg-accent/20 text-txt"
|
|
1224
|
+
: "border-border/50 bg-black/10 text-muted"
|
|
1225
|
+
}`}
|
|
1226
|
+
>
|
|
1227
|
+
{tag.count}
|
|
1228
|
+
</span>
|
|
1229
|
+
</button>
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
return (
|
|
1234
|
+
<Button
|
|
1235
|
+
key={tag.id}
|
|
1236
|
+
variant={isActive ? "default" : "outline"}
|
|
1237
|
+
size="sm"
|
|
1238
|
+
className={`h-7 px-3 text-[11px] font-bold tracking-wide rounded-lg transition-all ${
|
|
1239
|
+
isActive
|
|
1240
|
+
? "shadow-[0_0_10px_rgba(var(--accent),0.2)] border-accent"
|
|
1241
|
+
: "bg-card/40 backdrop-blur-sm border-border/40 text-muted hover:text-txt shadow-sm hover:border-accent/30"
|
|
1242
|
+
}`}
|
|
1243
|
+
onClick={() => setSubgroupFilter(tag.id)}
|
|
1244
|
+
>
|
|
1245
|
+
{tag.label}
|
|
1246
|
+
<span
|
|
1247
|
+
className={`ml-1.5 px-1.5 py-0.5 rounded border text-[9px] font-mono leading-none ${isActive ? "bg-black/20 border-black/10" : "bg-black/10 border-white/5"}`}
|
|
1248
|
+
>
|
|
1249
|
+
{tag.count}
|
|
1250
|
+
</span>
|
|
1251
|
+
</Button>
|
|
1252
|
+
);
|
|
1253
|
+
},
|
|
1254
|
+
[subgroupFilter],
|
|
1255
|
+
);
|
|
1256
|
+
|
|
1257
|
+
// ── Handlers ───────────────────────────────────────────────────────
|
|
1258
|
+
|
|
1259
|
+
const toggleSettings = (pluginId: string) => {
|
|
1260
|
+
const next = new Set<string>();
|
|
1261
|
+
if (!pluginSettingsOpen.has(pluginId)) next.add(pluginId);
|
|
1262
|
+
setState("pluginSettingsOpen", next);
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
const handleParamChange = (
|
|
1266
|
+
pluginId: string,
|
|
1267
|
+
paramKey: string,
|
|
1268
|
+
value: string,
|
|
1269
|
+
) => {
|
|
1270
|
+
setPluginConfigs((prev) => ({
|
|
1271
|
+
...prev,
|
|
1272
|
+
[pluginId]: { ...prev[pluginId], [paramKey]: value },
|
|
1273
|
+
}));
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
const handleConfigSave = async (pluginId: string) => {
|
|
1277
|
+
// Showcase plugin: no-op save (it's not a real plugin)
|
|
1278
|
+
if (pluginId === "__ui-showcase__") return;
|
|
1279
|
+
const config = pluginConfigs[pluginId] ?? {};
|
|
1280
|
+
await handlePluginConfigSave(pluginId, config);
|
|
1281
|
+
setPluginConfigs((prev) => {
|
|
1282
|
+
const next = { ...prev };
|
|
1283
|
+
delete next[pluginId];
|
|
1284
|
+
return next;
|
|
1285
|
+
});
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
const handleConfigReset = (pluginId: string) => {
|
|
1289
|
+
setPluginConfigs((prev) => {
|
|
1290
|
+
const next = { ...prev };
|
|
1291
|
+
delete next[pluginId];
|
|
1292
|
+
return next;
|
|
1293
|
+
});
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
const handleTestConnection = async (pluginId: string) => {
|
|
1297
|
+
setTestResults((prev) => {
|
|
1298
|
+
const next = new Map(prev);
|
|
1299
|
+
next.set(pluginId, { success: false, loading: true, durationMs: 0 });
|
|
1300
|
+
return next;
|
|
1301
|
+
});
|
|
1302
|
+
try {
|
|
1303
|
+
const result = await client.testPluginConnection(pluginId);
|
|
1304
|
+
setTestResults((prev) => {
|
|
1305
|
+
const next = new Map(prev);
|
|
1306
|
+
next.set(pluginId, { ...result, loading: false });
|
|
1307
|
+
return next;
|
|
1308
|
+
});
|
|
1309
|
+
} catch (err) {
|
|
1310
|
+
setTestResults((prev) => {
|
|
1311
|
+
const next = new Map(prev);
|
|
1312
|
+
next.set(pluginId, {
|
|
1313
|
+
success: false,
|
|
1314
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1315
|
+
loading: false,
|
|
1316
|
+
durationMs: 0,
|
|
1317
|
+
});
|
|
1318
|
+
return next;
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
const handleInstallPlugin = async (pluginId: string, npmName: string) => {
|
|
1324
|
+
setInstallingPlugins((prev) => new Set(prev).add(pluginId));
|
|
1325
|
+
try {
|
|
1326
|
+
await client.installRegistryPlugin(npmName);
|
|
1327
|
+
await loadPlugins();
|
|
1328
|
+
setActionNotice(
|
|
1329
|
+
`${npmName} installed. Restart required to activate.`,
|
|
1330
|
+
"success",
|
|
1331
|
+
);
|
|
1332
|
+
} catch (err) {
|
|
1333
|
+
setActionNotice(
|
|
1334
|
+
`Failed to install ${npmName}: ${err instanceof Error ? err.message : "unknown error"}`,
|
|
1335
|
+
"error",
|
|
1336
|
+
3800,
|
|
1337
|
+
);
|
|
1338
|
+
// Still try to refresh in case install succeeded but restart failed
|
|
1339
|
+
try {
|
|
1340
|
+
await loadPlugins();
|
|
1341
|
+
} catch {
|
|
1342
|
+
/* ignore */
|
|
1343
|
+
}
|
|
1344
|
+
} finally {
|
|
1345
|
+
setInstallingPlugins((prev) => {
|
|
1346
|
+
const next = new Set(prev);
|
|
1347
|
+
next.delete(pluginId);
|
|
1348
|
+
return next;
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1353
|
+
const handleTogglePlugin = useCallback(
|
|
1354
|
+
async (pluginId: string, enabled: boolean) => {
|
|
1355
|
+
let shouldStart = false;
|
|
1356
|
+
setTogglingPlugins((prev) => {
|
|
1357
|
+
if (prev.has(pluginId) || prev.size > 0) return prev;
|
|
1358
|
+
shouldStart = true;
|
|
1359
|
+
return new Set(prev).add(pluginId);
|
|
1360
|
+
});
|
|
1361
|
+
if (!shouldStart) return;
|
|
1362
|
+
|
|
1363
|
+
try {
|
|
1364
|
+
await handlePluginToggle(pluginId, enabled);
|
|
1365
|
+
} finally {
|
|
1366
|
+
setTogglingPlugins((prev) => {
|
|
1367
|
+
const next = new Set(prev);
|
|
1368
|
+
next.delete(pluginId);
|
|
1369
|
+
return next;
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
[handlePluginToggle],
|
|
1374
|
+
);
|
|
1375
|
+
|
|
1376
|
+
const handleOpenPluginExternalUrl = useCallback(
|
|
1377
|
+
async (url: string) => {
|
|
1378
|
+
try {
|
|
1379
|
+
await openExternalUrl(url);
|
|
1380
|
+
} catch (err) {
|
|
1381
|
+
setActionNotice(
|
|
1382
|
+
err instanceof Error ? err.message : "Failed to open external link.",
|
|
1383
|
+
"error",
|
|
1384
|
+
4200,
|
|
1385
|
+
);
|
|
1386
|
+
}
|
|
1387
|
+
},
|
|
1388
|
+
[setActionNotice],
|
|
1389
|
+
);
|
|
1390
|
+
|
|
1391
|
+
// ── Add from directory ──────────────────────────────────────────────
|
|
1392
|
+
|
|
1393
|
+
const handleAddFromDirectory = async () => {
|
|
1394
|
+
const trimmed = addDirPath.trim();
|
|
1395
|
+
if (!trimmed) return;
|
|
1396
|
+
setAddDirLoading(true);
|
|
1397
|
+
try {
|
|
1398
|
+
await client.installRegistryPlugin(trimmed);
|
|
1399
|
+
await loadPlugins();
|
|
1400
|
+
setAddDirPath("");
|
|
1401
|
+
setAddDirOpen(false);
|
|
1402
|
+
setActionNotice(`Plugin installed from ${trimmed}`, "success");
|
|
1403
|
+
} catch (err) {
|
|
1404
|
+
setActionNotice(
|
|
1405
|
+
`Failed to add plugin: ${err instanceof Error ? err.message : "unknown error"}`,
|
|
1406
|
+
"error",
|
|
1407
|
+
3800,
|
|
1408
|
+
);
|
|
1409
|
+
}
|
|
1410
|
+
setAddDirLoading(false);
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
// ── Drag-to-reorder handlers ─────────────────────────────────────
|
|
1414
|
+
|
|
1415
|
+
const handleDragStart = useCallback(
|
|
1416
|
+
(e: React.DragEvent, pluginId: string) => {
|
|
1417
|
+
dragRef.current = pluginId;
|
|
1418
|
+
setDraggingId(pluginId);
|
|
1419
|
+
e.dataTransfer.effectAllowed = "move";
|
|
1420
|
+
e.dataTransfer.setData("text/plain", pluginId);
|
|
1421
|
+
},
|
|
1422
|
+
[],
|
|
1423
|
+
);
|
|
1424
|
+
|
|
1425
|
+
const handleDragOver = useCallback((e: React.DragEvent, pluginId: string) => {
|
|
1426
|
+
e.preventDefault();
|
|
1427
|
+
e.dataTransfer.dropEffect = "move";
|
|
1428
|
+
if (dragRef.current && dragRef.current !== pluginId) {
|
|
1429
|
+
setDragOverId(pluginId);
|
|
1430
|
+
}
|
|
1431
|
+
}, []);
|
|
1432
|
+
|
|
1433
|
+
const handleDrop = useCallback(
|
|
1434
|
+
(e: React.DragEvent, targetId: string) => {
|
|
1435
|
+
e.preventDefault();
|
|
1436
|
+
const srcId = dragRef.current;
|
|
1437
|
+
if (!srcId || srcId === targetId) {
|
|
1438
|
+
dragRef.current = null;
|
|
1439
|
+
setDraggingId(null);
|
|
1440
|
+
setDragOverId(null);
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
// Materialize current sorted order, then splice
|
|
1444
|
+
if (!allowCustomOrder) return;
|
|
1445
|
+
setPluginOrder(() => {
|
|
1446
|
+
// Build full order: items in custom order first, then any new ones
|
|
1447
|
+
const allIds = nonDbPlugins.map((p: PluginInfo) => p.id);
|
|
1448
|
+
let ids: string[];
|
|
1449
|
+
if (pluginOrder.length > 0) {
|
|
1450
|
+
const known = new Set(pluginOrder);
|
|
1451
|
+
ids = [...pluginOrder, ...allIds.filter((id) => !known.has(id))];
|
|
1452
|
+
} else {
|
|
1453
|
+
ids = sorted.map((p: PluginInfo) => p.id);
|
|
1454
|
+
// Pad with any nonDbPlugins not currently in sorted (due to filters)
|
|
1455
|
+
const inSorted = new Set(ids);
|
|
1456
|
+
for (const id of allIds) {
|
|
1457
|
+
if (!inSorted.has(id)) ids.push(id);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
const fromIdx = ids.indexOf(srcId);
|
|
1461
|
+
const toIdx = ids.indexOf(targetId);
|
|
1462
|
+
if (fromIdx === -1 || toIdx === -1) return ids;
|
|
1463
|
+
ids.splice(fromIdx, 1);
|
|
1464
|
+
ids.splice(toIdx, 0, srcId);
|
|
1465
|
+
return ids;
|
|
1466
|
+
});
|
|
1467
|
+
dragRef.current = null;
|
|
1468
|
+
setDraggingId(null);
|
|
1469
|
+
setDragOverId(null);
|
|
1470
|
+
},
|
|
1471
|
+
[allowCustomOrder, nonDbPlugins, pluginOrder, sorted],
|
|
1472
|
+
);
|
|
1473
|
+
|
|
1474
|
+
const handleDragEnd = useCallback(() => {
|
|
1475
|
+
dragRef.current = null;
|
|
1476
|
+
setDraggingId(null);
|
|
1477
|
+
setDragOverId(null);
|
|
1478
|
+
}, []);
|
|
1479
|
+
|
|
1480
|
+
const handleResetOrder = useCallback(() => {
|
|
1481
|
+
setPluginOrder([]);
|
|
1482
|
+
localStorage.removeItem("pluginOrder");
|
|
1483
|
+
}, []);
|
|
1484
|
+
|
|
1485
|
+
const renderResolvedIcon = useCallback(
|
|
1486
|
+
(
|
|
1487
|
+
plugin: PluginInfo,
|
|
1488
|
+
options?: {
|
|
1489
|
+
className?: string;
|
|
1490
|
+
emojiClassName?: string;
|
|
1491
|
+
},
|
|
1492
|
+
) => {
|
|
1493
|
+
const icon = resolveIcon(plugin);
|
|
1494
|
+
if (!icon) {
|
|
1495
|
+
return <span className={options?.emojiClassName ?? "text-sm"}>🧩</span>;
|
|
1496
|
+
}
|
|
1497
|
+
if (typeof icon === "string") {
|
|
1498
|
+
const imageSrc = iconImageSource(icon);
|
|
1499
|
+
return imageSrc ? (
|
|
1500
|
+
<img
|
|
1501
|
+
src={imageSrc}
|
|
1502
|
+
alt=""
|
|
1503
|
+
className={
|
|
1504
|
+
options?.className ?? "w-5 h-5 rounded-sm object-contain"
|
|
1505
|
+
}
|
|
1506
|
+
onError={(e) => {
|
|
1507
|
+
(e.currentTarget as HTMLImageElement).style.display = "none";
|
|
1508
|
+
}}
|
|
1509
|
+
/>
|
|
1510
|
+
) : (
|
|
1511
|
+
<span className={options?.emojiClassName ?? "text-sm"}>{icon}</span>
|
|
1512
|
+
);
|
|
1513
|
+
}
|
|
1514
|
+
const IconComponent = icon;
|
|
1515
|
+
return <IconComponent className={options?.className ?? "w-5 h-5"} />;
|
|
1516
|
+
},
|
|
1517
|
+
[],
|
|
1518
|
+
);
|
|
1519
|
+
|
|
1520
|
+
// ── Card renderers ────────────────────────────────────────────────
|
|
1521
|
+
|
|
1522
|
+
const renderPluginCard = (p: PluginInfo) => {
|
|
1523
|
+
const hasParams = p.parameters && p.parameters.length > 0;
|
|
1524
|
+
const isOpen = pluginSettingsOpen.has(p.id);
|
|
1525
|
+
const setCount = hasParams
|
|
1526
|
+
? p.parameters.filter((param: PluginParamDef) => param.isSet).length
|
|
1527
|
+
: 0;
|
|
1528
|
+
const totalCount = hasParams ? p.parameters.length : 0;
|
|
1529
|
+
const allParamsSet = !hasParams || setCount === totalCount;
|
|
1530
|
+
const isShowcase = p.id === "__ui-showcase__";
|
|
1531
|
+
const categoryLabel = isShowcase
|
|
1532
|
+
? "showcase"
|
|
1533
|
+
: p.category === "ai-provider"
|
|
1534
|
+
? "ai provider"
|
|
1535
|
+
: p.category;
|
|
1536
|
+
|
|
1537
|
+
const enabledBorder = isShowcase
|
|
1538
|
+
? "border-l-[3px] border-l-accent"
|
|
1539
|
+
: p.enabled
|
|
1540
|
+
? !allParamsSet && hasParams
|
|
1541
|
+
? "border-l-[3px] border-l-warn"
|
|
1542
|
+
: "border-l-[3px] border-l-accent"
|
|
1543
|
+
: "";
|
|
1544
|
+
const isToggleBusy = togglingPlugins.has(p.id);
|
|
1545
|
+
const toggleDisabled =
|
|
1546
|
+
isToggleBusy || (hasPluginToggleInFlight && !isToggleBusy);
|
|
1547
|
+
|
|
1548
|
+
const isDragging = draggingId === p.id;
|
|
1549
|
+
const isDragOver = dragOverId === p.id && draggingId !== p.id;
|
|
1550
|
+
const pluginLinks = getPluginResourceLinks(p);
|
|
1551
|
+
|
|
1552
|
+
return (
|
|
1553
|
+
<li
|
|
1554
|
+
key={p.id}
|
|
1555
|
+
draggable={allowCustomOrder}
|
|
1556
|
+
onDragStart={
|
|
1557
|
+
allowCustomOrder ? (e) => handleDragStart(e, p.id) : undefined
|
|
1558
|
+
}
|
|
1559
|
+
onDragOver={
|
|
1560
|
+
allowCustomOrder ? (e) => handleDragOver(e, p.id) : undefined
|
|
1561
|
+
}
|
|
1562
|
+
onDrop={allowCustomOrder ? (e) => handleDrop(e, p.id) : undefined}
|
|
1563
|
+
onDragEnd={allowCustomOrder ? handleDragEnd : undefined}
|
|
1564
|
+
className={`border border-border bg-card transition-colors duration-150 flex flex-col ${enabledBorder} ${
|
|
1565
|
+
isOpen ? "ring-1 ring-accent" : "hover:border-accent/40"
|
|
1566
|
+
} ${isDragging ? "opacity-30" : ""} ${isDragOver ? "ring-2 ring-accent/60" : ""}`}
|
|
1567
|
+
data-plugin-id={p.id}
|
|
1568
|
+
>
|
|
1569
|
+
{/* Top: drag handle + icon + name + toggle */}
|
|
1570
|
+
<div className="flex items-center gap-2 px-3 pt-3 pb-1">
|
|
1571
|
+
{allowCustomOrder && (
|
|
1572
|
+
<span
|
|
1573
|
+
className="text-[10px] text-muted opacity-30 hover:opacity-70 cursor-grab active:cursor-grabbing shrink-0 select-none leading-none"
|
|
1574
|
+
title={t("pluginsview.DragToReorder")}
|
|
1575
|
+
>
|
|
1576
|
+
{t("pluginsview.X2807")}
|
|
1577
|
+
</span>
|
|
1578
|
+
)}
|
|
1579
|
+
<span className="font-bold text-sm flex items-center gap-1.5 min-w-0 truncate flex-1">
|
|
1580
|
+
{(() => {
|
|
1581
|
+
const icon = resolveIcon(p);
|
|
1582
|
+
if (!icon) return null;
|
|
1583
|
+
if (typeof icon === "string") {
|
|
1584
|
+
const imageSrc = iconImageSource(icon);
|
|
1585
|
+
return imageSrc ? (
|
|
1586
|
+
<img
|
|
1587
|
+
src={imageSrc}
|
|
1588
|
+
alt=""
|
|
1589
|
+
className="w-5 h-5 rounded-sm object-contain"
|
|
1590
|
+
onError={(e) => {
|
|
1591
|
+
(e.currentTarget as HTMLImageElement).style.display =
|
|
1592
|
+
"none";
|
|
1593
|
+
}}
|
|
1594
|
+
/>
|
|
1595
|
+
) : (
|
|
1596
|
+
<span className="text-sm">{icon}</span>
|
|
1597
|
+
);
|
|
1598
|
+
}
|
|
1599
|
+
const IconComponent = icon;
|
|
1600
|
+
return <IconComponent className="w-5 h-5" />;
|
|
1601
|
+
})()}
|
|
1602
|
+
{p.name}
|
|
1603
|
+
</span>
|
|
1604
|
+
{isShowcase ? (
|
|
1605
|
+
<span className="text-[10px] font-bold tracking-wider px-2.5 py-[2px] border border-accent text-txt bg-accent-subtle shrink-0">
|
|
1606
|
+
{t("pluginsview.DEMO")}
|
|
1607
|
+
</span>
|
|
1608
|
+
) : (
|
|
1609
|
+
<button
|
|
1610
|
+
type="button"
|
|
1611
|
+
data-plugin-toggle={p.id}
|
|
1612
|
+
className={`text-[10px] font-bold tracking-wider px-2.5 py-[2px] border transition-colors duration-150 shrink-0 ${
|
|
1613
|
+
p.enabled
|
|
1614
|
+
? "bg-accent text-accent-fg border-accent"
|
|
1615
|
+
: "bg-transparent text-muted border-border hover:text-txt"
|
|
1616
|
+
} ${
|
|
1617
|
+
toggleDisabled
|
|
1618
|
+
? "opacity-60 cursor-not-allowed"
|
|
1619
|
+
: "cursor-pointer"
|
|
1620
|
+
}`}
|
|
1621
|
+
onClick={(e) => {
|
|
1622
|
+
e.stopPropagation();
|
|
1623
|
+
void handleTogglePlugin(p.id, !p.enabled);
|
|
1624
|
+
}}
|
|
1625
|
+
disabled={toggleDisabled}
|
|
1626
|
+
>
|
|
1627
|
+
{isToggleBusy ? "APPLYING" : p.enabled ? "ON" : "OFF"}
|
|
1628
|
+
</button>
|
|
1629
|
+
)}
|
|
1630
|
+
</div>
|
|
1631
|
+
|
|
1632
|
+
{/* Badges: category + version + loaded status */}
|
|
1633
|
+
<div className="flex items-center gap-1.5 px-3 pb-1.5">
|
|
1634
|
+
<span className="text-[10px] px-1.5 py-px border border-border bg-surface text-muted lowercase tracking-wide whitespace-nowrap">
|
|
1635
|
+
{categoryLabel}
|
|
1636
|
+
</span>
|
|
1637
|
+
{p.version && (
|
|
1638
|
+
<span className="text-[10px] font-mono text-muted opacity-70">
|
|
1639
|
+
v{p.version}
|
|
1640
|
+
</span>
|
|
1641
|
+
)}
|
|
1642
|
+
{p.enabled && !p.isActive && !isShowcase && (
|
|
1643
|
+
<span
|
|
1644
|
+
className={`text-[10px] px-1.5 py-px border lowercase tracking-wide whitespace-nowrap ${
|
|
1645
|
+
p.loadError
|
|
1646
|
+
? "border-destructive bg-[rgba(153,27,27,0.04)] text-destructive"
|
|
1647
|
+
: "border-warn bg-[rgba(234,179,8,0.06)] text-warn"
|
|
1648
|
+
}`}
|
|
1649
|
+
title={
|
|
1650
|
+
p.loadError || "Plugin is enabled but not loaded in the runtime"
|
|
1651
|
+
}
|
|
1652
|
+
>
|
|
1653
|
+
{p.loadError ? "load failed" : "not installed"}
|
|
1654
|
+
</span>
|
|
1655
|
+
)}
|
|
1656
|
+
{isToggleBusy && (
|
|
1657
|
+
<span className="text-[10px] px-1.5 py-px border border-accent bg-accent-subtle text-txt lowercase tracking-wide whitespace-nowrap">
|
|
1658
|
+
{t("pluginsview.restarting")}
|
|
1659
|
+
</span>
|
|
1660
|
+
)}
|
|
1661
|
+
</div>
|
|
1662
|
+
|
|
1663
|
+
{/* Description — clamped to 3 lines */}
|
|
1664
|
+
<p
|
|
1665
|
+
className="text-xs text-muted px-3 pb-2 flex-1"
|
|
1666
|
+
style={{
|
|
1667
|
+
display: "-webkit-box",
|
|
1668
|
+
WebkitLineClamp: 3,
|
|
1669
|
+
WebkitBoxOrient: "vertical",
|
|
1670
|
+
overflow: "hidden",
|
|
1671
|
+
}}
|
|
1672
|
+
>
|
|
1673
|
+
{p.description || "No description available"}
|
|
1674
|
+
</p>
|
|
1675
|
+
|
|
1676
|
+
{(p.tags?.length ?? 0) > 0 && (
|
|
1677
|
+
<div className="flex flex-wrap gap-1.5 px-3 pb-2">
|
|
1678
|
+
{p.tags?.slice(0, 4).map((tag) => (
|
|
1679
|
+
<span
|
|
1680
|
+
key={`${p.id}:${tag}`}
|
|
1681
|
+
className="text-[10px] px-1.5 py-px border border-border/50 bg-black/10 text-muted lowercase tracking-wide whitespace-nowrap"
|
|
1682
|
+
>
|
|
1683
|
+
{tag}
|
|
1684
|
+
</span>
|
|
1685
|
+
))}
|
|
1686
|
+
</div>
|
|
1687
|
+
)}
|
|
1688
|
+
|
|
1689
|
+
{pluginLinks.length > 0 && (
|
|
1690
|
+
<div className="flex flex-wrap gap-2 px-3 pb-2">
|
|
1691
|
+
{pluginLinks.map((link) => (
|
|
1692
|
+
<Button
|
|
1693
|
+
key={`${p.id}:${link.key}`}
|
|
1694
|
+
variant="outline"
|
|
1695
|
+
size="sm"
|
|
1696
|
+
className="h-6 px-2 text-[10px] font-bold border-border/40 text-muted hover:text-txt hover:border-accent hover:bg-accent/5 backdrop-blur-sm transition-all"
|
|
1697
|
+
onClick={(e) => {
|
|
1698
|
+
e.stopPropagation();
|
|
1699
|
+
void handleOpenPluginExternalUrl(link.url);
|
|
1700
|
+
}}
|
|
1701
|
+
title={`${link.label}: ${link.url}`}
|
|
1702
|
+
>
|
|
1703
|
+
{link.label}
|
|
1704
|
+
</Button>
|
|
1705
|
+
))}
|
|
1706
|
+
</div>
|
|
1707
|
+
)}
|
|
1708
|
+
|
|
1709
|
+
{/* Bottom bar: config status + settings button */}
|
|
1710
|
+
<div className="flex items-center gap-3 px-4 py-3 border-t border-border/40 mt-auto bg-black/5">
|
|
1711
|
+
{hasParams && !isShowcase ? (
|
|
1712
|
+
<>
|
|
1713
|
+
<span
|
|
1714
|
+
className={`inline-block w-2 h-2 rounded-full shadow-[0_0_10px_currentColor] shrink-0 ${
|
|
1715
|
+
allParamsSet
|
|
1716
|
+
? "bg-ok text-ok"
|
|
1717
|
+
: "bg-destructive text-destructive"
|
|
1718
|
+
}`}
|
|
1719
|
+
/>
|
|
1720
|
+
<span className="text-[11px] font-bold tracking-wide text-muted">
|
|
1721
|
+
{setCount}/{totalCount} {t("pluginsview.configured")}
|
|
1722
|
+
</span>
|
|
1723
|
+
</>
|
|
1724
|
+
) : !hasParams && !isShowcase ? (
|
|
1725
|
+
<span className="text-[11px] font-bold tracking-wide text-muted/60">
|
|
1726
|
+
{t("pluginsview.NoConfigNeeded")}
|
|
1727
|
+
</span>
|
|
1728
|
+
) : (
|
|
1729
|
+
<span className="text-[11px] font-bold tracking-wide text-muted/60">
|
|
1730
|
+
{t("pluginsview.23FieldDemos")}
|
|
1731
|
+
</span>
|
|
1732
|
+
)}
|
|
1733
|
+
<div className="flex-1" />
|
|
1734
|
+
{p.enabled &&
|
|
1735
|
+
!p.isActive &&
|
|
1736
|
+
p.npmName &&
|
|
1737
|
+
!isShowcase &&
|
|
1738
|
+
!p.loadError && (
|
|
1739
|
+
<Button
|
|
1740
|
+
variant="default"
|
|
1741
|
+
size="sm"
|
|
1742
|
+
className="h-7 px-3 text-[10px] font-bold tracking-wide shadow-sm max-w-[140px] truncate"
|
|
1743
|
+
disabled={installingPlugins.has(p.id)}
|
|
1744
|
+
onClick={(e) => {
|
|
1745
|
+
e.stopPropagation();
|
|
1746
|
+
handleInstallPlugin(p.id, p.npmName ?? "");
|
|
1747
|
+
}}
|
|
1748
|
+
>
|
|
1749
|
+
{installingPlugins.has(p.id)
|
|
1750
|
+
? installProgress.get(p.npmName ?? "")?.message ||
|
|
1751
|
+
"Installing..."
|
|
1752
|
+
: "Install"}
|
|
1753
|
+
</Button>
|
|
1754
|
+
)}
|
|
1755
|
+
{hasParams && (
|
|
1756
|
+
<Button
|
|
1757
|
+
variant="ghost"
|
|
1758
|
+
size="sm"
|
|
1759
|
+
className={`h-7 px-2.5 text-[11px] font-bold transition-all flex items-center gap-1.5 ${
|
|
1760
|
+
isOpen
|
|
1761
|
+
? "text-txt bg-accent/10 hover:bg-accent/20"
|
|
1762
|
+
: "text-muted hover:text-txt hover:bg-white/5"
|
|
1763
|
+
}`}
|
|
1764
|
+
onClick={(e) => {
|
|
1765
|
+
e.stopPropagation();
|
|
1766
|
+
toggleSettings(p.id);
|
|
1767
|
+
}}
|
|
1768
|
+
title={t("pluginsview.Settings")}
|
|
1769
|
+
>
|
|
1770
|
+
<span className="text-[14px] leading-none">⚙</span>
|
|
1771
|
+
<span
|
|
1772
|
+
className={`inline-block text-[10px] transition-transform duration-200 ${isOpen ? "rotate-90" : ""}`}
|
|
1773
|
+
>
|
|
1774
|
+
▶
|
|
1775
|
+
</span>
|
|
1776
|
+
</Button>
|
|
1777
|
+
)}
|
|
1778
|
+
</div>
|
|
1779
|
+
|
|
1780
|
+
{/* Validation errors */}
|
|
1781
|
+
{p.enabled && p.validationErrors && p.validationErrors.length > 0 && (
|
|
1782
|
+
<div className="px-3 py-1.5 border-t border-destructive bg-[rgba(153,27,27,0.04)] text-xs">
|
|
1783
|
+
{p.validationErrors.map(
|
|
1784
|
+
(err: { field: string; message: string }) => (
|
|
1785
|
+
<div
|
|
1786
|
+
key={`${err.field}:${err.message}`}
|
|
1787
|
+
className="text-destructive mb-0.5 text-[10px]"
|
|
1788
|
+
>
|
|
1789
|
+
{err.field}: {err.message}
|
|
1790
|
+
</div>
|
|
1791
|
+
),
|
|
1792
|
+
)}
|
|
1793
|
+
</div>
|
|
1794
|
+
)}
|
|
1795
|
+
|
|
1796
|
+
{/* Validation warnings */}
|
|
1797
|
+
{p.enabled &&
|
|
1798
|
+
p.validationWarnings &&
|
|
1799
|
+
p.validationWarnings.length > 0 && (
|
|
1800
|
+
<div className="px-3 py-1">
|
|
1801
|
+
{p.validationWarnings.map(
|
|
1802
|
+
(w: { field: string; message: string }) => (
|
|
1803
|
+
<div
|
|
1804
|
+
key={`${w.field}:${w.message}`}
|
|
1805
|
+
className="text-warn text-[10px]"
|
|
1806
|
+
>
|
|
1807
|
+
{w.message}
|
|
1808
|
+
</div>
|
|
1809
|
+
),
|
|
1810
|
+
)}
|
|
1811
|
+
</div>
|
|
1812
|
+
)}
|
|
1813
|
+
</li>
|
|
1814
|
+
);
|
|
1815
|
+
};
|
|
1816
|
+
|
|
1817
|
+
/** Render a grid of plugin cards. */
|
|
1818
|
+
const renderPluginGrid = (plugins: PluginInfo[]) => (
|
|
1819
|
+
<ul className="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3 m-0 p-0 list-none">
|
|
1820
|
+
{plugins.map((p: PluginInfo) => renderPluginCard(p))}
|
|
1821
|
+
</ul>
|
|
1822
|
+
);
|
|
1823
|
+
|
|
1824
|
+
// Resolve the plugin whose settings dialog is currently open.
|
|
1825
|
+
// Exclude ai-provider plugins — those are configured in Settings.
|
|
1826
|
+
const settingsDialogPlugin =
|
|
1827
|
+
Array.from(pluginSettingsOpen)
|
|
1828
|
+
.map((id) => nonDbPlugins.find((plugin) => plugin.id === id) ?? null)
|
|
1829
|
+
.find((plugin) => (plugin?.parameters?.length ?? 0) > 0) ?? null;
|
|
1830
|
+
|
|
1831
|
+
// ── Game-modal state ──────────────────────────────────────────────
|
|
1832
|
+
const [gameSelectedId, setGameSelectedId] = useState<string | null>(null);
|
|
1833
|
+
const [gameMobileDetail, setGameMobileDetail] = useState(false);
|
|
1834
|
+
const gameNarrow =
|
|
1835
|
+
typeof window !== "undefined" && typeof window.matchMedia === "function"
|
|
1836
|
+
? window.matchMedia("(max-width: 600px)").matches
|
|
1837
|
+
: false;
|
|
1838
|
+
const [connectorExpandedIds, setConnectorExpandedIds] = useState<Set<string>>(
|
|
1839
|
+
() => new Set(),
|
|
1840
|
+
);
|
|
1841
|
+
const [connectorSelectedId, setConnectorSelectedId] = useState<string | null>(
|
|
1842
|
+
null,
|
|
1843
|
+
);
|
|
1844
|
+
const [desktopConnectorLayout, setDesktopConnectorLayout] = useState(() =>
|
|
1845
|
+
typeof window !== "undefined" && typeof window.matchMedia === "function"
|
|
1846
|
+
? window.matchMedia("(min-width: 1024px)").matches
|
|
1847
|
+
: false,
|
|
1848
|
+
);
|
|
1849
|
+
const connectorSectionRefs = useRef<Record<string, HTMLElement | null>>({});
|
|
1850
|
+
|
|
1851
|
+
// Auto-select first visible plugin in game modal
|
|
1852
|
+
const gameVisiblePlugins = visiblePlugins.filter(
|
|
1853
|
+
(p: PluginInfo) => p.id !== "__ui-showcase__",
|
|
1854
|
+
);
|
|
1855
|
+
const effectiveGameSelected = gameVisiblePlugins.find(
|
|
1856
|
+
(p: PluginInfo) => p.id === gameSelectedId,
|
|
1857
|
+
)
|
|
1858
|
+
? gameSelectedId
|
|
1859
|
+
: (gameVisiblePlugins[0]?.id ?? null);
|
|
1860
|
+
const selectedPlugin =
|
|
1861
|
+
gameVisiblePlugins.find(
|
|
1862
|
+
(p: PluginInfo) => p.id === effectiveGameSelected,
|
|
1863
|
+
) ?? null;
|
|
1864
|
+
const selectedPluginLinks = selectedPlugin
|
|
1865
|
+
? getPluginResourceLinks(selectedPlugin)
|
|
1866
|
+
: [];
|
|
1867
|
+
|
|
1868
|
+
useEffect(() => {
|
|
1869
|
+
if (!isSocialMode || !inModal) return;
|
|
1870
|
+
if (pluginStatusFilter !== "disabled") return;
|
|
1871
|
+
setState("pluginStatusFilter", "all");
|
|
1872
|
+
}, [inModal, isSocialMode, pluginStatusFilter, setState]);
|
|
1873
|
+
|
|
1874
|
+
useEffect(() => {
|
|
1875
|
+
if (!isSocialMode || !inModal) return;
|
|
1876
|
+
if (
|
|
1877
|
+
typeof window === "undefined" ||
|
|
1878
|
+
typeof window.matchMedia !== "function"
|
|
1879
|
+
)
|
|
1880
|
+
return;
|
|
1881
|
+
|
|
1882
|
+
const media = window.matchMedia("(min-width: 1024px)");
|
|
1883
|
+
const syncLayout = () => {
|
|
1884
|
+
setDesktopConnectorLayout(media.matches);
|
|
1885
|
+
};
|
|
1886
|
+
|
|
1887
|
+
syncLayout();
|
|
1888
|
+
if (typeof media.addEventListener === "function") {
|
|
1889
|
+
media.addEventListener("change", syncLayout);
|
|
1890
|
+
return () => media.removeEventListener("change", syncLayout);
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
media.addListener(syncLayout);
|
|
1894
|
+
return () => media.removeListener(syncLayout);
|
|
1895
|
+
}, [inModal, isSocialMode]);
|
|
1896
|
+
|
|
1897
|
+
useEffect(() => {
|
|
1898
|
+
if (!isSocialMode || !inModal) return;
|
|
1899
|
+
if (visiblePlugins.length === 0) {
|
|
1900
|
+
setConnectorSelectedId(null);
|
|
1901
|
+
setConnectorExpandedIds(new Set());
|
|
1902
|
+
return;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
setConnectorSelectedId((prev) => {
|
|
1906
|
+
if (visiblePlugins.some((plugin) => plugin.id === prev)) {
|
|
1907
|
+
return prev;
|
|
1908
|
+
}
|
|
1909
|
+
return desktopConnectorLayout ? (visiblePlugins[0]?.id ?? null) : null;
|
|
1910
|
+
});
|
|
1911
|
+
}, [desktopConnectorLayout, inModal, isSocialMode, visiblePlugins]);
|
|
1912
|
+
|
|
1913
|
+
useEffect(() => {
|
|
1914
|
+
if (!isSocialMode || !inModal || !desktopConnectorLayout) return;
|
|
1915
|
+
if (!connectorSelectedId) return;
|
|
1916
|
+
setConnectorExpandedIds(new Set([connectorSelectedId]));
|
|
1917
|
+
}, [connectorSelectedId, desktopConnectorLayout, inModal, isSocialMode]);
|
|
1918
|
+
|
|
1919
|
+
useEffect(() => {
|
|
1920
|
+
if (!isSocialMode || !inModal || desktopConnectorLayout) return;
|
|
1921
|
+
setConnectorExpandedIds(new Set());
|
|
1922
|
+
}, [desktopConnectorLayout, inModal, isSocialMode]);
|
|
1923
|
+
|
|
1924
|
+
const scrollConnectorIntoView = useCallback((pluginId: string) => {
|
|
1925
|
+
const element = connectorSectionRefs.current[pluginId];
|
|
1926
|
+
if (element && typeof element.scrollIntoView === "function") {
|
|
1927
|
+
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
1928
|
+
}
|
|
1929
|
+
}, []);
|
|
1930
|
+
|
|
1931
|
+
const handleConnectorSelect = useCallback(
|
|
1932
|
+
(pluginId: string) => {
|
|
1933
|
+
setConnectorSelectedId(pluginId);
|
|
1934
|
+
setConnectorExpandedIds((prev) => {
|
|
1935
|
+
if (desktopConnectorLayout) {
|
|
1936
|
+
return new Set([pluginId]);
|
|
1937
|
+
}
|
|
1938
|
+
const next = new Set(prev);
|
|
1939
|
+
next.add(pluginId);
|
|
1940
|
+
return next;
|
|
1941
|
+
});
|
|
1942
|
+
scrollConnectorIntoView(pluginId);
|
|
1943
|
+
},
|
|
1944
|
+
[desktopConnectorLayout, scrollConnectorIntoView],
|
|
1945
|
+
);
|
|
1946
|
+
|
|
1947
|
+
const handleConnectorSectionToggle = useCallback(
|
|
1948
|
+
(pluginId: string) => {
|
|
1949
|
+
setConnectorSelectedId(pluginId);
|
|
1950
|
+
setConnectorExpandedIds((prev) => {
|
|
1951
|
+
if (desktopConnectorLayout) {
|
|
1952
|
+
return new Set([pluginId]);
|
|
1953
|
+
}
|
|
1954
|
+
const next = new Set(prev);
|
|
1955
|
+
if (next.has(pluginId)) next.delete(pluginId);
|
|
1956
|
+
else next.add(pluginId);
|
|
1957
|
+
return next;
|
|
1958
|
+
});
|
|
1959
|
+
if (desktopConnectorLayout) {
|
|
1960
|
+
scrollConnectorIntoView(pluginId);
|
|
1961
|
+
}
|
|
1962
|
+
},
|
|
1963
|
+
[desktopConnectorLayout, scrollConnectorIntoView],
|
|
1964
|
+
);
|
|
1965
|
+
|
|
1966
|
+
// ── Game-modal render ─────────────────────────────────────────────
|
|
1967
|
+
if (inModal && isSocialMode) {
|
|
1968
|
+
return (
|
|
1969
|
+
<div
|
|
1970
|
+
data-testid="plugins-view-social"
|
|
1971
|
+
className={`flex min-h-full min-w-0 w-full flex-col bg-bg ${
|
|
1972
|
+
desktopConnectorLayout ? "md:flex-row" : ""
|
|
1973
|
+
}`}
|
|
1974
|
+
>
|
|
1975
|
+
{desktopConnectorLayout && (
|
|
1976
|
+
<aside
|
|
1977
|
+
data-testid="connectors-settings-sidebar"
|
|
1978
|
+
className="flex w-[22rem] shrink-0 border-r border-border/50 bg-bg/35 backdrop-blur-xl"
|
|
1979
|
+
>
|
|
1980
|
+
<div className="flex min-h-full flex-1 flex-col sticky top-0 max-h-screen">
|
|
1981
|
+
<div className="border-b border-border/40 px-5 py-5">
|
|
1982
|
+
<div className="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted/80">
|
|
1983
|
+
Connectors
|
|
1984
|
+
</div>
|
|
1985
|
+
<div className="mt-2 text-sm text-muted">
|
|
1986
|
+
{enabledCount} enabled of {categoryPlugins.length}
|
|
1987
|
+
</div>
|
|
1988
|
+
</div>
|
|
1989
|
+
<nav className="flex-1 space-y-2 overflow-y-auto px-4 py-4">
|
|
1990
|
+
{(desktopConnectorLayout
|
|
1991
|
+
? visiblePlugins.filter((plugin) => {
|
|
1992
|
+
return plugin.id === connectorSelectedId;
|
|
1993
|
+
})
|
|
1994
|
+
: visiblePlugins
|
|
1995
|
+
).map((plugin) => {
|
|
1996
|
+
const isSelected = connectorSelectedId === plugin.id;
|
|
1997
|
+
const isExpanded = connectorExpandedIds.has(plugin.id);
|
|
1998
|
+
const isToggleBusy = togglingPlugins.has(plugin.id);
|
|
1999
|
+
const toggleDisabled =
|
|
2000
|
+
isToggleBusy || (hasPluginToggleInFlight && !isToggleBusy);
|
|
2001
|
+
|
|
2002
|
+
return (
|
|
2003
|
+
<div
|
|
2004
|
+
key={plugin.id}
|
|
2005
|
+
className={`flex items-center gap-2 rounded-2xl border px-3 py-2 transition-all ${
|
|
2006
|
+
isSelected
|
|
2007
|
+
? "border-accent/40 bg-accent/10 text-txt shadow-[0_10px_30px_rgba(var(--accent),0.08)]"
|
|
2008
|
+
: "border-transparent bg-transparent text-muted hover:border-border/60 hover:bg-card/55 hover:text-txt"
|
|
2009
|
+
}`}
|
|
2010
|
+
>
|
|
2011
|
+
<button
|
|
2012
|
+
type="button"
|
|
2013
|
+
className="flex min-w-0 flex-1 items-center gap-3 text-left"
|
|
2014
|
+
onClick={() => handleConnectorSelect(plugin.id)}
|
|
2015
|
+
aria-current={isSelected ? "page" : undefined}
|
|
2016
|
+
>
|
|
2017
|
+
<span
|
|
2018
|
+
className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border ${
|
|
2019
|
+
isSelected
|
|
2020
|
+
? "border-accent/30 bg-accent/18 text-txt-strong"
|
|
2021
|
+
: "border-border/50 bg-bg-accent/80 text-muted"
|
|
2022
|
+
}`}
|
|
2023
|
+
>
|
|
2024
|
+
{renderResolvedIcon(plugin, {
|
|
2025
|
+
className: "w-4 h-4 rounded-sm object-contain",
|
|
2026
|
+
emojiClassName: "text-sm",
|
|
2027
|
+
})}
|
|
2028
|
+
</span>
|
|
2029
|
+
<span className="min-w-0 flex-1 truncate text-sm font-semibold leading-none">
|
|
2030
|
+
{plugin.name}
|
|
2031
|
+
</span>
|
|
2032
|
+
</button>
|
|
2033
|
+
<button
|
|
2034
|
+
type="button"
|
|
2035
|
+
className={`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold tracking-[0.16em] transition-colors ${
|
|
2036
|
+
plugin.enabled
|
|
2037
|
+
? "border-accent bg-accent text-accent-fg"
|
|
2038
|
+
: "border-border bg-transparent text-muted hover:border-accent/40 hover:text-txt"
|
|
2039
|
+
} ${
|
|
2040
|
+
toggleDisabled
|
|
2041
|
+
? "cursor-not-allowed opacity-60"
|
|
2042
|
+
: "cursor-pointer"
|
|
2043
|
+
}`}
|
|
2044
|
+
onClick={() =>
|
|
2045
|
+
void handleTogglePlugin(plugin.id, !plugin.enabled)
|
|
2046
|
+
}
|
|
2047
|
+
disabled={toggleDisabled}
|
|
2048
|
+
>
|
|
2049
|
+
{isToggleBusy ? "..." : plugin.enabled ? "ON" : "OFF"}
|
|
2050
|
+
</button>
|
|
2051
|
+
<span
|
|
2052
|
+
className={`shrink-0 text-muted transition-transform ${
|
|
2053
|
+
isExpanded ? "rotate-90" : ""
|
|
2054
|
+
}`}
|
|
2055
|
+
>
|
|
2056
|
+
<ChevronRight className="h-4 w-4" />
|
|
2057
|
+
</span>
|
|
2058
|
+
</div>
|
|
2059
|
+
);
|
|
2060
|
+
})}
|
|
2061
|
+
</nav>
|
|
2062
|
+
</div>
|
|
2063
|
+
</aside>
|
|
2064
|
+
)}
|
|
2065
|
+
|
|
2066
|
+
<div className="min-w-0 flex-1">
|
|
2067
|
+
<div className="sticky top-0 z-20 border-b border-border/50 bg-bg/85 px-4 py-4 shadow-[0_12px_30px_rgba(0,0,0,0.14)] backdrop-blur-xl sm:px-6 lg:px-8">
|
|
2068
|
+
<div className="mx-auto max-w-5xl">
|
|
2069
|
+
<div className="flex flex-col gap-3 sm:flex-row sm:items-center">
|
|
2070
|
+
<Input
|
|
2071
|
+
type="text"
|
|
2072
|
+
className="h-11 w-full rounded-xl border-border/60 bg-card/70 text-sm shadow-sm"
|
|
2073
|
+
placeholder="Search connectors..."
|
|
2074
|
+
value={pluginSearch}
|
|
2075
|
+
onChange={(e) => setState("pluginSearch", e.target.value)}
|
|
2076
|
+
/>
|
|
2077
|
+
<div className="flex shrink-0 gap-1.5 rounded-xl border border-white/5 bg-black/10 p-1">
|
|
2078
|
+
{(["all", "enabled"] as const).map((status) => (
|
|
2079
|
+
<Button
|
|
2080
|
+
key={status}
|
|
2081
|
+
variant={
|
|
2082
|
+
effectiveStatusFilter === status ? "default" : "ghost"
|
|
2083
|
+
}
|
|
2084
|
+
size="sm"
|
|
2085
|
+
className={`h-8 px-3 text-[11px] font-bold tracking-wide transition-all ${
|
|
2086
|
+
effectiveStatusFilter === status
|
|
2087
|
+
? "shadow-sm"
|
|
2088
|
+
: "text-muted hover:bg-white/5 hover:text-txt"
|
|
2089
|
+
}`}
|
|
2090
|
+
onClick={() =>
|
|
2091
|
+
setState("pluginStatusFilter", status as StatusFilter)
|
|
2092
|
+
}
|
|
2093
|
+
>
|
|
2094
|
+
{status === "all"
|
|
2095
|
+
? `All (${categoryPlugins.length})`
|
|
2096
|
+
: `Enabled (${enabledCount})`}
|
|
2097
|
+
</Button>
|
|
2098
|
+
))}
|
|
2099
|
+
</div>
|
|
2100
|
+
</div>
|
|
2101
|
+
</div>
|
|
2102
|
+
</div>
|
|
2103
|
+
|
|
2104
|
+
<div className="mx-auto max-w-5xl px-4 py-4 sm:px-6 sm:py-5 lg:px-8 lg:py-6">
|
|
2105
|
+
{hasPluginToggleInFlight && (
|
|
2106
|
+
<div className="mb-4 rounded-2xl border border-accent bg-accent-subtle px-4 py-3 text-[11px] text-txt">
|
|
2107
|
+
{t("pluginsview.ApplyingPluginChan")}
|
|
2108
|
+
</div>
|
|
2109
|
+
)}
|
|
2110
|
+
|
|
2111
|
+
{visiblePlugins.length === 0 ? (
|
|
2112
|
+
<div className="rounded-2xl border border-dashed border-border px-5 py-10 text-center text-muted">
|
|
2113
|
+
{effectiveSearch
|
|
2114
|
+
? "No connectors match your search."
|
|
2115
|
+
: "No connectors match your filters."}
|
|
2116
|
+
</div>
|
|
2117
|
+
) : (
|
|
2118
|
+
<div
|
|
2119
|
+
data-testid="connectors-settings-content"
|
|
2120
|
+
className="space-y-4"
|
|
2121
|
+
>
|
|
2122
|
+
{visiblePlugins.map((plugin) => {
|
|
2123
|
+
const hasParams =
|
|
2124
|
+
(plugin.parameters?.length ?? 0) > 0 &&
|
|
2125
|
+
plugin.id !== "__ui-showcase__";
|
|
2126
|
+
const isExpanded = connectorExpandedIds.has(plugin.id);
|
|
2127
|
+
const isSelected = connectorSelectedId === plugin.id;
|
|
2128
|
+
const setCount = hasParams
|
|
2129
|
+
? plugin.parameters.filter((param) => param.isSet).length
|
|
2130
|
+
: 0;
|
|
2131
|
+
const totalCount = hasParams ? plugin.parameters.length : 0;
|
|
2132
|
+
const allParamsSet = !hasParams || setCount === totalCount;
|
|
2133
|
+
const isToggleBusy = togglingPlugins.has(plugin.id);
|
|
2134
|
+
const toggleDisabled =
|
|
2135
|
+
isToggleBusy || (hasPluginToggleInFlight && !isToggleBusy);
|
|
2136
|
+
const isSaving = pluginSaving.has(plugin.id);
|
|
2137
|
+
const saveSuccess = pluginSaveSuccess.has(plugin.id);
|
|
2138
|
+
const testResult = testResults.get(plugin.id);
|
|
2139
|
+
const pluginLinks = getPluginResourceLinks(plugin);
|
|
2140
|
+
|
|
2141
|
+
return (
|
|
2142
|
+
<section
|
|
2143
|
+
key={plugin.id}
|
|
2144
|
+
ref={(element) => {
|
|
2145
|
+
connectorSectionRefs.current[plugin.id] = element;
|
|
2146
|
+
}}
|
|
2147
|
+
data-testid={`connector-section-${plugin.id}`}
|
|
2148
|
+
className={`overflow-hidden rounded-[1.4rem] border bg-card/90 shadow-sm transition-all ${
|
|
2149
|
+
isSelected
|
|
2150
|
+
? "border-accent/35 shadow-[0_18px_40px_rgba(var(--accent),0.08)]"
|
|
2151
|
+
: "border-border/50"
|
|
2152
|
+
}`}
|
|
2153
|
+
>
|
|
2154
|
+
<div className="flex items-start gap-3 px-4 py-4 sm:px-5">
|
|
2155
|
+
<button
|
|
2156
|
+
type="button"
|
|
2157
|
+
data-testid={`connector-header-${plugin.id}`}
|
|
2158
|
+
className="flex min-w-0 flex-1 items-start gap-3 text-left"
|
|
2159
|
+
onClick={() =>
|
|
2160
|
+
handleConnectorSectionToggle(plugin.id)
|
|
2161
|
+
}
|
|
2162
|
+
>
|
|
2163
|
+
<span
|
|
2164
|
+
className={`mt-0.5 flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl border ${
|
|
2165
|
+
isSelected
|
|
2166
|
+
? "border-accent/30 bg-accent/18 text-txt-strong"
|
|
2167
|
+
: "border-border/50 bg-bg-accent/80 text-muted"
|
|
2168
|
+
}`}
|
|
2169
|
+
>
|
|
2170
|
+
{renderResolvedIcon(plugin, {
|
|
2171
|
+
className: "w-4 h-4 rounded-sm object-contain",
|
|
2172
|
+
emojiClassName: "text-base",
|
|
2173
|
+
})}
|
|
2174
|
+
</span>
|
|
2175
|
+
<span className="min-w-0 flex-1">
|
|
2176
|
+
<span className="flex min-w-0 flex-wrap items-center gap-2">
|
|
2177
|
+
<span className="truncate text-sm font-semibold text-txt">
|
|
2178
|
+
{plugin.name}
|
|
2179
|
+
</span>
|
|
2180
|
+
<span
|
|
2181
|
+
className={`rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] ${
|
|
2182
|
+
allParamsSet
|
|
2183
|
+
? "border-ok/30 bg-ok/10 text-ok"
|
|
2184
|
+
: "border-warn/30 bg-warn/10 text-warn"
|
|
2185
|
+
}`}
|
|
2186
|
+
>
|
|
2187
|
+
{allParamsSet ? "Ready" : "Needs setup"}
|
|
2188
|
+
</span>
|
|
2189
|
+
{plugin.version && (
|
|
2190
|
+
<span className="text-[11px] font-mono text-muted/80">
|
|
2191
|
+
v{plugin.version}
|
|
2192
|
+
</span>
|
|
2193
|
+
)}
|
|
2194
|
+
</span>
|
|
2195
|
+
<span className="mt-1 block text-sm text-muted">
|
|
2196
|
+
{plugin.description || "No description available"}
|
|
2197
|
+
</span>
|
|
2198
|
+
<span className="mt-2 flex flex-wrap items-center gap-2 text-[11px] text-muted">
|
|
2199
|
+
<span>
|
|
2200
|
+
{hasParams
|
|
2201
|
+
? `${setCount}/${totalCount} configured`
|
|
2202
|
+
: "No configuration needed"}
|
|
2203
|
+
</span>
|
|
2204
|
+
{plugin.enabled && !plugin.isActive && (
|
|
2205
|
+
<span
|
|
2206
|
+
className={`rounded-full border px-2 py-0.5 ${
|
|
2207
|
+
plugin.loadError
|
|
2208
|
+
? "border-danger/30 bg-danger/10 text-danger"
|
|
2209
|
+
: "border-warn/30 bg-warn/10 text-warn"
|
|
2210
|
+
}`}
|
|
2211
|
+
>
|
|
2212
|
+
{plugin.loadError
|
|
2213
|
+
? "Load failed"
|
|
2214
|
+
: "Not installed"}
|
|
2215
|
+
</span>
|
|
2216
|
+
)}
|
|
2217
|
+
</span>
|
|
2218
|
+
</span>
|
|
2219
|
+
</button>
|
|
2220
|
+
|
|
2221
|
+
<div className="flex shrink-0 items-center gap-2">
|
|
2222
|
+
<button
|
|
2223
|
+
type="button"
|
|
2224
|
+
className={`rounded-full border px-3 py-1.5 text-[10px] font-bold tracking-[0.16em] transition-colors ${
|
|
2225
|
+
plugin.enabled
|
|
2226
|
+
? "border-accent bg-accent text-accent-fg"
|
|
2227
|
+
: "border-border bg-transparent text-muted hover:border-accent/40 hover:text-txt"
|
|
2228
|
+
} ${
|
|
2229
|
+
toggleDisabled
|
|
2230
|
+
? "cursor-not-allowed opacity-60"
|
|
2231
|
+
: "cursor-pointer"
|
|
2232
|
+
}`}
|
|
2233
|
+
onClick={() =>
|
|
2234
|
+
void handleTogglePlugin(
|
|
2235
|
+
plugin.id,
|
|
2236
|
+
!plugin.enabled,
|
|
2237
|
+
)
|
|
2238
|
+
}
|
|
2239
|
+
disabled={toggleDisabled}
|
|
2240
|
+
>
|
|
2241
|
+
{isToggleBusy
|
|
2242
|
+
? "..."
|
|
2243
|
+
: plugin.enabled
|
|
2244
|
+
? "ON"
|
|
2245
|
+
: "OFF"}
|
|
2246
|
+
</button>
|
|
2247
|
+
<button
|
|
2248
|
+
type="button"
|
|
2249
|
+
className={`flex items-center gap-1 rounded-full border px-3 py-1.5 text-[11px] font-semibold transition-colors ${
|
|
2250
|
+
isExpanded
|
|
2251
|
+
? "border-accent/40 bg-accent/10 text-txt"
|
|
2252
|
+
: "border-border/50 text-muted hover:border-accent/40 hover:text-txt"
|
|
2253
|
+
}`}
|
|
2254
|
+
onClick={() =>
|
|
2255
|
+
handleConnectorSectionToggle(plugin.id)
|
|
2256
|
+
}
|
|
2257
|
+
aria-expanded={isExpanded}
|
|
2258
|
+
aria-label={`${isExpanded ? "Collapse" : "Expand"} ${plugin.name}`}
|
|
2259
|
+
>
|
|
2260
|
+
<span>{isExpanded ? "Collapse" : "Expand"}</span>
|
|
2261
|
+
<ChevronRight
|
|
2262
|
+
className={`h-4 w-4 transition-transform ${
|
|
2263
|
+
isExpanded ? "rotate-90" : ""
|
|
2264
|
+
}`}
|
|
2265
|
+
/>
|
|
2266
|
+
</button>
|
|
2267
|
+
</div>
|
|
2268
|
+
</div>
|
|
2269
|
+
|
|
2270
|
+
{isExpanded && (
|
|
2271
|
+
<div className="border-t border-border/40 bg-black/5 px-4 py-4 sm:px-5">
|
|
2272
|
+
{plugin.validationErrors &&
|
|
2273
|
+
plugin.validationErrors.length > 0 && (
|
|
2274
|
+
<div className="mb-4 rounded-2xl border border-danger/30 bg-danger/10 px-4 py-3 text-sm text-danger">
|
|
2275
|
+
{plugin.validationErrors.map((error) => (
|
|
2276
|
+
<div
|
|
2277
|
+
key={`${plugin.id}:${error.field}:${error.message}`}
|
|
2278
|
+
>
|
|
2279
|
+
{error.field}: {error.message}
|
|
2280
|
+
</div>
|
|
2281
|
+
))}
|
|
2282
|
+
</div>
|
|
2283
|
+
)}
|
|
2284
|
+
|
|
2285
|
+
{plugin.validationWarnings &&
|
|
2286
|
+
plugin.validationWarnings.length > 0 && (
|
|
2287
|
+
<div className="mb-4 rounded-2xl border border-warn/30 bg-warn/10 px-4 py-3 text-sm text-warn">
|
|
2288
|
+
{plugin.validationWarnings.map((warning) => (
|
|
2289
|
+
<div
|
|
2290
|
+
key={`${plugin.id}:${warning.field}:${warning.message}`}
|
|
2291
|
+
>
|
|
2292
|
+
{warning.message}
|
|
2293
|
+
</div>
|
|
2294
|
+
))}
|
|
2295
|
+
</div>
|
|
2296
|
+
)}
|
|
2297
|
+
|
|
2298
|
+
{pluginLinks.length > 0 && (
|
|
2299
|
+
<div className="mb-4 flex flex-wrap gap-2">
|
|
2300
|
+
{pluginLinks.map((link) => (
|
|
2301
|
+
<Button
|
|
2302
|
+
key={`${plugin.id}:${link.key}`}
|
|
2303
|
+
variant="outline"
|
|
2304
|
+
size="sm"
|
|
2305
|
+
className="h-8 rounded-xl border-border/40 bg-card/40 px-3 text-[11px] font-semibold text-muted transition-all hover:border-accent hover:bg-accent/5 hover:text-txt"
|
|
2306
|
+
onClick={() => {
|
|
2307
|
+
void handleOpenPluginExternalUrl(link.url);
|
|
2308
|
+
}}
|
|
2309
|
+
title={`${link.label}: ${link.url}`}
|
|
2310
|
+
>
|
|
2311
|
+
{link.label}
|
|
2312
|
+
</Button>
|
|
2313
|
+
))}
|
|
2314
|
+
</div>
|
|
2315
|
+
)}
|
|
2316
|
+
|
|
2317
|
+
{plugin.enabled &&
|
|
2318
|
+
!plugin.isActive &&
|
|
2319
|
+
plugin.npmName &&
|
|
2320
|
+
!plugin.loadError && (
|
|
2321
|
+
<div className="mb-4 rounded-2xl border border-warn/30 bg-warn/10 px-4 py-3 text-sm text-txt">
|
|
2322
|
+
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
2323
|
+
<div>
|
|
2324
|
+
Install this connector to activate it in the
|
|
2325
|
+
runtime.
|
|
2326
|
+
</div>
|
|
2327
|
+
<Button
|
|
2328
|
+
variant="default"
|
|
2329
|
+
size="sm"
|
|
2330
|
+
className="h-8 rounded-xl px-4 text-[11px] font-bold"
|
|
2331
|
+
disabled={installingPlugins.has(plugin.id)}
|
|
2332
|
+
onClick={() =>
|
|
2333
|
+
handleInstallPlugin(
|
|
2334
|
+
plugin.id,
|
|
2335
|
+
plugin.npmName ?? "",
|
|
2336
|
+
)
|
|
2337
|
+
}
|
|
2338
|
+
>
|
|
2339
|
+
{installingPlugins.has(plugin.id)
|
|
2340
|
+
? installProgress.get(
|
|
2341
|
+
plugin.npmName ?? "",
|
|
2342
|
+
)?.message || "Installing..."
|
|
2343
|
+
: "Install Plugin"}
|
|
2344
|
+
</Button>
|
|
2345
|
+
</div>
|
|
2346
|
+
</div>
|
|
2347
|
+
)}
|
|
2348
|
+
|
|
2349
|
+
{hasParams ? (
|
|
2350
|
+
<div className="space-y-4">
|
|
2351
|
+
<PluginConfigForm
|
|
2352
|
+
plugin={plugin}
|
|
2353
|
+
pluginConfigs={pluginConfigs}
|
|
2354
|
+
onParamChange={handleParamChange}
|
|
2355
|
+
/>
|
|
2356
|
+
{plugin.id === "whatsapp" && (
|
|
2357
|
+
<WhatsAppQrOverlay accountId="default" />
|
|
2358
|
+
)}
|
|
2359
|
+
</div>
|
|
2360
|
+
) : (
|
|
2361
|
+
<div className="rounded-2xl border border-border/40 bg-card/40 px-4 py-3 text-sm text-muted">
|
|
2362
|
+
No configuration needed.
|
|
2363
|
+
</div>
|
|
2364
|
+
)}
|
|
2365
|
+
|
|
2366
|
+
<div className="mt-4 flex flex-wrap items-center gap-2">
|
|
2367
|
+
{plugin.isActive && (
|
|
2368
|
+
<Button
|
|
2369
|
+
variant={
|
|
2370
|
+
testResult?.success
|
|
2371
|
+
? "default"
|
|
2372
|
+
: testResult?.error
|
|
2373
|
+
? "destructive"
|
|
2374
|
+
: "outline"
|
|
2375
|
+
}
|
|
2376
|
+
size="sm"
|
|
2377
|
+
className={`h-8 rounded-xl px-4 text-[11px] font-bold transition-all ${
|
|
2378
|
+
testResult?.loading
|
|
2379
|
+
? "cursor-wait opacity-70"
|
|
2380
|
+
: testResult?.success
|
|
2381
|
+
? "border-ok bg-ok text-ok-fg hover:bg-ok/90"
|
|
2382
|
+
: testResult?.error
|
|
2383
|
+
? "border-danger bg-danger text-danger-fg hover:bg-danger/90"
|
|
2384
|
+
: "border-border/40 bg-card/40 hover:border-accent/40"
|
|
2385
|
+
}`}
|
|
2386
|
+
disabled={testResult?.loading}
|
|
2387
|
+
onClick={() =>
|
|
2388
|
+
void handleTestConnection(plugin.id)
|
|
2389
|
+
}
|
|
2390
|
+
>
|
|
2391
|
+
{testResult?.loading
|
|
2392
|
+
? "Testing..."
|
|
2393
|
+
: testResult?.success
|
|
2394
|
+
? `OK (${testResult.durationMs}ms)`
|
|
2395
|
+
: testResult?.error
|
|
2396
|
+
? `Failed: ${testResult.error}`
|
|
2397
|
+
: "Test Connection"}
|
|
2398
|
+
</Button>
|
|
2399
|
+
)}
|
|
2400
|
+
{hasParams && (
|
|
2401
|
+
<>
|
|
2402
|
+
<Button
|
|
2403
|
+
variant="ghost"
|
|
2404
|
+
size="sm"
|
|
2405
|
+
className="h-8 rounded-xl px-4 text-[11px] font-semibold text-muted hover:text-txt"
|
|
2406
|
+
onClick={() => handleConfigReset(plugin.id)}
|
|
2407
|
+
>
|
|
2408
|
+
Reset
|
|
2409
|
+
</Button>
|
|
2410
|
+
<Button
|
|
2411
|
+
variant={
|
|
2412
|
+
saveSuccess ? "default" : "secondary"
|
|
2413
|
+
}
|
|
2414
|
+
size="sm"
|
|
2415
|
+
className={`h-8 rounded-xl px-4 text-[11px] font-bold transition-all ${
|
|
2416
|
+
saveSuccess
|
|
2417
|
+
? "bg-ok text-ok-fg hover:bg-ok/90"
|
|
2418
|
+
: "bg-accent text-accent-fg hover:bg-accent/90"
|
|
2419
|
+
}`}
|
|
2420
|
+
onClick={() =>
|
|
2421
|
+
void handleConfigSave(plugin.id)
|
|
2422
|
+
}
|
|
2423
|
+
disabled={isSaving}
|
|
2424
|
+
>
|
|
2425
|
+
{isSaving
|
|
2426
|
+
? "Saving..."
|
|
2427
|
+
: saveSuccess
|
|
2428
|
+
? "Saved"
|
|
2429
|
+
: "Save Settings"}
|
|
2430
|
+
</Button>
|
|
2431
|
+
</>
|
|
2432
|
+
)}
|
|
2433
|
+
</div>
|
|
2434
|
+
</div>
|
|
2435
|
+
)}
|
|
2436
|
+
</section>
|
|
2437
|
+
);
|
|
2438
|
+
})}
|
|
2439
|
+
</div>
|
|
2440
|
+
)}
|
|
2441
|
+
</div>
|
|
2442
|
+
</div>
|
|
2443
|
+
</div>
|
|
2444
|
+
);
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
if (inModal) {
|
|
2448
|
+
const sectionTitle =
|
|
2449
|
+
mode === "social"
|
|
2450
|
+
? "Connectors"
|
|
2451
|
+
: mode === "connectors"
|
|
2452
|
+
? "Connectors"
|
|
2453
|
+
: label;
|
|
2454
|
+
return (
|
|
2455
|
+
<div className="plugins-game-modal plugins-game-modal--inline">
|
|
2456
|
+
<div
|
|
2457
|
+
className={`plugins-game-list-panel${
|
|
2458
|
+
gameNarrow && gameMobileDetail ? " is-hidden" : ""
|
|
2459
|
+
}`}
|
|
2460
|
+
>
|
|
2461
|
+
<div className="plugins-game-list-head">
|
|
2462
|
+
<div className="plugins-game-section-title">{sectionTitle}</div>
|
|
2463
|
+
</div>
|
|
2464
|
+
<div className="plugins-game-list-scroll">
|
|
2465
|
+
{gameVisiblePlugins.length === 0 ? (
|
|
2466
|
+
<div className="plugins-game-list-empty">
|
|
2467
|
+
No {resultLabel} {t("pluginsview.found")}
|
|
2468
|
+
</div>
|
|
2469
|
+
) : (
|
|
2470
|
+
gameVisiblePlugins.map((p: PluginInfo) => (
|
|
2471
|
+
<button
|
|
2472
|
+
key={p.id}
|
|
2473
|
+
type="button"
|
|
2474
|
+
className={`plugins-game-card${
|
|
2475
|
+
effectiveGameSelected === p.id ? " is-selected" : ""
|
|
2476
|
+
}${!p.enabled ? " is-disabled" : ""}`}
|
|
2477
|
+
onClick={() => {
|
|
2478
|
+
setGameSelectedId(p.id);
|
|
2479
|
+
if (gameNarrow) setGameMobileDetail(true);
|
|
2480
|
+
}}
|
|
2481
|
+
>
|
|
2482
|
+
<div className="plugins-game-card-icon-shell">
|
|
2483
|
+
<span className="plugins-game-card-icon">
|
|
2484
|
+
{(() => {
|
|
2485
|
+
const icon = resolveIcon(p);
|
|
2486
|
+
if (!icon) return "🧩";
|
|
2487
|
+
if (typeof icon === "string") {
|
|
2488
|
+
const imageSrc = iconImageSource(icon);
|
|
2489
|
+
return imageSrc ? (
|
|
2490
|
+
<img
|
|
2491
|
+
src={imageSrc}
|
|
2492
|
+
alt=""
|
|
2493
|
+
className="plugins-game-card-icon"
|
|
2494
|
+
style={{ objectFit: "contain" }}
|
|
2495
|
+
/>
|
|
2496
|
+
) : (
|
|
2497
|
+
icon
|
|
2498
|
+
);
|
|
2499
|
+
}
|
|
2500
|
+
const IconComponent = icon;
|
|
2501
|
+
return <IconComponent className="w-5 h-5" />;
|
|
2502
|
+
})()}
|
|
2503
|
+
</span>
|
|
2504
|
+
</div>
|
|
2505
|
+
<div className="plugins-game-card-body">
|
|
2506
|
+
<div className="plugins-game-card-name">{p.name}</div>
|
|
2507
|
+
<div className="plugins-game-card-meta">
|
|
2508
|
+
<span
|
|
2509
|
+
className={`plugins-game-badge ${
|
|
2510
|
+
p.enabled ? "is-on" : "is-off"
|
|
2511
|
+
}`}
|
|
2512
|
+
>
|
|
2513
|
+
{p.enabled ? "ON" : "OFF"}
|
|
2514
|
+
</span>
|
|
2515
|
+
</div>
|
|
2516
|
+
</div>
|
|
2517
|
+
</button>
|
|
2518
|
+
))
|
|
2519
|
+
)}
|
|
2520
|
+
</div>
|
|
2521
|
+
</div>
|
|
2522
|
+
<div
|
|
2523
|
+
className={`plugins-game-detail-panel${
|
|
2524
|
+
gameNarrow && !gameMobileDetail ? " is-hidden" : ""
|
|
2525
|
+
}`}
|
|
2526
|
+
>
|
|
2527
|
+
{selectedPlugin ? (
|
|
2528
|
+
<>
|
|
2529
|
+
<div className="plugins-game-detail-head">
|
|
2530
|
+
{gameNarrow && (
|
|
2531
|
+
<button
|
|
2532
|
+
type="button"
|
|
2533
|
+
className="plugins-game-back-btn"
|
|
2534
|
+
onClick={() => setGameMobileDetail(false)}
|
|
2535
|
+
>
|
|
2536
|
+
{t("pluginsview.Back")}
|
|
2537
|
+
</button>
|
|
2538
|
+
)}
|
|
2539
|
+
<div className="plugins-game-detail-title-row">
|
|
2540
|
+
<div className="plugins-game-detail-icon-shell">
|
|
2541
|
+
<span className="plugins-game-detail-icon">
|
|
2542
|
+
{(() => {
|
|
2543
|
+
const icon = resolveIcon(selectedPlugin);
|
|
2544
|
+
if (!icon) return "🧩";
|
|
2545
|
+
if (typeof icon === "string") {
|
|
2546
|
+
const imageSrc = iconImageSource(icon);
|
|
2547
|
+
return imageSrc ? (
|
|
2548
|
+
<img
|
|
2549
|
+
src={imageSrc}
|
|
2550
|
+
alt=""
|
|
2551
|
+
className="plugins-game-detail-icon"
|
|
2552
|
+
/>
|
|
2553
|
+
) : (
|
|
2554
|
+
icon
|
|
2555
|
+
);
|
|
2556
|
+
}
|
|
2557
|
+
const IconComponent = icon;
|
|
2558
|
+
return <IconComponent className="w-6 h-6" />;
|
|
2559
|
+
})()}
|
|
2560
|
+
</span>
|
|
2561
|
+
</div>
|
|
2562
|
+
<div className="plugins-game-detail-main">
|
|
2563
|
+
<div className="plugins-game-detail-name">
|
|
2564
|
+
{selectedPlugin.name}
|
|
2565
|
+
</div>
|
|
2566
|
+
{selectedPlugin.version && (
|
|
2567
|
+
<span className="plugins-game-version">
|
|
2568
|
+
v{selectedPlugin.version}
|
|
2569
|
+
</span>
|
|
2570
|
+
)}
|
|
2571
|
+
</div>
|
|
2572
|
+
<button
|
|
2573
|
+
type="button"
|
|
2574
|
+
className={`plugins-game-toggle ${
|
|
2575
|
+
selectedPlugin.enabled ? "is-on" : "is-off"
|
|
2576
|
+
}`}
|
|
2577
|
+
onClick={() =>
|
|
2578
|
+
void handleTogglePlugin(
|
|
2579
|
+
selectedPlugin.id,
|
|
2580
|
+
!selectedPlugin.enabled,
|
|
2581
|
+
)
|
|
2582
|
+
}
|
|
2583
|
+
disabled={togglingPlugins.has(selectedPlugin.id)}
|
|
2584
|
+
>
|
|
2585
|
+
{selectedPlugin.enabled ? "ON" : "OFF"}
|
|
2586
|
+
</button>
|
|
2587
|
+
</div>
|
|
2588
|
+
</div>
|
|
2589
|
+
<div className="plugins-game-detail-description">
|
|
2590
|
+
{selectedPlugin.description}
|
|
2591
|
+
</div>
|
|
2592
|
+
{(selectedPlugin.tags?.length ?? 0) > 0 && (
|
|
2593
|
+
<div className="flex flex-wrap gap-1.5 px-3 pb-3">
|
|
2594
|
+
{selectedPlugin.tags?.map((tag) => (
|
|
2595
|
+
<span
|
|
2596
|
+
key={`${selectedPlugin.id}:${tag}`}
|
|
2597
|
+
className="text-[10px] px-1.5 py-px border border-border bg-black/10 text-muted lowercase tracking-wide whitespace-nowrap"
|
|
2598
|
+
>
|
|
2599
|
+
{tag}
|
|
2600
|
+
</span>
|
|
2601
|
+
))}
|
|
2602
|
+
</div>
|
|
2603
|
+
)}
|
|
2604
|
+
{selectedPluginLinks.length > 0 && (
|
|
2605
|
+
<div className="plugins-game-detail-links flex flex-wrap gap-2 px-3 pb-3">
|
|
2606
|
+
{selectedPluginLinks.map((link) => (
|
|
2607
|
+
<button
|
|
2608
|
+
key={`${selectedPlugin.id}:${link.key}`}
|
|
2609
|
+
type="button"
|
|
2610
|
+
className="plugins-game-link-btn border border-border bg-transparent px-2.5 py-1 text-[11px] text-muted transition-colors hover:border-accent hover:text-txt"
|
|
2611
|
+
onClick={() => {
|
|
2612
|
+
void handleOpenPluginExternalUrl(link.url);
|
|
2613
|
+
}}
|
|
2614
|
+
>
|
|
2615
|
+
{link.label}
|
|
2616
|
+
</button>
|
|
2617
|
+
))}
|
|
2618
|
+
</div>
|
|
2619
|
+
)}
|
|
2620
|
+
{selectedPlugin.parameters &&
|
|
2621
|
+
selectedPlugin.parameters.length > 0 && (
|
|
2622
|
+
<div className="plugins-game-detail-config">
|
|
2623
|
+
{selectedPlugin.parameters.map((param: PluginParamDef) => (
|
|
2624
|
+
<div key={param.key} id={`field-${param.key}`}>
|
|
2625
|
+
<label
|
|
2626
|
+
htmlFor={`input-${param.key}`}
|
|
2627
|
+
className="text-[11px] tracking-wider text-muted block mb-1"
|
|
2628
|
+
>
|
|
2629
|
+
{param.key}
|
|
2630
|
+
</label>
|
|
2631
|
+
<input
|
|
2632
|
+
id={`input-${param.key}`}
|
|
2633
|
+
type={param.sensitive ? "password" : "text"}
|
|
2634
|
+
className="w-full px-2 py-1 text-[12px]"
|
|
2635
|
+
placeholder={param.description}
|
|
2636
|
+
value={
|
|
2637
|
+
pluginConfigs[selectedPlugin.id]?.[param.key] ??
|
|
2638
|
+
param.currentValue ??
|
|
2639
|
+
""
|
|
2640
|
+
}
|
|
2641
|
+
onChange={(e) =>
|
|
2642
|
+
handleParamChange(
|
|
2643
|
+
selectedPlugin.id,
|
|
2644
|
+
param.key,
|
|
2645
|
+
e.target.value,
|
|
2646
|
+
)
|
|
2647
|
+
}
|
|
2648
|
+
/>
|
|
2649
|
+
</div>
|
|
2650
|
+
))}
|
|
2651
|
+
</div>
|
|
2652
|
+
)}
|
|
2653
|
+
<div className="plugins-game-detail-actions">
|
|
2654
|
+
<button
|
|
2655
|
+
type="button"
|
|
2656
|
+
className="plugins-game-action-btn"
|
|
2657
|
+
onClick={() => void handleTestConnection(selectedPlugin.id)}
|
|
2658
|
+
>
|
|
2659
|
+
{t("pluginsview.TestConnection")}
|
|
2660
|
+
</button>
|
|
2661
|
+
<button
|
|
2662
|
+
type="button"
|
|
2663
|
+
className={`plugins-game-action-btn plugins-game-save-btn${
|
|
2664
|
+
pluginSaveSuccess.has(selectedPlugin.id) ? " is-saved" : ""
|
|
2665
|
+
}`}
|
|
2666
|
+
onClick={() => void handleConfigSave(selectedPlugin.id)}
|
|
2667
|
+
disabled={pluginSaving.has(selectedPlugin.id)}
|
|
2668
|
+
>
|
|
2669
|
+
{pluginSaving.has(selectedPlugin.id)
|
|
2670
|
+
? "Saving..."
|
|
2671
|
+
: pluginSaveSuccess.has(selectedPlugin.id)
|
|
2672
|
+
? "Saved!"
|
|
2673
|
+
: "Save"}
|
|
2674
|
+
</button>
|
|
2675
|
+
</div>
|
|
2676
|
+
</>
|
|
2677
|
+
) : (
|
|
2678
|
+
<div className="plugins-game-detail-empty">
|
|
2679
|
+
<span className="plugins-game-detail-empty-icon">🧩</span>
|
|
2680
|
+
<span className="plugins-game-detail-empty-text">
|
|
2681
|
+
{t("pluginsview.SelectA")}{" "}
|
|
2682
|
+
{isConnectorLikeMode ? "connector" : "plugin"}{" "}
|
|
2683
|
+
{t("pluginsview.toC")}
|
|
2684
|
+
</span>
|
|
2685
|
+
</div>
|
|
2686
|
+
)}
|
|
2687
|
+
</div>
|
|
2688
|
+
</div>
|
|
2689
|
+
);
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
// ── Main render ────────────────────────────────────────────────────
|
|
2693
|
+
|
|
2694
|
+
return (
|
|
2695
|
+
<div
|
|
2696
|
+
data-testid={mode === "social" ? "plugins-view-social" : undefined}
|
|
2697
|
+
className={`relative min-h-0 ${showDesktopSubgroupSidebar ? "md:pl-[18rem]" : ""}`}
|
|
2698
|
+
>
|
|
2699
|
+
{showDesktopSubgroupSidebar && (
|
|
2700
|
+
<aside
|
|
2701
|
+
className="hidden md:absolute md:left-0 md:top-0 md:block md:w-64"
|
|
2702
|
+
data-testid="plugins-subgroup-sidebar"
|
|
2703
|
+
>
|
|
2704
|
+
<div className="sticky top-0 rounded-[28px] border border-border/50 bg-bg/35 p-5 backdrop-blur-xl shadow-sm">
|
|
2705
|
+
<div className="mb-4 text-[11px] font-semibold uppercase tracking-[0.18em] text-muted/80">
|
|
2706
|
+
Plugin Types
|
|
2707
|
+
</div>
|
|
2708
|
+
<nav className="flex flex-col gap-2">
|
|
2709
|
+
{subgroupTags.map((tag) =>
|
|
2710
|
+
renderSubgroupFilterButton(tag, { sidebar: true }),
|
|
2711
|
+
)}
|
|
2712
|
+
</nav>
|
|
2713
|
+
</div>
|
|
2714
|
+
</aside>
|
|
2715
|
+
)}
|
|
2716
|
+
|
|
2717
|
+
<div className="min-w-0">
|
|
2718
|
+
{showToolbar && (
|
|
2719
|
+
<div className="flex items-center gap-3 mb-4 flex-wrap">
|
|
2720
|
+
<div className="relative flex-1 min-w-[220px]">
|
|
2721
|
+
<Input
|
|
2722
|
+
type="text"
|
|
2723
|
+
className="w-full bg-card/60 backdrop-blur-md shadow-inner pr-8 h-9 rounded-xl focus-visible:ring-accent border-border/40"
|
|
2724
|
+
placeholder={searchPlaceholder}
|
|
2725
|
+
value={pluginSearch}
|
|
2726
|
+
onChange={(e) => setState("pluginSearch", e.target.value)}
|
|
2727
|
+
/>
|
|
2728
|
+
{pluginSearch && (
|
|
2729
|
+
<Button
|
|
2730
|
+
variant="ghost"
|
|
2731
|
+
size="icon"
|
|
2732
|
+
className="absolute right-1 top-1/2 -translate-y-1/2 w-6 h-6 text-muted hover:text-txt rounded-full"
|
|
2733
|
+
onClick={() => setState("pluginSearch", "")}
|
|
2734
|
+
title={t("pluginsview.ClearSearch")}
|
|
2735
|
+
>
|
|
2736
|
+
✕
|
|
2737
|
+
</Button>
|
|
2738
|
+
)}
|
|
2739
|
+
</div>
|
|
2740
|
+
|
|
2741
|
+
<div className="flex gap-1.5 shrink-0 bg-black/10 p-1 rounded-xl border border-white/5">
|
|
2742
|
+
{(["all", "enabled"] as const).map((s) => (
|
|
2743
|
+
<Button
|
|
2744
|
+
key={s}
|
|
2745
|
+
variant={pluginStatusFilter === s ? "default" : "ghost"}
|
|
2746
|
+
size="sm"
|
|
2747
|
+
className={`h-7 px-3 text-[11px] font-bold tracking-wide rounded-lg transition-all ${
|
|
2748
|
+
pluginStatusFilter === s
|
|
2749
|
+
? "shadow-sm"
|
|
2750
|
+
: "text-muted hover:text-txt hover:bg-white/5"
|
|
2751
|
+
}`}
|
|
2752
|
+
onClick={() =>
|
|
2753
|
+
setState("pluginStatusFilter", s as StatusFilter)
|
|
2754
|
+
}
|
|
2755
|
+
>
|
|
2756
|
+
{s === "all"
|
|
2757
|
+
? `All (${categoryPlugins.length})`
|
|
2758
|
+
: `Enabled (${enabledCount})`}
|
|
2759
|
+
</Button>
|
|
2760
|
+
))}
|
|
2761
|
+
</div>
|
|
2762
|
+
|
|
2763
|
+
{allowCustomOrder && pluginOrder.length > 0 && (
|
|
2764
|
+
<Button
|
|
2765
|
+
variant="outline"
|
|
2766
|
+
size="sm"
|
|
2767
|
+
className="h-8 px-3 text-[11px] font-bold border-border/40 bg-card/40 backdrop-blur-md shadow-sm rounded-xl shrink-0"
|
|
2768
|
+
onClick={handleResetOrder}
|
|
2769
|
+
title={t("pluginsview.ResetToDefaultSor")}
|
|
2770
|
+
>
|
|
2771
|
+
{t("pluginsview.ResetOrder")}
|
|
2772
|
+
</Button>
|
|
2773
|
+
)}
|
|
2774
|
+
|
|
2775
|
+
{showPluginManagementActions && (
|
|
2776
|
+
<Button
|
|
2777
|
+
variant="secondary"
|
|
2778
|
+
size="sm"
|
|
2779
|
+
className="h-8 px-4 text-[11px] font-bold tracking-wide border border-accent/30 text-txt bg-accent/10 hover:bg-accent/20 hover:border-accent/50 shadow-sm rounded-xl shrink-0 transition-all"
|
|
2780
|
+
onClick={() => setAddDirOpen(true)}
|
|
2781
|
+
>
|
|
2782
|
+
{t("pluginsview.AddPlugin")}
|
|
2783
|
+
</Button>
|
|
2784
|
+
)}
|
|
2785
|
+
</div>
|
|
2786
|
+
)}
|
|
2787
|
+
|
|
2788
|
+
{hasPluginToggleInFlight && (
|
|
2789
|
+
<div className="mb-3 px-3 py-2 border border-accent bg-accent-subtle text-[11px] text-txt">
|
|
2790
|
+
{t("pluginsview.ApplyingPluginChan")}
|
|
2791
|
+
</div>
|
|
2792
|
+
)}
|
|
2793
|
+
|
|
2794
|
+
{showSubgroupFilters && (
|
|
2795
|
+
<div
|
|
2796
|
+
className="flex items-center gap-2 mb-5 flex-wrap md:hidden"
|
|
2797
|
+
data-testid="plugins-subgroup-chips"
|
|
2798
|
+
>
|
|
2799
|
+
{subgroupTags.map((tag) => renderSubgroupFilterButton(tag))}
|
|
2800
|
+
</div>
|
|
2801
|
+
)}
|
|
2802
|
+
|
|
2803
|
+
{/* Plugin grid */}
|
|
2804
|
+
<div className="overflow-y-auto">
|
|
2805
|
+
{sorted.length === 0 ? (
|
|
2806
|
+
<div className="text-center py-10 px-5 text-muted border border-dashed border-border">
|
|
2807
|
+
{effectiveSearch
|
|
2808
|
+
? `No ${resultLabel} match your search.`
|
|
2809
|
+
: `No ${resultLabel} available.`}
|
|
2810
|
+
</div>
|
|
2811
|
+
) : visiblePlugins.length === 0 ? (
|
|
2812
|
+
<div className="text-center py-10 px-5 text-muted border border-dashed border-border">
|
|
2813
|
+
{showSubgroupFilters
|
|
2814
|
+
? "No plugins match this tag filter."
|
|
2815
|
+
: `No ${resultLabel} match your filters.`}
|
|
2816
|
+
</div>
|
|
2817
|
+
) : (
|
|
2818
|
+
renderPluginGrid(visiblePlugins)
|
|
2819
|
+
)}
|
|
2820
|
+
</div>
|
|
2821
|
+
</div>
|
|
2822
|
+
|
|
2823
|
+
{/* Settings dialog */}
|
|
2824
|
+
{settingsDialogPlugin &&
|
|
2825
|
+
(() => {
|
|
2826
|
+
const p = settingsDialogPlugin;
|
|
2827
|
+
const isShowcase = p.id === "__ui-showcase__";
|
|
2828
|
+
const isSaving = pluginSaving.has(p.id);
|
|
2829
|
+
const saveSuccess = pluginSaveSuccess.has(p.id);
|
|
2830
|
+
const categoryLabel = isShowcase
|
|
2831
|
+
? "showcase"
|
|
2832
|
+
: p.category === "ai-provider"
|
|
2833
|
+
? "ai provider"
|
|
2834
|
+
: p.category;
|
|
2835
|
+
return (
|
|
2836
|
+
<div
|
|
2837
|
+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-6 animate-in fade-in duration-200"
|
|
2838
|
+
onClick={(e) => {
|
|
2839
|
+
if (e.target === e.currentTarget) toggleSettings(p.id);
|
|
2840
|
+
}}
|
|
2841
|
+
onKeyDown={(e) => {
|
|
2842
|
+
if (e.key === "Escape" || e.key === "Enter" || e.key === " ") {
|
|
2843
|
+
e.preventDefault();
|
|
2844
|
+
toggleSettings(p.id);
|
|
2845
|
+
}
|
|
2846
|
+
}}
|
|
2847
|
+
role="dialog"
|
|
2848
|
+
aria-modal="true"
|
|
2849
|
+
>
|
|
2850
|
+
<div className="w-full max-w-2xl max-h-[85vh] border border-border/50 bg-card/90 shadow-2xl flex flex-col overflow-hidden rounded-2xl backdrop-blur-xl">
|
|
2851
|
+
{/* Dialog header */}
|
|
2852
|
+
<div className="flex items-center gap-3 px-5 py-4 border-b border-border/30 bg-black/10 shrink-0">
|
|
2853
|
+
<span className="font-bold text-base flex items-center gap-2 flex-1 min-w-0 tracking-wide text-txt">
|
|
2854
|
+
{(() => {
|
|
2855
|
+
const icon = resolveIcon(p);
|
|
2856
|
+
if (!icon) return null;
|
|
2857
|
+
if (typeof icon === "string") {
|
|
2858
|
+
const imageSrc = iconImageSource(icon);
|
|
2859
|
+
return imageSrc ? (
|
|
2860
|
+
<img
|
|
2861
|
+
src={imageSrc}
|
|
2862
|
+
alt=""
|
|
2863
|
+
className="w-6 h-6 rounded-md object-contain"
|
|
2864
|
+
onError={(e) => {
|
|
2865
|
+
(
|
|
2866
|
+
e.currentTarget as HTMLImageElement
|
|
2867
|
+
).style.display = "none";
|
|
2868
|
+
}}
|
|
2869
|
+
/>
|
|
2870
|
+
) : (
|
|
2871
|
+
<span className="text-base">{icon}</span>
|
|
2872
|
+
);
|
|
2873
|
+
}
|
|
2874
|
+
const IconComponent = icon;
|
|
2875
|
+
return <IconComponent className="w-6 h-6 text-txt" />;
|
|
2876
|
+
})()}
|
|
2877
|
+
{p.name}
|
|
2878
|
+
</span>
|
|
2879
|
+
<span className="text-[10px] px-2 py-0.5 rounded-full border border-border/40 bg-black/20 text-muted lowercase tracking-widest font-bold">
|
|
2880
|
+
{categoryLabel}
|
|
2881
|
+
</span>
|
|
2882
|
+
{p.version && (
|
|
2883
|
+
<span className="text-[10px] font-mono text-muted/70">
|
|
2884
|
+
v{p.version}
|
|
2885
|
+
</span>
|
|
2886
|
+
)}
|
|
2887
|
+
{isShowcase && (
|
|
2888
|
+
<span className="text-[10px] font-bold tracking-widest px-2.5 py-[2px] border border-accent/30 text-txt bg-accent/10 rounded-full">
|
|
2889
|
+
{t("pluginsview.DEMO")}
|
|
2890
|
+
</span>
|
|
2891
|
+
)}
|
|
2892
|
+
<Button
|
|
2893
|
+
variant="ghost"
|
|
2894
|
+
size="icon"
|
|
2895
|
+
className="h-8 w-8 text-muted hover:bg-white/10 hover:text-txt rounded-full transition-all shrink-0 ml-2"
|
|
2896
|
+
onClick={() => toggleSettings(p.id)}
|
|
2897
|
+
>
|
|
2898
|
+
✕
|
|
2899
|
+
</Button>
|
|
2900
|
+
</div>
|
|
2901
|
+
|
|
2902
|
+
{/* Dialog body — scrollable */}
|
|
2903
|
+
<div className="overflow-y-auto flex-1 scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent">
|
|
2904
|
+
{/* Plugin details */}
|
|
2905
|
+
<div className="px-5 pt-4 pb-1 flex items-center gap-3 flex-wrap text-xs text-muted">
|
|
2906
|
+
{p.description && (
|
|
2907
|
+
<span className="text-[12px] text-muted leading-relaxed">
|
|
2908
|
+
{p.description}
|
|
2909
|
+
</span>
|
|
2910
|
+
)}
|
|
2911
|
+
{(p.tags?.length ?? 0) > 0 && (
|
|
2912
|
+
<span className="flex items-center gap-1.5 flex-wrap">
|
|
2913
|
+
{p.tags?.map((tag) => (
|
|
2914
|
+
<span
|
|
2915
|
+
key={`${p.id}:${tag}:settings`}
|
|
2916
|
+
className="text-[10px] px-1.5 py-px border border-border/40 bg-black/10 text-muted lowercase tracking-wide whitespace-nowrap"
|
|
2917
|
+
>
|
|
2918
|
+
{tag}
|
|
2919
|
+
</span>
|
|
2920
|
+
))}
|
|
2921
|
+
</span>
|
|
2922
|
+
)}
|
|
2923
|
+
</div>
|
|
2924
|
+
{(p.npmName || (p.pluginDeps && p.pluginDeps.length > 0)) && (
|
|
2925
|
+
<div className="px-5 pb-2 flex items-center gap-3 flex-wrap">
|
|
2926
|
+
{p.npmName && (
|
|
2927
|
+
<span className="font-mono text-[10px] text-muted opacity-50">
|
|
2928
|
+
{p.npmName}
|
|
2929
|
+
</span>
|
|
2930
|
+
)}
|
|
2931
|
+
{p.pluginDeps && p.pluginDeps.length > 0 && (
|
|
2932
|
+
<span className="flex items-center gap-1 flex-wrap">
|
|
2933
|
+
<span className="text-[10px] text-muted opacity-60">
|
|
2934
|
+
{t("pluginsview.dependsOn")}
|
|
2935
|
+
</span>
|
|
2936
|
+
{p.pluginDeps.map((dep: string) => (
|
|
2937
|
+
<span
|
|
2938
|
+
key={dep}
|
|
2939
|
+
className="text-[10px] px-1.5 py-px border border-border bg-accent-subtle text-muted rounded-sm"
|
|
2940
|
+
>
|
|
2941
|
+
{dep}
|
|
2942
|
+
</span>
|
|
2943
|
+
))}
|
|
2944
|
+
</span>
|
|
2945
|
+
)}
|
|
2946
|
+
</div>
|
|
2947
|
+
)}
|
|
2948
|
+
|
|
2949
|
+
<div className="px-5 py-3">
|
|
2950
|
+
<PluginConfigForm
|
|
2951
|
+
plugin={p}
|
|
2952
|
+
pluginConfigs={pluginConfigs}
|
|
2953
|
+
onParamChange={handleParamChange}
|
|
2954
|
+
/>
|
|
2955
|
+
{p.id === "whatsapp" && (
|
|
2956
|
+
<WhatsAppQrOverlay accountId="default" />
|
|
2957
|
+
)}
|
|
2958
|
+
</div>
|
|
2959
|
+
</div>
|
|
2960
|
+
|
|
2961
|
+
{/* Dialog footer — actions (hidden for showcase) */}
|
|
2962
|
+
{!isShowcase && (
|
|
2963
|
+
<div className="flex justify-end gap-3 px-5 py-4 border-t border-border/30 shrink-0 bg-black/10">
|
|
2964
|
+
{p.enabled && !p.isActive && p.npmName && !p.loadError && (
|
|
2965
|
+
<Button
|
|
2966
|
+
variant="default"
|
|
2967
|
+
size="sm"
|
|
2968
|
+
className="h-8 px-4 text-[11px] font-bold tracking-wide shadow-sm"
|
|
2969
|
+
disabled={installingPlugins.has(p.id)}
|
|
2970
|
+
onClick={() =>
|
|
2971
|
+
handleInstallPlugin(p.id, p.npmName ?? "")
|
|
2972
|
+
}
|
|
2973
|
+
>
|
|
2974
|
+
{installingPlugins.has(p.id)
|
|
2975
|
+
? installProgress.get(p.npmName ?? "")?.message ||
|
|
2976
|
+
"Installing..."
|
|
2977
|
+
: "Install Plugin"}
|
|
2978
|
+
</Button>
|
|
2979
|
+
)}
|
|
2980
|
+
{p.loadError && (
|
|
2981
|
+
<span
|
|
2982
|
+
className="px-3 py-1.5 text-[11px] text-danger font-bold tracking-wide"
|
|
2983
|
+
title={p.loadError}
|
|
2984
|
+
>
|
|
2985
|
+
{t("pluginsview.PackageBrokenMis")}
|
|
2986
|
+
</span>
|
|
2987
|
+
)}
|
|
2988
|
+
{p.isActive && (
|
|
2989
|
+
<Button
|
|
2990
|
+
variant={
|
|
2991
|
+
testResults.get(p.id)?.success
|
|
2992
|
+
? "default"
|
|
2993
|
+
: testResults.get(p.id)?.error
|
|
2994
|
+
? "destructive"
|
|
2995
|
+
: "outline"
|
|
2996
|
+
}
|
|
2997
|
+
size="sm"
|
|
2998
|
+
className={`h-8 px-4 text-[11px] font-bold tracking-wide transition-all ${
|
|
2999
|
+
testResults.get(p.id)?.loading
|
|
3000
|
+
? "opacity-70 cursor-wait"
|
|
3001
|
+
: testResults.get(p.id)?.success
|
|
3002
|
+
? "bg-ok text-ok-fg border-ok hover:bg-ok/90"
|
|
3003
|
+
: testResults.get(p.id)?.error
|
|
3004
|
+
? "bg-danger text-danger-fg border-danger hover:bg-danger/90"
|
|
3005
|
+
: "border-border/40 bg-card/40 backdrop-blur-md shadow-sm hover:border-accent/40"
|
|
3006
|
+
}`}
|
|
3007
|
+
disabled={testResults.get(p.id)?.loading}
|
|
3008
|
+
onClick={() => handleTestConnection(p.id)}
|
|
3009
|
+
>
|
|
3010
|
+
{testResults.get(p.id)?.loading
|
|
3011
|
+
? "Testing..."
|
|
3012
|
+
: testResults.get(p.id)?.success
|
|
3013
|
+
? `\u2713 OK (${testResults.get(p.id)?.durationMs}ms)`
|
|
3014
|
+
: testResults.get(p.id)?.error
|
|
3015
|
+
? `\u2715 ${testResults.get(p.id)?.error}`
|
|
3016
|
+
: "Test Connection"}
|
|
3017
|
+
</Button>
|
|
3018
|
+
)}
|
|
3019
|
+
<Button
|
|
3020
|
+
variant="ghost"
|
|
3021
|
+
size="sm"
|
|
3022
|
+
className="h-8 px-4 text-[12px] font-bold text-muted hover:text-txt transition-all"
|
|
3023
|
+
onClick={() => handleConfigReset(p.id)}
|
|
3024
|
+
>
|
|
3025
|
+
{t("pluginsview.Reset")}
|
|
3026
|
+
</Button>
|
|
3027
|
+
<Button
|
|
3028
|
+
variant={saveSuccess ? "default" : "secondary"}
|
|
3029
|
+
size="sm"
|
|
3030
|
+
className={`h-8 px-5 text-[12px] font-bold tracking-wide transition-all ${
|
|
3031
|
+
saveSuccess
|
|
3032
|
+
? "bg-ok text-ok-fg hover:bg-ok/90"
|
|
3033
|
+
: "bg-accent text-accent-fg hover:bg-accent/90 shadow-lg shadow-accent/20"
|
|
3034
|
+
}`}
|
|
3035
|
+
onClick={() => handleConfigSave(p.id)}
|
|
3036
|
+
disabled={isSaving}
|
|
3037
|
+
>
|
|
3038
|
+
{isSaving
|
|
3039
|
+
? "Saving..."
|
|
3040
|
+
: saveSuccess
|
|
3041
|
+
? "\u2713 Saved"
|
|
3042
|
+
: "Save Settings"}
|
|
3043
|
+
</Button>
|
|
3044
|
+
</div>
|
|
3045
|
+
)}
|
|
3046
|
+
</div>
|
|
3047
|
+
</div>
|
|
3048
|
+
);
|
|
3049
|
+
})()}
|
|
3050
|
+
|
|
3051
|
+
{/* Add from directory modal */}
|
|
3052
|
+
{addDirOpen && (
|
|
3053
|
+
<div
|
|
3054
|
+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-6 duration-200 animate-in fade-in"
|
|
3055
|
+
onClick={(e) => {
|
|
3056
|
+
if (e.target === e.currentTarget) {
|
|
3057
|
+
setAddDirOpen(false);
|
|
3058
|
+
setAddDirPath("");
|
|
3059
|
+
}
|
|
3060
|
+
}}
|
|
3061
|
+
onKeyDown={(e) => {
|
|
3062
|
+
if (e.key === "Escape" || e.key === "Enter" || e.key === " ") {
|
|
3063
|
+
e.preventDefault();
|
|
3064
|
+
setAddDirOpen(false);
|
|
3065
|
+
setAddDirPath("");
|
|
3066
|
+
}
|
|
3067
|
+
}}
|
|
3068
|
+
role="dialog"
|
|
3069
|
+
aria-modal="true"
|
|
3070
|
+
>
|
|
3071
|
+
<div className="w-full max-w-md border border-border/50 bg-card/90 backdrop-blur-xl p-6 rounded-2xl shadow-2xl">
|
|
3072
|
+
<div className="flex items-center justify-between mb-5">
|
|
3073
|
+
<div className="font-bold text-base tracking-wide text-txt">
|
|
3074
|
+
{t("pluginsview.AddPlugin1")}
|
|
3075
|
+
</div>
|
|
3076
|
+
<Button
|
|
3077
|
+
variant="ghost"
|
|
3078
|
+
size="icon"
|
|
3079
|
+
className="h-8 w-8 text-muted hover:bg-white/10 hover:text-txt rounded-full transition-all shrink-0 ml-2"
|
|
3080
|
+
onClick={() => {
|
|
3081
|
+
setAddDirOpen(false);
|
|
3082
|
+
setAddDirPath("");
|
|
3083
|
+
}}
|
|
3084
|
+
>
|
|
3085
|
+
✕
|
|
3086
|
+
</Button>
|
|
3087
|
+
</div>
|
|
3088
|
+
|
|
3089
|
+
<p className="text-sm font-medium tracking-wide text-muted mb-4">
|
|
3090
|
+
{t("pluginsview.EnterThePathToA")}
|
|
3091
|
+
</p>
|
|
3092
|
+
|
|
3093
|
+
<Input
|
|
3094
|
+
type="text"
|
|
3095
|
+
className="w-full h-10 px-3 border border-border/40 bg-black/20 text-txt text-[13px] font-mono transition-all duration-150 focus-visible:ring-accent rounded-xl shadow-inner placeholder:text-muted/50"
|
|
3096
|
+
placeholder={t("pluginsview.PathToPluginOrP")}
|
|
3097
|
+
value={addDirPath}
|
|
3098
|
+
onChange={(e) => setAddDirPath(e.target.value)}
|
|
3099
|
+
onKeyDown={(e) => {
|
|
3100
|
+
if (e.key === "Enter") void handleAddFromDirectory();
|
|
3101
|
+
}}
|
|
3102
|
+
/>
|
|
3103
|
+
|
|
3104
|
+
<div className="flex justify-end gap-3 mt-6">
|
|
3105
|
+
<Button
|
|
3106
|
+
variant="ghost"
|
|
3107
|
+
size="sm"
|
|
3108
|
+
className="h-8 px-4 text-[12px] font-bold text-muted hover:text-txt transition-all"
|
|
3109
|
+
onClick={() => {
|
|
3110
|
+
setAddDirOpen(false);
|
|
3111
|
+
setAddDirPath("");
|
|
3112
|
+
}}
|
|
3113
|
+
>
|
|
3114
|
+
{t("pluginsview.Cancel")}
|
|
3115
|
+
</Button>
|
|
3116
|
+
<Button
|
|
3117
|
+
variant="default"
|
|
3118
|
+
size="sm"
|
|
3119
|
+
className="h-8 px-6 text-[12px] font-bold tracking-wide shadow-sm"
|
|
3120
|
+
onClick={handleAddFromDirectory}
|
|
3121
|
+
disabled={addDirLoading || !addDirPath.trim()}
|
|
3122
|
+
>
|
|
3123
|
+
{addDirLoading ? "Adding..." : "Add"}
|
|
3124
|
+
</Button>
|
|
3125
|
+
</div>
|
|
3126
|
+
</div>
|
|
3127
|
+
</div>
|
|
3128
|
+
)}
|
|
3129
|
+
</div>
|
|
3130
|
+
);
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
/* ── Exported views ────────────────────────────────────────────────── */
|
|
3134
|
+
|
|
3135
|
+
/** Unified plugins view — tag-filtered plugin list. */
|
|
3136
|
+
export function PluginsView({
|
|
3137
|
+
mode = "all",
|
|
3138
|
+
inModal,
|
|
3139
|
+
}: {
|
|
3140
|
+
mode?: PluginsViewMode;
|
|
3141
|
+
inModal?: boolean;
|
|
3142
|
+
}) {
|
|
3143
|
+
const label =
|
|
3144
|
+
mode === "social"
|
|
3145
|
+
? "Connectors"
|
|
3146
|
+
: mode === "connectors"
|
|
3147
|
+
? "Connectors"
|
|
3148
|
+
: mode === "streaming"
|
|
3149
|
+
? "Streaming"
|
|
3150
|
+
: "Plugins";
|
|
3151
|
+
return <PluginListView label={label} mode={mode} inModal={inModal} />;
|
|
3152
|
+
}
|