@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,499 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import "@elizaos/app-core/styles/xterm.css";
|
|
3
|
+
import {
|
|
4
|
+
client,
|
|
5
|
+
type SandboxBrowserEndpoints,
|
|
6
|
+
type SandboxWindowInfo,
|
|
7
|
+
} from "@elizaos/app-core/api";
|
|
8
|
+
import { LifoMonitorPanel } from "@elizaos/app-core/components";
|
|
9
|
+
import { useLifoSync } from "@elizaos/app-core/hooks";
|
|
10
|
+
import {
|
|
11
|
+
createLifoRuntime,
|
|
12
|
+
generateLifoSessionId,
|
|
13
|
+
isSafeEndpointUrl,
|
|
14
|
+
type LifoRuntime,
|
|
15
|
+
normalizeTerminalText,
|
|
16
|
+
} from "@elizaos/app-core/platform";
|
|
17
|
+
import { useApp } from "@elizaos/app-core/state";
|
|
18
|
+
|
|
19
|
+
interface TerminalOutputEvent {
|
|
20
|
+
event?: unknown;
|
|
21
|
+
command?: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const MONITOR_SCREENSHOT_POLL_MS = 1800;
|
|
25
|
+
const MONITOR_META_POLL_MS = 10000;
|
|
26
|
+
|
|
27
|
+
function formatError(error: unknown): string {
|
|
28
|
+
if (error instanceof Error) {
|
|
29
|
+
return error.message;
|
|
30
|
+
}
|
|
31
|
+
return String(error);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function LifoSandboxView({ inModal }: { inModal?: boolean } = {}) {
|
|
35
|
+
const { t } = useApp();
|
|
36
|
+
const terminalRef = useRef<HTMLDivElement | null>(null);
|
|
37
|
+
const explorerRef = useRef<HTMLDivElement | null>(null);
|
|
38
|
+
const runtimeRef = useRef<LifoRuntime | null>(null);
|
|
39
|
+
const queueRef = useRef<string[]>([]);
|
|
40
|
+
const runningRef = useRef(false);
|
|
41
|
+
const controllerHeartbeatAtRef = useRef(0);
|
|
42
|
+
|
|
43
|
+
const [booting, setBooting] = useState(false);
|
|
44
|
+
const [ready, setReady] = useState(false);
|
|
45
|
+
const [error, setError] = useState<string | null>(null);
|
|
46
|
+
const [output, setOutput] = useState<string[]>([]);
|
|
47
|
+
const [runCount, setRunCount] = useState(0);
|
|
48
|
+
const [sessionKey, setSessionKey] = useState(0);
|
|
49
|
+
|
|
50
|
+
const popoutMode = false;
|
|
51
|
+
const [lifoSessionId] = useState(() => generateLifoSessionId());
|
|
52
|
+
const [controllerOnline, setControllerOnline] = useState(false);
|
|
53
|
+
const controllerOnlineRef = useRef(false);
|
|
54
|
+
controllerOnlineRef.current = controllerOnline;
|
|
55
|
+
const [monitorOnline, setMonitorOnline] = useState(false);
|
|
56
|
+
const [monitorError, setMonitorError] = useState<string | null>(null);
|
|
57
|
+
const [monitorUpdatedAt, setMonitorUpdatedAt] = useState<number | null>(null);
|
|
58
|
+
const [browserEndpoints, setBrowserEndpoints] =
|
|
59
|
+
useState<SandboxBrowserEndpoints | null>(null);
|
|
60
|
+
const [sandboxWindows, setSandboxWindows] = useState<SandboxWindowInfo[]>([]);
|
|
61
|
+
const [noVncFailed, setNoVncFailed] = useState(false);
|
|
62
|
+
const [screenPreviewBase64, setScreenPreviewBase64] = useState<string | null>(
|
|
63
|
+
null,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const appendOutput = useCallback((line: string) => {
|
|
67
|
+
setOutput((prev) => {
|
|
68
|
+
const next = [...prev, line];
|
|
69
|
+
return next.slice(-600);
|
|
70
|
+
});
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
const screenPreviewUrl = screenPreviewBase64
|
|
74
|
+
? `data:image/png;base64,${screenPreviewBase64}`
|
|
75
|
+
: null;
|
|
76
|
+
const noVncEndpoint = browserEndpoints?.noVncEndpoint ?? null;
|
|
77
|
+
const safeNoVncEndpoint =
|
|
78
|
+
noVncEndpoint && isSafeEndpointUrl(noVncEndpoint) ? noVncEndpoint : null;
|
|
79
|
+
const noVncActive = Boolean(safeNoVncEndpoint) && !noVncFailed;
|
|
80
|
+
|
|
81
|
+
const { broadcastSyncMessage } = useLifoSync({
|
|
82
|
+
popoutMode,
|
|
83
|
+
lifoSessionId,
|
|
84
|
+
runtimeRef,
|
|
85
|
+
appendOutput,
|
|
86
|
+
setRunCount,
|
|
87
|
+
setSessionKey,
|
|
88
|
+
setControllerOnline,
|
|
89
|
+
controllerHeartbeatAtRef,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const teardown = useCallback(() => {
|
|
93
|
+
try {
|
|
94
|
+
const term = runtimeRef.current?.terminal;
|
|
95
|
+
if (term && "dispose" in term) {
|
|
96
|
+
(term as { dispose(): void }).dispose();
|
|
97
|
+
}
|
|
98
|
+
} catch {
|
|
99
|
+
// Ignore terminal disposal failures.
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
runtimeRef.current?.explorer.destroy();
|
|
103
|
+
} catch {
|
|
104
|
+
// Ignore teardown failures.
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
runtimeRef.current = null;
|
|
108
|
+
queueRef.current = [];
|
|
109
|
+
runningRef.current = false;
|
|
110
|
+
|
|
111
|
+
if (terminalRef.current) {
|
|
112
|
+
terminalRef.current.innerHTML = "";
|
|
113
|
+
}
|
|
114
|
+
if (explorerRef.current) {
|
|
115
|
+
explorerRef.current.innerHTML = "";
|
|
116
|
+
}
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
const runQueuedCommands = useCallback(async () => {
|
|
120
|
+
const runtime = runtimeRef.current;
|
|
121
|
+
if (!runtime || runningRef.current) return;
|
|
122
|
+
|
|
123
|
+
runningRef.current = true;
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
while (queueRef.current.length > 0) {
|
|
127
|
+
const command = queueRef.current.shift();
|
|
128
|
+
if (!command) continue;
|
|
129
|
+
|
|
130
|
+
runtime.terminal.writeln(`$ ${command}`);
|
|
131
|
+
appendOutput(`$ ${command}`);
|
|
132
|
+
setRunCount((prev) => prev + 1);
|
|
133
|
+
broadcastSyncMessage({ type: "command-start", command });
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const result = await runtime.shell.execute(command, {
|
|
137
|
+
onStdout: (chunk: string) => {
|
|
138
|
+
runtime.terminal.write(normalizeTerminalText(chunk));
|
|
139
|
+
const trimmed = chunk.trimEnd();
|
|
140
|
+
if (trimmed) appendOutput(trimmed);
|
|
141
|
+
broadcastSyncMessage({ type: "stdout", chunk });
|
|
142
|
+
},
|
|
143
|
+
onStderr: (chunk: string) => {
|
|
144
|
+
runtime.terminal.write(normalizeTerminalText(chunk));
|
|
145
|
+
const trimmed = chunk.trimEnd();
|
|
146
|
+
if (trimmed) appendOutput(`stderr: ${trimmed}`);
|
|
147
|
+
broadcastSyncMessage({ type: "stderr", chunk });
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
runtime.terminal.writeln(`[exit ${result.exitCode}]`);
|
|
152
|
+
appendOutput(`[exit ${result.exitCode}]`);
|
|
153
|
+
broadcastSyncMessage({
|
|
154
|
+
type: "command-exit",
|
|
155
|
+
exitCode: result.exitCode,
|
|
156
|
+
});
|
|
157
|
+
} catch (err) {
|
|
158
|
+
const message = formatError(err);
|
|
159
|
+
runtime.terminal.writeln(`error: ${message}`);
|
|
160
|
+
appendOutput(`error: ${message}`);
|
|
161
|
+
broadcastSyncMessage({ type: "command-error", message });
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
runtime.explorer.refresh();
|
|
166
|
+
} catch {
|
|
167
|
+
// Keep processing command queue even if explorer refresh fails.
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
} finally {
|
|
171
|
+
runningRef.current = false;
|
|
172
|
+
}
|
|
173
|
+
}, [appendOutput, broadcastSyncMessage]);
|
|
174
|
+
|
|
175
|
+
const enqueueAgentCommand = useCallback(
|
|
176
|
+
(command: string) => {
|
|
177
|
+
const trimmed = command.trim();
|
|
178
|
+
if (!trimmed) return;
|
|
179
|
+
queueRef.current.push(trimmed);
|
|
180
|
+
void runQueuedCommands();
|
|
181
|
+
},
|
|
182
|
+
[runQueuedCommands],
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const refreshMonitorMeta = useCallback(async () => {
|
|
186
|
+
if (popoutMode) return;
|
|
187
|
+
try {
|
|
188
|
+
const [browser, windowsResponse] = await Promise.all([
|
|
189
|
+
client.getSandboxBrowser(),
|
|
190
|
+
client.getSandboxWindows(),
|
|
191
|
+
]);
|
|
192
|
+
setBrowserEndpoints(browser);
|
|
193
|
+
if (!browser.noVncEndpoint) {
|
|
194
|
+
setNoVncFailed(false);
|
|
195
|
+
}
|
|
196
|
+
setSandboxWindows(
|
|
197
|
+
Array.isArray(windowsResponse.windows) ? windowsResponse.windows : [],
|
|
198
|
+
);
|
|
199
|
+
setMonitorError(null);
|
|
200
|
+
} catch (err) {
|
|
201
|
+
setMonitorError(formatError(err));
|
|
202
|
+
}
|
|
203
|
+
}, []);
|
|
204
|
+
|
|
205
|
+
const refreshScreenPreview = useCallback(async () => {
|
|
206
|
+
if (popoutMode) return;
|
|
207
|
+
if (noVncActive) return;
|
|
208
|
+
try {
|
|
209
|
+
const screenshot = await client.getSandboxScreenshot();
|
|
210
|
+
if (typeof screenshot.data !== "string" || !screenshot.data.trim()) {
|
|
211
|
+
throw new Error("Sandbox screenshot response was empty");
|
|
212
|
+
}
|
|
213
|
+
setScreenPreviewBase64(screenshot.data);
|
|
214
|
+
setMonitorUpdatedAt(Date.now());
|
|
215
|
+
setMonitorOnline(true);
|
|
216
|
+
setMonitorError(null);
|
|
217
|
+
} catch (err) {
|
|
218
|
+
setMonitorOnline(false);
|
|
219
|
+
setMonitorError(formatError(err));
|
|
220
|
+
}
|
|
221
|
+
}, [noVncActive]);
|
|
222
|
+
|
|
223
|
+
useEffect(() => {
|
|
224
|
+
let cancelled = false;
|
|
225
|
+
|
|
226
|
+
const initialize = async () => {
|
|
227
|
+
const terminalElement = terminalRef.current;
|
|
228
|
+
const explorerElement = explorerRef.current;
|
|
229
|
+
if (!terminalElement || !explorerElement) return;
|
|
230
|
+
|
|
231
|
+
teardown();
|
|
232
|
+
setBooting(true);
|
|
233
|
+
setReady(false);
|
|
234
|
+
setError(null);
|
|
235
|
+
setOutput([`Starting Lifo session #${sessionKey + 1}...`]);
|
|
236
|
+
setRunCount(0);
|
|
237
|
+
|
|
238
|
+
try {
|
|
239
|
+
const runtime = await createLifoRuntime(
|
|
240
|
+
terminalElement,
|
|
241
|
+
explorerElement,
|
|
242
|
+
);
|
|
243
|
+
if (cancelled) {
|
|
244
|
+
try {
|
|
245
|
+
runtime.explorer.destroy();
|
|
246
|
+
} catch {
|
|
247
|
+
// Ignore cleanup failure on cancelled boot.
|
|
248
|
+
}
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
runtimeRef.current = runtime;
|
|
253
|
+
runtime.terminal.writeln(
|
|
254
|
+
"Lifo runtime ready. Waiting for agent commands...",
|
|
255
|
+
);
|
|
256
|
+
appendOutput("Lifo runtime ready. Waiting for agent commands...");
|
|
257
|
+
setReady(true);
|
|
258
|
+
|
|
259
|
+
void runQueuedCommands();
|
|
260
|
+
} catch (err) {
|
|
261
|
+
setError(formatError(err));
|
|
262
|
+
} finally {
|
|
263
|
+
setBooting(false);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
void initialize();
|
|
268
|
+
|
|
269
|
+
return () => {
|
|
270
|
+
cancelled = true;
|
|
271
|
+
teardown();
|
|
272
|
+
};
|
|
273
|
+
}, [appendOutput, runQueuedCommands, sessionKey, teardown]);
|
|
274
|
+
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
if (popoutMode) return;
|
|
277
|
+
|
|
278
|
+
let cancelled = false;
|
|
279
|
+
let previewInterval: number | null = null;
|
|
280
|
+
let metaInterval: number | null = null;
|
|
281
|
+
|
|
282
|
+
const refreshMeta = async () => {
|
|
283
|
+
if (cancelled) return;
|
|
284
|
+
await refreshMonitorMeta();
|
|
285
|
+
};
|
|
286
|
+
const refreshPreview = async () => {
|
|
287
|
+
if (cancelled) return;
|
|
288
|
+
await refreshScreenPreview();
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const startPolling = () => {
|
|
292
|
+
stopPolling();
|
|
293
|
+
void refreshMeta();
|
|
294
|
+
void refreshPreview();
|
|
295
|
+
previewInterval = window.setInterval(() => {
|
|
296
|
+
void refreshPreview();
|
|
297
|
+
}, MONITOR_SCREENSHOT_POLL_MS);
|
|
298
|
+
metaInterval = window.setInterval(() => {
|
|
299
|
+
void refreshMeta();
|
|
300
|
+
}, MONITOR_META_POLL_MS);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const stopPolling = () => {
|
|
304
|
+
if (previewInterval) window.clearInterval(previewInterval);
|
|
305
|
+
if (metaInterval) window.clearInterval(metaInterval);
|
|
306
|
+
previewInterval = null;
|
|
307
|
+
metaInterval = null;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const handleVisibilityChange = () => {
|
|
311
|
+
if (document.visibilityState === "visible") {
|
|
312
|
+
startPolling();
|
|
313
|
+
} else {
|
|
314
|
+
stopPolling();
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
startPolling();
|
|
319
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
320
|
+
|
|
321
|
+
return () => {
|
|
322
|
+
cancelled = true;
|
|
323
|
+
stopPolling();
|
|
324
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
325
|
+
};
|
|
326
|
+
}, [refreshMonitorMeta, refreshScreenPreview]);
|
|
327
|
+
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
const unbind = client.onWsEvent(
|
|
330
|
+
"terminal-output",
|
|
331
|
+
(data: Record<string, unknown>) => {
|
|
332
|
+
const event = data as TerminalOutputEvent;
|
|
333
|
+
if (event.event !== "start") return;
|
|
334
|
+
if (typeof event.command !== "string" || !event.command.trim()) return;
|
|
335
|
+
if (!popoutMode && controllerOnlineRef.current) {
|
|
336
|
+
// A dedicated popout controller is active; watcher mirrors via sync.
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
enqueueAgentCommand(event.command);
|
|
340
|
+
},
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
return unbind;
|
|
344
|
+
}, [enqueueAgentCommand]);
|
|
345
|
+
|
|
346
|
+
const resetSession = useCallback(() => {
|
|
347
|
+
setSessionKey((value) => value + 1);
|
|
348
|
+
broadcastSyncMessage({ type: "session-reset" });
|
|
349
|
+
}, [broadcastSyncMessage]);
|
|
350
|
+
|
|
351
|
+
const panelCls = inModal
|
|
352
|
+
? "rounded-xl border border-[var(--border)] overflow-hidden bg-[rgba(255,255,255,0.04)] backdrop-blur-sm"
|
|
353
|
+
: "rounded-xl border border-border overflow-hidden bg-panel";
|
|
354
|
+
const headerCls = inModal
|
|
355
|
+
? "rounded-xl border border-[var(--border)] bg-[rgba(255,255,255,0.04)] backdrop-blur-sm p-3"
|
|
356
|
+
: "rounded-xl border border-border bg-panel p-3";
|
|
357
|
+
const badgeCls = inModal
|
|
358
|
+
? "rounded-full px-2 py-1 text-[11px] font-medium bg-[rgba(255,255,255,0.06)] border border-[var(--border)] text-[var(--muted)]"
|
|
359
|
+
: "rounded-full px-2 py-1 text-[11px] font-medium bg-card border border-border text-muted";
|
|
360
|
+
const btnCls = inModal
|
|
361
|
+
? "px-3 py-1.5 rounded-md border border-[var(--border)] bg-[rgba(255,255,255,0.06)] text-xs text-[var(--txt)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors"
|
|
362
|
+
: "px-3 py-1.5 rounded-md border border-border bg-card text-xs text-txt hover:border-accent hover:text-txt transition-colors";
|
|
363
|
+
|
|
364
|
+
return (
|
|
365
|
+
<section
|
|
366
|
+
className={`h-full flex flex-col gap-3 ${inModal ? "p-4" : "min-h-[620px]"}`}
|
|
367
|
+
>
|
|
368
|
+
<header className={headerCls}>
|
|
369
|
+
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
370
|
+
<div>
|
|
371
|
+
<h2
|
|
372
|
+
className={`text-sm font-semibold ${inModal ? "text-[var(--txt)]" : "text-txt"}`}
|
|
373
|
+
>
|
|
374
|
+
Lifo Agent Surface
|
|
375
|
+
</h2>
|
|
376
|
+
<p
|
|
377
|
+
className={`mt-1 text-xs ${inModal ? "text-[var(--muted)]" : "text-muted"}`}
|
|
378
|
+
>
|
|
379
|
+
Embedded Lifo watcher. Agent commands execute here in real time.
|
|
380
|
+
</p>
|
|
381
|
+
</div>
|
|
382
|
+
|
|
383
|
+
<div className="flex items-center gap-2">
|
|
384
|
+
<span
|
|
385
|
+
className={`rounded-full px-2 py-1 text-[11px] font-medium ${
|
|
386
|
+
error
|
|
387
|
+
? "bg-danger/20 text-danger"
|
|
388
|
+
: ready
|
|
389
|
+
? "bg-ok/20 text-ok"
|
|
390
|
+
: "bg-warn/20 text-warn"
|
|
391
|
+
}`}
|
|
392
|
+
>
|
|
393
|
+
{error ? "error" : ready ? "ready" : "booting"}
|
|
394
|
+
</span>
|
|
395
|
+
|
|
396
|
+
<span className={badgeCls}>embedded</span>
|
|
397
|
+
|
|
398
|
+
<button type="button" onClick={resetSession} className={btnCls}>
|
|
399
|
+
{t("lifosandboxview.Reset")}
|
|
400
|
+
</button>
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
<div
|
|
405
|
+
className={`mt-2 text-[11px] ${inModal ? "text-[var(--muted)]" : "text-muted"}`}
|
|
406
|
+
>
|
|
407
|
+
{t("lifosandboxview.AgentCommandsRepla")}{" "}
|
|
408
|
+
<span className={inModal ? "text-[var(--txt)]" : "text-txt"}>
|
|
409
|
+
{runCount}
|
|
410
|
+
</span>
|
|
411
|
+
</div>
|
|
412
|
+
|
|
413
|
+
{error && (
|
|
414
|
+
<p className="mt-2 rounded-md border border-danger/40 bg-danger/10 px-2 py-1.5 text-xs text-danger">
|
|
415
|
+
{error}
|
|
416
|
+
</p>
|
|
417
|
+
)}
|
|
418
|
+
</header>
|
|
419
|
+
|
|
420
|
+
<div className="grid flex-1 min-h-[360px] grid-cols-1 xl:grid-cols-[360px_1fr] gap-3">
|
|
421
|
+
<div
|
|
422
|
+
className={`${panelCls} min-h-[280px] ${
|
|
423
|
+
popoutMode ? "" : "pointer-events-none select-none"
|
|
424
|
+
}`}
|
|
425
|
+
>
|
|
426
|
+
<div
|
|
427
|
+
className={`px-3 py-2 text-xs font-semibold border-b ${
|
|
428
|
+
inModal
|
|
429
|
+
? "border-[var(--border)] text-[var(--txt)]"
|
|
430
|
+
: "border-border text-txt"
|
|
431
|
+
}`}
|
|
432
|
+
>
|
|
433
|
+
{t("lifosandboxview.Explorer")}
|
|
434
|
+
</div>
|
|
435
|
+
<div ref={explorerRef} className="h-[calc(100%-37px)] w-full" />
|
|
436
|
+
</div>
|
|
437
|
+
<div
|
|
438
|
+
className={`${panelCls} min-h-[280px] ${
|
|
439
|
+
popoutMode ? "" : "pointer-events-none select-none"
|
|
440
|
+
}`}
|
|
441
|
+
>
|
|
442
|
+
<div
|
|
443
|
+
className={`px-3 py-2 text-xs font-semibold border-b ${
|
|
444
|
+
inModal
|
|
445
|
+
? "border-[var(--border)] text-[var(--txt)]"
|
|
446
|
+
: "border-border text-txt"
|
|
447
|
+
}`}
|
|
448
|
+
>
|
|
449
|
+
{t("lifosandboxview.Terminal")}
|
|
450
|
+
</div>
|
|
451
|
+
<div ref={terminalRef} className="h-[calc(100%-37px)] w-full" />
|
|
452
|
+
</div>
|
|
453
|
+
</div>
|
|
454
|
+
|
|
455
|
+
<LifoMonitorPanel
|
|
456
|
+
monitorOnline={monitorOnline}
|
|
457
|
+
monitorError={monitorError}
|
|
458
|
+
monitorUpdatedAt={monitorUpdatedAt}
|
|
459
|
+
noVncActive={noVncActive}
|
|
460
|
+
safeNoVncEndpoint={safeNoVncEndpoint}
|
|
461
|
+
noVncFailed={noVncFailed}
|
|
462
|
+
setNoVncFailed={setNoVncFailed}
|
|
463
|
+
screenPreviewUrl={screenPreviewUrl}
|
|
464
|
+
browserEndpoints={browserEndpoints}
|
|
465
|
+
sandboxWindows={sandboxWindows}
|
|
466
|
+
noVncEndpoint={noVncEndpoint}
|
|
467
|
+
refreshMonitorMeta={refreshMonitorMeta}
|
|
468
|
+
refreshScreenPreview={refreshScreenPreview}
|
|
469
|
+
setMonitorOnline={setMonitorOnline}
|
|
470
|
+
setMonitorError={setMonitorError}
|
|
471
|
+
/>
|
|
472
|
+
|
|
473
|
+
<div
|
|
474
|
+
className={`${
|
|
475
|
+
inModal
|
|
476
|
+
? "rounded-xl border border-[var(--border)] bg-[rgba(255,255,255,0.04)] backdrop-blur-sm"
|
|
477
|
+
: "rounded-xl border border-border bg-panel"
|
|
478
|
+
} p-3 min-h-[140px] max-h-[220px] overflow-auto`}
|
|
479
|
+
>
|
|
480
|
+
<div
|
|
481
|
+
className={`text-xs font-semibold ${inModal ? "text-[var(--txt)]" : "text-txt"}`}
|
|
482
|
+
>
|
|
483
|
+
{t("lifosandboxview.AgentReplayLog")}
|
|
484
|
+
</div>
|
|
485
|
+
<pre
|
|
486
|
+
className={`mt-2 whitespace-pre-wrap break-words text-[11px] font-mono ${
|
|
487
|
+
inModal ? "text-[var(--muted)]" : "text-muted"
|
|
488
|
+
}`}
|
|
489
|
+
>
|
|
490
|
+
{output.length > 0
|
|
491
|
+
? output.join("\n")
|
|
492
|
+
: booting
|
|
493
|
+
? "Booting Lifo..."
|
|
494
|
+
: "Waiting for the agent to run a terminal command."}
|
|
495
|
+
</pre>
|
|
496
|
+
</div>
|
|
497
|
+
</section>
|
|
498
|
+
);
|
|
499
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading screen — NieR: Automata inspired loader with horizontal progress bar,
|
|
3
|
+
* phase label, and percentage indicator.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import type { StartupPhase } from "../state";
|
|
8
|
+
|
|
9
|
+
const PHASE_META: Record<StartupPhase, { label: string; progress: number }> = {
|
|
10
|
+
"starting-backend": { label: "Initializing systems", progress: 20 },
|
|
11
|
+
"initializing-agent": { label: "Loading neural network", progress: 50 },
|
|
12
|
+
ready: { label: "Systems online", progress: 100 },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
interface LoadingScreenProps {
|
|
16
|
+
phase?: StartupPhase;
|
|
17
|
+
elapsedSeconds?: number;
|
|
18
|
+
vrmUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function LoadingScreen({
|
|
22
|
+
phase = "starting-backend",
|
|
23
|
+
elapsedSeconds,
|
|
24
|
+
vrmUrl,
|
|
25
|
+
}: LoadingScreenProps) {
|
|
26
|
+
const [vrmCached, setVrmCached] = useState(false);
|
|
27
|
+
const [, setRuntimeElapsedSeconds] = useState(0);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (typeof elapsedSeconds === "number") return;
|
|
31
|
+
const startedAt = Date.now();
|
|
32
|
+
const timer = setInterval(() => {
|
|
33
|
+
setRuntimeElapsedSeconds(
|
|
34
|
+
Math.max(0, Math.floor((Date.now() - startedAt) / 1000)),
|
|
35
|
+
);
|
|
36
|
+
}, 1000);
|
|
37
|
+
return () => clearInterval(timer);
|
|
38
|
+
}, [elapsedSeconds]);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!vrmUrl) return;
|
|
42
|
+
const controller = new AbortController();
|
|
43
|
+
fetch(vrmUrl, { signal: controller.signal })
|
|
44
|
+
.then(() => setVrmCached(true))
|
|
45
|
+
.catch(() => {
|
|
46
|
+
// Non-blocking — VRM will load normally later.
|
|
47
|
+
});
|
|
48
|
+
return () => controller.abort();
|
|
49
|
+
}, [vrmUrl]);
|
|
50
|
+
|
|
51
|
+
const meta = PHASE_META[phase];
|
|
52
|
+
const progress = vrmCached ? Math.max(meta.progress, 80) : meta.progress;
|
|
53
|
+
const label = vrmCached && phase !== "ready" ? "Loading avatar" : meta.label;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className="loading-screen">
|
|
57
|
+
<div className="loading-screen__center">
|
|
58
|
+
<div className="loading-screen__title">
|
|
59
|
+
LOADING
|
|
60
|
+
<span className="loading-screen__dots" />
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div className="loading-screen__bar-row">
|
|
64
|
+
<div className="loading-screen__progress-track">
|
|
65
|
+
<div
|
|
66
|
+
className="loading-screen__progress-fill"
|
|
67
|
+
style={{ width: `${progress}%` }}
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
<div className="loading-screen__percent">{progress} %</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div className="loading-screen__phase">{label}</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useApp } from "../state";
|
|
2
|
+
import { LogsView } from "./LogsView";
|
|
3
|
+
|
|
4
|
+
export function LogsPageView() {
|
|
5
|
+
const { t } = useApp();
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex flex-col h-full">
|
|
8
|
+
<h2 className="text-lg font-bold mb-1">{t("bugreportmodal.Logs")}</h2>
|
|
9
|
+
<p className="text-[13px] text-[var(--muted)] mb-4">
|
|
10
|
+
{t("logspageview.AgentRuntimeLogsW")}
|
|
11
|
+
</p>
|
|
12
|
+
<div className="flex-1 min-h-0">
|
|
13
|
+
<LogsView />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|