import { useRef, useState } from 'react' import { ChevronDown, ChevronUp } from 'lucide-react' import { useClock } from './hooks/useClock' import { useCommandCenter } from './hooks/useCommandCenter' import { useLiveMetrics } from './hooks/useLiveMetrics' import { SideNav } from './components/layout/SideNav' import { TopBar } from './components/layout/TopBar' import { AgentFleet } from './components/features/AgentFleet' import { ApprovalInbox } from './components/features/ApprovalInbox' import { ChatDrawer } from './components/features/ChatDrawer' import { GpuMonitor } from './components/features/GpuMonitor' import { InfraQuickAccess } from './components/features/InfraQuickAccess' import { InspectorPanel } from './components/features/InspectorPanel' import { PlatformTopology } from './components/features/PlatformTopology' import { PresentationView } from './components/features/PresentationView' import { DataQualityView } from './components/features/DataQualityView' import { KnowledgeChatView } from './components/features/KnowledgeChatView' import { StorageView } from './components/features/StorageView' import { HdfsView } from './components/features/HdfsView' import { SearchView } from './components/features/SearchView' import { SshTerminal } from './components/features/SshTerminal' import { TerminalDock } from './components/features/TerminalDock' import { WorkbenchPanel } from './components/features/WorkbenchPanel' import { resolveInfraNode } from './lib/infraCatalog' import { cn } from './lib/utils' export default function App() { const clock = useClock() const cc = useCommandCenter() const [gpuChatActive, setGpuChatActive] = useState(false) const [infraOpen, setInfraOpen] = useState(false) const [sshOpen, setSshOpen] = useState(false) const gpuBoost = gpuChatActive || cc.mainView === 'knowledge' const { agentLoads, gpuLive } = useLiveMetrics(cc.agents, cc.gpu, cc.anims, gpuBoost) const mainScrollRef = useRef(null) const isPlatform = cc.mainView === 'platform' const openApprovals = () => { cc.setMainView('approvals') mainScrollRef.current?.scrollTo({ top: 0, behavior: 'smooth' }) } const terminalSubject = cc.terminalSubjectId const terminalLabel = (() => { if (cc.selectedAgent) return cc.selectedAgent.name.split(' ยท')[0] const infra = resolveInfraNode(terminalSubject) if (infra) return infra.label if (cc.selectedNode) return cc.selectedNode.label return 'Lab' })() return (
setSshOpen(true)} />
{isPlatform && ( <>
{infraOpen && ( )} )}
{cc.mainView === 'platform' ? ( ) : cc.mainView === 'presentation' ? ( ) : cc.mainView === 'dataquality' ? ( ) : cc.mainView === 'knowledge' ? ( ) : cc.mainView === 'storage' ? ( ) : cc.mainView === 'hdfs' ? ( ) : cc.mainView === 'search' ? ( ) : ( )}
{isPlatform && cc.workbenchMode && ( )}
{isPlatform && (
{!cc.workbenchMode && ( cc.setTerminalExpanded(!cc.terminalExpanded)} /> )}
)}
cc.setChatExpanded(!cc.chatExpanded)} chat={cc.chat} feed={cc.feed} agents={cc.agents} approvals={cc.approvals} selectedAgent={cc.selectedAgent} promptBusy={cc.promptBusy} approvalHighlight={cc.approvalHighlight} filterAgentId={cc.selectedAgentId} onSendPrompt={cc.sendPrompt} onDecide={cc.decide} onDismissHighlight={() => cc.setApprovalHighlight(false)} /> setSshOpen(false)} />
) }