@elizaos/app-core 2.0.0-alpha.10
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/LICENSE +21 -0
- package/package.json +90 -0
- package/src/App.tsx +472 -0
- package/src/actions/character.test.ts +139 -0
- package/src/actions/character.ts +152 -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 +5516 -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 +250 -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 +1645 -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 +992 -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 +497 -0
- package/src/components/CompanionShell.tsx +31 -0
- package/src/components/CompanionView.tsx +109 -0
- package/src/components/ConfigPageView.tsx +758 -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 +1077 -0
- package/src/components/GameView.tsx +552 -0
- package/src/components/GameViewOverlay.tsx +133 -0
- package/src/components/GlobalEmoteOverlay.tsx +155 -0
- package/src/components/Header.test.tsx +413 -0
- package/src/components/Header.tsx +403 -0
- package/src/components/HeartbeatsView.tsx +1003 -0
- package/src/components/InventoryView.tsx +385 -0
- package/src/components/KnowledgeView.tsx +1128 -0
- package/src/components/LanguageDropdown.tsx +188 -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 +433 -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 +189 -0
- package/src/components/PairingView.tsx +110 -0
- package/src/components/PermissionsSection.tsx +1186 -0
- package/src/components/PluginsPageView.tsx +9 -0
- package/src/components/PluginsView.tsx +3157 -0
- package/src/components/ProviderSwitcher.tsx +908 -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 +640 -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 +675 -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 +1 -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 +142 -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 +94 -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/IdentityStep.tsx +147 -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 +413 -0
- package/src/components/plugins/showcase-data.ts +481 -0
- package/src/components/shared/ShellHeaderControls.tsx +193 -0
- package/src/components/shared-companion-scene-context.ts +15 -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 +1901 -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 +334 -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 +1441 -0
- package/src/hooks/useWhatsAppPairing.ts +123 -0
- package/src/i18n/index.ts +76 -0
- package/src/i18n/locales/en.json +1194 -0
- package/src/i18n/locales/es.json +1194 -0
- package/src/i18n/locales/ko.json +1194 -0
- package/src/i18n/locales/pt.json +1194 -0
- package/src/i18n/locales/zh-CN.json +1194 -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/onboarding-config.test.ts +104 -0
- package/src/onboarding-config.ts +114 -0
- package/src/platform/browser-launch.test.ts +94 -0
- package/src/platform/browser-launch.ts +149 -0
- package/src/platform/index.ts +58 -0
- package/src/platform/init.ts +236 -0
- package/src/platform/lifo.ts +215 -0
- package/src/providers/index.ts +99 -0
- package/src/state/AppContext.tsx +5846 -0
- package/src/state/index.ts +6 -0
- package/src/state/internal.ts +86 -0
- package/src/state/onboarding-resume.test.ts +135 -0
- package/src/state/onboarding-resume.ts +263 -0
- package/src/state/parsers.test.ts +124 -0
- package/src/state/parsers.ts +308 -0
- package/src/state/persistence.ts +321 -0
- package/src/state/shell-routing.ts +32 -0
- package/src/state/types.ts +701 -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 +738 -0
- package/src/styles/styles.css +2087 -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/src/wallet-rpc.ts +176 -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 +356 -0
- package/test/app/PermissionsSection.test.tsx +573 -0
- package/test/app/advanced-trajectory-fine-tuning.e2e.test.ts +393 -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 +1199 -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 +1465 -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 +425 -0
- package/test/app/companion-stale-conversation.test.tsx +447 -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 +940 -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 +22 -0
- package/test/app/onboarding-finish-lock.test.ts +663 -0
- package/test/app/onboarding-language.test.tsx +160 -0
- package/test/app/onboarding-steps.test.tsx +375 -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 +302 -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 +726 -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 +58 -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 +618 -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 +113 -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 +298 -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 +20 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
3
|
+
type ConfirmDeleteControlProps = {
|
|
4
|
+
onConfirm: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
triggerLabel?: string;
|
|
7
|
+
confirmLabel?: string;
|
|
8
|
+
cancelLabel?: string;
|
|
9
|
+
busyLabel?: string;
|
|
10
|
+
promptText?: string;
|
|
11
|
+
triggerClassName: string;
|
|
12
|
+
confirmClassName: string;
|
|
13
|
+
cancelClassName: string;
|
|
14
|
+
promptClassName?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function ConfirmDeleteControl({
|
|
18
|
+
onConfirm,
|
|
19
|
+
disabled = false,
|
|
20
|
+
triggerLabel = "Delete",
|
|
21
|
+
confirmLabel = "Confirm",
|
|
22
|
+
cancelLabel = "Cancel",
|
|
23
|
+
busyLabel,
|
|
24
|
+
promptText = "Delete?",
|
|
25
|
+
triggerClassName,
|
|
26
|
+
confirmClassName,
|
|
27
|
+
cancelClassName,
|
|
28
|
+
promptClassName = "text-[11px] text-[#e74c3c] ml-1",
|
|
29
|
+
}: ConfirmDeleteControlProps) {
|
|
30
|
+
const [confirming, setConfirming] = useState(false);
|
|
31
|
+
|
|
32
|
+
if (!confirming) {
|
|
33
|
+
return (
|
|
34
|
+
<button
|
|
35
|
+
type="button"
|
|
36
|
+
className={triggerClassName}
|
|
37
|
+
onClick={() => setConfirming(true)}
|
|
38
|
+
disabled={disabled}
|
|
39
|
+
>
|
|
40
|
+
{triggerLabel}
|
|
41
|
+
</button>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<span className={promptClassName}>{promptText}</span>
|
|
48
|
+
<button
|
|
49
|
+
type="button"
|
|
50
|
+
className={confirmClassName}
|
|
51
|
+
onClick={() => {
|
|
52
|
+
onConfirm();
|
|
53
|
+
setConfirming(false);
|
|
54
|
+
}}
|
|
55
|
+
disabled={disabled}
|
|
56
|
+
>
|
|
57
|
+
{disabled && busyLabel ? busyLabel : confirmLabel}
|
|
58
|
+
</button>
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
className={cancelClassName}
|
|
62
|
+
onClick={() => setConfirming(false)}
|
|
63
|
+
disabled={disabled}
|
|
64
|
+
>
|
|
65
|
+
{cancelLabel}
|
|
66
|
+
</button>
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { Button, Input } from "@elizaos/ui";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { getLocalizedConversationTitle } from "./conversation-utils";
|
|
5
|
+
|
|
6
|
+
interface ConversationListItemProps {
|
|
7
|
+
conv: { id: string; title: string; updatedAt: string };
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
isEditing: boolean;
|
|
10
|
+
isUnread: boolean;
|
|
11
|
+
isGameModal: boolean;
|
|
12
|
+
editingTitle: string;
|
|
13
|
+
confirmDeleteId: string | null;
|
|
14
|
+
deletingId: string | null;
|
|
15
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
16
|
+
t: (
|
|
17
|
+
key: string,
|
|
18
|
+
vars?: Record<string, string | number | boolean | null | undefined>,
|
|
19
|
+
) => string;
|
|
20
|
+
mobile: boolean;
|
|
21
|
+
onSelect: (id: string) => void;
|
|
22
|
+
onEditingTitleChange: (value: string) => void;
|
|
23
|
+
onEditSubmit: (id: string) => void;
|
|
24
|
+
onEditKeyDown: (e: React.KeyboardEvent<HTMLInputElement>, id: string) => void;
|
|
25
|
+
onConfirmDelete: (id: string) => void;
|
|
26
|
+
onCancelDelete: () => void;
|
|
27
|
+
onOpenActions: (
|
|
28
|
+
event:
|
|
29
|
+
| React.MouseEvent<HTMLButtonElement | HTMLDivElement>
|
|
30
|
+
| React.TouchEvent<HTMLButtonElement | HTMLDivElement>,
|
|
31
|
+
conv: { id: string; title: string },
|
|
32
|
+
) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function ConversationListItem({
|
|
36
|
+
conv,
|
|
37
|
+
isActive,
|
|
38
|
+
isEditing,
|
|
39
|
+
isUnread,
|
|
40
|
+
isGameModal,
|
|
41
|
+
editingTitle,
|
|
42
|
+
confirmDeleteId,
|
|
43
|
+
deletingId,
|
|
44
|
+
inputRef,
|
|
45
|
+
t,
|
|
46
|
+
mobile,
|
|
47
|
+
onSelect,
|
|
48
|
+
onEditingTitleChange,
|
|
49
|
+
onEditSubmit,
|
|
50
|
+
onEditKeyDown,
|
|
51
|
+
onConfirmDelete,
|
|
52
|
+
onCancelDelete,
|
|
53
|
+
onOpenActions,
|
|
54
|
+
}: ConversationListItemProps) {
|
|
55
|
+
const longPressTimerRef = useRef<number | null>(null);
|
|
56
|
+
const suppressClickRef = useRef(false);
|
|
57
|
+
|
|
58
|
+
const clearLongPressTimer = () => {
|
|
59
|
+
if (longPressTimerRef.current !== null) {
|
|
60
|
+
window.clearTimeout(longPressTimerRef.current);
|
|
61
|
+
longPressTimerRef.current = null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleTouchStart = (event: React.TouchEvent<HTMLButtonElement>) => {
|
|
66
|
+
if (!mobile) return;
|
|
67
|
+
clearLongPressTimer();
|
|
68
|
+
longPressTimerRef.current = window.setTimeout(() => {
|
|
69
|
+
suppressClickRef.current = true;
|
|
70
|
+
onOpenActions(event, conv);
|
|
71
|
+
clearLongPressTimer();
|
|
72
|
+
}, 450);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handleTouchEnd = () => {
|
|
76
|
+
clearLongPressTimer();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
key={conv.id}
|
|
82
|
+
data-testid="conv-item"
|
|
83
|
+
data-active={isActive || undefined}
|
|
84
|
+
className={`w-full ${
|
|
85
|
+
isGameModal
|
|
86
|
+
? "group relative flex items-start gap-3 w-full p-2.5 rounded-xl cursor-pointer transition-all border border-transparent"
|
|
87
|
+
: "flex items-center pl-3 pr-2 py-2 gap-1 cursor-pointer transition-colors border-l-[3px]"
|
|
88
|
+
} ${
|
|
89
|
+
isActive
|
|
90
|
+
? isGameModal
|
|
91
|
+
? "bg-accent/15 border-accent/30 shadow-[0_0_15px_rgba(240,178,50,0.1)]"
|
|
92
|
+
: "bg-bg-hover border-l-accent"
|
|
93
|
+
: isGameModal
|
|
94
|
+
? "hover:bg-white/5 hover:border-white/10"
|
|
95
|
+
: "border-l-transparent hover:bg-bg-hover"
|
|
96
|
+
}`}
|
|
97
|
+
>
|
|
98
|
+
{isEditing ? (
|
|
99
|
+
<Input
|
|
100
|
+
ref={inputRef}
|
|
101
|
+
className="w-full h-8 px-1.5 border-accent bg-card text-txt text-[13px] shadow-sm focus-visible:ring-1 focus-visible:ring-accent"
|
|
102
|
+
value={editingTitle}
|
|
103
|
+
onChange={(e) => onEditingTitleChange(e.target.value)}
|
|
104
|
+
onBlur={() => void onEditSubmit(conv.id)}
|
|
105
|
+
onKeyDown={(e) => onEditKeyDown(e, conv.id)}
|
|
106
|
+
onClick={(e) => e.stopPropagation()}
|
|
107
|
+
/>
|
|
108
|
+
) : (
|
|
109
|
+
<>
|
|
110
|
+
<Button
|
|
111
|
+
variant="ghost"
|
|
112
|
+
size="sm"
|
|
113
|
+
data-testid="conv-select"
|
|
114
|
+
className={
|
|
115
|
+
isGameModal
|
|
116
|
+
? "flex w-full flex-col flex-1 min-w-0 !items-start !justify-start !text-left cursor-pointer h-auto p-0 rounded-none bg-transparent border-none"
|
|
117
|
+
: "flex items-center gap-2 flex-1 min-w-0 bg-transparent border-0 p-0 m-0 text-left h-auto cursor-pointer rounded-none"
|
|
118
|
+
}
|
|
119
|
+
onClick={() => {
|
|
120
|
+
if (suppressClickRef.current) {
|
|
121
|
+
suppressClickRef.current = false;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
onSelect(conv.id);
|
|
125
|
+
}}
|
|
126
|
+
onContextMenu={(event) => {
|
|
127
|
+
if (mobile) return;
|
|
128
|
+
onOpenActions(event, conv);
|
|
129
|
+
}}
|
|
130
|
+
onTouchStart={handleTouchStart}
|
|
131
|
+
onTouchEnd={handleTouchEnd}
|
|
132
|
+
onTouchCancel={handleTouchEnd}
|
|
133
|
+
onTouchMove={handleTouchEnd}
|
|
134
|
+
>
|
|
135
|
+
{isUnread && (
|
|
136
|
+
<span
|
|
137
|
+
className={
|
|
138
|
+
isGameModal
|
|
139
|
+
? "absolute top-3 left-3 w-2 h-2 rounded-full bg-accent animate-pulse shadow-[0_0_8px_rgba(240,178,50,0.8)]"
|
|
140
|
+
: "w-2 h-2 rounded-full bg-accent shrink-0"
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
|
|
145
|
+
<span
|
|
146
|
+
className={
|
|
147
|
+
isGameModal
|
|
148
|
+
? `block w-full text-[13px] font-medium truncate leading-tight text-left transition-colors min-w-0 ${isActive ? "text-txt text-shadow-glow" : "text-white/90 group-hover:text-white"}`
|
|
149
|
+
: "block w-full font-medium truncate text-left text-txt min-w-0"
|
|
150
|
+
}
|
|
151
|
+
>
|
|
152
|
+
{getLocalizedConversationTitle(conv.title, t)}
|
|
153
|
+
</span>
|
|
154
|
+
</Button>
|
|
155
|
+
|
|
156
|
+
{confirmDeleteId === conv.id ? (
|
|
157
|
+
<div className="flex items-center gap-1.5 flex-shrink-0">
|
|
158
|
+
<span className="text-[10px] text-danger">
|
|
159
|
+
{t("conversations.deleteConfirm")}
|
|
160
|
+
</span>
|
|
161
|
+
<Button
|
|
162
|
+
variant="destructive"
|
|
163
|
+
size="sm"
|
|
164
|
+
className="h-6 px-1.5 py-0.5 text-[10px] text-white shadow-sm disabled:opacity-50"
|
|
165
|
+
onClick={() => void onConfirmDelete(conv.id)}
|
|
166
|
+
disabled={deletingId === conv.id}
|
|
167
|
+
>
|
|
168
|
+
{deletingId === conv.id ? "..." : t("conversations.deleteYes")}
|
|
169
|
+
</Button>
|
|
170
|
+
<Button
|
|
171
|
+
variant="outline"
|
|
172
|
+
size="sm"
|
|
173
|
+
className="h-6 px-1.5 py-0.5 text-[10px] text-muted shadow-sm hover:border-accent hover:text-txt disabled:opacity-50"
|
|
174
|
+
onClick={() => onCancelDelete()}
|
|
175
|
+
disabled={deletingId === conv.id}
|
|
176
|
+
>
|
|
177
|
+
{t("conversations.deleteNo")}
|
|
178
|
+
</Button>
|
|
179
|
+
</div>
|
|
180
|
+
) : null}
|
|
181
|
+
</>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { VRM_COUNT } from "../../state";
|
|
2
|
+
|
|
3
|
+
export function getLocalizedConversationTitle(
|
|
4
|
+
title: string | undefined | null,
|
|
5
|
+
t: (
|
|
6
|
+
key: string,
|
|
7
|
+
vars?: Record<string, string | number | boolean | null | undefined>,
|
|
8
|
+
) => string,
|
|
9
|
+
): string {
|
|
10
|
+
if (
|
|
11
|
+
!title ||
|
|
12
|
+
title === "New Chat" ||
|
|
13
|
+
title === "conversations.newChatTitle"
|
|
14
|
+
) {
|
|
15
|
+
const localized = t("conversations.newChatTitle");
|
|
16
|
+
return localized === "conversations.newChatTitle" ? "New Chat" : localized;
|
|
17
|
+
}
|
|
18
|
+
return title;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const BROWSER_CAPABILITY_PLUGIN_IDS = new Set([
|
|
22
|
+
"browser",
|
|
23
|
+
"browserbase",
|
|
24
|
+
"chrome-extension",
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
export const COMPUTER_CAPABILITY_PLUGIN_IDS = new Set([
|
|
28
|
+
"computeruse",
|
|
29
|
+
"computer-use",
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
export function formatRelativeTime(
|
|
33
|
+
dateString: string,
|
|
34
|
+
t: (
|
|
35
|
+
key: string,
|
|
36
|
+
vars?: Record<string, string | number | boolean | null | undefined>,
|
|
37
|
+
) => string,
|
|
38
|
+
): string {
|
|
39
|
+
const date = new Date(dateString);
|
|
40
|
+
const now = new Date();
|
|
41
|
+
const diffMs = now.getTime() - date.getTime();
|
|
42
|
+
const diffMins = Math.floor(diffMs / 60000);
|
|
43
|
+
const diffHours = Math.floor(diffMs / 3600000);
|
|
44
|
+
const diffDays = Math.floor(diffMs / 86400000);
|
|
45
|
+
|
|
46
|
+
if (diffMins < 1) return t("conversations.justNow");
|
|
47
|
+
if (diffMins < 60) return t("conversations.minutesAgo", { count: diffMins });
|
|
48
|
+
if (diffHours < 24) return t("conversations.hoursAgo", { count: diffHours });
|
|
49
|
+
if (diffDays < 7) return t("conversations.daysAgo", { count: diffDays });
|
|
50
|
+
|
|
51
|
+
return date.toLocaleDateString();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function avatarIndexFromConversationId(id: string): number {
|
|
55
|
+
let hash = 0;
|
|
56
|
+
for (let i = 0; i < id.length; i += 1) {
|
|
57
|
+
hash = (hash * 31 + id.charCodeAt(i)) | 0;
|
|
58
|
+
}
|
|
59
|
+
const normalized = Math.abs(hash) % VRM_COUNT;
|
|
60
|
+
return normalized + 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function resolveProviderLabel(model: string | undefined): string {
|
|
64
|
+
const value = (model ?? "").trim();
|
|
65
|
+
if (!value) return "";
|
|
66
|
+
|
|
67
|
+
const lower = value.toLowerCase();
|
|
68
|
+
const knownProviders: Array<{ match: string; label: string }> = [
|
|
69
|
+
{ match: "elizacloud", label: "Eliza Cloud" },
|
|
70
|
+
{ match: "openrouter", label: "OpenRouter" },
|
|
71
|
+
{ match: "openai", label: "OpenAI" },
|
|
72
|
+
{ match: "anthropic", label: "Anthropic" },
|
|
73
|
+
{ match: "gemini", label: "Google" },
|
|
74
|
+
{ match: "google", label: "Google" },
|
|
75
|
+
{ match: "grok", label: "xAI" },
|
|
76
|
+
{ match: "xai", label: "xAI" },
|
|
77
|
+
{ match: "groq", label: "Groq" },
|
|
78
|
+
{ match: "ollama", label: "Ollama" },
|
|
79
|
+
{ match: "deepseek", label: "DeepSeek" },
|
|
80
|
+
{ match: "mistral", label: "Mistral" },
|
|
81
|
+
{ match: "together", label: "Together AI" },
|
|
82
|
+
{ match: "zai", label: "z.ai" },
|
|
83
|
+
{ match: "cohere", label: "Cohere" },
|
|
84
|
+
{ match: "pi-ai", label: "Pi AI" },
|
|
85
|
+
];
|
|
86
|
+
for (const provider of knownProviders) {
|
|
87
|
+
if (lower.includes(provider.match)) return provider.label;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (lower.startsWith("gpt")) return "OpenAI";
|
|
91
|
+
if (lower.startsWith("claude")) return "Anthropic";
|
|
92
|
+
if (lower.startsWith("gemini")) return "Google";
|
|
93
|
+
|
|
94
|
+
const splitToken = value.split(/[/:|]/)[0]?.trim();
|
|
95
|
+
if (splitToken) return splitToken.toUpperCase();
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function isNonChatModelLabel(model: string | undefined): boolean {
|
|
100
|
+
const value = (model ?? "").trim().toLowerCase();
|
|
101
|
+
if (!value) return false;
|
|
102
|
+
if (value === "text_embedding") return true;
|
|
103
|
+
if (value === "text_large") return true;
|
|
104
|
+
if (value === "text_small") return true;
|
|
105
|
+
if (value.includes("text_embedding")) return true;
|
|
106
|
+
if (value.includes("embedding")) return true;
|
|
107
|
+
if (value.includes("text_large") || value.includes("text_small")) return true;
|
|
108
|
+
if (/^text_[a-z0-9_]+$/.test(value)) return true;
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function estimateTokenCost(
|
|
113
|
+
promptTokens: number,
|
|
114
|
+
completionTokens: number,
|
|
115
|
+
model: string | undefined,
|
|
116
|
+
): string {
|
|
117
|
+
const normalizedModel = (model ?? "").toLowerCase();
|
|
118
|
+
const pricingByMillion: Record<string, [number, number]> = {
|
|
119
|
+
"gpt-5": [1.25, 10.0],
|
|
120
|
+
"gpt-4.1": [2.0, 8.0],
|
|
121
|
+
"gpt-4o": [2.5, 10.0],
|
|
122
|
+
"gpt-4": [30.0, 60.0],
|
|
123
|
+
"claude-4": [15.0, 75.0],
|
|
124
|
+
"claude-3.7": [3.0, 15.0],
|
|
125
|
+
"claude-3.5": [3.0, 15.0],
|
|
126
|
+
"gemini-2.5-pro": [1.25, 10.0],
|
|
127
|
+
"gemini-2.0-flash": [0.1, 0.4],
|
|
128
|
+
deepseek: [0.55, 2.19],
|
|
129
|
+
qwen: [0.35, 1.4],
|
|
130
|
+
kimi: [0.2, 0.8],
|
|
131
|
+
moonshot: [0.2, 0.8],
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
let inputCostPerMillion = 1.0;
|
|
135
|
+
let outputCostPerMillion = 3.0;
|
|
136
|
+
for (const [key, [inCost, outCost]] of Object.entries(pricingByMillion)) {
|
|
137
|
+
if (normalizedModel.includes(key)) {
|
|
138
|
+
inputCostPerMillion = inCost;
|
|
139
|
+
outputCostPerMillion = outCost;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const estimated =
|
|
145
|
+
(promptTokens / 1_000_000) * inputCostPerMillion +
|
|
146
|
+
(completionTokens / 1_000_000) * outputCostPerMillion;
|
|
147
|
+
if (estimated <= 0) return "$0.0000";
|
|
148
|
+
if (estimated < 0.0001) return "<$0.0001";
|
|
149
|
+
if (estimated < 0.01) return `~$${estimated.toFixed(4)}`;
|
|
150
|
+
return `~$${estimated.toFixed(3)}`;
|
|
151
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared formatting helpers for Milady app views.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
type ByteSizeFormatterOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Fallback string for invalid or negative byte values.
|
|
8
|
+
*/
|
|
9
|
+
unknownLabel?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Precision for KB / MB / GB / TB values.
|
|
12
|
+
*/
|
|
13
|
+
kbPrecision?: number;
|
|
14
|
+
mbPrecision?: number;
|
|
15
|
+
gbPrecision?: number;
|
|
16
|
+
tbPrecision?: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type DateFormatOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* Fallback string for empty/invalid dates.
|
|
22
|
+
*/
|
|
23
|
+
fallback?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional locale override.
|
|
26
|
+
*/
|
|
27
|
+
locale?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type DurationFormatOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* Fallback string for non-positive/invalid durations.
|
|
33
|
+
*/
|
|
34
|
+
fallback?: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Format a byte count in human-readable units.
|
|
39
|
+
*/
|
|
40
|
+
export function formatByteSize(
|
|
41
|
+
bytes: number,
|
|
42
|
+
options: ByteSizeFormatterOptions = {},
|
|
43
|
+
): string {
|
|
44
|
+
const {
|
|
45
|
+
unknownLabel = "unknown",
|
|
46
|
+
kbPrecision = 1,
|
|
47
|
+
mbPrecision = 1,
|
|
48
|
+
gbPrecision = 1,
|
|
49
|
+
tbPrecision = 1,
|
|
50
|
+
} = options;
|
|
51
|
+
|
|
52
|
+
if (!Number.isFinite(bytes) || bytes < 0) return unknownLabel;
|
|
53
|
+
if (bytes >= 1024 ** 4) {
|
|
54
|
+
return `${(bytes / 1024 ** 4).toFixed(tbPrecision)} TB`;
|
|
55
|
+
}
|
|
56
|
+
if (bytes >= 1024 ** 3) {
|
|
57
|
+
return `${(bytes / 1024 ** 3).toFixed(gbPrecision)} GB`;
|
|
58
|
+
}
|
|
59
|
+
if (bytes >= 1024 ** 2) {
|
|
60
|
+
return `${(bytes / 1024 ** 2).toFixed(mbPrecision)} MB`;
|
|
61
|
+
}
|
|
62
|
+
if (bytes >= 1024) {
|
|
63
|
+
return `${(bytes / 1024).toFixed(kbPrecision)} KB`;
|
|
64
|
+
}
|
|
65
|
+
return `${bytes} B`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Format timestamp / date for locale display (`toLocaleString`).
|
|
70
|
+
*/
|
|
71
|
+
export function formatDateTime(
|
|
72
|
+
value: number | string | Date | null | undefined,
|
|
73
|
+
options: DateFormatOptions = {},
|
|
74
|
+
): string {
|
|
75
|
+
const { fallback = "—", locale } = options;
|
|
76
|
+
if (value == null || value === "") return fallback;
|
|
77
|
+
const parsed = value instanceof Date ? value : new Date(value);
|
|
78
|
+
if (!Number.isFinite(parsed.getTime())) return fallback;
|
|
79
|
+
return parsed.toLocaleString(locale);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Format timestamp / date as locale time only (`toLocaleTimeString`).
|
|
84
|
+
*/
|
|
85
|
+
export function formatTime(
|
|
86
|
+
value: number | string | Date | null | undefined,
|
|
87
|
+
options: DateFormatOptions = {},
|
|
88
|
+
): string {
|
|
89
|
+
const { fallback = "—", locale } = options;
|
|
90
|
+
if (value == null || value === "") return fallback;
|
|
91
|
+
const parsed = value instanceof Date ? value : new Date(value);
|
|
92
|
+
if (!Number.isFinite(parsed.getTime())) return fallback;
|
|
93
|
+
return parsed.toLocaleTimeString(locale);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Format timestamp / date as locale date only (`toLocaleDateString`).
|
|
98
|
+
*/
|
|
99
|
+
export function formatShortDate(
|
|
100
|
+
value: number | string | Date | null | undefined,
|
|
101
|
+
options: DateFormatOptions = {},
|
|
102
|
+
): string {
|
|
103
|
+
const { fallback = "—", locale } = options;
|
|
104
|
+
if (value == null || value === "") return fallback;
|
|
105
|
+
const parsed = value instanceof Date ? value : new Date(value);
|
|
106
|
+
if (!Number.isFinite(parsed.getTime())) return fallback;
|
|
107
|
+
return parsed.toLocaleDateString(locale, {
|
|
108
|
+
year: "numeric",
|
|
109
|
+
month: "short",
|
|
110
|
+
day: "numeric",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Format an elapsed duration in milliseconds into a compact human string.
|
|
116
|
+
*/
|
|
117
|
+
export function formatDurationMs(
|
|
118
|
+
ms?: number | null,
|
|
119
|
+
options: DurationFormatOptions = {},
|
|
120
|
+
): string {
|
|
121
|
+
const { fallback = "—" } = options;
|
|
122
|
+
if (!ms || ms <= 0) return fallback;
|
|
123
|
+
if (ms < 60_000) return `${Math.round(ms / 1000)}s`;
|
|
124
|
+
if (ms < 3_600_000) return `${Math.round(ms / 60_000)}m`;
|
|
125
|
+
if (ms < 86_400_000) {
|
|
126
|
+
const hours = ms / 3_600_000;
|
|
127
|
+
return hours === Math.floor(hours) ? `${hours}h` : `${hours.toFixed(1)}h`;
|
|
128
|
+
}
|
|
129
|
+
const days = ms / 86_400_000;
|
|
130
|
+
return days === Math.floor(days) ? `${days}d` : `${days.toFixed(1)}d`;
|
|
131
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export * from "./ApiKeyConfig";
|
|
2
|
+
export * from "./AdvancedPageView";
|
|
3
|
+
export * from "./AgentActivityBox";
|
|
4
|
+
export * from "./AppsPageView";
|
|
5
|
+
export * from "./AppsView";
|
|
6
|
+
export * from "./AvatarLoader";
|
|
7
|
+
export * from "./AvatarSelector";
|
|
8
|
+
export * from "./avatar/VrmEngine";
|
|
9
|
+
export * from "./avatar/VrmViewer";
|
|
10
|
+
export * from "./BscTradePanel";
|
|
11
|
+
export * from "./BugReportModal";
|
|
12
|
+
export * from "./CharacterView";
|
|
13
|
+
export * from "./ChatAvatar";
|
|
14
|
+
export * from "./ChatComposer";
|
|
15
|
+
export * from "./ChatMessage";
|
|
16
|
+
export * from "./ChatModalView";
|
|
17
|
+
export * from "./ChatView";
|
|
18
|
+
export * from "./CloudSourceControls";
|
|
19
|
+
export * from "./CodingAgentSettingsSection";
|
|
20
|
+
export * from "./CommandPalette";
|
|
21
|
+
export * from "./CompanionSceneHost";
|
|
22
|
+
export * from "./CompanionShell";
|
|
23
|
+
export * from "./CompanionView";
|
|
24
|
+
export * from "./ConfigPageView";
|
|
25
|
+
export * from "./ConfigSaveFooter";
|
|
26
|
+
export * from "./ConfirmModal";
|
|
27
|
+
export * from "./ConnectionFailedBanner";
|
|
28
|
+
export * from "./ConversationsSidebar";
|
|
29
|
+
export * from "./ConnectorsPageView";
|
|
30
|
+
export * from "./confirm-delete-control";
|
|
31
|
+
export * from "./CustomActionEditor";
|
|
32
|
+
export * from "./CustomActionsPanel";
|
|
33
|
+
export * from "./CustomActionsView";
|
|
34
|
+
export * from "./DatabasePageView";
|
|
35
|
+
export * from "./DatabaseView";
|
|
36
|
+
export * from "./ElizaCloudDashboard";
|
|
37
|
+
export * from "./EmotePicker";
|
|
38
|
+
export * from "./ErrorBoundary";
|
|
39
|
+
export * from "./FineTuningView";
|
|
40
|
+
export * from "./format";
|
|
41
|
+
export * from "./GameView";
|
|
42
|
+
export * from "./GameViewOverlay";
|
|
43
|
+
export * from "./GlobalEmoteOverlay";
|
|
44
|
+
export * from "./HeartbeatsView";
|
|
45
|
+
export * from "./Header";
|
|
46
|
+
export * from "./InventoryView";
|
|
47
|
+
export * from "./KnowledgeView";
|
|
48
|
+
export * from "./knowledge-upload-image";
|
|
49
|
+
export * from "./LanguageDropdown";
|
|
50
|
+
export * from "./LifoMonitorPanel";
|
|
51
|
+
export * from "./LifoSandboxView";
|
|
52
|
+
export * from "./LoadingScreen";
|
|
53
|
+
export * from "./LogsPageView";
|
|
54
|
+
export * from "./LogsView";
|
|
55
|
+
export * from "./labels";
|
|
56
|
+
export * from "./MediaGalleryView";
|
|
57
|
+
export * from "./MediaSettingsSection";
|
|
58
|
+
export * from "./MessageContent";
|
|
59
|
+
export * from "./ElizaCloudDashboard";
|
|
60
|
+
export * from "./OnboardingWizard";
|
|
61
|
+
export * from "./PairingView";
|
|
62
|
+
export * from "./PermissionsSection";
|
|
63
|
+
export * from "./PluginsPageView";
|
|
64
|
+
export * from "./PluginsView";
|
|
65
|
+
export * from "./ProviderSwitcher";
|
|
66
|
+
export * from "./RestartBanner";
|
|
67
|
+
export * from "./RuntimeView";
|
|
68
|
+
export * from "./SaveCommandModal";
|
|
69
|
+
export * from "./SecretsView";
|
|
70
|
+
export * from "./SettingsView";
|
|
71
|
+
export * from "./ShellOverlays";
|
|
72
|
+
export * from "./ShortcutsOverlay";
|
|
73
|
+
export * from "./SkillsView";
|
|
74
|
+
export * from "./StartupFailureView";
|
|
75
|
+
export * from "./StreamView";
|
|
76
|
+
export * from "./SubscriptionStatus";
|
|
77
|
+
export * from "./SystemWarningBanner";
|
|
78
|
+
export { useSharedCompanionScene } from "./shared-companion-scene-context";
|
|
79
|
+
export * from "./skeletons";
|
|
80
|
+
export * from "./ThemeToggle";
|
|
81
|
+
export * from "./TriggersView";
|
|
82
|
+
export * from "./TrajectoriesView";
|
|
83
|
+
export * from "./TrajectoryDetailView";
|
|
84
|
+
export * from "./trajectory-format";
|
|
85
|
+
export * from "./ui-badges";
|
|
86
|
+
export * from "./ui-switch";
|
|
87
|
+
export * from "./VectorBrowserView";
|
|
88
|
+
export * from "./VoiceConfigView";
|
|
89
|
+
export * from "./VrmStage";
|
|
90
|
+
export * from "./WhatsAppQrOverlay";
|
|
91
|
+
export * from "./chainConfig";
|
|
92
|
+
export * from "./companion-shell-styles";
|
|
93
|
+
export * from "./conversations/ConversationListItem";
|
|
94
|
+
export * from "./conversations/conversation-utils";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncated wallet address with a copy button.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { useTimeout } from "@elizaos/app-core/hooks";
|
|
6
|
+
import { Button } from "@elizaos/ui";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
|
|
9
|
+
export function CopyableAddress({
|
|
10
|
+
address,
|
|
11
|
+
onCopy,
|
|
12
|
+
}: {
|
|
13
|
+
address: string;
|
|
14
|
+
onCopy: (text: string) => Promise<void>;
|
|
15
|
+
}) {
|
|
16
|
+
const { setTimeout } = useTimeout();
|
|
17
|
+
const [copied, setCopied] = useState(false);
|
|
18
|
+
const short = `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
19
|
+
|
|
20
|
+
const handleCopy = async () => {
|
|
21
|
+
await onCopy(address);
|
|
22
|
+
setCopied(true);
|
|
23
|
+
setTimeout(() => setCopied(false), 1500);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className="flex items-center gap-1.5 shrink-0">
|
|
28
|
+
<code className="font-mono text-xs text-muted select-all" title={address}>
|
|
29
|
+
{short}
|
|
30
|
+
</code>
|
|
31
|
+
<Button
|
|
32
|
+
variant="outline"
|
|
33
|
+
size="sm"
|
|
34
|
+
onClick={handleCopy}
|
|
35
|
+
className="h-6 px-1.5 py-0.5 border-border bg-bg text-[10px] font-mono shadow-sm hover:border-accent hover:text-txt"
|
|
36
|
+
>
|
|
37
|
+
{copied ? "copied" : "copy"}
|
|
38
|
+
</Button>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|