titan-agent 7.0.0 β 7.2.0
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/README.md +54 -2
- package/dist/agent/agent.js +55 -10
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/contextManager.js +1 -1
- package/dist/agent/contextManager.js.map +1 -1
- package/dist/agent/honestyGuard.js +66 -0
- package/dist/agent/honestyGuard.js.map +1 -0
- package/dist/agent/selfCritique.js +101 -0
- package/dist/agent/selfCritique.js.map +1 -0
- package/dist/agent/toolSearch.js +9 -2
- package/dist/agent/toolSearch.js.map +1 -1
- package/dist/agent/trajectoryLogger.js +19 -2
- package/dist/agent/trajectoryLogger.js.map +1 -1
- package/dist/analytics/collector.js +1 -1
- package/dist/analytics/collector.js.map +1 -1
- package/dist/config/schema.js +32 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/eval/harness.js +4 -1
- package/dist/eval/harness.js.map +1 -1
- package/dist/gateway/server.js +24 -8
- package/dist/gateway/server.js.map +1 -1
- package/dist/gateway/slashCommands.js +31 -0
- package/dist/gateway/slashCommands.js.map +1 -1
- package/dist/mcp/agentTools.js +135 -0
- package/dist/mcp/agentTools.js.map +1 -0
- package/dist/mcp/server.js +19 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/memory/graph.js +2 -0
- package/dist/memory/graph.js.map +1 -1
- package/dist/providers/errorTaxonomy.js +4 -0
- package/dist/providers/errorTaxonomy.js.map +1 -1
- package/dist/providers/moa.js +151 -0
- package/dist/providers/moa.js.map +1 -0
- package/dist/providers/modelCapabilities.js +65 -2
- package/dist/providers/modelCapabilities.js.map +1 -1
- package/dist/providers/ollama.js +1 -0
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai_compat.js +14 -2
- package/dist/providers/openai_compat.js.map +1 -1
- package/dist/providers/router.js +3 -1
- package/dist/providers/router.js.map +1 -1
- package/dist/utils/benchMode.js +8 -0
- package/dist/utils/benchMode.js.map +1 -0
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/package.json +26 -26
- package/ui/dist/assets/AboutYouMemory-57X5SqHQ.js +1 -0
- package/ui/dist/assets/AuditPanel-AyB8ciLZ.js +1 -0
- package/ui/dist/assets/AutonomyPanel-wmVPr-n3.js +1 -0
- package/ui/dist/assets/AutopilotPanel-CbLy4lJP.js +1 -0
- package/ui/dist/assets/AutoresearchPanel-DxRO1rBF.js +1 -0
- package/ui/dist/assets/BackupPanel-BUh9rQ-3.js +1 -0
- package/ui/dist/assets/BrowserPanel-OqKwGrIL.js +1 -0
- package/ui/dist/assets/CPActivity-DGfS7EY3.js +1 -0
- package/ui/dist/assets/CPAgentDetail-p0Kvzhhb.js +1 -0
- package/ui/dist/assets/CPAgents-B6wSSQZM.js +1 -0
- package/ui/dist/assets/CPApprovals-CYv9Do0i.js +1 -0
- package/ui/dist/assets/CPCosts-Dx6Q71rN.js +1 -0
- package/ui/dist/assets/CPDashboard-DA8-tE-l.js +1 -0
- package/ui/dist/assets/CPFiles-BJ49tzai.js +1 -0
- package/ui/dist/assets/CPGoals-h0dKL5V_.js +1 -0
- package/ui/dist/assets/CPInbox-CDvefgNH.js +1 -0
- package/ui/dist/assets/CPIssueDetail-CnmLzzDD.js +1 -0
- package/ui/dist/assets/CPIssues-DknAIMyl.js +1 -0
- package/ui/dist/assets/CPLayout-C2nqgkmY.js +2 -0
- package/ui/dist/assets/CPOrg-tDbHFphX.js +1 -0
- package/ui/dist/assets/CPRuns-UlrIURqG.js +1 -0
- package/ui/dist/assets/CPSocial-B-gHgvEw.js +1 -0
- package/ui/dist/assets/CPVoice-CJy938ZF.js +1 -0
- package/ui/dist/assets/ChannelsPanel-DLbxg1zO.js +1 -0
- package/ui/dist/assets/CheckpointsPanel-BB6TT0aE.js +1 -0
- package/ui/dist/assets/CommandPostHub-fIslwU_t.js +2 -0
- package/ui/dist/assets/ConfirmDialog-6hcNjmAh.js +9 -0
- package/ui/dist/assets/CronPanel-DLpw3Y25.js +1 -0
- package/ui/dist/assets/DataTable-KVqtDzvP.js +1 -0
- package/ui/dist/assets/DreamPanel-lcMXpbEb.js +5 -0
- package/ui/dist/assets/EmptyState-D-Dg8B8r.js +1 -0
- package/ui/dist/assets/EvalHarnessPanel-BKzRiiQw.js +2 -0
- package/ui/dist/assets/EvalPanel-Dtodacmj.js +1 -0
- package/ui/dist/assets/FileViewer-DjcVKkO2.js +60 -0
- package/ui/dist/assets/FilesPanel-BI90Pplh.js +1 -0
- package/ui/dist/assets/FleetPanel-tr0wjAwr.js +1 -0
- package/ui/dist/assets/HomelabPanel-m8vMm5rE.js +1 -0
- package/ui/dist/assets/InfraView-3WriJnyE.js +2 -0
- package/ui/dist/assets/IntegrationsPanel-BmL70fOw.js +1 -0
- package/ui/dist/assets/IntelligenceView-BGVxCKD3.js +2 -0
- package/ui/dist/assets/LearningPanel-CrYLQ6eV.js +1 -0
- package/ui/dist/assets/LiveStudio-CnW3eZYF.js +2 -0
- package/ui/dist/assets/LogsPanel-DbShr4Ic.js +1 -0
- package/ui/dist/assets/McpPanel-uMYEsPI4.js +1 -0
- package/ui/dist/assets/MemoryGraphPanel-C7-Z8f0v.js +1 -0
- package/ui/dist/assets/MemoryTaxonomyPanel-KrxN8U1G.js +1 -0
- package/ui/dist/assets/MemoryWikiPanel-DI3q6IHC.js +1 -0
- package/ui/dist/assets/MeshPanel-D4-g2tlu.js +1 -0
- package/ui/dist/assets/MissionCanvas-D8cjakJe.js +61 -0
- package/ui/dist/assets/MissionChat-BvqCUf1E.js +3 -0
- package/ui/dist/assets/MissionLibrary-CZoJQ9WD.js +1 -0
- package/ui/dist/assets/MissionStart-CXCq-_AD.js +1 -0
- package/ui/dist/assets/NvidiaPanel-BfI1K5Pg.js +1 -0
- package/ui/dist/assets/OrganismPanel-B7Gm9pP-.js +1 -0
- package/ui/dist/assets/OverviewPanel-B9tKWRK2.js +1 -0
- package/ui/dist/assets/PageHeader-CH85uoZG.js +1 -0
- package/ui/dist/assets/PersonaProfilesPanel-BPi8fl-U.js +3 -0
- package/ui/dist/assets/PersonasPanel-Dwr7sycT.js +1 -0
- package/ui/dist/assets/PhoneDeskPanel-D7qc6wUI.js +1 -0
- package/ui/dist/assets/RecipesPanel-DcqPWRSU.js +1 -0
- package/ui/dist/assets/SecurityPanel-Bv_B9Ahf.js +1 -0
- package/ui/dist/assets/SelfImprovePanel-Ca4rGwEG.js +1 -0
- package/ui/dist/assets/SelfProposalsPanel-DteMSASq.js +1 -0
- package/ui/dist/assets/SessionsPanel-BdbbKTbL.js +1 -0
- package/ui/dist/assets/SessionsTab-BJipiVJs.js +1 -0
- package/ui/dist/assets/SettingsPanel-mV7ykOCc.js +1 -0
- package/ui/dist/assets/SettingsView-Bu_wYTT5.js +2 -0
- package/ui/dist/assets/SkeletonLoader-9H7QWa9E.js +1 -0
- package/ui/dist/assets/SkillsPanel-CHwX2kDR.js +1 -0
- package/ui/dist/assets/SomaView-Bpsm4ZW7.js +5 -0
- package/ui/dist/assets/SomaView-Dghh9om4.css +1 -0
- package/ui/dist/assets/StatCard-wmSgMAM3.js +1 -0
- package/ui/dist/assets/TeamsPanel-XJiHxdDX.js +1 -0
- package/ui/dist/assets/TelemetryPanel-_pmGVxpO.js +1 -0
- package/ui/dist/assets/TitanCanvas-Cb7KG80W.css +1 -0
- package/ui/dist/assets/TitanCanvas-CmLy7p2N.js +883 -0
- package/ui/dist/assets/ToolsView-PHizHZBx.js +2 -0
- package/ui/dist/assets/TraceViewer-CYAzIcfB.js +1 -0
- package/ui/dist/assets/TracesPanel-CRSN_dzK.js +1 -0
- package/ui/dist/assets/TrainingPanel-B9rcuMsV.js +1 -0
- package/ui/dist/assets/VoiceOverlay-BL_ns1ZA.js +7 -0
- package/ui/dist/assets/VramPanel-BNPQ06_9.js +1 -0
- package/ui/dist/assets/WatchView-BgAkNnur.js +13 -0
- package/ui/dist/assets/WorkTab-RRpPpEOg.js +1 -0
- package/ui/dist/assets/WorkflowBuilderPanel-BPHIH8pf.js +1 -0
- package/ui/dist/assets/WorkflowsPanel-DqtmT0NB.js +1 -0
- package/ui/dist/assets/approvalHeadline-BRg3ReTi.js +1 -0
- package/ui/dist/assets/archive-DcK9HrbE.js +1 -0
- package/ui/dist/assets/arrow-left-4c2FnES1.js +1 -0
- package/ui/dist/assets/book-open-Ds_yciQm.js +1 -0
- package/ui/dist/assets/bot-CWDCc265.js +1 -0
- package/ui/dist/assets/chart-column-hhZMdCgB.js +1 -0
- package/ui/dist/assets/chevron-right-A_pvnRh_.js +1 -0
- package/ui/dist/assets/circle-check-big-C-JUM7wb.js +1 -0
- package/ui/dist/assets/circle-stop-yZuG9ZAE.js +1 -0
- package/ui/dist/assets/clipboard-list-C2HUEjZc.js +1 -0
- package/ui/dist/assets/clock-DSPgndSD.js +1 -0
- package/ui/dist/assets/clsx-CjueKrWZ.js +1 -0
- package/ui/dist/assets/createLucideIcon-qnlrxww7.js +1 -0
- package/ui/dist/assets/database-C1SgHa8T.js +1 -0
- package/ui/dist/assets/dollar-sign-D9siqK91.js +1 -0
- package/ui/dist/assets/download-CJZWQNfV.js +1 -0
- package/ui/dist/assets/external-link-CpQLWKKE.js +1 -0
- package/ui/dist/assets/file-text-BbGTi-Po.js +1 -0
- package/ui/dist/assets/flask-conical-B1YVft4E.js +1 -0
- package/ui/dist/assets/folder-EbR-w2Mq.js +1 -0
- package/ui/dist/assets/funnel-D2Dkn8Pf.js +1 -0
- package/ui/dist/assets/git-branch-CQ2yNSzU.js +1 -0
- package/ui/dist/assets/git-pull-request-BxL5wlGX.js +1 -0
- package/ui/dist/assets/index-Cz8190xO.css +2 -0
- package/ui/dist/assets/index-WI-E4I3h.js +243 -0
- package/ui/dist/assets/jsx-runtime-B15e6lOy.js +1 -0
- package/ui/dist/assets/layers-BPu5SRjI.js +1 -0
- package/ui/dist/assets/legacy-BIzifT-t.js +3 -0
- package/ui/dist/assets/lightbulb-BY7CpMte.js +1 -0
- package/ui/dist/assets/link-VDQkrGJw.js +1 -0
- package/ui/dist/assets/list-todo-DfnNUV_T.js +1 -0
- package/ui/dist/assets/message-square-BpzrINHz.js +1 -0
- package/ui/dist/assets/mic-De6oZFaV.js +1 -0
- package/ui/dist/assets/missions-y-qg_f9b.js +1 -0
- package/ui/dist/assets/network-CM7y1ats.js +1 -0
- package/ui/dist/assets/pause-C4TDJSfA.js +1 -0
- package/ui/dist/assets/pencil-Dd_vzHE-.js +1 -0
- package/ui/dist/assets/play-9WxZWVHA.js +1 -0
- package/ui/dist/assets/plug-Dm25Wbrc.js +1 -0
- package/ui/dist/assets/plus-CHryCIkk.js +1 -0
- package/ui/dist/assets/radio-D-XnoAVu.js +1 -0
- package/ui/dist/assets/refresh-cw-Disd5wRB.js +1 -0
- package/ui/dist/assets/rotate-ccw-Cw1T2W1T.js +1 -0
- package/ui/dist/assets/save-DP7oNar2.js +1 -0
- package/ui/dist/assets/search-aNVcX-nv.js +1 -0
- package/ui/dist/assets/send-D7iQD57b.js +1 -0
- package/ui/dist/assets/server-DFfeYjoM.js +1 -0
- package/ui/dist/assets/settings-5NWXzgyY.js +1 -0
- package/ui/dist/assets/shared-DLz_Jtg3.js +1 -0
- package/ui/dist/assets/shield-check-Cd50jCAn.js +1 -0
- package/ui/dist/assets/square-DlcoJ1ZM.js +1 -0
- package/ui/dist/assets/terminal-DgFz2Vsf.js +1 -0
- package/ui/dist/assets/test-tube-BimtS92_.js +1 -0
- package/ui/dist/assets/toggle-right-BMaR-sfT.js +1 -0
- package/ui/dist/assets/trash-2-CwUv7ww1.js +1 -0
- package/ui/dist/assets/trending-up-Ba9TwEow.js +1 -0
- package/ui/dist/assets/trophy-Gfv1QC45.js +1 -0
- package/ui/dist/assets/volume-2-BVlfVl2U.js +1 -0
- package/ui/dist/assets/wifi-off-CWLeusSV.js +1 -0
- package/ui/dist/assets/zoom-out-DeggJ7RM.js +1 -0
- package/ui/dist/index.html +4 -2
- package/ui/dist/sw.js +1 -1
- package/ui/dist/assets/AboutYouMemory-CZKEOd_O.js +0 -11
- package/ui/dist/assets/AuditPanel-Bu71N5Er.js +0 -1
- package/ui/dist/assets/AutonomyPanel-DB-39dX4.js +0 -11
- package/ui/dist/assets/AutopilotPanel-Cj8oKxWv.js +0 -1
- package/ui/dist/assets/AutoresearchPanel-3s8pjm6Z.js +0 -6
- package/ui/dist/assets/BackupPanel-EUQJMJE7.js +0 -1
- package/ui/dist/assets/BrowserPanel-Beo4F5Ar.js +0 -6
- package/ui/dist/assets/Button-MdXmb4_n.js +0 -1
- package/ui/dist/assets/CPActivity-B1Se9VVc.js +0 -1
- package/ui/dist/assets/CPAgentDetail-BYji6tT8.js +0 -1
- package/ui/dist/assets/CPAgents-BSUKucTe.js +0 -1
- package/ui/dist/assets/CPApprovals-B4v0em6e.js +0 -1
- package/ui/dist/assets/CPCosts-9ikh61Kv.js +0 -1
- package/ui/dist/assets/CPDashboard-sOok2T5v.js +0 -1
- package/ui/dist/assets/CPFiles-DB2nY5JE.js +0 -1
- package/ui/dist/assets/CPGoals-8Z1yOY8e.js +0 -1
- package/ui/dist/assets/CPInbox-Cq6-UY8F.js +0 -11
- package/ui/dist/assets/CPIssueDetail-NAGfmJg8.js +0 -1
- package/ui/dist/assets/CPIssues-BzX6Rckx.js +0 -1
- package/ui/dist/assets/CPLayout-BcRM6QSg.js +0 -2
- package/ui/dist/assets/CPOrg-B7DQ4UQP.js +0 -1
- package/ui/dist/assets/CPRuns-D-cpPw_M.js +0 -1
- package/ui/dist/assets/CPSocial-DshtmcK0.js +0 -11
- package/ui/dist/assets/CPVoice-DfXRnQVU.js +0 -1
- package/ui/dist/assets/ChannelsPanel-BnaTOeyf.js +0 -1
- package/ui/dist/assets/CheckpointsPanel-C62naE4U.js +0 -1
- package/ui/dist/assets/CommandPostHub-B_L1CAss.js +0 -24
- package/ui/dist/assets/ConfirmDialog-VErHWAbo.js +0 -1
- package/ui/dist/assets/CronPanel-BwMrrZ5d.js +0 -1
- package/ui/dist/assets/DataTable-BCqSUuN7.js +0 -1
- package/ui/dist/assets/DreamPanel-BNAcCLBB.js +0 -15
- package/ui/dist/assets/EmptyState-D9kQf1PX.js +0 -1
- package/ui/dist/assets/EvalHarnessPanel-BaMLdBNm.js +0 -2
- package/ui/dist/assets/EvalPanel-CW-SSjtg.js +0 -1
- package/ui/dist/assets/FileViewer-BL00nsd7.js +0 -61
- package/ui/dist/assets/FilesPanel-CeC6YUSd.js +0 -16
- package/ui/dist/assets/FleetPanel-EyWF7l3W.js +0 -1
- package/ui/dist/assets/HomelabPanel-BRfKRYe7.js +0 -6
- package/ui/dist/assets/InfraView-Jmqhg_Yc.js +0 -2
- package/ui/dist/assets/InlineEditableField-DgMrLDj1.js +0 -1
- package/ui/dist/assets/Input-CBTwa_Iw.js +0 -1
- package/ui/dist/assets/IntegrationsPanel-DQL-7Ec6.js +0 -1
- package/ui/dist/assets/IntelligenceView-DxD78qfP.js +0 -2
- package/ui/dist/assets/LearningPanel-C_JzSbJU.js +0 -1
- package/ui/dist/assets/LiveStudio-Db5yeaWo.js +0 -7
- package/ui/dist/assets/LogsPanel-CpinKwaZ.js +0 -1
- package/ui/dist/assets/McpPanel-D-MqN_f-.js +0 -1
- package/ui/dist/assets/MemoryGraphPanel-BnD5jRqf.js +0 -1
- package/ui/dist/assets/MemoryTaxonomyPanel-BBI202dd.js +0 -6
- package/ui/dist/assets/MemoryWikiPanel-Dn3XZHL0.js +0 -6
- package/ui/dist/assets/MeshPanel-C-mRJpr0.js +0 -11
- package/ui/dist/assets/MissionCanvas-CbZW83Ch.js +0 -72
- package/ui/dist/assets/MissionChat-Bs75jPAD.js +0 -7
- package/ui/dist/assets/MissionLibrary-BxQ6SxPe.js +0 -5
- package/ui/dist/assets/MissionStart-CBuBPasl.js +0 -1
- package/ui/dist/assets/Modal-ybPGvlQs.js +0 -9
- package/ui/dist/assets/NvidiaPanel-DdG13OX4.js +0 -1
- package/ui/dist/assets/OrganismPanel-xZWUJKyr.js +0 -1
- package/ui/dist/assets/OverviewPanel-B45ZYhJV.js +0 -1
- package/ui/dist/assets/PageHeader-DdrbS1aq.js +0 -1
- package/ui/dist/assets/PersonaProfilesPanel-CKER-EU5.js +0 -8
- package/ui/dist/assets/PersonasPanel-CMMQ3nh3.js +0 -1
- package/ui/dist/assets/PhoneDeskPanel-Bw_Y-cVE.js +0 -11
- package/ui/dist/assets/RecipesPanel-DzMcxpJJ.js +0 -1
- package/ui/dist/assets/SecurityPanel-BCq3Fzbr.js +0 -1
- package/ui/dist/assets/SelfImprovePanel-YE3hT8jK.js +0 -1
- package/ui/dist/assets/SelfProposalsPanel-DXuqBM6p.js +0 -1
- package/ui/dist/assets/SessionsPanel-DORz5goR.js +0 -1
- package/ui/dist/assets/SessionsTab-qYHDOuC8.js +0 -1
- package/ui/dist/assets/SettingsPanel-BbwPu1i7.js +0 -1
- package/ui/dist/assets/SettingsView-zgqkDDBJ.js +0 -2
- package/ui/dist/assets/SkeletonLoader-r6OGXaU9.js +0 -1
- package/ui/dist/assets/SkillsPanel-BjEOBMRo.js +0 -11
- package/ui/dist/assets/SomaView-BtCkeWfZ.css +0 -1
- package/ui/dist/assets/SomaView-DLzApZVW.js +0 -5
- package/ui/dist/assets/StatCard-DLq8aBps.js +0 -1
- package/ui/dist/assets/StatusBadge-BqlvIbdj.js +0 -1
- package/ui/dist/assets/Tabs-DdUThlp1.js +0 -1
- package/ui/dist/assets/TeamsPanel-uIIKoU7I.js +0 -1
- package/ui/dist/assets/TelemetryPanel-dVr3yQQr.js +0 -1
- package/ui/dist/assets/TitanCanvas-BfitWg9R.css +0 -1
- package/ui/dist/assets/TitanCanvas-xHAJqwG2.js +0 -945
- package/ui/dist/assets/ToolsView-CG1mZdiy.js +0 -2
- package/ui/dist/assets/Tooltip-C2tXJcrN.js +0 -6
- package/ui/dist/assets/TraceViewer-BIMD_Osr.js +0 -1
- package/ui/dist/assets/TracesPanel-nMUiyMj5.js +0 -1
- package/ui/dist/assets/TrainingPanel-CT5R4HWm.js +0 -1
- package/ui/dist/assets/VoiceOverlay-Br4QnCtw.js +0 -17
- package/ui/dist/assets/VramPanel-CdnJYytg.js +0 -1
- package/ui/dist/assets/WatchView-TNU6Ns1Q.js +0 -13
- package/ui/dist/assets/WorkTab-wTlX_UKP.js +0 -1
- package/ui/dist/assets/WorkflowBuilderPanel-CDpVt5ux.js +0 -6
- package/ui/dist/assets/WorkflowsPanel-zsFqsLdn.js +0 -11
- package/ui/dist/assets/approvalHeadline-DB9SgR-9.js +0 -1
- package/ui/dist/assets/archive-Bh689DNg.js +0 -6
- package/ui/dist/assets/arrow-left-WkVYLm80.js +0 -6
- package/ui/dist/assets/book-open-ohEXgUsS.js +0 -6
- package/ui/dist/assets/bot-DvEcyQcD.js +0 -6
- package/ui/dist/assets/chart-column-w3goFd5f.js +0 -6
- package/ui/dist/assets/check-CuRYh4Zh.js +0 -6
- package/ui/dist/assets/chevron-right-DbLSHmff.js +0 -6
- package/ui/dist/assets/circle-check-big-Bkba568b.js +0 -6
- package/ui/dist/assets/circle-stop-Bx2ohEg8.js +0 -6
- package/ui/dist/assets/clipboard-list-Dj9tORnu.js +0 -6
- package/ui/dist/assets/clock-JyQAYy6X.js +0 -6
- package/ui/dist/assets/clsx-B-dksMZM.js +0 -1
- package/ui/dist/assets/dollar-sign-XxwPAA2a.js +0 -6
- package/ui/dist/assets/download-D1izVEOL.js +0 -6
- package/ui/dist/assets/external-link-DZ_rZsIt.js +0 -6
- package/ui/dist/assets/file-text-Cfawu8Bs.js +0 -6
- package/ui/dist/assets/flask-conical-Ql8QxhgY.js +0 -6
- package/ui/dist/assets/folder-DAdIw-Pb.js +0 -6
- package/ui/dist/assets/funnel-FycfZcXo.js +0 -6
- package/ui/dist/assets/git-branch-C2qrhGGu.js +0 -6
- package/ui/dist/assets/index-Cml2x9pA.js +0 -507
- package/ui/dist/assets/index-yWybhcfI.css +0 -1
- package/ui/dist/assets/layers-yzjtGlHB.js +0 -6
- package/ui/dist/assets/legacy-D21WSMF1.js +0 -3
- package/ui/dist/assets/lightbulb-BZJNK69S.js +0 -6
- package/ui/dist/assets/link-CnFkBkaY.js +0 -6
- package/ui/dist/assets/list-todo-BlgfQHup.js +0 -6
- package/ui/dist/assets/message-square-CRsG9u6_.js +0 -6
- package/ui/dist/assets/mic-B32RHc7Y.js +0 -6
- package/ui/dist/assets/missions-1iw8Z2_0.js +0 -1
- package/ui/dist/assets/network-C9RXQGrV.js +0 -6
- package/ui/dist/assets/pause-BT1Bc2q3.js +0 -6
- package/ui/dist/assets/pencil-BK5IU6o0.js +0 -6
- package/ui/dist/assets/play-Cl1nC_gc.js +0 -6
- package/ui/dist/assets/plug-DvcpOalj.js +0 -6
- package/ui/dist/assets/plus-Dpo1qfrl.js +0 -6
- package/ui/dist/assets/radio-C5c9IyqX.js +0 -6
- package/ui/dist/assets/refresh-cw-C-iZkzuS.js +0 -6
- package/ui/dist/assets/rotate-ccw-qzrB3SNw.js +0 -6
- package/ui/dist/assets/save-DwR9wQVu.js +0 -6
- package/ui/dist/assets/search-D10l0m3-.js +0 -6
- package/ui/dist/assets/send-DtXGsaFW.js +0 -6
- package/ui/dist/assets/server-BzisF3LL.js +0 -6
- package/ui/dist/assets/settings-Dbwd1_-c.js +0 -6
- package/ui/dist/assets/shield-check-CXlDJyAW.js +0 -6
- package/ui/dist/assets/square-BBC-JKzY.js +0 -11
- package/ui/dist/assets/terminal-DaBIlWEM.js +0 -6
- package/ui/dist/assets/test-tube-CDATRD5t.js +0 -11
- package/ui/dist/assets/toggle-right-DTmrC5RD.js +0 -11
- package/ui/dist/assets/trash-2-CTeyjxD_.js +0 -6
- package/ui/dist/assets/trending-up-CXPRjRV4.js +0 -6
- package/ui/dist/assets/trophy-DbVdXRtU.js +0 -6
- package/ui/dist/assets/volume-2-DYDBmm3M.js +0 -6
- package/ui/dist/assets/wifi-off-BBuIGbiP.js +0 -6
- package/ui/dist/assets/zoom-out-D47_pRAO.js +0 -16
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{n as r,r as i,t as a}from"./zoom-out-DeggJ7RM.js";import{t as o}from"./network-CM7y1ats.js";import{t as s}from"./refresh-cw-Disd5wRB.js";import{t as c}from"./search-aNVcX-nv.js";import{t as l}from"./trash-2-CwUv7ww1.js";import{H as u,a as d,s as f}from"./index-WI-E4I3h.js";import{t as p}from"./ConfirmDialog-6hcNjmAh.js";var m=e(t(),1),h=n(),g={person:`#818cf8`,topic:`#22d3ee`,project:`#34d399`,place:`#fbbf24`,fact:`#f472b6`,tool:`#fb923c`,preference:`#a78bfa`,software:`#38bdf8`,system:`#e879f9`,event:`#fb7185`,product:`#4ade80`,company:`#facc15`,file:`#94a3b8`,technology:`#2dd4bf`,hardware:`#f97316`,component:`#c084fc`,feature:`#67e8f9`,directory:`#a1a1aa`,social_post:`#ec4899`},_={person:`Person`,topic:`Topic`,project:`Project`,place:`Place`,fact:`Fact`,tool:`Tool`,preference:`Preference`,software:`Software`,system:`System`,event:`Event`,product:`Product`,company:`Company`,file:`File`,technology:`Technology`,hardware:`Hardware`,component:`Component`,feature:`Feature`,directory:`Directory`,social_post:`Social Post`},v=[`#f0abfc`,`#86efac`,`#fda4af`,`#7dd3fc`,`#d9f99d`,`#fcd34d`];function y(e){let t=e?.toLowerCase();if(g[t])return g[t];let n=0;for(let e=0;e<(t?.length??0);e++)n=(n<<5)-n+t.charCodeAt(e)|0;return v[Math.abs(n)%v.length]}function b(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function x(e){return typeof e==`number`&&Number.isFinite(e)}function S(e){return x(e.x)&&x(e.y)}function C(e,t,n,r){let i=e.length;if(i===0||!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0)return;let a=n/2,o=r/2,s=new Map;for(let t=0;t<i;t++){let n=e[t].type?.toLowerCase()??`unknown`;s.has(n)||s.set(n,[]),s.get(n).push(t)}let c=[...s.keys()],l=new Map,u=Math.min(n,r)*.3;for(let e=0;e<c.length;e++){let t=e/c.length*Math.PI*2-Math.PI/2;l.set(c[e],{x:a+Math.cos(t)*u,y:o+Math.sin(t)*u})}for(let t=0;t<i;t++){let i=e[t];if(S(i))continue;let s=l.get(i.type?.toLowerCase()??`unknown`)??{x:a,y:o},c=Math.min(n,r)*.12;i.x=s.x+(Math.random()-.5)*c,i.y=s.y+(Math.random()-.5)*c,i.vx=0,i.vy=0}let d=new Map(e.map(e=>[e.id,e])),f=Math.sqrt(i/50),p=Math.min(200,Math.max(80,Math.round(60+i*.2))),m=4e3*f,h=.003/f,g=.003/f,_=new Map;for(let e of t)_.has(e.from)||_.set(e.from,new Set),_.has(e.to)||_.set(e.to,new Set),_.get(e.from).add(e.to),_.get(e.to).add(e.from);for(let s=0;s<p;s++){let c=.9-s/p*.35,u=s/p;if(i>200)for(let t=0;t<i;t++){let n=e[t];if(!S(n))continue;let r=_.get(n.id)??new Set;for(let a=t+1;a<i;a++){if(!r.has(e[a].id)&&Math.random()>.2)continue;let t=e[a];if(!S(t))continue;let i=n.x-t.x,o=n.y-t.y,s=i*i+o*o,c=Math.sqrt(s)||1,l=m/(s+100),u=i/c*l,d=o/c*l;n.vx+=u,n.vy+=d,t.vx-=u,t.vy-=d}}else for(let t=0;t<i;t++)for(let n=t+1;n<i;n++){let r=e[t],i=e[n];if(!S(r)||!S(i))continue;let a=r.x-i.x,o=r.y-i.y,s=a*a+o*o,c=Math.sqrt(s)||1,l=m/(s+100),u=a/c*l,d=o/c*l;r.vx+=u,r.vy+=d,i.vx-=u,i.vy-=d}for(let e of t){let t=d.get(e.from),n=d.get(e.to);if(!t||!n||!S(t)||!S(n))continue;let r=n.x-t.x,i=n.y-t.y,a=Math.sqrt(r*r+i*i)||1,o=a*h,s=r/a*o,c=i/a*o;t.vx+=s,t.vy+=c,n.vx-=s,n.vy-=c}let f=.015*(1-u*.5);for(let t of e){if(!S(t))continue;let e=l.get(t.type?.toLowerCase()??`unknown`);e&&(t.vx+=(e.x-t.x)*f,t.vy+=(e.y-t.y)*f)}for(let t of e)S(t)&&(t.vx+=(a-t.x)*g,t.vy+=(o-t.y)*g);for(let t of e)S(t)&&(t.vx*=c,t.vy*=c,t.x+=t.vx,t.y+=t.vy,(!Number.isFinite(t.x)||!Number.isFinite(t.y))&&(t.x=a,t.y=o),t.x=Math.max(40,Math.min(Math.max(40,n-40),t.x)),t.y=Math.max(40,Math.min(Math.max(40,r-40),t.y)))}}function w(e,t,n,r,i){let a=(e+n)/2,o=(t+r)/2,s=n-e,c=-(r-t),l=s,u=Math.sqrt(c*c+l*l)||1;return{cx:a+c/u*i,cy:o+l/u*i}}function T(e,t,n,r,i,a,o){let s=Math.atan2(n-i,t-r),c=t-Math.cos(s)*a,l=n-Math.sin(s)*a;e.beginPath(),e.moveTo(c,l),e.lineTo(c-Math.cos(s-Math.PI/6)*8,l-Math.sin(s-Math.PI/6)*8),e.lineTo(c-Math.cos(s)*8*.5,l-Math.sin(s)*8*.5),e.lineTo(c-Math.cos(s+Math.PI/6)*8,l-Math.sin(s+Math.PI/6)*8),e.closePath(),e.fillStyle=o,e.fill()}function E(){let{toast:e}=d(),[t,n]=(0,m.useState)(null),[g,v]=(0,m.useState)(!0),[E,D]=(0,m.useState)(null),[O,k]=(0,m.useState)(!1),[A,j]=(0,m.useState)(null),[M,N]=(0,m.useState)(null),[P,F]=(0,m.useState)(``),[I,L]=(0,m.useState)(new Set),R=(0,m.useRef)(null),z=(0,m.useRef)(null),B=(0,m.useRef)({x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0}),V=(0,m.useRef)(0),H=(0,m.useRef)(0),U=(0,m.useRef)(new Map),W=(0,m.useCallback)(async()=>{try{let e=await u(`/api/graphiti`,{headers:{"Content-Type":`application/json`}});if(!e.ok)throw Error(`${e.status}: ${e.statusText}`);let t=await e.json();if(t.nodes?.length){let e=z.current,n=e?.clientWidth??1200,r=e?.clientHeight??600;for(let e of t.nodes){let t=U.current.get(e.id);t&&x(t.x)&&x(t.y)&&(e.x=t.x,e.y=t.y)}C(t.nodes,t.edges??[],n,r);for(let e of t.nodes)S(e)&&U.current.set(e.id,{x:e.x,y:e.y})}n(t),D(null)}catch(e){D(e instanceof Error?e.message:`Failed to load graph`),n(null)}finally{v(!1)}},[]);(0,m.useEffect)(()=>{W()},[W]);let G=(0,m.useMemo)(()=>{if(!t)return{nodes:[],edges:[]};let e=P.toLowerCase().trim(),n=t.nodes;if(I.size>0&&(n=n.filter(e=>!I.has(e.type?.toLowerCase()))),e){let r=new Set;for(let t of n)(t.label.toLowerCase().includes(e)||t.facts.some(t=>t.toLowerCase().includes(e)))&&r.add(t.id);for(let e of t.edges)r.has(e.from)&&r.add(e.to),r.has(e.to)&&r.add(e.from);n=n.filter(e=>r.has(e.id))}let r=new Set(n.map(e=>e.id)),i=(t.edges??[]).filter(e=>r.has(e.from)&&r.has(e.to));return{nodes:n,edges:i}},[t,P,I]),K=(0,m.useMemo)(()=>{if(!P.trim()||!t)return null;let e=P.toLowerCase().trim();return t.nodes.find(t=>t.label.toLowerCase().includes(e))?.id??null},[P,t]),q=async()=>{try{await u(`/api/graphiti`,{method:`DELETE`}),e(`success`,`Memory graph cleared.`),W(),j(null)}catch(t){e(`error`,`Couldn't clear the memory graph β try again. ${t.message}`)}},J=e=>{let t=B.current;t.zoom=Math.max(.2,Math.min(4,t.zoom*e)),N(e=>e)},Y=()=>{B.current={x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0},N(e=>e)},X=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,m.useEffect)(()=>{let e=R.current;if(!e||!G.nodes.length)return;let t=e.getContext(`2d`);if(!t)return;let n=window.devicePixelRatio||1,r=e.getBoundingClientRect();if(!Number.isFinite(r.width)||!Number.isFinite(r.height)||r.width<=0||r.height<=0)return;e.width=r.width*n,e.height=r.height*n,t.scale(n,n);let i=r.width,a=r.height,{nodes:o,edges:s}=G,c=o.filter(S),l=new Map(c.map(e=>[e.id,e])),u=()=>{H.current++;let e=H.current,n=B.current;t.clearRect(0,0,i,a);let r=t.createRadialGradient(i/2,a/2,0,i/2,a/2,i*.7);r.addColorStop(0,`#0c0c14`),r.addColorStop(1,`#09090b`),t.fillStyle=r,t.fillRect(0,0,i,a),t.fillStyle=`rgba(255,255,255,0.02)`;let d=35*n.zoom,f=(n.x%d+d)%d,p=(n.y%d+d)%d;for(let e=f;e<i;e+=d)for(let n=p;n<a;n+=d)t.fillRect(e,n,1,1);for(let n=0;n<15;n++){let r=(e*.15+n*127)%i,o=(e*.1+n*173)%a,s=.02+Math.sin(e*.008+n)*.01;t.beginPath(),t.arc(r,o,1,0,Math.PI*2),t.fillStyle=`rgba(99,102,241,${s})`,t.fill()}let m=new Set,h=A?.id??M??K;if(h){m.add(h);for(let e of s)e.from===h&&m.add(e.to),e.to===h&&m.add(e.from)}let g=h!=null;for(let e of s){let r=l.get(e.from),c=l.get(e.to);if(!r||!c)continue;let u=g&&(e.from===h||e.to===h);if(g&&!u&&o.length>100)continue;let d=r.x*n.zoom+n.x,f=r.y*n.zoom+n.y,p=c.x*n.zoom+n.x,m=c.y*n.zoom+n.y;if(d<-50&&p<-50||f<-50&&m<-50||d>i+50&&p>i+50||f>a+50&&m>a+50)continue;let _=s.indexOf(e),{cx:v,cy:x}=w(d,f,p,m,(15+_%3*6)*(_%2==0?1:-1));if(u&&(t.beginPath(),t.moveTo(d,f),t.quadraticCurveTo(v,x,p,m),t.strokeStyle=`rgba(99,102,241,0.12)`,t.lineWidth=5,t.stroke()),t.beginPath(),t.moveTo(d,f),t.quadraticCurveTo(v,x,p,m),u){let[e,n,i]=b(y(r.type));t.strokeStyle=`rgba(${e},${n},${i},0.5)`,t.lineWidth=1.8}else t.strokeStyle=`rgba(100,116,139,0.04)`,t.lineWidth=.5;if(t.stroke(),u){let e=Math.max(10,Math.min(24,c.size||14))*n.zoom;T(t,p,m,v,x,e+3,`rgba(148,163,184,0.6)`)}if(u&&e.label&&e.label!==`co_mentioned`){let r=.5,i=(1-r)*(1-r)*d+2*(1-r)*r*v+r*r*p,a=(1-r)*(1-r)*f+2*(1-r)*r*x+r*r*m;t.font=`${Math.max(9,10*n.zoom)}px "Inter", system-ui, sans-serif`;let o=t.measureText(e.label).width+12;t.fillStyle=`rgba(15,15,25,0.85)`,t.beginPath(),t.roundRect(i-o/2,a-11,o,18,4),t.fill(),t.strokeStyle=`rgba(99,102,241,0.3)`,t.lineWidth=.5,t.stroke(),t.fillStyle=`var(--color-accent-light)`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(e.label,i,a)}}for(let r of c){let[o,s,c]=b(y(r.type)),l=(Math.max(8,Math.min(24,r.size||12))+Math.sin(e*.025+r.id.charCodeAt(0)*.5)*1)*n.zoom;if(!Number.isFinite(l)||l<=0)continue;let u=r.x*n.zoom+n.x,d=r.y*n.zoom+n.y;if(!Number.isFinite(u)||!Number.isFinite(d)||u<-l*3||d<-l*3||u>i+l*3||d>a+l*3)continue;let f=M===r.id,p=A?.id===r.id,h=K===r.id,_=f||p||h,v=g&&!m.has(r.id);if(!v){let n=_?.2:.05+Math.sin(e*.02+r.id.charCodeAt(0))*.015,i=_?l*3.5:l*2,a=t.createRadialGradient(u,d,l*.3,u,d,i);a.addColorStop(0,`rgba(${o},${s},${c},${n})`),a.addColorStop(.5,`rgba(${o},${s},${c},${n*.3})`),a.addColorStop(1,`rgba(${o},${s},${c},0)`),t.fillStyle=a,t.beginPath(),t.arc(u,d,i,0,Math.PI*2),t.fill()}let x=t.createRadialGradient(u-l*.3,d-l*.35,0,u,d,l);v?(x.addColorStop(0,`rgba(${o},${s},${c},0.06)`),x.addColorStop(1,`rgba(${o},${s},${c},0.02)`)):(x.addColorStop(0,`rgba(${o},${s},${c},${_?.45:.25})`),x.addColorStop(1,`rgba(${o},${s},${c},${_?.18:.07})`)),t.beginPath(),t.arc(u,d,l,0,Math.PI*2),t.fillStyle=x,t.fill(),t.beginPath(),t.arc(u,d,l,0,Math.PI*2),v?(t.strokeStyle=`rgba(${o},${s},${c},0.08)`,t.lineWidth=.5):_?(t.strokeStyle=`rgba(${o},${s},${c},0.9)`,t.lineWidth=2.5):(t.strokeStyle=`rgba(${o},${s},${c},0.4)`,t.lineWidth=1),t.stroke(),p&&(t.beginPath(),t.arc(u,d,l+5,0,Math.PI*2),t.setLineDash([4,4]),t.lineDashOffset=-e*.3,t.strokeStyle=`rgba(${o},${s},${c},0.4)`,t.lineWidth=1,t.stroke(),t.setLineDash([]));let S=r.facts.length>=3;if(!v&&(_||g&&m.has(r.id)||n.zoom>=1.3||n.zoom>=.8&&S)){let e=n.zoom>1?20:12,i=r.label.length>e?r.label.slice(0,e-1)+`β¦`:r.label,a=Math.max(9,11*n.zoom);t.font=`600 ${a}px "Inter", system-ui, sans-serif`;let f=t.measureText(i).width+8;if(t.fillStyle=`rgba(9,9,11,0.75)`,t.beginPath(),t.roundRect(u-f/2,d-a/2-1,f,a+2,3),t.fill(),t.fillStyle=_?`#fafafa`:`#a1a1aa`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(i,u,d),n.zoom>.7){let e=Math.max(7,8*n.zoom);t.font=`500 ${e}px "Inter", system-ui, sans-serif`,t.fillStyle=`rgba(${o},${s},${c},${_?.9:.5})`,t.fillText(r.type,u,d+l+Math.max(9,11*n.zoom))}}}V.current=requestAnimationFrame(u)};return V.current=requestAnimationFrame(u),()=>cancelAnimationFrame(V.current)},[G,M,A,K]),(0,m.useEffect)(()=>{let e=R.current;if(!e||!G.nodes.length)return;let t=B.current,n=(n,r)=>{let i=e.getBoundingClientRect(),a=n-i.left,o=r-i.top;for(let e of[...G.nodes].reverse()){let n=Math.max(8,Math.min(24,e.size||12))*t.zoom;if(!S(e)||!Number.isFinite(n)||n<=0)continue;let r=e.x*t.zoom+t.x,i=e.y*t.zoom+t.y;if(!Number.isFinite(r)||!Number.isFinite(i))continue;let s=a-r,c=o-i;if(s*s+c*c<=(n+6)*(n+6))return e}return null},r=n=>{n.preventDefault();let r=e.getBoundingClientRect(),i=n.clientX-r.left,a=n.clientY-r.top,o=t.zoom,s=n.deltaY>0?.92:1.08;t.zoom=Math.max(.2,Math.min(4,t.zoom*s)),t.x=i-(i-t.x)*(t.zoom/o),t.y=a-(a-t.y)*(t.zoom/o),N(e=>e)},i=n=>{t.dragging=!0,t.startX=n.clientX-t.x,t.startY=n.clientY-t.y,e.style.cursor=`grabbing`},a=r=>{if(t.dragging)t.x=r.clientX-t.startX,t.y=r.clientY-t.startY,N(e=>e);else{let t=n(r.clientX,r.clientY);N(t?.id??null),e.style.cursor=t?`pointer`:`grab`}},o=()=>{t.dragging=!1,e.style.cursor=`grab`},s=e=>{if(t.dragging)return;let r=n(e.clientX,e.clientY);j(e=>e?.id===r?.id?null:r??null)};return e.addEventListener(`wheel`,r,{passive:!1}),e.addEventListener(`mousedown`,i),e.addEventListener(`mousemove`,a),e.addEventListener(`mouseup`,o),e.addEventListener(`mouseleave`,o),e.addEventListener(`click`,s),()=>{e.removeEventListener(`wheel`,r),e.removeEventListener(`mousedown`,i),e.removeEventListener(`mousemove`,a),e.removeEventListener(`mouseup`,o),e.removeEventListener(`mouseleave`,o),e.removeEventListener(`click`,s)}},[G]);let Z=(0,m.useMemo)(()=>{if(!t)return[];let e=new Map;for(let n of t.nodes){let t=n.type?.toLowerCase()??`unknown`;e.set(t,(e.get(t)??0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]).map(([e,t])=>({type:e,count:t}))},[t]);if(g)return(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsx)(`div`,{className:`h-12 animate-pulse rounded-xl bg-bg-secondary`}),(0,h.jsx)(`div`,{className:`animate-pulse rounded-xl border border-border bg-bg`,style:{height:`60vh`,minHeight:400}})]});let Q=t&&t.nodes.length>0;return(0,h.jsxs)(`div`,{className:`space-y-4`,ref:z,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10`,children:(0,h.jsx)(o,{className:`h-4 w-4 text-accent-hover`})}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold text-text`,children:`Memory Graph`}),(0,h.jsx)(`p`,{className:`text-xs text-text-muted`,children:`Temporal knowledge graph powered by entity extraction`})]})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[Q&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`button`,{onClick:()=>J(1.2),className:`rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors`,title:`Zoom in`,children:(0,h.jsx)(r,{className:`h-4 w-4`})}),(0,h.jsx)(`button`,{onClick:()=>J(.8),className:`rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors`,title:`Zoom out`,children:(0,h.jsx)(a,{className:`h-4 w-4`})}),(0,h.jsx)(`button`,{onClick:Y,className:`rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors`,title:`Fit view`,children:(0,h.jsx)(i,{className:`h-4 w-4`})}),(0,h.jsx)(`div`,{className:`mx-1 h-4 w-px bg-bg-tertiary`})]}),(0,h.jsxs)(`button`,{onClick:W,className:`flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-text-secondary hover:bg-border hover:text-text transition-colors`,children:[(0,h.jsx)(s,{className:`h-3.5 w-3.5`}),` Refresh`]}),(0,h.jsxs)(`button`,{onClick:()=>k(!0),className:`flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-error hover:bg-error/10 transition-colors`,children:[(0,h.jsx)(l,{className:`h-3.5 w-3.5`}),` Clear`]})]})]}),E&&(0,h.jsx)(`div`,{className:`rounded-xl border border-error/50 bg-error/5 p-4 text-sm text-error`,children:E}),(0,h.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:[{label:`Entities`,value:t?.nodeCount??0,color:`var(--color-accent-hover)`},{label:`Relationships`,value:t?.edgeCount??0,color:`var(--color-cyan)`},{label:`Episodes`,value:t?.episodeCount??0,color:`var(--color-emerald)`}].map(({label:e,value:t,color:n})=>(0,h.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary px-4 py-3`,children:[(0,h.jsx)(`p`,{className:`text-xs text-text-muted`,children:e}),(0,h.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,h.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:n},children:t.toLocaleString()}),t>0&&(0,h.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full animate-pulse`,style:{backgroundColor:n}})]})]},e))}),Q&&(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsxs)(`div`,{className:`relative`,children:[(0,h.jsx)(c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted`}),(0,h.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),placeholder:`Search entities and facts...`,className:`w-full rounded-lg border border-border bg-bg-secondary py-2 pl-9 pr-8 text-sm text-text placeholder:text-text-muted focus:border-accent focus:outline-none`}),P&&(0,h.jsx)(`button`,{onClick:()=>F(``),className:`absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-text-muted hover:text-text`,children:(0,h.jsx)(f,{className:`h-3.5 w-3.5`})})]}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Z.map(({type:e,count:t})=>{let n=y(e),r=I.has(e);return(0,h.jsxs)(`button`,{onClick:()=>X(e),className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] font-medium transition-all ${r?`bg-bg-tertiary/50 text-text-muted opacity-40`:`bg-bg-tertiary text-text-secondary hover:brightness-110`}`,children:[(0,h.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:r?`var(--color-border-light)`:n}}),_[e]??e.charAt(0).toUpperCase()+e.slice(1),(0,h.jsx)(`span`,{className:`text-text-muted`,children:t})]},e)})})]}),Q?(0,h.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-bg overflow-hidden shadow-2xl shadow-black/50`,style:{height:`60vh`,minHeight:400},children:[(0,h.jsx)(`canvas`,{ref:R,style:{width:`100%`,height:`100%`,cursor:`grab`}}),(0,h.jsxs)(`div`,{className:`absolute bottom-3 right-3 rounded-md bg-bg/80 px-2 py-1 text-[10px] text-text-muted backdrop-blur-sm border border-bg-tertiary`,children:[Math.round(B.current.zoom*100),`%`]}),(P||I.size>0)&&(0,h.jsxs)(`div`,{className:`absolute top-3 left-3 rounded-md bg-bg/80 px-2 py-1 text-[10px] text-text-muted backdrop-blur-sm border border-bg-tertiary`,children:[`Showing `,G.nodes.length,` of `,t?.nodes.length??0,` entities`]})]}):(0,h.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-bg-secondary overflow-hidden flex flex-col items-center justify-center`,style:{height:`60vh`,minHeight:400},children:[(0,h.jsx)(`div`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl bg-accent/10 border border-accent/20 mb-4`,children:(0,h.jsx)(o,{className:`h-7 w-7 text-accent-hover`})}),(0,h.jsx)(`p`,{className:`text-sm font-medium text-text-secondary`,children:`No entities in the graph yet`}),(0,h.jsx)(`p`,{className:`mt-1 max-w-sm text-center text-xs text-text-muted`,children:`Start chatting with TITAN to build the knowledge graph. Entities, relationships, and facts are extracted automatically from conversations.`})]}),A&&(0,h.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-bg-tertiary px-4 py-3`,children:[(0,h.jsx)(`div`,{className:`h-3.5 w-3.5 rounded-full shadow-lg`,style:{backgroundColor:y(A.type),boxShadow:`0 0 8px ${y(A.type)}40`}}),(0,h.jsx)(`span`,{className:`font-semibold text-text`,children:A.label}),(0,h.jsx)(`span`,{className:`rounded-md bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-text-secondary`,children:A.type})]}),(0,h.jsxs)(`div`,{className:`space-y-3 p-4`,children:[A.facts.length>0&&(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wider text-text-muted`,children:`Facts`}),(0,h.jsx)(`div`,{className:`space-y-1.5`,children:A.facts.map((e,t)=>(0,h.jsx)(`p`,{className:`text-xs text-[#d4d4d8] pl-3 border-l-2`,style:{borderColor:y(A.type)+`40`},children:e},t))})]}),t&&(()=>{let e=t.edges.filter(e=>e.from===A.id||e.to===A.id);if(!e.length)return null;let n=new Map(t.nodes.map(e=>[e.id,e]));return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wider text-text-muted`,children:[`Relationships (`,e.length,`)`]}),(0,h.jsxs)(`div`,{className:`space-y-1.5 max-h-48 overflow-y-auto`,children:[e.slice(0,30).map((e,t)=>{let r=n.get(e.from===A.id?e.to:e.from),i=r?y(r.type):`#64748b`;return(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,h.jsx)(`span`,{className:`text-text-secondary`,children:e.label}),(0,h.jsx)(`span`,{className:`text-text-muted`,children:`β`}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,h.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:i}}),(0,h.jsx)(`span`,{className:`text-[#d4d4d8]`,children:r?.label??`?`})]})]},t)}),e.length>30&&(0,h.jsxs)(`p`,{className:`text-[10px] text-text-muted`,children:[`+ `,e.length-30,` more`]})]})]})})()]})]}),(0,h.jsx)(p,{open:O,title:`Clear the entire memory graph?`,message:`This permanently deletes every entity, relationship, and episode. This cannot be undone.`,confirmLabel:`Clear graph`,onConfirm:async()=>{k(!1),await q()},onCancel:()=>k(!1)})]})}export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{F as i,H as a}from"./index-WI-E4I3h.js";import{t as o}from"./PageHeader-CH85uoZG.js";var s=r(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),c=e(t(),1),l=n(),u={"always-on":`bg-green-500/10 text-green-400 border-green-500/30`,"opt-in":`bg-green-500/10 text-green-400 border-green-500/30`,connected:`bg-blue-500/10 text-blue-400 border-blue-500/30`,unavailable:`bg-slate-500/10 text-slate-400 border-slate-500/30`},d={"always-on":`always-on`,"opt-in":`enabled`,connected:`connected`,unavailable:`inactive`};function f(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(!0);return(0,c.useEffect)(()=>{a(`/api/memory/taxonomy`,{headers:{"Content-Type":`application/json`}}).then(e=>e.json()).then(t).catch(()=>t(null)).finally(()=>r(!1))},[]),n?(0,l.jsx)(`div`,{className:`text-[var(--text-muted)]`,children:`Loading memory taxonomyβ¦`}):e?(0,l.jsxs)(`div`,{className:`space-y-6`,children:[(0,l.jsx)(o,{title:`Memory Taxonomy`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Knowledge`},{label:`Memory Taxonomy`}]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--text-secondary)]`,children:[(0,l.jsx)(i,{size:18}),(0,l.jsxs)(`span`,{className:`text-sm`,children:[e.total,` named memory types Β· `,e.active,` active`]})]}),(0,l.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:e.types.map(e=>(0,l.jsxs)(`div`,{className:`bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,l.jsx)(`span`,{className:`text-sm font-semibold text-[var(--text)]`,children:e.label}),e.differentiator&&(0,l.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-amber-400`,title:`Unique to TITAN β no competitor has a drive-backed emotional memory`,children:[(0,l.jsx)(s,{size:11}),` unique`]}),(0,l.jsx)(`span`,{className:`ml-auto text-[10px] px-2 py-0.5 rounded border ${u[e.availability]}`,children:d[e.availability]})]}),(0,l.jsx)(`p`,{className:`text-xs text-[var(--text-secondary)]`,children:e.captures}),(0,l.jsxs)(`p`,{className:`text-[11px] text-[var(--text-muted)] mt-1`,children:[(0,l.jsx)(`span`,{className:`opacity-70`,children:`Recall:`}),` `,e.recall]}),(0,l.jsx)(`p`,{className:`text-[11px] text-[var(--text-muted)] mt-1 font-mono truncate`,title:e.module,children:e.module})]},e.key))})]}):(0,l.jsx)(`div`,{className:`text-[var(--text-muted)]`,children:`Memory taxonomy unavailable.`})}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./arrow-left-4c2FnES1.js";import{t as a}from"./book-open-Ds_yciQm.js";import{t as o}from"./clock-DSPgndSD.js";import{t as s}from"./link-VDQkrGJw.js";import{t as c}from"./search-aNVcX-nv.js";import{H as l,a as u}from"./index-WI-E4I3h.js";import{t as d}from"./PageHeader-CH85uoZG.js";var f=r(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),p=e(t(),1),m=n(),h={person:`var(--color-accent-hover)`,topic:`var(--color-cyan)`,project:`var(--color-emerald)`,place:`#fbbf24`,company:`#facc15`,technology:`#2dd4bf`,event:`#fb7185`};function g(e){return h[e?.toLowerCase()]??`#94a3b8`}function _(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function v(){let{toast:e}=u(),[t,n]=(0,p.useState)([]),[r,h]=(0,p.useState)(null),[v,y]=(0,p.useState)(!0),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),w=(0,p.useCallback)(async()=>{try{let t=new URLSearchParams;b&&t.set(`q`,b),S&&t.set(`type`,S);let r=await l(`/api/wiki/entities?${t}`);r.ok?n(await r.json()):e(`error`,`Couldn't load the memory wiki β try again. (${r.status})`)}catch(t){e(`error`,`Couldn't load the memory wiki β try again. ${t.message}`)}finally{y(!1)}},[b,S,e]),T=async t=>{try{let n=await l(`/api/wiki/entity/${encodeURIComponent(t)}`);n.ok?h(await n.json()):e(`error`,`Couldn't open "${t}" β try again. (${n.status})`)}catch(n){e(`error`,`Couldn't open "${t}" β try again. ${n.message}`)}};(0,p.useEffect)(()=>{w()},[w]);let E=[...new Set(t.map(e=>e.type))].sort();return r?(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsx)(d,{title:r.name,breadcrumbs:[{label:`Memory`},{label:`Wiki`,href:`/memory-wiki`},{label:r.name}],actions:(0,m.jsxs)(`button`,{onClick:()=>h(null),className:`flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-text-secondary hover:text-text transition-colors`,children:[(0,m.jsx)(i,{className:`h-3.5 w-3.5`}),` Back to list`]})}),(0,m.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,m.jsx)(`div`,{className:`h-4 w-4 rounded-full`,style:{backgroundColor:g(r.type),boxShadow:`0 0 10px ${g(r.type)}50`}}),(0,m.jsx)(`h2`,{className:`text-xl font-bold text-text`,children:r.name}),(0,m.jsx)(`span`,{className:`rounded-md bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-text-secondary`,children:r.type})]}),r.summary&&(0,m.jsx)(`p`,{className:`text-sm text-text-secondary mb-2`,children:r.summary}),r.aliases.length>0&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-text-muted`,children:[(0,m.jsx)(f,{className:`h-3 w-3`}),` Also known as: `,r.aliases.join(`, `)]}),(0,m.jsxs)(`div`,{className:`flex gap-4 mt-3 text-[10px] text-text-muted`,children:[(0,m.jsxs)(`span`,{children:[`First seen: `,new Date(r.firstSeen).toLocaleDateString()]}),(0,m.jsxs)(`span`,{children:[`Last seen: `,_(r.lastSeen)]})]})]}),r.facts.length>0&&(0,m.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-4`,children:[(0,m.jsxs)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-text-muted mb-3`,children:[`Facts (`,r.facts.length,`)`]}),(0,m.jsx)(`div`,{className:`space-y-2`,children:r.facts.map((e,t)=>(0,m.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,m.jsx)(`span`,{className:`text-accent mt-0.5`,children:`β’`}),(0,m.jsx)(`span`,{className:`text-text-secondary`,children:e})]},t))})]}),r.related.length>0&&(0,m.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-4`,children:[(0,m.jsxs)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-text-muted mb-3`,children:[(0,m.jsx)(s,{className:`h-3 w-3 inline mr-1`}),` Related (`,r.related.length,`)`]}),(0,m.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.related.map(e=>(0,m.jsxs)(`button`,{onClick:()=>T(e.name),className:`inline-flex items-center gap-1.5 rounded-lg border border-border bg-bg px-3 py-1.5 text-xs hover:border-accent transition-colors`,children:[(0,m.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:g(e.type)}}),(0,m.jsx)(`span`,{className:`text-text`,children:e.name}),(0,m.jsxs)(`span`,{className:`text-text-muted`,children:[`(`,e.relation,`)`]})]},e.id))})]}),r.episodes.length>0&&(0,m.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-4`,children:[(0,m.jsxs)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-text-muted mb-3`,children:[(0,m.jsx)(o,{className:`h-3 w-3 inline mr-1`}),` Episode History (`,r.episodes.length,`)`]}),(0,m.jsx)(`div`,{className:`space-y-2 max-h-[300px] overflow-y-auto`,children:r.episodes.map(e=>(0,m.jsxs)(`div`,{className:`border-l-2 border-border pl-3 py-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-text-muted mb-0.5`,children:[(0,m.jsx)(`span`,{children:new Date(e.createdAt).toLocaleString()}),(0,m.jsx)(`span`,{className:`rounded bg-bg-tertiary px-1.5 py-0.5`,children:e.source})]}),(0,m.jsx)(`p`,{className:`text-xs text-text-secondary`,children:e.content})]},e.id))})]})]}):(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsx)(d,{title:`Memory Wiki`,breadcrumbs:[{label:`Memory`},{label:`Wiki`}]}),(0,m.jsxs)(`div`,{className:`flex gap-3`,children:[(0,m.jsxs)(`div`,{className:`relative flex-1`,children:[(0,m.jsx)(c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted`}),(0,m.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`Search entities, facts, summaries...`,className:`w-full rounded-lg border border-border bg-bg-secondary py-2 pl-9 pr-4 text-sm text-text placeholder:text-text-muted focus:border-accent focus:outline-none`})]}),(0,m.jsxs)(`select`,{value:S,onChange:e=>C(e.target.value),className:`rounded-lg border border-border bg-bg-secondary px-3 py-2 text-sm text-text-secondary focus:border-accent focus:outline-none`,children:[(0,m.jsx)(`option`,{value:``,children:`All types`}),E.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]})]}),(0,m.jsxs)(`div`,{className:`flex gap-3 text-xs text-text-muted`,children:[(0,m.jsxs)(`span`,{children:[t.length,` entities`]}),(0,m.jsx)(`span`,{children:`β’`}),(0,m.jsxs)(`span`,{children:[E.length,` types`]})]}),v?(0,m.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:9}).map((e,t)=>(0,m.jsx)(`div`,{className:`h-24 animate-pulse rounded-xl border border-border bg-bg-secondary`},t))}):(0,m.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[t.map(e=>(0,m.jsxs)(`button`,{onClick:()=>T(e.name),className:`rounded-xl border border-border bg-bg-secondary p-4 text-left hover:border-accent transition-colors`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,m.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{backgroundColor:g(e.type)}}),(0,m.jsx)(`span`,{className:`font-medium text-sm text-text truncate`,children:e.name})]}),(0,m.jsx)(`p`,{className:`text-xs text-text-secondary line-clamp-2 mb-2`,children:e.summary||`No summary`}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-text-muted`,children:[(0,m.jsx)(`span`,{className:`capitalize`,children:e.type}),(0,m.jsxs)(`span`,{children:[e.factCount,` facts`]}),(0,m.jsx)(`span`,{children:_(e.lastSeen)})]})]},e.id)),t.length===0&&(0,m.jsxs)(`div`,{className:`col-span-full py-12 text-center`,children:[(0,m.jsx)(a,{className:`h-8 w-8 text-text-muted mx-auto mb-2`}),(0,m.jsx)(`p`,{className:`text-text-muted`,children:`No entities found`})]})]})]})}export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./refresh-cw-Disd5wRB.js";import{t as a}from"./shield-check-Cd50jCAn.js";import{$t as o,Jt as s,Mn as c,Tn as l,W as u}from"./index-WI-E4I3h.js";import{t as d}from"./PageHeader-CH85uoZG.js";import{t as f}from"./DataTable-KVqtDzvP.js";var p=r(`shield-x`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m14.5 9.5-5 5`,key:`17q4r4`}],[`path`,{d:`m9.5 9.5 5 5`,key:`18nt4w`}]]),m=r(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),h=e(t(),1),g=n();function _(){let[e,t]=(0,h.useState)([]),[n,r]=(0,h.useState)([]),[_,v]=(0,h.useState)(!0),[y,b]=(0,h.useState)(null),x=async()=>{try{let[e,n]=await Promise.all([s(),o()]);t(e),r(n),b(null)}catch(e){b(e instanceof Error?e.message:`Failed to fetch mesh data`)}finally{v(!1)}};(0,h.useEffect)(()=>{x()},[]);let S=async e=>{try{await u(e),await x()}catch(e){b(e instanceof Error?e.message:`Failed to approve peer`)}},C=async e=>{try{await l(e),await x()}catch(e){b(e instanceof Error?e.message:`Failed to reject peer`)}},w=async e=>{try{await c(e),await x()}catch(e){b(e instanceof Error?e.message:`Failed to revoke peer`)}};return _?(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(`div`,{className:`h-32 animate-pulse rounded-xl border border-border bg-bg-secondary`}),(0,g.jsx)(`div`,{className:`h-48 animate-pulse rounded-xl border border-border bg-bg-secondary`})]}):(0,g.jsxs)(`div`,{className:`space-y-6`,children:[(0,g.jsx)(d,{title:`Mesh Network`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Tools`},{label:`Mesh`}],actions:(0,g.jsx)(`button`,{onClick:x,className:`rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text`,title:`Refresh`,children:(0,g.jsx)(i,{className:`h-4 w-4`})})}),y&&(0,g.jsx)(`div`,{className:`rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error`,children:y}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`mb-3 text-sm font-medium text-text-secondary`,children:[`Pending Requests (`,n.length,`)`]}),n.length===0?(0,g.jsx)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-6 text-center text-text-muted`,children:`No pending requests`}):(0,g.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:n.map(e=>(0,g.jsxs)(`div`,{className:`rounded-xl border border-border bg-bg-secondary p-4`,children:[(0,g.jsx)(`p`,{className:`font-mono text-sm text-text`,children:e.nodeId}),(0,g.jsx)(`p`,{className:`mt-1 text-xs text-text-secondary`,children:e.url}),e.name&&(0,g.jsx)(`p`,{className:`mt-1 text-xs text-text-muted`,children:e.name}),(0,g.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,g.jsxs)(`button`,{onClick:()=>S(e.id),className:`flex items-center gap-1.5 rounded-lg bg-success px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-success/80`,children:[(0,g.jsx)(a,{className:`h-3.5 w-3.5`}),`Approve`]}),(0,g.jsxs)(`button`,{onClick:()=>C(e.id),className:`flex items-center gap-1.5 rounded-lg bg-error px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-error/80`,children:[(0,g.jsx)(p,{className:`h-3.5 w-3.5`}),`Reject`]})]})]},e.id))})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`mb-3 text-sm font-medium text-text-secondary`,children:[`Connected Peers (`,e.length,`)`]}),(0,g.jsx)(f,{columns:[{key:`nodeId`,header:`Node ID`,render:e=>(0,g.jsx)(`span`,{className:`font-mono text-xs`,children:e.nodeId})},{key:`url`,header:`URL`},{key:`status`,header:`Status`,render:e=>(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-success`}),(0,g.jsx)(`span`,{className:`capitalize`,children:e.status})]})},{key:`connectedAt`,header:`Connected At`,render:e=>e.connectedAt?(0,g.jsx)(`span`,{children:new Date(e.connectedAt).toLocaleString()}):(0,g.jsx)(`span`,{className:`text-text-muted`,children:`-`})},{key:`_actions`,header:``,className:`w-16`,render:e=>(0,g.jsx)(`button`,{onClick:t=>{t.stopPropagation(),w(e.id)},className:`rounded-md p-1.5 text-error transition-colors hover:bg-bg-tertiary`,title:`Revoke peer`,children:(0,g.jsx)(m,{className:`h-4 w-4`})})}],data:e,emptyMessage:`No connected peers`})]})]})}export{_ as default};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{Xt as r,ar as i,ir as a}from"./index-WI-E4I3h.js";import{a as o,c as s,d as c,f as l,i as u,l as d,r as f,s as p,t as m,u as h}from"./missions-y-qg_f9b.js";import{t as g}from"./FileViewer-DjcVKkO2.js";var _=e(t(),1),v=n();function y({member:e,room:t,anchor:n,availableModels:r,onClose:i,onTalkInChat:a}){let o=(0,_.useRef)(null),[c,l]=(0,_.useState)(`main`),[u,f]=(0,_.useState)(``),[m,g]=(0,_.useState)(!1),[y,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]);let ee=x(n,320,360);async function O(){T(!0),D(null);try{await p(t.id,`@${e.name} quick check-in β how's it going? Anything I can clear for you?`),i()}catch(e){D(e.message)}finally{T(!1)}}async function k(n){let r=u.trim();if(!(!r||m)){g(!0),D(null);try{await p(t.id,`@${e.name} ${n}${r}`),f(``),i()}catch(e){D(e.message)}finally{g(!1)}}}async function te(n){T(!0),D(null);try{await s(t.id,e.agentId,n),l(`main`)}catch(e){D(e.message)}finally{T(!1)}}async function ne(){T(!0),D(null);try{await d(t.id,e.agentId,!e.paused)}catch(e){D(e.message)}finally{T(!1)}}async function A(){T(!0),D(null);try{await h(t.id,!t.longRunningMode)}catch(e){D(e.message)}finally{T(!1)}}return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`fixed inset-0 z-[60]`,onClick:i,"aria-hidden":!0}),(0,v.jsxs)(`div`,{ref:o,className:`absolute z-[61] flex flex-col titan-modal-surface overflow-hidden`,style:{left:ee.x,top:ee.y,width:320,maxHeight:360,borderRadius:12},onClick:e=>e.stopPropagation(),children:[(0,v.jsx)(`div`,{className:`h-1.5`,style:{background:`linear-gradient(90deg, ${e.color}, ${w(e.color,-25)})`}}),(0,v.jsxs)(`div`,{className:`px-4 pt-3 pb-2 flex items-center gap-2`,children:[(0,v.jsx)(`div`,{className:`w-8 h-8 rounded-md flex items-center justify-center text-white font-bold text-[14px]`,style:{background:`linear-gradient(135deg, ${e.color}, ${w(e.color,-25)})`},children:e.name[0]}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,v.jsx)(`div`,{className:`font-semibold text-sm`,children:e.name}),(0,v.jsxs)(`div`,{className:`text-[11px] text-text-muted`,children:[e.role,` Β· `,S(e)]})]}),(0,v.jsx)(`button`,{onClick:i,"aria-label":`Close`,className:`titan-close-btn w-7 h-7 rounded-full flex items-center justify-center text-sm`,style:{border:`1px solid var(--theme-menu-border)`},children:`β`})]}),e.currentActivity&&(0,v.jsxs)(`div`,{className:`px-4 pb-2 text-[11px] text-text-secondary italic leading-snug border-b border-border/60`,children:[`"`,e.currentActivity,`"`]}),E&&(0,v.jsx)(`div`,{className:`px-4 py-2 text-[11px] text-error bg-error/10 border-b border-error/30`,children:E}),(0,v.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[c===`main`&&(0,v.jsxs)(`div`,{className:`p-2 grid grid-cols-2 gap-2`,children:[(0,v.jsx)(b,{icon:`π`,label:`Nudge`,hint:`A friendly check-in`,onClick:O,disabled:y}),(0,v.jsx)(b,{icon:`π¬`,label:`Talk to them`,hint:`Send a message just to them`,onClick:()=>{a?(a(e.agentId,`@${e.name} `),i()):l(`talk`)},disabled:y}),(0,v.jsx)(b,{icon:`π§`,label:`Steer`,hint:`Redirect them mid-task`,onClick:()=>l(`steer`),disabled:y}),(0,v.jsx)(b,{icon:`π§ `,label:`Model`,hint:e.modelOverride?C(e.modelOverride):`default`,onClick:()=>l(`model`),disabled:y}),(0,v.jsx)(b,{icon:e.paused?`βΆ`:`βΈ`,label:e.paused?`Resume agent`:`Pause agent`,hint:e.paused?`Bring them back`:`Skip them for now`,onClick:ne,disabled:y,wide:!1}),(0,v.jsx)(b,{icon:`π`,label:t.longRunningMode?`Marathon ON`:`Marathon mode`,hint:t.longRunningMode?`running 72h goal`:`72h auto-run`,onClick:A,disabled:y,active:!!t.longRunningMode})]}),(c===`talk`||c===`steer`)&&(0,v.jsxs)(`div`,{className:`p-3 flex flex-col gap-2`,children:[(0,v.jsx)(`div`,{className:`text-[10px] uppercase tracking-widest text-text-muted`,children:c===`talk`?`Message ${e.name}`:`Steer ${e.name}`}),(0,v.jsx)(`textarea`,{autoFocus:!0,value:u,onChange:e=>f(e.target.value),rows:4,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k(c===`steer`?`steer: `:``))},placeholder:c===`steer`?`e.g. "skip the chart, focus on cost comparison"`:`Type a private note to themβ¦`,className:`bg-bg-tertiary border border-border rounded-lg p-2 text-sm text-text outline-none focus:border-accent resize-none`}),c===`steer`&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:[`Slow down`,`Be thorough`,`Wrap it up`,`Skip the chart`].map(e=>(0,v.jsx)(`button`,{onClick:()=>f(e.toLowerCase()),className:`px-2 py-0.5 text-[11px] bg-bg-tertiary border border-border rounded-full text-text-muted hover:text-text`,children:e},e))}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsx)(`button`,{onClick:()=>l(`main`),className:`text-xs text-text-muted hover:text-text`,children:`β Back`}),(0,v.jsx)(`button`,{onClick:()=>k(c===`steer`?`steer: `:``),disabled:!u.trim()||m,className:`px-3 py-1.5 rounded-lg font-bold text-bg-deep bg-gradient-to-br from-accent to-accent2 disabled:opacity-50 text-xs`,children:m?`Sendingβ¦`:`Send ββ΅`})]})]}),c===`model`&&(0,v.jsxs)(`div`,{className:`p-3 flex flex-col gap-2`,children:[(0,v.jsxs)(`div`,{className:`text-[10px] uppercase tracking-widest text-text-muted`,children:[e.name,`'s brain`]}),(0,v.jsx)(`div`,{className:`text-[11px] text-text-secondary leading-snug`,children:`Pick a specific model for this agent on this mission. Empty = the role's default.`}),e.modelOverride&&(0,v.jsxs)(`div`,{className:`px-2.5 py-1.5 rounded-lg bg-accent/10 border border-accent/40 text-[12px] text-text flex items-center justify-between`,children:[(0,v.jsxs)(`span`,{className:`truncate`,children:[`Now: `,(0,v.jsx)(`b`,{children:e.modelOverride})]}),(0,v.jsx)(`button`,{onClick:()=>te(null),className:`text-[11px] text-text-muted hover:text-text shrink-0`,children:`clear`})]}),(0,v.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto`,children:r.length===0?(0,v.jsx)(`div`,{className:`text-[11px] text-text-muted italic`,children:`No models discovered. /api/models returned empty.`}):r.map(t=>{let n=e.modelOverride===t.id;return(0,v.jsxs)(`button`,{onClick:()=>te(t.id),disabled:y,className:`flex items-center justify-between px-2.5 py-1.5 rounded-lg text-[12px] border text-left ${n?`bg-accent/10 border-accent/60 text-text`:`bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light`}`,children:[(0,v.jsx)(`span`,{className:`truncate`,children:t.id}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-muted ml-2 shrink-0`,children:t.provider})]},t.id)})}),(0,v.jsx)(`button`,{onClick:()=>l(`main`),className:`text-xs text-text-muted hover:text-text self-start mt-1`,children:`β Back`})]})]})]})]})}function b({icon:e,label:t,hint:n,onClick:r,disabled:i,wide:a,active:o}){return(0,v.jsxs)(`button`,{onClick:r,disabled:i,className:`text-left p-2.5 rounded-xl border transition-colors ${o?`bg-accent/15 border-accent/50 text-text`:`bg-bg-tertiary/40 border-border text-text-secondary hover:text-text hover:border-border-light`} ${a?`col-span-2`:``} disabled:opacity-50`,children:[(0,v.jsx)(`div`,{className:`text-lg leading-none mb-1`,children:e}),(0,v.jsx)(`div`,{className:`text-[12px] font-semibold leading-tight`,children:t}),n&&(0,v.jsx)(`div`,{className:`text-[10px] text-text-muted leading-snug mt-0.5 truncate`,children:n})]})}function x({x:e,y:t},n,r){let i=window.innerWidth,a=window.innerHeight;return{x:Math.max(8,Math.min(e,i-n-8)),y:Math.max(8,Math.min(t,a-r-8))}}function S(e){return e.paused?`paused (by you)`:e.state===`working`?`working`:e.state===`editing`?`editing`:e.state===`blocked`?`needs you`:e.state===`done`?`done`:`idle`}function C(e){return e.length<=24?e:e.slice(0,22)+`β¦`}function w(e,t){let n=e.replace(`#`,``);if(n.length!==6)return e;let r=parseInt(n,16),i=r>>16&255,a=r>>8&255,o=r&255,s=Math.round(t/100*255);return i=Math.max(0,Math.min(255,i+s)),a=Math.max(0,Math.min(255,a+s)),o=Math.max(0,Math.min(255,o+s)),`#`+(i<<16|a<<8|o).toString(16).padStart(6,`0`)}function T(e){let t=new Map;for(let n of e){let e=n.activityLog??[];for(let r of e){let e=`${n.agentId}::${r.activity}`,i=t.get(e);if(!i){t.set(e,{id:e,agentId:n.agentId,agentName:n.name,agentColor:n.color,icon:r.icon,activity:r.activity,detail:r.detail,at:r.at,count:1,recentDetails:r.detail?[r.detail]:[]});continue}i.count+=1,r.at>i.at&&(i.at=r.at,i.icon=r.icon,r.detail&&(i.detail=r.detail)),r.detail&&(i.recentDetails=[r.detail,...i.recentDetails.filter(e=>e!==r.detail)].slice(0,3))}}return Array.from(t.values()).sort((e,t)=>e.at<t.at?1:-1).slice(0,12)}var E=[{cmd:`/slow down`,label:`Slow down`,hint:`be more careful`},{cmd:`/be thorough`,label:`Be thorough`,hint:`dig deeper`},{cmd:`/wrap it up`,label:`Wrap it up`,hint:`finish what you have`},{cmd:`/pause`,label:`Pause`,hint:`pause the team`}];function D(e){try{let t=localStorage.getItem(O(e));return t?JSON.parse(t):{}}catch{return{}}}function ee(e,t){try{localStorage.setItem(O(e),JSON.stringify(t))}catch{}}function O(e){return`titan-desk:${e}`}function k(e){return`titan-desk-furniture:${e}`}function te(e){let t={cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1};try{let n=localStorage.getItem(k(e));if(!n)return t;let r=JSON.parse(n);return{cabinet:Array.isArray(r.cabinet)?r.cabinet:[],trash:Array.isArray(r.trash)?r.trash:[],permanentlyHidden:Array.isArray(r.permanentlyHidden)?r.permanentlyHidden:[],cabinetOpen:!!r.cabinetOpen,trashOpen:!!r.trashOpen}}catch{return t}}function ne(e,t){try{localStorage.setItem(k(e),JSON.stringify(t))}catch{}}function A(){let{id:e}=i(),t=a(),[n,s]=(0,_.useState)(null),[d,h]=(0,_.useState)(!0),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(``),[w,O]=(0,_.useState)(!1),[k,A]=(0,_.useState)(!1),j=(0,_.useRef)(null),[M,ae]=(0,_.useState)(()=>({width:typeof window>`u`?1400:window.innerWidth,height:typeof window>`u`?800:window.innerHeight}));(0,_.useLayoutEffect)(()=>{let e=j.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();ae(e=>{let n=Math.max(320,Math.round(t.width)),r=Math.max(320,Math.round(t.height));return e.width===n&&e.height===r?e:{width:n,height:r}})};t();let n=typeof ResizeObserver<`u`?new ResizeObserver(t):null;return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[d,n?.id]);let N=(0,_.useCallback)(()=>j.current?.getBoundingClientRect()||{left:0,top:0,width:typeof window>`u`?1400:window.innerWidth,height:typeof window>`u`?800:window.innerHeight},[]),P=(0,_.useCallback)((e,t)=>{let n=N();return{x:e-n.left,y:t-n.top}},[N]),F=(0,_.useCallback)((e,t)=>{let n=P(e,t);return{x:Math.max(8,Math.min(n.x,M.width-328)),y:Math.max(8,Math.min(n.y,M.height-368))}},[M,P]),[I,L]=(0,_.useState)({});(0,_.useEffect)(()=>{e&&L(D(e))},[e]);let R=(0,_.useCallback)(t=>{L(t),e&&ee(e,t)},[e]),[z,B]=(0,_.useState)({cabinet:[],trash:[],permanentlyHidden:[],cabinetOpen:!1,trashOpen:!1});(0,_.useEffect)(()=>{e&&B(te(e))},[e]);let V=(0,_.useCallback)(t=>{B(t),e&&ne(e,t)},[e]),[oe,H]=(0,_.useState)([]);(0,_.useEffect)(()=>{r().then(H).catch(()=>H([]))},[]);let[U,W]=(0,_.useState)(null),[G,K]=(0,_.useState)(null),ge=(0,_.useCallback)(async t=>{if(e){K({ref:t,loading:!0});try{let n=await o(e,t);K({ref:t,loading:!1,file:n})}catch(e){K({ref:t,loading:!1,error:e.message})}}},[e]);(0,_.useEffect)(()=>{if(!e)return;let t=!0;return h(!0),u(e).then(({mission:e})=>{t&&(s(e),h(!1))}).catch(e=>{t&&(x(e.message),h(!1))}),()=>{t=!1}},[e]),(0,_.useEffect)(()=>{if(e)return l(e,n=>{if(n.kind===`mission_deleted`){t(`/mission`);return}n.kind!==`hello`&&u(e).then(({mission:e})=>s(e)).catch(()=>{})})},[e,t]);let _e=(0,_.useCallback)(async e=>{if(!(!n||!e.trim()||w)){O(!0);try{await p(n.id,e.trim()),C(``)}catch(e){x(e.message)}finally{O(!1)}}},[n,w]),ve=(0,_.useCallback)(async(e,t)=>{if(n)try{await m(n.id,e,t)}catch(e){x(e.message)}},[n]),ye=(0,_.useCallback)(async()=>{if(!n)return;let e=n.status===`paused`?`working`:`paused`;try{await c(n.id,e)}catch(e){x(e.message)}},[n]),be=(0,_.useCallback)(async()=>{if(n&&window.confirm(`Delete this mission?\n\n"${n.goal.slice(0,120)}${n.goal.length>120?`β¦`:``}"\n\nThe file is renamed on disk (recoverable manually), but the mission disappears from the UI immediately.`))try{await f(n.id),t(`/mission`)}catch(e){x(e.message)}},[n,t]),q=(0,_.useMemo)(()=>{if(n)return[...n.messages].reverse().find(e=>e.kind===`question`&&!e.answer)},[n]),J=(0,_.useMemo)(()=>{if(!n)return[];let e=new Map;for(let t of n.messages)if(!(t.kind!==`agent`||!Array.isArray(t.sources)))for(let n of t.sources)(n.type===`file`||n.type===`report`)&&e.set(n.ref,{ref:n.ref,description:n.description,type:n.type});return Array.from(e.values())},[n]),Y=(0,_.useMemo)(()=>n?T(n.team.map(e=>({agentId:e.agentId,name:e.name,color:e.color,activityLog:e.activityLog}))):[],[n]),X=(0,_.useMemo)(()=>{if(!n)return[];let e=new Map;for(let t of n.messages)if(!(t.kind!==`agent`||!Array.isArray(t.sources)))for(let n of t.sources)n.type===`fact`&&e.set(n.ref,{ref:n.ref,description:n.description});return Array.from(e.values()).slice(0,8)},[n]),Z=(0,_.useMemo)(()=>{if(!n)return[];let e=[];e.push({id:`goal`,kind:`goal`}),e.push({id:`document`,kind:`document`}),e.push({id:`cost`,kind:`cost`}),e.push({id:`clock`,kind:`clock`}),e.push({id:`cabinet`,kind:`cabinet`}),e.push({id:`trash`,kind:`trash`});for(let t of n.team)e.push({id:`agent:${t.agentId}`,kind:`agent`,ref:t.agentId});for(let t of J)e.push({id:`file:${t.ref}`,kind:`file`,ref:t.ref});for(let t of X)e.push({id:`fact:${t.ref}`,kind:`fact`,ref:t.ref});for(let t of Y)e.push({id:t.id,kind:`activity`,ref:t.id});return q&&e.push({id:`q:${q.approvalId}`,kind:`question`,ref:q.approvalId}),e},[n,J,X,Y,q]),xe=(0,_.useCallback)(e=>z.cabinet.includes(e)||z.trash.includes(e)||z.permanentlyHidden.includes(e),[z]),Se=(0,_.useCallback)((e,t)=>t===`cabinet`?(V({...z,cabinet:[...new Set([...z.cabinet,e])],trash:z.trash.filter(t=>t!==e)}),!0):t===`trash`?(V({...z,trash:[...new Set([...z.trash,e])],cabinet:z.cabinet.filter(t=>t!==e)}),!0):!1,[z,V]),Ce=(0,_.useCallback)(e=>{V({...z,cabinet:z.cabinet.filter(t=>t!==e),trash:z.trash.filter(t=>t!==e)})},[z,V]),we=(0,_.useCallback)(()=>{V({...z,cabinetOpen:!z.cabinetOpen})},[z,V]),Te=(0,_.useCallback)(()=>{V({...z,trashOpen:!z.trashOpen})},[z,V]),Ee=(0,_.useCallback)(e=>{V({...z,trash:z.trash.filter(t=>t!==e),permanentlyHidden:[...new Set([...z.permanentlyHidden,e])]})},[z,V]),Q=(0,_.useCallback)((e,t)=>{let n=M.width,r=M.height,i=n/2,a=r/2;if(e.kind===`goal`)return{x:i-220,y:90,z:5,rotation:-1.2};if(e.kind===`document`)return{x:i-240,y:a-220,z:4,rotation:.4};if(e.kind===`cost`)return{x:n-130,y:90,z:6,rotation:2};if(e.kind===`clock`)return{x:n-440,y:r-240,z:7,rotation:-1.5};if(e.kind===`cabinet`)return{x:30,y:r-280,z:3,rotation:0};if(e.kind===`trash`)return{x:n-130,y:r-220,z:13,rotation:0};if(e.kind===`question`)return{x:i+120,y:200,z:30,rotation:-3};if(e.kind===`agent`){let r=t.filter(e=>e.kind===`agent`).findIndex(t=>t.id===e.id),i=r%2,a=Math.floor(r/2);return{x:n-280+i*20,y:200+a*180+i*30,z:10+r,rotation:(r%2==0?-1:1)*(1.5+r*.5)}}if(e.kind===`file`){let n=t.filter(e=>e.kind===`file`).findIndex(t=>t.id===e.id),r=n%2,i=Math.floor(n/2);return{x:60+r*30,y:180+i*180+r*25,z:8+n,rotation:(n%2==0?1:-1)*(2+n*.3)}}if(e.kind===`fact`){let n=t.filter(e=>e.kind===`fact`).findIndex(t=>t.id===e.id),a=n%3,o=Math.floor(n/3);return{x:i-160+a*100+(o%2==0?0:25),y:r-280+o*80,z:12+n,rotation:(n%2==0?-1:1)*(4+n*.7)}}if(e.kind===`activity`){let i=t.filter(e=>e.kind===`activity`).findIndex(t=>t.id===e.id),a=Math.max(4,Math.floor((n-120)/180)),o=i%a,s=Math.floor(i/a);return{x:40+o*180+(s%2==0?0:40),y:r-200-s*110,z:14+i,rotation:(i%2==0?-1:1)*(2+i*.3)}}return{x:100,y:100,z:1,rotation:0}},[M]),De=(0,_.useCallback)(e=>I[e.id]??Q(e,Z),[I,Z,Q]),$=(0,_.useCallback)((e,t)=>{let n={...I,[e]:t};R(n)},[I,R]),Oe=(0,_.useCallback)(e=>{let t=Math.max(0,...Z.map(e=>(I[e.id]??Q(e,Z)).z)),n=I[e]??Q(Z.find(t=>t.id===e),Z);n.z>=t||$(e,{...n,z:t+1})},[Z,I,Q,$]),ke=(0,_.useCallback)(()=>{e&&R({})},[e,R]),Ae=(0,_.useCallback)((e,t,n)=>{V({...z,cabinet:z.cabinet.filter(t=>t!==e),trash:z.trash.filter(t=>t!==e)});let r=Math.max(0,...Z.map(e=>(I[e.id]??Q(e,Z)).z)),i=I[e]?.rotation??Math.random()*6-3,a=P(t,n);$(e,{x:a.x-80,y:a.y-20,z:r+1,rotation:i})},[z,V,Z,I,Q,$,P]);if(d)return(0,v.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm`,style:{background:`var(--theme-bg-base, #3a2a1c)`,color:`var(--theme-paper-fg, #f3e9d0)`},children:`Setting the deskβ¦`});if(b||!n)return(0,v.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center flex-col gap-3`,style:{background:`var(--theme-bg-base, #3a2a1c)`},children:[(0,v.jsx)(`div`,{className:`text-[#ffb4a2] text-sm`,children:b??`Mission not found.`}),(0,v.jsx)(`button`,{onClick:()=>t(`/mission`),className:`text-sm hover:underline`,style:{color:`var(--theme-paper-fg, #f3e9d0)`},children:`β Start a new mission`})]});let{working:je,blocked:Me}=me(n);return(0,v.jsxs)(`div`,{ref:j,className:`absolute inset-0 overflow-hidden font-sans`,style:{...le,color:`var(--theme-paper-fg, #f3e9d0)`,fontFamily:`var(--theme-font-display, ui-sans-serif, system-ui)`},children:[(0,v.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:ue}),(0,v.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:de}),(0,v.jsxs)(`header`,{className:`relative z-30 flex flex-wrap items-center justify-between gap-3 px-4 py-3 sm:px-5 sm:py-3.5`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,v.jsx)(`button`,{onClick:()=>t(`/mission`),className:`hover:text-white text-sm`,style:{color:`var(--theme-metal-bright, #e7d6a8)`},title:`New mission`,children:`β`}),(0,v.jsx)(`button`,{onClick:()=>t(`/mission/library`),className:`text-[10px] uppercase tracking-widest hover:text-white rounded-full px-2 py-0.5`,style:{color:`var(--theme-ink-soft, #d9c08c)`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`},title:`Browse past missions`,children:`Library`}),(0,v.jsx)(`button`,{onClick:()=>t(`/space/home`),className:`text-[10px] uppercase tracking-widest hover:text-white rounded-full px-2 py-0.5 inline-flex items-center gap-1`,style:{color:`var(--theme-ink-soft, #d9c08c)`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`},title:`Back to the canvas spaces`,children:`π Canvas`}),(0,v.jsxs)(`div`,{className:`min-w-0 font-semibold tracking-tight`,style:{color:`var(--theme-paper-fg, #f3e9d0)`},children:[(0,v.jsx)(`span`,{style:{background:`linear-gradient(90deg, var(--theme-metal-bright, #f3d27a), var(--theme-metal, #d8a85a))`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:`TITAN`}),(0,v.jsx)(`span`,{className:`font-normal`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:` \xA0βΊ\xA0 `}),(0,v.jsx)(`span`,{className:`font-normal`,style:{color:`var(--theme-metal-bright, #e7d6a8)`},children:`Desk`})]})]}),(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-start gap-2 sm:justify-end`,children:[(0,v.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs`,style:{background:`var(--theme-leather, rgba(42,29,17,0.7))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`},children:[(0,v.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Me>0?`bg-error animate-pulse`:je>0?`bg-accent animate-pulse`:`bg-success`}`}),(0,v.jsx)(`span`,{style:{color:`var(--theme-metal-bright, #e7d6a8)`},children:he(n.status,je,Me)})]}),n.longRunningMode&&(0,v.jsx)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold`,style:{background:`linear-gradient(90deg, rgba(245,210,122,0.18), rgba(176,138,58,0.18))`,border:`1px solid var(--theme-metal-dark, #b08a3a)`,color:`var(--theme-metal-bright, #ffd86e)`},title:`Marathon mode β long-running multi-agent collaboration (72h cap)`,children:`π Marathon`}),(0,v.jsx)(`button`,{onClick:ke,className:`px-3 py-1.5 text-xs rounded-full hover:text-white`,style:{background:`var(--theme-leather, rgba(42,29,17,0.7))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`,color:`var(--theme-metal-bright, #e7d6a8)`},title:`Reset every item to a sensible starting position`,children:`Tidy up`}),(0,v.jsx)(`button`,{onClick:()=>t(`/mission/${n.id}`),className:`px-3 py-1.5 text-xs rounded-full hover:text-white`,style:{background:`var(--theme-leather, rgba(42,29,17,0.7))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`,color:`var(--theme-metal-bright, #e7d6a8)`},title:`Switch to the chat thread view`,children:`Chat view`}),(0,v.jsx)(`button`,{onClick:ye,className:`px-3 py-1.5 text-xs rounded-full hover:text-white`,style:{background:`var(--theme-leather, rgba(42,29,17,0.7))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`,color:`var(--theme-metal-bright, #e7d6a8)`},children:n.status===`paused`?`Resume`:`Pause`}),(0,v.jsx)(`button`,{onClick:be,className:`px-3 py-1.5 text-xs rounded-full hover:text-[#ff9c9c] hover:border-[#ff9c9c]/50 transition-colors`,style:{background:`var(--theme-leather, rgba(42,29,17,0.7))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`,color:`var(--theme-ink-soft, #d9c08c)`},title:`Delete this mission`,children:`π Delete`}),(0,v.jsx)(`button`,{onClick:()=>A(e=>!e),className:`w-8 h-8 rounded-full hover:text-white font-semibold text-sm flex items-center justify-center`,style:{background:`var(--theme-leather, rgba(42,29,17,0.7))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`,color:`var(--theme-metal-bright, #e7d6a8)`},title:`What's this?`,children:`?`})]})]}),(0,v.jsx)(pe,{items:Z,room:n,poseOf:De,isHidden:xe}),(0,v.jsx)(`div`,{className:`absolute inset-0 z-10 pointer-events-none`,children:Z.map(e=>{if(xe(e.id))return null;let t=De(e),r=e.kind===`agent`,i=e.kind===`file`||e.kind===`fact`||e.kind===`activity`;return(0,v.jsx)(re,{pose:t,onGrab:()=>Oe(e.id),onPose:t=>$(e.id,t),onClick:r?(t,n)=>W({agentId:e.ref,anchor:F(t,n)}):void 0,onDrop:i?t=>Se(e.id,t):void 0,children:(0,v.jsx)(ie,{item:e,room:n,openQuestion:q,fileSources:J,factSources:X,activityStickies:Y,furniture:z,onOpenCabinet:we,onOpenTrash:Te,onOpenFile:ge,onAnswer:ve})},e.id)})}),z.cabinetOpen&&(0,v.jsx)(se,{itemIds:z.cabinet,items:Z,fileSources:J,factSources:X,activityStickies:Y,onRestore:Ce,onRestoreAt:Ae,onOpenFile:ge,onClose:we}),z.trashOpen&&(0,v.jsx)(ce,{itemIds:z.trash,items:Z,fileSources:J,factSources:X,activityStickies:Y,onRestore:Ce,onDeleteForever:Ee,onClose:Te}),U&&(()=>{let e=n.team.find(e=>e.agentId===U.agentId);if(!e)return null;let t=oe.map(e=>({id:e.id,label:e.name,provider:e.provider}));return(0,v.jsx)(y,{member:e,room:n,anchor:U.anchor,availableModels:t,onClose:()=>W(null)})})(),(0,v.jsxs)(`footer`,{className:`absolute left-0 right-0 bottom-0 z-30 px-3 pb-12 pt-3 sm:px-5 md:pb-8 flex flex-col gap-2`,style:{background:`linear-gradient(to top, var(--theme-leather-edge, rgba(29,19,10,0.95)), transparent)`},children:[(0,v.jsxs)(`div`,{className:`flex max-h-24 flex-wrap items-center gap-2 overflow-y-auto pr-1 max-w-5xl mx-auto w-full sm:max-h-none sm:overflow-visible sm:pr-0`,children:[(0,v.jsx)(`span`,{className:`text-[10px] uppercase tracking-widest`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:`quick steer`}),E.map(e=>(0,v.jsx)(`button`,{onClick:()=>_e(e.cmd),disabled:w,title:e.hint,className:`px-2.5 py-1 text-[11px] rounded-full hover:text-white disabled:opacity-50`,style:{color:`var(--theme-metal-bright, #e7d6a8)`,background:`var(--theme-leather, rgba(42,29,17,0.7))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`},children:e.label},e.cmd))]}),(0,v.jsx)(`div`,{className:`flex items-center gap-3 max-w-5xl mx-auto w-full`,children:(0,v.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_e(S)},className:`min-w-0 flex-1 h-11 flex items-center gap-2.5 px-3.5 rounded-full`,style:{background:`var(--theme-leather, rgba(42,29,17,0.8))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`},children:[(0,v.jsx)(`input`,{value:S,onChange:e=>C(e.target.value),placeholder:`Tell the team β "Add a one-line risk note at the top"`,className:`min-w-0 flex-1 bg-transparent outline-none text-sm placeholder:text-[#d9c08c]/50`,style:{color:`var(--theme-paper-fg, #f3e9d0)`}}),(0,v.jsx)(`span`,{className:`px-2 py-1 text-[10px] uppercase tracking-widest rounded`,style:{color:`var(--theme-ink-soft, #d9c08c)`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`},children:`β΅`})]})}),(0,v.jsx)(`div`,{className:`max-w-5xl mx-auto w-full text-center text-[11px] italic`,style:{color:`var(--theme-ink-soft, #d9c08c)`,opacity:.7},children:`Your team works independently, but asks before risky or sensitive changes.`})]}),G&&(0,v.jsx)(g,{state:G,onClose:()=>K(null)}),k&&(0,v.jsxs)(`div`,{className:`absolute left-4 right-4 top-20 z-40 rounded-xl p-4 backdrop-blur-xl shadow-2xl sm:left-auto sm:right-5 sm:w-80`,style:{background:`var(--theme-leather, rgba(42,29,17,0.95))`,border:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.6))`},children:[(0,v.jsx)(`button`,{onClick:()=>A(!1),className:`absolute top-3 right-3 hover:text-white text-sm`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:`β`}),(0,v.jsx)(`h3`,{className:`font-semibold text-sm mb-2`,style:{color:`var(--theme-paper-fg, #f3e9d0)`},children:`The desk`}),(0,v.jsxs)(`p`,{className:`text-xs leading-relaxed mb-3`,style:{color:`var(--theme-metal-bright, #e7d6a8)`},children:[`Everything the team produces lands on this desk as a physical object. Drag anything anywhere. `,(0,v.jsx)(`b`,{children:`Tidy up`}),` resets the layout if it gets cluttered.`]}),(0,v.jsxs)(`ul`,{className:`space-y-2 text-xs`,style:{color:`var(--theme-metal-bright, #e7d6a8)`},children:[(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(`span`,{children:`π`}),(0,v.jsxs)(`span`,{children:[(0,v.jsx)(`b`,{className:`text-white`,children:`Leather placard`}),` β your mission goal.`]})]}),(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(`span`,{children:`π`}),(0,v.jsxs)(`span`,{children:[(0,v.jsx)(`b`,{className:`text-white`,children:`Paper sheets`}),` β files the team wrote. Double-click to open.`]})]}),(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(`span`,{children:`π€`}),(0,v.jsxs)(`span`,{children:[(0,v.jsx)(`b`,{className:`text-white`,children:`Index cards`}),` β each AI helper, showing what they're doing now.`]})]}),(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(`span`,{children:`π‘`}),(0,v.jsxs)(`span`,{children:[(0,v.jsx)(`b`,{className:`text-white`,children:`Sticky notes`}),` β facts the team picked up while working.`]})]}),(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(`span`,{children:`π`}),(0,v.jsxs)(`span`,{children:[(0,v.jsx)(`b`,{className:`text-white`,children:`Pink card`}),` β a question waiting on you.`]})]})]})]}),(0,v.jsx)(`style`,{children:fe})]})}function re({pose:e,onGrab:t,onPose:n,onClick:r,onDrop:i,children:a}){let[o,s]=(0,_.useState)(null),c=o?{x:o.x,y:o.y}:{x:e.x,y:e.y};return(0,v.jsx)(`div`,{onPointerDown:(0,_.useCallback)(a=>{if(a.pointerType===`mouse`&&a.button!==0||a.target.closest(`[data-no-drag]`))return;a.preventDefault(),t();let o=a.currentTarget,c=a.clientX,l=a.clientY,u=a.pointerId,d=e.x,f=e.y;s({dx:0,dy:0,x:d,y:f});try{o.setPointerCapture(u)}catch{}let p=e=>{if(e.pointerId!==u)return;let t=e.clientX-c,n=e.clientY-l;s({dx:t,dy:n,x:d+t,y:f+n})},m=t=>{if(t.pointerId!==u)return;let a=t.clientX-c,h=t.clientY-l;window.removeEventListener(`pointermove`,p),window.removeEventListener(`pointerup`,m),window.removeEventListener(`pointercancel`,m);try{o.releasePointerCapture(u)}catch{}let g=d+a,_=f+h;if(s(null),!(Math.abs(a)>4||Math.abs(h)>4)){r&&r(t.clientX,t.clientY);return}if(i){let e=document.elementsFromPoint(t.clientX,t.clientY);for(let t of e){let e=t.closest(`[data-drop-target]`);if(!e||e.contains(o))continue;let n=e.getAttribute(`data-drop-target`);if(n){if(i(n)!==!1)return;break}}}n({...e,x:g,y:_})};window.addEventListener(`pointermove`,p),window.addEventListener(`pointerup`,m),window.addEventListener(`pointercancel`,m)},[e,t,n,r,i]),className:`absolute select-none pointer-events-auto cursor-grab touch-none active:cursor-grabbing`,style:{left:c.x,top:c.y,zIndex:o?999:e.z,transform:`rotate(${e.rotation}deg) ${o?`scale(1.03)`:``}`,transition:o?`transform 80ms ease-out`:`transform 200ms ease-out`,filter:o?`drop-shadow(0 22px 32px rgba(0,0,0,0.55))`:`drop-shadow(0 6px 14px rgba(0,0,0,0.42))`,willChange:o?`left, top`:void 0},children:a})}function ie({item:e,room:t,openQuestion:n,fileSources:r,factSources:i,activityStickies:a,furniture:o,onOpenCabinet:s,onOpenTrash:c,onOpenFile:l,onAnswer:u}){if(e.kind===`goal`)return(0,v.jsx)(j,{goal:t.goal,status:t.status});if(e.kind===`document`)return(0,v.jsx)(M,{room:t});if(e.kind===`cost`)return(0,v.jsx)(N,{room:t});if(e.kind===`clock`)return(0,v.jsx)(P,{room:t});if(e.kind===`cabinet`)return(0,v.jsx)(W,{count:o.cabinet.length,onOpen:s});if(e.kind===`trash`)return(0,v.jsx)(G,{count:o.trash.length,onOpen:c});if(e.kind===`agent`){let n=t.team.find(t=>t.agentId===e.ref);return n?(0,v.jsx)(R,{member:n}):null}if(e.kind===`file`){let t=r.find(t=>t.ref===e.ref);return t?(0,v.jsx)(B,{file:t,onOpen:()=>l(t.ref)}):null}if(e.kind===`fact`){let t=i.find(t=>t.ref===e.ref);return t?(0,v.jsx)(V,{fact:t}):null}if(e.kind===`activity`){let t=a.find(t=>t.id===e.ref);return t?(0,v.jsx)(oe,{sticky:t}):null}return e.kind===`question`&&n?(0,v.jsx)(U,{msg:n,onAnswer:e=>u(n.approvalId,e)}):null}function j({goal:e,status:t}){let n={forming:{text:`forming the teamβ¦`,dotColor:`#c4a14a`,dotGlow:`#c4a14a`},working:{text:`in progress β TITAN`,dotColor:`#8ed1ff`,dotGlow:`#8ed1ff`},paused:{text:`paused β your call`,dotColor:`#d9c08c`,dotGlow:`#d9c08c`},blocked:{text:`needs your input`,dotColor:`#ff9c9c`,dotGlow:`#ff9c9c`},done:{text:`complete Β· signed off`,dotColor:`#22c55e`,dotGlow:`#22c55e`},failed:{text:`stopped β see chat`,dotColor:`#ef4444`,dotGlow:`#ef4444`}},r=n[t]??n.working;return(0,v.jsxs)(`div`,{className:`w-[420px] px-5 py-4 relative`,style:{background:`linear-gradient(140deg, var(--theme-leather, #6b2c2a) 0%, var(--theme-leather-edge, #4a1816) 60%, var(--theme-bolt, #3b110f) 100%)`,border:`1px solid var(--theme-bolt, #2a0908)`,borderRadius:10,boxShadow:`inset 0 0 24px var(--theme-shadow, rgba(0,0,0,0.5)), 0 0 0 4px rgba(0,0,0,0.08), 0 0 32px color-mix(in srgb, var(--theme-accent, #c45a30) 28%, transparent)`,backgroundBlendMode:`multiply`,color:`var(--theme-paper-fg, #f3e9d0)`},children:[(0,v.jsx)(`div`,{className:`text-[10px] uppercase mb-1.5`,style:{letterSpacing:`0.16em`,color:`var(--theme-ink-soft, #d9c08c)`,fontWeight:600},children:`Active Mission`}),(0,v.jsx)(`div`,{className:`leading-snug font-semibold tracking-tight`,style:{fontSize:22,color:`var(--theme-paper-fg, #f3e9d0)`},children:e}),(0,v.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-[10px] uppercase tracking-widest`,style:{color:`var(--theme-ink-soft, rgba(217,192,140,0.7))`},children:[(0,v.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${t===`working`||t===`blocked`||t===`forming`?`animate-pulse`:``}`,style:{background:r.dotColor,boxShadow:`0 0 6px ${r.dotGlow}`}}),(0,v.jsx)(`span`,{children:r.text})]})]})}function M({room:e}){let t=e.artifact?.content??``,n=(0,_.useRef)(t.length),[r,i]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(t.length>n.current){i(!0);let e=setTimeout(()=>i(!1),2e3);return n.current=t.length,()=>clearTimeout(e)}n.current=t.length},[t]);let a=(0,_.useMemo)(()=>t.split(`
|
|
2
|
+
`).filter(e=>e.trim().length>0).slice(0,10),[t]),o=t.trim().split(/\s+/).filter(Boolean).length,s=e.team.some(e=>e.state===`working`||e.state===`editing`),c=s&&e.team.some(e=>(e.state===`working`||e.state===`editing`)&&(e.name.toLowerCase().includes(`analyst`)||(e.role??``).toLowerCase().includes(`analyst`)));return(0,v.jsxs)(`div`,{className:`w-[620px] max-w-[92vw] rounded-md p-8 pt-7 relative`,style:{background:`var(--theme-paper, #f7f5ee)`,color:`var(--theme-ink, #1a1f2e)`,fontFamily:`var(--theme-font-display, "Iowan Old Style", "Charter", "Georgia", serif)`,backgroundImage:`repeating-linear-gradient(180deg, transparent 0 26px, var(--theme-paper-line, #d8d3c2) 26px 27px)`,backgroundPosition:`0 56px`,boxShadow:`0 18px 40px var(--theme-shadow, rgba(0,0,0,0.45)), 0 6px 14px var(--theme-shadow, rgba(0,0,0,0.35)), 0 0 0 1px color-mix(in srgb, var(--theme-accent, #c45a30) 12%, transparent)`},children:[(0,v.jsx)(`h1`,{className:`text-[22px] font-semibold tracking-tight leading-tight mb-1`,children:_e(e.goal,70)}),(0,v.jsxs)(`div`,{className:`text-[11px] uppercase tracking-widest mb-4 flex items-center gap-2`,style:{color:`var(--theme-ink-soft, #8a8472)`},children:[(0,v.jsxs)(`span`,{children:[`Draft Β· `,o,` words Β· `,ge(e.status)]}),r&&s&&(0,v.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,v.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full animate-pulse`,style:{background:`var(--theme-accent, #c4a35a)`}}),(0,v.jsx)(`span`,{className:`text-[10px] italic`,children:`Writingβ¦`})]})]}),a.length>0?(0,v.jsx)(`div`,{className:`text-[14px] leading-[1.6] space-y-3`,children:a.map((e,t)=>(0,v.jsxs)(`p`,{children:[e,r&&s&&t===a.length-1&&(0,v.jsx)(`span`,{className:`inline-block w-0.5 h-3.5 ml-0.5 align-middle animate-pulse`,style:{background:`var(--theme-accent, #c4a35a)`}})]},t))}):(0,v.jsx)(`div`,{className:`text-[12px] italic py-6 text-center`,style:{color:`var(--theme-ink-soft, #8a8472)`},children:`The team is just getting started β your document fills in as they work.`}),c&&(0,v.jsx)(ae,{})]})}function ae(){return(0,v.jsxs)(`div`,{className:`mt-5 pt-4`,style:{borderTop:`1px dashed var(--theme-paper-line, #d8d3c2)`},children:[(0,v.jsxs)(`svg`,{viewBox:`0 0 320 110`,className:`w-full h-[110px]`,"aria-hidden":!0,style:{overflow:`visible`},children:[(0,v.jsx)(`line`,{x1:`22`,y1:`6`,x2:`22`,y2:`92`,stroke:`var(--theme-ink-soft, #8a8472)`,strokeWidth:`1`,opacity:`0.5`}),(0,v.jsx)(`line`,{x1:`22`,y1:`92`,x2:`312`,y2:`92`,stroke:`var(--theme-ink-soft, #8a8472)`,strokeWidth:`1`,opacity:`0.5`}),[20,44,68].map(e=>(0,v.jsx)(`line`,{x1:`18`,y1:e,x2:`22`,y2:e,stroke:`var(--theme-ink-soft, #8a8472)`,strokeWidth:`1`,opacity:`0.35`},e)),[{x:40,h:52},{x:82,h:68},{x:124,h:32},{x:166,h:78},{x:208,h:46},{x:250,h:62},{x:292,h:40}].map((e,t)=>(0,v.jsx)(`rect`,{x:e.x-12,y:92-e.h,width:24,height:e.h,fill:`none`,stroke:`var(--theme-accent, #c45a30)`,strokeWidth:`1.5`,strokeDasharray:`4 3`,opacity:`0.55`,style:{animation:`tetherFlow 2.4s linear infinite`}},t))]}),(0,v.jsx)(`div`,{className:`text-[11px] italic mt-1 text-center`,style:{color:`var(--theme-ink-soft, #8a8472)`},children:`Analyst computingβ¦`})]})}function N({room:e}){return(0,v.jsxs)(`div`,{className:`w-[110px] h-[110px] rounded-full flex flex-col items-center justify-center`,style:{background:`radial-gradient(circle at 35% 30%, var(--theme-leather, #2b1a14) 0%, var(--theme-leather-edge, #1a0e08) 70%)`,boxShadow:`inset 0 0 18px var(--theme-shadow, rgba(0,0,0,0.6)), 0 0 0 5px var(--theme-metal-dark, #6e4a26), 0 0 0 6px var(--theme-bolt, #382213)`,color:`var(--theme-paper-fg, #f3e9d0)`},title:`Tokens + dollars spent this mission`,children:[(0,v.jsx)(`span`,{className:`text-[9px] uppercase tracking-widest`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:`spent`}),(0,v.jsxs)(`span`,{className:`text-[20px] font-bold tabular-nums`,children:[`$`,e.cost.usd.toFixed(2)]}),(0,v.jsxs)(`span`,{className:`text-[9px] tabular-nums`,style:{color:`var(--theme-ink-soft, rgba(217,192,140,0.8))`},children:[(e.cost.tokens/1e3).toFixed(1),`k tok`]})]})}function P({room:e}){let[t,n]=(0,_.useState)(()=>new Date);(0,_.useEffect)(()=>{let e=setInterval(()=>n(new Date),1e3);return()=>clearInterval(e)},[]);let r=String(t.getHours()).padStart(2,`0`),i=String(t.getMinutes()).padStart(2,`0`),a=String(t.getSeconds()).padStart(2,`0`),o=(0,_.useMemo)(()=>{try{return new Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}catch{return``}},[]),s=(0,_.useMemo)(()=>new Date(e.createdAt).getTime(),[e.createdAt]),c=e.status===`paused`||e.status===`done`||e.status===`failed`,l=L(c?Math.max(0,new Date(e.updatedAt).getTime()-s):Math.max(0,t.getTime()-s)),{working:u,blocked:d}=me(e);return(0,v.jsxs)(`div`,{className:`w-[260px] p-4 pb-3`,style:{background:`radial-gradient(ellipse at 30% 25%, var(--theme-leather, #4a2e18) 0%, var(--theme-bolt, #2a1808) 75%, var(--theme-leather-edge, #1a0e04) 100%)`,borderRadius:14,boxShadow:`0 0 0 3px var(--theme-metal-dark, #b08a3a), 0 0 0 5px var(--theme-bolt, #5a3a14), 0 12px 22px var(--theme-shadow, rgba(0,0,0,0.5)), inset 0 0 16px rgba(0,0,0,0.6)`,color:`var(--theme-metal-bright, #f5d27a)`},children:[(0,v.jsxs)(`div`,{className:`text-[9px] uppercase tracking-[0.28em] text-center mb-1.5`,style:{color:`var(--theme-metal, #c4a14a)`},children:[`TITAN`,o?` Β· `+o:``]}),(0,v.jsxs)(`div`,{className:`flex items-baseline justify-center gap-1 mb-1`,style:{fontFamily:`"DSEG7 Classic", "Orbitron", "Menlo", monospace`,textShadow:`0 0 10px rgba(245,210,122,0.65), 0 0 22px rgba(245,210,122,0.35)`},children:[(0,v.jsx)(F,{value:r}),(0,v.jsx)(`span`,{className:`text-[28px] font-bold opacity-80 -translate-y-0.5 animate-pulse`,children:`:`}),(0,v.jsx)(F,{value:i}),(0,v.jsx)(`span`,{className:`text-[20px] font-bold opacity-60 -translate-y-0.5`,children:`:`}),(0,v.jsx)(`span`,{className:`text-[24px] font-bold opacity-80 tabular-nums`,children:a})]}),(0,v.jsxs)(`div`,{className:`text-center text-[10px] uppercase tracking-[0.22em] mb-1.5`,style:{fontFamily:`system-ui`,color:`var(--theme-metal, rgba(196,161,74,0.85))`},children:[`Mission Β· `,l.hh,`:`,l.mm,`:`,l.ss,c&&(0,v.jsxs)(`span`,{className:`ml-1.5`,style:{color:`var(--theme-ink-soft, rgba(217,192,140,0.7))`},children:[`Β· `,e.status]})]}),(0,v.jsxs)(`div`,{className:`flex items-center justify-center gap-3 pt-2`,style:{fontFamily:`system-ui`,borderTop:`1px solid var(--theme-bolt, rgba(90,58,20,0.6))`},children:[(0,v.jsx)(I,{n:u,label:`working`,tone:`accent`}),(0,v.jsx)(I,{n:d,label:d===1?`needs you`:`need you`,tone:`warn`}),(0,v.jsx)(I,{n:e.team.length,label:`on team`,tone:`muted`})]})]})}function F({value:e}){return(0,v.jsx)(`span`,{className:`text-[34px] font-bold tabular-nums leading-none`,children:e})}function I({n:e,label:t,tone:n}){return(0,v.jsxs)(`div`,{className:`flex flex-col items-center leading-tight`,children:[(0,v.jsx)(`span`,{className:`text-[18px] font-bold tabular-nums`,style:{color:n===`accent`?`#8ed1ff`:n===`warn`?`#ff9c9c`:`var(--theme-metal, #c4a14a)`},children:e}),(0,v.jsx)(`span`,{className:`text-[9px] uppercase tracking-widest`,style:{color:`var(--theme-metal, rgba(196,161,74,0.8))`},children:t})]})}function L(e){let t=Math.floor(e/1e3);return{hh:String(Math.floor(t/3600)).padStart(2,`0`),mm:String(Math.floor(t%3600/60)).padStart(2,`0`),ss:String(t%60).padStart(2,`0`)}}function R({member:e}){let t=e.state===`blocked`,n=e.state===`editing`,r=e.state===`working`,i=e.state===`done`,a=r||n,o=z(e.color,t),s=a?`${e.agentId.charCodeAt(0)%10*.34}s`:`0s`,c=t?`stickyBreatheUrgent 1.2s ease-in-out infinite`:r?`stickyBreathe 1.8s ease-in-out infinite`:n?`stickyBreathe 2.4s ease-in-out infinite`:`none`,l=i?.65:1,u=be(e.state),d=e.currentActivity??(i?`wrapped up`:t?`awaiting your call`:`standing by`);return(0,v.jsxs)(`div`,{className:`w-[220px] p-3.5 pt-5 text-[#2a2418] relative`,style:{background:o,boxShadow:`0 1px 0 rgba(255,255,255,0.55) inset, 0 12px 18px rgba(0,0,0,0.42)`,fontFamily:`"Bradley Hand", "Marker Felt", "Comic Sans MS", cursive`,animation:c,animationDelay:s,opacity:l,transition:`opacity 400ms ease-out`},children:[(0,v.jsx)(`div`,{className:`absolute -top-1.5 left-1/2 -translate-x-1/2 w-20 h-4 opacity-70 pointer-events-none`,style:{background:`linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.25))`,boxShadow:`0 1px 2px rgba(0,0,0,0.15)`}}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,v.jsx)(`div`,{className:`w-7 h-7 rounded-md flex items-center justify-center text-white font-bold text-[13px]`,style:{background:`linear-gradient(135deg, ${e.color}, ${q(e.color,-25)})`,boxShadow:`0 2px 6px ${e.color}55`,fontFamily:`system-ui`},children:e.name[0]}),(0,v.jsxs)(`div`,{className:`leading-tight`,children:[(0,v.jsx)(`div`,{className:`font-semibold text-[15px] text-[#2a2418]`,children:e.name}),(0,v.jsx)(`div`,{className:`text-[10px] uppercase tracking-widest text-[#6b5a3a]`,style:{fontFamily:`system-ui`},children:e.role})]}),(0,v.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 text-[10px] text-[#6b5a3a]`,style:{fontFamily:`system-ui`},children:[i?(0,v.jsx)(`span`,{className:`text-[12px] leading-none`,"aria-label":`done`,children:`β`}):(0,v.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${ve(e.state)}`,style:{boxShadow:`0 0 6px ${ye(e.state)}`}}),(0,v.jsx)(`span`,{children:u})]})]}),(0,v.jsx)(`div`,{className:`text-[14px] text-[#2a2418] leading-snug min-h-[2.4rem] break-words`,children:e.currentActivity??(0,v.jsx)(`span`,{className:`italic text-[#6b5a3a]`,children:d})}),(a||t)&&(0,v.jsx)(`div`,{className:`absolute -inset-1 -z-10 pointer-events-none rounded-[2px] blur-md`,style:{background:t?`radial-gradient(circle at 50% 50%, rgba(239,68,68,0.6), transparent 70%)`:`radial-gradient(circle at 30% 30%, ${e.color}55, transparent 70%)`,animation:t?`deskAlarm 1.2s ease-in-out infinite`:`deskGlow 4.2s ease-in-out infinite`}})]})}function z(e,t){if(t)return`linear-gradient(165deg, #ffd6d6 0%, #ffbaba 100%), linear-gradient(45deg, transparent 49%, rgba(0,0,0,0.04) 49% 51%, transparent 51%)`;let n=e.toLowerCase();return n.includes(`6366f1`)||n.includes(`8b5cf6`)?`linear-gradient(160deg, #e7e1ff 0%, #cfc4ff 100%)`:n.includes(`22c55e`)||n.includes(`10b981`)?`linear-gradient(160deg, #d9f7d9 0%, #b8edb8 100%)`:n.includes(`f59e0b`)||n.includes(`eab308`)?`linear-gradient(160deg, #fff2a8 0%, #ffe88a 100%)`:n.includes(`ef4444`)||n.includes(`f97316`)?`linear-gradient(160deg, #ffd6c2 0%, #ffbf9e 100%)`:n.includes(`06b6d4`)||n.includes(`0ea5e9`)?`linear-gradient(160deg, #cef3f7 0%, #a8e4ec 100%)`:`linear-gradient(160deg, #fff2a8 0%, #ffe88a 100%)`}function B({file:e,onOpen:t}){let n=(0,_.useMemo)(()=>{let t=e.ref.lastIndexOf(`/`);return t>=0?e.ref.slice(t+1):e.ref},[e.ref]);return(0,v.jsxs)(`div`,{onDoubleClick:t,title:`Double-click to open`,className:`w-[200px] p-3`,style:{background:`linear-gradient(170deg, var(--theme-paper, #fdfbf3) 0%, var(--theme-paper, #f1eada) 100%)`,color:`var(--theme-ink, #1a1f2e)`,borderRadius:4,boxShadow:`0 1px 0 rgba(255,255,255,0.6) inset, 0 0 0 1px rgba(0,0,0,0.06)`},children:[(0,v.jsx)(`div`,{className:`absolute top-0 right-0 w-4 h-4`,style:{background:`linear-gradient(225deg, var(--theme-paper-line, #d8cdb3) 0%, var(--theme-paper, #f1eada) 50%, transparent 50%)`,borderBottomLeftRadius:4}}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-2`,children:[(0,v.jsx)(`span`,{className:`text-base leading-none`,children:e.type===`report`?`π`:`π`}),(0,v.jsx)(`span`,{className:`text-[9px] uppercase tracking-widest`,style:{color:`var(--theme-ink-soft, #8a8472)`},children:e.type})]}),(0,v.jsx)(`div`,{className:`font-semibold text-[12px] leading-tight break-words`,style:{color:`var(--theme-ink, #1a1f2e)`},children:n}),e.description&&(0,v.jsx)(`div`,{className:`text-[10px] mt-1 leading-snug line-clamp-2`,style:{color:`var(--theme-ink-soft, #5a5240)`},children:e.description}),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:t,className:`mt-2 w-full px-2 py-1 text-[10px] font-semibold uppercase tracking-widest rounded`,style:{background:`var(--theme-ink, #1a1f2e)`,color:`var(--theme-paper-fg, #f3e9d0)`},children:`Open β`})]})}function V({fact:e}){let t=e.description??e.ref;return(0,v.jsxs)(`div`,{className:`w-[160px] p-3`,style:{background:`linear-gradient(160deg, var(--theme-sticky-yellow, #fff2a8) 0%, var(--theme-sticky-yellow, #ffe88a) 100%)`,boxShadow:`0 1px 0 rgba(255,255,255,0.5) inset, 0 8px 14px var(--theme-shadow, rgba(0,0,0,0.35))`,fontFamily:`"Bradley Hand", "Comic Sans MS", cursive`,color:`var(--theme-ink, #3a2e10)`},children:[(0,v.jsx)(`div`,{className:`absolute -top-2 left-1/2 -translate-x-1/2 w-12 h-3.5 opacity-60`,style:{background:`linear-gradient(180deg, var(--theme-sticky-tape, rgba(255,255,255,0.65)), rgba(255,255,255,0.25))`}}),(0,v.jsx)(`div`,{className:`text-[12px] leading-snug`,children:t})]})}function oe({sticky:e}){let t=H(e.agentColor),n=e.count>1;return(0,v.jsxs)(`div`,{className:`w-[170px] p-2.5 relative`,title:n?`${e.agentName} Β· ${e.activity} Γ ${e.count}\nlatest: ${e.recentDetails[0]??`(no detail)`}\n`+(e.recentDetails.length>1?`prior: ${e.recentDetails.slice(1).join(` Β· `)}\n`:``)+`most recent at ${new Date(e.at).toLocaleTimeString()}`:`${e.agentName} ${e.activity}${e.detail?`: `+e.detail:``} Β· ${new Date(e.at).toLocaleTimeString()}`,style:{background:t,boxShadow:`0 1px 0 rgba(255,255,255,0.55) inset, 0 6px 10px var(--theme-shadow, rgba(0,0,0,0.32))`,fontFamily:`"Bradley Hand", "Marker Felt", "Comic Sans MS", cursive`,color:`var(--theme-ink, #2a2418)`},children:[(0,v.jsx)(`div`,{className:`absolute -top-1.5 left-1/2 -translate-x-1/2 w-10 h-3 opacity-60 pointer-events-none`,style:{background:`linear-gradient(180deg, var(--theme-sticky-tape, rgba(255,255,255,0.7)), rgba(255,255,255,0.25))`}}),n&&(0,v.jsxs)(`div`,{className:`absolute -top-2 -right-2 min-w-[22px] h-[22px] px-1.5 rounded-full flex items-center justify-center text-[11px] font-semibold pointer-events-none`,style:{background:`var(--theme-metal-dark, #5a4818)`,color:`var(--theme-sticky-yellow, #fff8c8)`,boxShadow:`0 1px 3px rgba(0,0,0,0.35)`,fontFamily:`system-ui`},"aria-label":`${e.count} repeated activities`,children:[`Γ`,e.count]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1`,children:[(0,v.jsx)(`span`,{className:`text-base leading-none`,children:e.icon}),(0,v.jsx)(`span`,{className:`text-[10px] uppercase tracking-widest truncate`,style:{fontFamily:`system-ui`,color:`var(--theme-ink-soft, #6b5a3a)`},children:e.agentName})]}),(0,v.jsx)(`div`,{className:`text-[12px] leading-snug`,children:e.activity}),e.detail&&(0,v.jsxs)(`div`,{className:`text-[11px] mt-1 leading-snug break-words line-clamp-3`,style:{color:`var(--theme-ink-soft, #5a4818)`},children:[n?(0,v.jsx)(`span`,{style:{color:`var(--theme-ink-soft, #5a4818)`,opacity:.7},children:`latest: `}):null,e.detail]})]})}function H(e){let t=e.toLowerCase();return t.includes(`6366f1`)||t.includes(`8b5cf6`)?`linear-gradient(160deg, #efeaff 0%, #e0d5ff 100%)`:t.includes(`22c55e`)||t.includes(`10b981`)||t.includes(`4adbb5`)?`linear-gradient(160deg, #e7faea 0%, #cef0d4 100%)`:t.includes(`f59e0b`)||t.includes(`eab308`)||t.includes(`ff9a4a`)?`linear-gradient(160deg, #fff8c8 0%, #ffefa3 100%)`:t.includes(`ef4444`)||t.includes(`f97316`)||t.includes(`ff5d6c`)?`linear-gradient(160deg, #ffe2d4 0%, #ffcfba 100%)`:t.includes(`06b6d4`)||t.includes(`0ea5e9`)||t.includes(`6ea8ff`)?`linear-gradient(160deg, #e0f5fa 0%, #c5e9f1 100%)`:`linear-gradient(160deg, #fff8c8 0%, #ffefa3 100%)`}function U({msg:e,onAnswer:t}){let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(``),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{n&&o.current&&o.current.focus()},[n]),(0,v.jsxs)(`div`,{className:`w-[300px] p-4 rounded-xl`,style:{background:`linear-gradient(180deg, var(--theme-sticky-pink, #ffe9eb), var(--theme-sticky-pink, #ffd0d4))`,boxShadow:`0 18px 36px rgba(255,93,108,0.45), 0 0 0 1.5px var(--theme-accent, rgba(196,90,48,0.6)), 0 0 0 4px rgba(255,93,108,0.12)`,animation:`questionLift 4s ease-in-out infinite`,color:`#5c1820`,transform:`translateY(-10px)`},children:[(0,v.jsx)(`div`,{className:`absolute -top-2 -right-2 w-5 h-5 rounded-full`,style:{background:`radial-gradient(circle at 35% 30%, var(--theme-metal-bright, #ffd86e) 0%, var(--theme-metal-dark, #b07a1a) 70%, var(--theme-bolt, #6a4710) 100%)`,boxShadow:`0 2px 4px var(--theme-shadow, rgba(0,0,0,0.5))`}}),(0,v.jsxs)(`div`,{className:`text-[10px] uppercase mb-1.5`,style:{letterSpacing:`0.16em`,color:`rgba(92,24,32,0.7)`,fontWeight:600},children:[e.from.name,` asks`]}),(0,v.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 px-2 py-0.5 mb-2 bg-[#5c1820] text-[#ffd0d4] text-[10px] uppercase tracking-widest font-bold rounded-full`,children:[(0,v.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-white animate-pulse`}),`TITAN paused β your call.`]}),(0,v.jsx)(`div`,{className:`text-[13px] leading-snug`,children:e.content}),n?(0,v.jsxs)(`div`,{className:`mt-3`,children:[(0,v.jsx)(`textarea`,{ref:o,"data-no-drag":!0,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)){e.preventDefault();let n=i.trim();n&&t(n)}else e.key===`Escape`&&r(!1)},rows:2,placeholder:`Your answerβ¦`,className:`w-full bg-white/90 border border-[rgba(160,41,56,0.25)] rounded-lg p-2 text-[12px] text-[#5c1820] outline-none`}),(0,v.jsxs)(`div`,{className:`flex items-center justify-end gap-2 mt-1`,children:[(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>r(!1),className:`text-[10px] text-[#5c1820]/70 hover:text-[#5c1820]`,children:`cancel`}),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>{let e=i.trim();e&&t(e)},disabled:!i.trim(),className:`px-2 py-0.5 rounded text-[11px] font-semibold disabled:opacity-50 text-[var(--theme-paper,#f3e9d0)] bg-[var(--theme-ink,#1a1f2e)]`,children:`Send`})]})]}):(0,v.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[e.quickReplies.map((n,r)=>(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>t(n),className:`px-2.5 py-1 rounded-lg text-[11px] font-semibold border ${r===e.quickReplies.length-1?`border-transparent text-[var(--theme-paper,#f3e9d0)] bg-[var(--theme-ink,#1a1f2e)]`:`bg-white border-[rgba(160,41,56,0.25)] text-[#5c1820]`}`,children:n},n)),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>r(!0),className:`px-2.5 py-1 rounded-lg text-[11px] font-medium underline underline-offset-2 text-[#5c1820]/80 hover:text-[#5c1820]`,children:`or typeβ¦`})]})]})}function W({count:e,onOpen:t}){return(0,v.jsxs)(`div`,{"data-drop-target":`cabinet`,className:`w-[140px] flex flex-col`,style:{color:`var(--theme-metal-bright, #f5d27a)`},title:e>0?`${e} filed β click to open`:`Drop files & notes here`,children:[(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:t,className:`text-left flex flex-col gap-1 p-0 bg-transparent border-none`,children:[0,1].map(e=>(0,v.jsxs)(`div`,{className:`relative w-full h-[58px] flex items-center justify-center`,style:{background:`linear-gradient(180deg, var(--theme-leather, #5a3a18) 0%, var(--theme-leather-edge, #3a230b) 100%), repeating-linear-gradient(90deg, rgba(255,180,90,0.05) 0px, rgba(60,30,10,0.08) 2px)`,border:`1px solid var(--theme-bolt, #2a1808)`,boxShadow:`inset 0 -2px 0 rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.08) inset`},children:[(0,v.jsx)(`div`,{className:`px-3 py-0.5 text-[10px] uppercase tracking-widest font-bold`,style:{background:`linear-gradient(180deg, var(--theme-metal-bright, #ffd86e) 0%, var(--theme-metal-dark, #b07a1a) 100%)`,borderRadius:2,boxShadow:`0 1px 2px var(--theme-shadow, rgba(0,0,0,0.4))`,color:`var(--theme-bolt, #3a2a10)`},children:e===0?`Files`:`Drafts`}),(0,v.jsx)(`div`,{className:`absolute right-3 w-6 h-1.5 rounded`,style:{background:`linear-gradient(180deg, var(--theme-metal-bright, #ffd86e) 0%, var(--theme-metal-dark, #8a5810) 100%)`,boxShadow:`0 1px 2px var(--theme-shadow, rgba(0,0,0,0.5))`}})]},e))}),e>0&&(0,v.jsxs)(`div`,{className:`mt-1 text-center text-[10px] uppercase tracking-widest`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:[e,` `,e===1?`item`:`items`,` inside`]})]})}function G({count:e,onOpen:t}){let n=Math.min(e,6);return(0,v.jsxs)(`button`,{type:`button`,"data-drop-target":`trash`,"data-no-drag":!0,onClick:t,className:`relative w-[110px] h-[120px] p-0 bg-transparent border-none cursor-pointer`,title:e>0?`${e} tossed β click to open the bin`:`Drop notes here to toss them`,children:[(0,v.jsx)(`div`,{className:`absolute inset-x-3 top-3 bottom-12 flex flex-wrap gap-1 items-end justify-center overflow-hidden`,children:Array.from({length:n}).map((e,t)=>(0,v.jsx)(`div`,{className:`rounded-full`,style:{width:18+t*5%14,height:18+t*7%12,background:`radial-gradient(circle at 35% 30%, var(--theme-paper, #fffaee) 0%, var(--theme-paper-line, #d6cdb1) 70%, var(--theme-ink-soft, #a99b71) 100%)`,boxShadow:`inset -2px -2px 4px rgba(0,0,0,0.18), 0 1px 2px var(--theme-shadow, rgba(0,0,0,0.3))`,transform:`rotate(${t*37%60-30}deg)`}},t))}),(0,v.jsx)(`div`,{className:`absolute left-2 right-2 bottom-0 h-[80px] overflow-hidden`,style:{clipPath:`polygon(8% 0%, 92% 0%, 100% 100%, 0% 100%)`,background:`repeating-linear-gradient(90deg, var(--theme-leather, #5a3a18) 0px, var(--theme-leather, #5a3a18) 2px, var(--theme-leather-edge, #3a230b) 2px, var(--theme-leather-edge, #3a230b) 4px),repeating-linear-gradient(0deg, transparent 0 6px, rgba(0,0,0,0.25) 6px 7px)`,border:`1px solid var(--theme-bolt, #2a1808)`,borderRadius:4,boxShadow:`inset 0 4px 8px var(--theme-shadow, rgba(0,0,0,0.5))`}}),(0,v.jsx)(`div`,{className:`absolute left-1 right-1 bottom-[78px] h-2.5 rounded-sm`,style:{background:`linear-gradient(180deg, var(--theme-metal-dark, #6b4720) 0%, var(--theme-leather-edge, #3a230b) 100%)`,border:`1px solid var(--theme-bolt, #1a0f05)`,boxShadow:`inset 0 1px 0 rgba(255,255,255,0.1)`}}),e>0&&(0,v.jsxs)(`div`,{className:`absolute -bottom-5 left-1/2 -translate-x-1/2 text-[10px] uppercase tracking-widest whitespace-nowrap`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:[e,` tossed`]})]})}function se({itemIds:e,items:t,fileSources:n,factSources:r,activityStickies:i,onRestore:a,onRestoreAt:o,onOpenFile:s,onClose:c}){let[l,u]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!l)return;let e=e=>{u(t=>t?{...t,x:e.clientX,y:e.clientY}:null)},t=e=>{o(l.itemId,e.clientX,e.clientY),u(null)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[l,o]);function d(e,t,n,r){e.target.closest(`[data-no-drag]`)||(e.preventDefault(),u({itemId:t,label:n,icon:r,x:e.clientX,y:e.clientY}),c())}return(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-6`,onClick:c,children:[(0,v.jsxs)(`div`,{className:`relative w-full max-w-2xl max-h-[80vh] flex flex-col rounded-2xl overflow-hidden`,onClick:e=>e.stopPropagation(),style:{background:`linear-gradient(180deg, var(--theme-leather, #4a2e18) 0%, var(--theme-bolt, #2a1808) 100%)`,boxShadow:`0 0 0 3px var(--theme-metal-dark, #b08a3a), 0 30px 60px var(--theme-shadow, rgba(0,0,0,0.6))`,color:`var(--theme-metal-bright, #f5d27a)`},children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-3`,style:{borderBottom:`1px solid var(--theme-metal-dark, #6e4724)`},children:[(0,v.jsx)(`span`,{className:`text-2xl`,children:`ποΈ`}),(0,v.jsxs)(`div`,{className:`flex-1`,children:[(0,v.jsx)(`div`,{className:`text-sm font-semibold tracking-tight`,children:`Filing cabinet`}),(0,v.jsxs)(`div`,{className:`text-[11px]`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:[e.length,` item`,e.length===1?``:`s`,` filed Β· drag a row out, or click `,(0,v.jsx)(`b`,{children:`to desk`})]})]}),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:c,className:`w-8 h-8 rounded-full hover:text-white flex items-center justify-center`,style:{background:`var(--theme-leather-edge, #1a0f05)`,border:`1px solid var(--theme-metal-dark, #6e4724)`,color:`var(--theme-ink-soft, #d9c08c)`},children:`β`})]}),(0,v.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 flex flex-col gap-2`,children:[e.length===0&&(0,v.jsx)(`div`,{className:`text-center py-12 italic`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:`Nothing filed yet. Drag a file or sticky note onto the cabinet to file it.`}),e.map(e=>{let o=t.find(t=>t.id===e);if(!o)return(0,v.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 rounded-lg`,style:{background:`var(--theme-leather-edge, rgba(26,15,5,0.4))`,border:`1px solid var(--theme-metal-dark, rgba(110,71,36,0.5))`,color:`var(--theme-ink-soft, rgba(217,192,140,0.7))`},children:[(0,v.jsxs)(`span`,{className:`text-xs italic`,children:[e,` (no longer in mission)`]}),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>a(e),className:`text-[11px] hover:text-white`,children:`remove`})]},e);let c=o.kind===`file`?n.find(e=>e.ref===o.ref):void 0,l=o.kind===`fact`?r.find(e=>e.ref===o.ref):void 0,u=o.kind===`activity`?i.find(e=>e.id===o.ref):void 0,f=c?c.type===`report`?`π`:`π`:l?`π‘`:u?u.icon:`π`,p=c?.ref??l?.ref??(u?`${u.agentName} Β· ${u.activity}`:e);return(0,v.jsxs)(`div`,{onMouseDown:t=>d(t,e,p,f),className:`flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-grab active:cursor-grabbing`,style:{background:`var(--theme-leather-edge, rgba(26,15,5,0.4))`,border:`1px solid var(--theme-metal-dark, rgba(110,71,36,0.5))`},title:`Drag out to place on the desk, or use the buttons β`,children:[(0,v.jsx)(`span`,{className:`text-lg leading-none`,children:f}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,v.jsx)(`div`,{className:`text-xs truncate`,style:{color:`var(--theme-metal-bright, #f5d27a)`},children:p}),(c?.description??l?.description)&&(0,v.jsx)(`div`,{className:`text-[10px] truncate`,style:{color:`var(--theme-ink-soft, #d9c08c)`},children:c?.description??l?.description})]}),c&&(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>s(c.ref),className:`px-2 py-1 text-[10px] rounded hover:text-white`,style:{background:`var(--theme-metal-dark, #6e4724)`,border:`1px solid var(--theme-metal-dark, #b08a3a)`,color:`var(--theme-metal-bright, #f5d27a)`},children:`Open β`}),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>a(e),className:`px-2 py-1 text-[10px] rounded hover:text-white`,style:{background:`var(--theme-leather-edge, #1a0f05)`,border:`1px solid var(--theme-metal-dark, #6e4724)`,color:`var(--theme-ink-soft, #d9c08c)`},children:`to desk`})]},e)})]})]}),l&&(0,v.jsx)(`div`,{className:`fixed z-[70] pointer-events-none`,style:{left:l.x-80,top:l.y-20},children:(0,v.jsxs)(`div`,{className:`px-3 py-2 rounded text-xs flex items-center gap-2 shadow-2xl`,style:{transform:`rotate(-2deg)`,background:`var(--theme-paper, #fdfbf3)`,color:`var(--theme-ink, #1a1f2e)`},children:[(0,v.jsx)(`span`,{children:l.icon}),(0,v.jsx)(`span`,{className:`font-semibold truncate max-w-[200px]`,children:l.label})]})})]})}function ce({itemIds:e,items:t,fileSources:n,factSources:r,activityStickies:i,onRestore:a,onDeleteForever:o,onClose:s}){return(0,v.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-6`,onClick:s,children:(0,v.jsxs)(`div`,{className:`relative w-full max-w-2xl max-h-[80vh] flex flex-col rounded-2xl overflow-hidden text-[#f5d27a]`,onClick:e=>e.stopPropagation(),style:{background:`linear-gradient(180deg, #4a2018 0%, #2a0e08 100%)`,boxShadow:`0 0 0 3px #c46a52, 0 30px 60px var(--theme-shadow, rgba(0,0,0,0.6))`},children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-3 border-b border-[#6e3024]`,children:[(0,v.jsx)(`span`,{className:`text-2xl`,children:`ποΈ`}),(0,v.jsxs)(`div`,{className:`flex-1`,children:[(0,v.jsx)(`div`,{className:`text-sm font-semibold tracking-tight`,children:`Wastebasket`}),(0,v.jsxs)(`div`,{className:`text-[11px] text-[#e9b09a]`,children:[e.length,` item`,e.length===1?``:`s`,` tossed Β·`,(0,v.jsx)(`span`,{className:`ml-1`,children:`restore to desk, or delete forever`})]})]}),(0,v.jsx)(`button`,{onClick:s,className:`w-8 h-8 rounded-full bg-[#1a0a08] border border-[#6e3024] text-[#e9b09a] hover:text-white flex items-center justify-center`,children:`β`})]}),(0,v.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 flex flex-col gap-2`,children:[e.length===0&&(0,v.jsx)(`div`,{className:`text-center py-12 text-[#e9b09a] italic`,children:`Nothing in the bin. Drag a file, sticky, or activity onto the wastebasket to toss it.`}),e.map(e=>{let s=t.find(t=>t.id===e),c=s?.kind===`file`?n.find(e=>e.ref===s.ref):void 0,l=s?.kind===`fact`?r.find(e=>e.ref===s.ref):void 0,u=s?.kind===`activity`?i.find(e=>e.id===s.ref):void 0,d=c?c.type===`report`?`π`:`π`:l?`π‘`:u?u.icon:`π`,f=c?.ref??l?.ref??(u?`${u.agentName} Β· ${u.activity}`:e),p=c?.description??l?.description??u?.detail;return(0,v.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 bg-[#1a0a08]/60 border border-[#6e3024]/50 rounded-lg hover:bg-[#1a0a08]/80 transition-colors`,title:s?`Restore to the desk or delete forever`:`This item no longer exists in the mission`,children:[(0,v.jsx)(`span`,{className:`text-lg leading-none opacity-70`,children:d}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,v.jsx)(`div`,{className:`text-xs text-[#f5d27a] truncate line-through decoration-[#c46a52]/50`,children:f}),p&&(0,v.jsx)(`div`,{className:`text-[10px] text-[#e9b09a]/80 truncate`,children:p})]}),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>a(e),className:`px-2.5 py-1 text-[10px] bg-[#1a0a08] border border-[#6e3024] rounded text-[#e9b09a] hover:text-white hover:border-[#c46a52]`,title:`Pull this item back out of the bin and put it on the desk`,children:`β© to desk`}),(0,v.jsx)(`button`,{"data-no-drag":!0,onClick:()=>{window.confirm(`Delete this forever?\n\n"${f.slice(0,100)}${f.length>100?`β¦`:``}"\n\nThe item will never reappear on the desk again, even after a reload. This is UI-only β the underlying mission file/note isn't deleted on disk.`)&&o(e)},className:`px-2.5 py-1 text-[10px] bg-[#3a0a08] border border-[#c46a52]/60 rounded text-[#ff9c9c] hover:text-white hover:bg-[#5a0e0a] hover:border-[#ff9c9c]`,title:`Permanently hide this item β gone for good`,children:`β Delete forever`})]},e)})]}),e.length>0&&(0,v.jsx)(`div`,{className:`px-5 py-2 border-t border-[#6e3024] text-center text-[10px] text-[#e9b09a]/70 uppercase tracking-widest`,children:`tip: drag items onto the wastebasket from the desk Β· restore is non-destructive`})]})})}var le={background:[`radial-gradient(ellipse 120px 80px at 78% 28%, rgba(40,18,8,0.55) 0%, rgba(40,18,8,0) 70%)`,`radial-gradient(ellipse 90px 60px at 22% 72%, rgba(40,18,8,0.45) 0%, rgba(40,18,8,0) 75%)`,`repeating-linear-gradient(92deg, rgba(255,180,90,0.05) 0px, rgba(60,30,10,0.08) 3px, rgba(255,180,90,0.04) 7px, rgba(60,30,10,0.10) 11px, rgba(255,180,90,0.06) 16px)`,`repeating-linear-gradient(0deg, rgba(0,0,0,0.04) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.03) 4px)`,`linear-gradient(180deg, var(--theme-bg-base, #6e4724) 0%, var(--theme-bg-grain, #5a3717) 50%, var(--theme-leather-edge, #482a13) 100%)`].join(`,`)},ue={background:`radial-gradient(ellipse 80% 60% at 20% 0%, rgba(255,220,140,0.18) 0%, rgba(0,0,0,0) 55%)`},de={background:`radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 50%, var(--theme-bg-vignette, rgba(0,0,0,0.45)) 100%)`},fe=`
|
|
3
|
+
@keyframes deskGlow {
|
|
4
|
+
0%, 100% { opacity: 0.5; }
|
|
5
|
+
50% { opacity: 0.8; }
|
|
6
|
+
}
|
|
7
|
+
@keyframes deskAlarm {
|
|
8
|
+
0%, 100% { opacity: 0.5; }
|
|
9
|
+
50% { opacity: 1; }
|
|
10
|
+
}
|
|
11
|
+
@keyframes deskFloat {
|
|
12
|
+
0%, 100% { transform: translateY(0); }
|
|
13
|
+
50% { transform: translateY(-3px); }
|
|
14
|
+
}
|
|
15
|
+
/* Phase 3 polish β Sage decision card sits ~10px elevated and
|
|
16
|
+
floats gently. Uses an offset baseline so the card stays raised
|
|
17
|
+
relative to the rest of the desk furniture. */
|
|
18
|
+
@keyframes questionLift {
|
|
19
|
+
0%, 100% { transform: translateY(-10px); }
|
|
20
|
+
50% { transform: translateY(-13px); }
|
|
21
|
+
}
|
|
22
|
+
/* v6.1.0-alpha.24 β gentle bob on working sticky notes. Lives on an
|
|
23
|
+
INNER wrapper so it composes with the parent Draggable's rotation
|
|
24
|
+
transform. */
|
|
25
|
+
@keyframes stickyBreathe {
|
|
26
|
+
0%, 100% { transform: translateY(0); }
|
|
27
|
+
50% { transform: translateY(-2.5px); }
|
|
28
|
+
}
|
|
29
|
+
/* Phase 2 polish β faster breath for "needs you" cards (1.2s). */
|
|
30
|
+
@keyframes stickyBreatheUrgent {
|
|
31
|
+
0%, 100% { transform: translateY(0); }
|
|
32
|
+
50% { transform: translateY(-3.5px); }
|
|
33
|
+
}
|
|
34
|
+
/* Phase 2 polish β generic bead-fade keyframe. Actual path travel
|
|
35
|
+
is implemented via SVG animateMotion + mpath in LivingDeskLayer
|
|
36
|
+
so it works without offset-path support. Kept as a fallback. */
|
|
37
|
+
@keyframes beadFlow {
|
|
38
|
+
0%, 100% { opacity: 0; }
|
|
39
|
+
10%, 90% { opacity: 0.9; }
|
|
40
|
+
}
|
|
41
|
+
/* Tether-line dash flow β animates stroke-dashoffset to give the
|
|
42
|
+
thread a moving-current feel. The dasharray defines the segment
|
|
43
|
+
pattern. */
|
|
44
|
+
@keyframes tetherFlow {
|
|
45
|
+
to { stroke-dashoffset: -20; }
|
|
46
|
+
}
|
|
47
|
+
/* Dust mote drift β slow vertical drift with a gentle horizontal
|
|
48
|
+
wobble. Two duration variants so motes don't tick in unison. */
|
|
49
|
+
@keyframes mote1 {
|
|
50
|
+
0% { transform: translate(0, 0) scale(1); opacity: 0; }
|
|
51
|
+
10% { opacity: 0.55; }
|
|
52
|
+
90% { opacity: 0.45; }
|
|
53
|
+
100% { transform: translate(14px, -90vh) scale(1.1); opacity: 0; }
|
|
54
|
+
}
|
|
55
|
+
@keyframes mote2 {
|
|
56
|
+
0% { transform: translate(0, 0) scale(0.9); opacity: 0; }
|
|
57
|
+
10% { opacity: 0.4; }
|
|
58
|
+
90% { opacity: 0.3; }
|
|
59
|
+
100% { transform: translate(-12px, -90vh) scale(1); opacity: 0; }
|
|
60
|
+
}
|
|
61
|
+
`;function pe({items:e,room:t,poseOf:n,isHidden:r}){let i=e.find(e=>e.kind===`document`),a=i&&!r(i.id)?n(i):null,o=(0,_.useMemo)(()=>{if(!a)return[];let i=[];for(let a of e){if(a.kind!==`agent`||r(a.id))continue;let e=t.team.find(e=>e.agentId===a.ref);e&&(e.paused||e.state!==`working`&&e.state!==`editing`||i.push({item:a,member:e,pose:n(a)}))}return i},[e,t.team,n,r,a]),s=o.length>0;return(0,v.jsxs)(v.Fragment,{children:[a&&o.length>0&&(0,v.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none`,style:{zIndex:5},"aria-hidden":!0,children:[(0,v.jsx)(`defs`,{children:(0,v.jsxs)(`radialGradient`,{id:`tetherNodeGlow`,children:[(0,v.jsx)(`stop`,{offset:`0%`,stopColor:`var(--theme-metal-bright, #ffd86e)`,stopOpacity:`0.9`}),(0,v.jsx)(`stop`,{offset:`100%`,stopColor:`var(--theme-metal-bright, #ffd86e)`,stopOpacity:`0`})]})}),o.map(({item:e,member:t,pose:n})=>{let r=n.x+220/2,i=n.y+110/2,o=a.x+620/2,s=a.y+300/2,c=`M ${r} ${i} Q ${(r+o)/2} ${(i+s)/2-40}, ${o} ${s}`,l=t.state===`editing`?`rgba(245, 158, 11, 0.55)`:t.state===`blocked`?`rgba(239, 68, 68, 0.7)`:`rgba(255, 216, 110, 0.55)`,u=t.color,d=`tether-path-${e.id}`;return(0,v.jsxs)(`g`,{children:[(0,v.jsx)(`path`,{id:d,d:c,fill:`none`,stroke:l,strokeWidth:1.4,strokeDasharray:`8 8`,style:{animation:`tetherFlow 1.6s linear infinite`}}),(0,v.jsx)(`circle`,{cx:r,cy:i,r:14,fill:`url(#tetherNodeGlow)`}),(0,v.jsx)(`circle`,{r:3.2,fill:u,opacity:.95,children:(0,v.jsx)(`animateMotion`,{dur:`2.2s`,repeatCount:`indefinite`,children:(0,v.jsx)(`mpath`,{href:`#${d}`})})})]},e.id)})]}),s&&(0,v.jsx)(`div`,{className:`absolute inset-0 pointer-events-none overflow-hidden`,style:{zIndex:6},"aria-hidden":!0,children:K.map((e,t)=>(0,v.jsx)(`span`,{className:`absolute rounded-full`,style:{left:`${e.left}vw`,bottom:`${-5+e.delay%12}vh`,width:e.size,height:e.size,background:`radial-gradient(circle at 35% 30%, rgba(255,250,235,0.85) 0%, rgba(212,196,158,0.4) 60%, rgba(0,0,0,0) 100%)`,animation:`${t%2==0?`mote1`:`mote2`} ${e.duration}s linear infinite`,animationDelay:`${e.delay}s`,filter:`blur(0.4px)`}},t))})]})}var K=[{left:6,size:3,duration:28,delay:0},{left:14,size:2,duration:36,delay:3},{left:22,size:4,duration:30,delay:8},{left:30,size:2,duration:40,delay:1},{left:38,size:3,duration:26,delay:5},{left:46,size:3,duration:34,delay:11},{left:54,size:2,duration:38,delay:2},{left:62,size:4,duration:32,delay:7},{left:70,size:3,duration:30,delay:9},{left:78,size:2,duration:36,delay:4},{left:86,size:3,duration:28,delay:12},{left:94,size:4,duration:34,delay:6}];function me(e){let t=0,n=0;for(let r of e.team)(r.state===`working`||r.state===`editing`)&&t++,r.state===`blocked`&&n++;return{working:t,blocked:n}}function he(e,t,n){return e===`paused`?`Paused`:e===`done`?`Done`:e===`failed`?`Stopped`:n>0?`${t} working Β· ${n} needs you`:t>0?`${t} working`:e===`forming`?`Forming teamβ¦`:`Idle`}function ge(e){return e===`paused`?`paused`:e===`done`?`done`:e===`failed`?`stopped`:e===`blocked`?`waiting on you`:`auto-saving`}function _e(e,t){return e.length<=t?e:e.slice(0,t-1)+`β¦`}function ve(e){switch(e){case`working`:return`bg-accent animate-pulse`;case`editing`:return`bg-warning animate-pulse`;case`blocked`:return`bg-error animate-pulse`;case`done`:return`bg-success`;default:return`bg-text-muted`}}function ye(e){switch(e){case`working`:return`#6366f1`;case`editing`:return`#f59e0b`;case`blocked`:return`#ef4444`;case`done`:return`#22c55e`;default:return`#71717a`}}function be(e){return e===`working`?`working`:e===`editing`?`editing`:e===`blocked`?`needs you`:e===`done`?`done`:`idle`}function q(e,t){let n=e.replace(`#`,``);if(n.length!==6)return e;let r=parseInt(n,16),i=r>>16&255,a=r>>8&255,o=r&255,s=Math.round(t/100*255);return i=Math.max(0,Math.min(255,i+s)),a=Math.max(0,Math.min(255,a+s)),o=Math.max(0,Math.min(255,o+s)),`#`+(i<<16|a<<8|o).toString(16).padStart(6,`0`)}export{A as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{ar as r,ir as i}from"./index-WI-E4I3h.js";import{a,d as o,f as s,i as c,r as l,s as u,t as d}from"./missions-y-qg_f9b.js";import{t as f}from"./FileViewer-DjcVKkO2.js";var p=e(t(),1),m=n(),h=/\bhttps?:\/\/[^\s<>()[\]"']+[^\s<>()[\]"',.!?;:]/gi;function g(e){if(!e)return[];let t=[],n=0;for(let r of e.matchAll(h))r.index!==void 0&&(r.index>n&&t.push(e.slice(n,r.index)),t.push({url:r[0]}),n=r.index+r[0].length);return n<e.length&&t.push(e.slice(n)),t}function _(e){try{let t=new URL(e),n=t.host.replace(/^www\./,``),r=(t.pathname+t.search+t.hash).replace(/^\//,``);if(r.length===0)return n;let i=`${n}/${r}`;return i.length<=60?i:i.slice(0,57)+`β¦`}catch{return e.length<=60?e:e.slice(0,57)+`β¦`}}function v({text:e,sources:t,onOpenFile:n}){let r=(0,p.useMemo)(()=>g(e),[e]),i=(0,p.useMemo)(()=>(t??[]).filter(e=>e.type===`url`),[t]),a=(0,p.useMemo)(()=>(t??[]).filter(e=>e.type!==`url`),[t]),o=(0,p.useMemo)(()=>{let e=new Set;for(let t of r)typeof t!=`string`&&e.add(t.url);return e},[r]),s=(0,p.useMemo)(()=>i.filter(e=>!o.has(e.ref)),[i,o]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`whitespace-pre-wrap`,children:r.map((e,t)=>typeof e==`string`?(0,m.jsx)(p.Fragment,{children:e},t):(0,m.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`text-accent hover:text-accent2 underline underline-offset-2 break-all`,children:_(e.url)},t))}),(s.length>0||a.length>0)&&(0,m.jsxs)(`div`,{className:`mt-3 pt-2.5 border-t border-border/50`,children:[(0,m.jsx)(`div`,{className:`text-[10px] uppercase tracking-widest text-text-muted mb-1.5`,children:`Sources`}),s.length>0&&(0,m.jsx)(`ul`,{className:`space-y-1 mb-1.5`,children:s.map((e,t)=>(0,m.jsxs)(`li`,{className:`text-[12px] leading-snug`,children:[(0,m.jsx)(`span`,{className:`mr-1.5`,children:`π`}),(0,m.jsx)(`a`,{href:e.ref,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`text-accent hover:text-accent2 underline underline-offset-2 break-all`,title:e.ref,children:e.description??_(e.ref)}),e.description&&(0,m.jsxs)(`span`,{className:`text-text-muted ml-2 text-[11px]`,children:[`(`,_(e.ref),`)`]})]},`u-${t}`))}),a.length>0&&(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:a.map((e,t)=>{let r=e.type===`file`?`π`:e.type===`fact`?`π‘`:`π`,i=e.ref.length>50?e.ref.slice(0,47)+`β¦`:e.ref;return(e.type===`file`||e.type===`report`)&&n?(0,m.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),n(e.ref,e.type)},className:`inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary hover:bg-accent/15 hover:text-text hover:border-accent/40 transition-colors cursor-pointer`,title:`Open ${e.ref}${e.description?` β `+e.description:``}`,children:[r,` `,(0,m.jsx)(`b`,{className:`text-text font-medium`,children:i}),(0,m.jsx)(`span`,{className:`text-text-muted text-[10px]`,children:`β`})]},`o-${t}`):(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-secondary`,title:e.description??e.ref,children:[r,` `,(0,m.jsx)(`b`,{className:`text-text font-medium`,children:i})]},`o-${t}`)})})]})]})}function y(){let{id:e}=r(),t=i(),[n,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(null),[b,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(!1),[k,N]=(0,p.useState)(!1),[P,F]=(0,p.useState)(new Set),I=(0,p.useCallback)(e=>{F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),L=(0,p.useRef)(null),R=(0,p.useRef)(null),z=(0,p.useRef)(!0),[B,V]=(0,p.useState)(null),H=(0,p.useCallback)(async t=>{if(e){V({ref:t,loading:!0});try{let n=await a(e,t);V({ref:t,loading:!1,file:n})}catch(e){V({ref:t,loading:!1,error:e.message})}}},[e]),U=(0,p.useCallback)(()=>V(null),[]);(0,p.useEffect)(()=>{if(!e)return;let t=!0;return _(!0),c(e).then(({mission:e})=>{t&&(h(e),_(!1))}).catch(e=>{t&&(y(e.message),_(!1))}),()=>{t=!1}},[e]),(0,p.useEffect)(()=>{if(e)return s(e,n=>{if(n.kind===`mission_deleted`){t(`/mission`);return}n.kind!==`hello`&&c(e).then(({mission:e})=>h(e)).catch(()=>{})})},[e,t]),(0,p.useEffect)(()=>{let e=L.current;if(!e)return;let t=()=>{z.current=e.scrollHeight-e.scrollTop-e.clientHeight<100};return t(),e.addEventListener(`scroll`,t,{passive:!0}),()=>{e.removeEventListener(`scroll`,t)}},[n?.id]),(0,p.useEffect)(()=>{if(!z.current)return;let e=R.current;e&&e.scrollIntoView({behavior:`smooth`,block:`end`})},[n?.messages.length]);let W=(0,p.useCallback)(async()=>{if(!(!n||!b.trim()||T)){E(!0);try{await u(n.id,b.trim()),w(``)}catch(e){y(e.message)}finally{E(!1)}}},[n,b,T]),G=(0,p.useCallback)(async(e,t)=>{if(n)try{await d(n.id,e,t)}catch(e){y(e.message)}},[n]),K=(0,p.useCallback)(async()=>{if(!n)return;let e=n.status===`paused`?`working`:`paused`;try{await o(n.id,e)}catch(e){y(e.message)}},[n]),q=(0,p.useCallback)(async()=>{if(n&&window.confirm(`Delete this mission?\n\n"${n.goal.slice(0,120)}${n.goal.length>120?`β¦`:``}"\n\nThe file is renamed on disk (recoverable manually), but the mission disappears from the UI immediately.`))try{await l(n.id),t(`/mission`)}catch(e){y(e.message)}},[n,t]);if(g)return(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full text-sm`,style:{fontFamily:`var(--theme-font-display, 'Georgia', serif)`,color:`var(--theme-ink-soft, #a89070)`},children:`Loading missionβ¦`});if(v||!n)return(0,m.jsxs)(`div`,{className:`flex items-center justify-center h-full flex-col gap-3`,style:{fontFamily:`var(--theme-font-display, 'Georgia', serif)`,color:`var(--theme-paper-fg, #f3e9d0)`},children:[(0,m.jsx)(`div`,{className:`text-sm`,style:{color:`var(--theme-accent, #c45050)`},children:v??`Mission not found.`}),(0,m.jsx)(`button`,{onClick:()=>t(`/mission`),className:`text-sm hover:underline`,style:{color:`var(--theme-metal, #c4a35a)`},children:`β Start a new mission`})]});let{working:J,blocked:Y}=j(n);return(0,m.jsxs)(`div`,{className:`h-full w-full flex flex-col overflow-hidden`,style:{fontFamily:`var(--theme-font-display, 'Georgia', serif)`,color:`var(--theme-paper-fg, #f3e9d0)`,minHeight:0},children:[(0,m.jsxs)(`header`,{className:`relative z-20 flex items-center gap-4 px-5 py-3 shrink-0`,style:{background:`linear-gradient(180deg, var(--theme-leather, rgba(42,26,10,0.92)), var(--theme-leather-edge, rgba(56,36,16,0.88)))`,borderBottom:`1px solid var(--theme-metal-dark, rgba(138,106,58,0.5))`,boxShadow:`0 2px 12px rgba(0,0,0,0.3)`},children:[(0,m.jsx)(`button`,{onClick:()=>t(`/mission`),className:`text-text-muted hover:text-text text-sm shrink-0`,title:`Start a new mission`,children:`β`}),(0,m.jsx)(`button`,{onClick:()=>t(`/mission/library`),className:`text-[10px] uppercase tracking-widest text-text-muted hover:text-text border border-border rounded-full px-2 py-0.5 shrink-0`,title:`Browse past missions`,children:`Library`}),(0,m.jsx)(`button`,{onClick:()=>t(`/space/home`),className:`text-[10px] uppercase tracking-widest text-text-muted hover:text-text border border-border rounded-full px-2 py-0.5 shrink-0 inline-flex items-center gap-1`,title:`Back to the canvas spaces`,children:`π Canvas`}),(0,m.jsxs)(`div`,{className:`font-semibold tracking-tight shrink-0`,children:[(0,m.jsx)(`span`,{className:`bg-gradient-to-r from-accent to-accent2 bg-clip-text text-transparent`,children:`TITAN`}),(0,m.jsx)(`span`,{className:`text-text-muted font-normal`,children:` \xA0βΊ\xA0 `}),`Mission`]}),(0,m.jsx)(S,{room:n}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,m.jsxs)(`div`,{title:`Team health`,className:`inline-flex items-center gap-2 px-3 py-1.5 bg-bg-secondary/60 border border-border rounded-full text-xs text-text-muted`,children:[(0,m.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Y>0?`bg-error animate-pulse`:J>0?`bg-accent animate-pulse`:`bg-success`}`}),M(n.status,J,Y)]}),Y>0&&(0,m.jsxs)(`div`,{className:`inline-flex items-center gap-1 px-2.5 py-1.5 bg-error/15 border border-error/30 rounded-full text-xs text-error`,title:`Decisions waiting on you`,children:[`π `,Y]}),(0,m.jsxs)(`div`,{title:`Effort so far`,className:`inline-flex items-center gap-2 px-3 py-1.5 bg-bg-secondary/60 border border-border rounded-full text-xs`,children:[(0,m.jsx)(`span`,{className:`inline-block w-3 h-4 bg-gradient-radial-flame`}),(0,m.jsxs)(`span`,{className:`text-text font-medium`,children:[`$`,n.cost.usd.toFixed(2)]})]}),(0,m.jsx)(`button`,{onClick:()=>t(`/mission/${n.id}/canvas`),className:`px-3 py-1.5 text-xs bg-bg-secondary/60 border border-border rounded-full text-text-secondary hover:text-text`,title:`Switch to the canvas (spatial) view of the same mission`,children:`Canvas view`}),(0,m.jsx)(`button`,{onClick:K,className:`px-3 py-1.5 text-xs bg-bg-secondary/60 border border-border rounded-full text-text-secondary hover:text-text`,children:n.status===`paused`?`Resume`:`Pause`}),(0,m.jsx)(`button`,{onClick:q,className:`px-3 py-1.5 text-xs bg-bg-secondary/60 border border-border rounded-full text-text-muted hover:text-error hover:bg-error/15 hover:border-error/40 transition-colors`,title:`Delete this mission`,children:`π Delete`}),(0,m.jsx)(`button`,{onClick:()=>N(e=>!e),className:`w-8 h-8 rounded-full bg-bg-secondary/60 border border-border text-text-muted hover:text-text flex items-center justify-center font-semibold text-sm`,title:`What's this?`,children:`?`})]})]}),(0,m.jsx)(`main`,{ref:L,className:`relative z-10 flex-1 overflow-y-auto`,style:{minHeight:0},children:(0,m.jsxs)(`div`,{className:`max-w-3xl mx-auto px-4 md:px-6 py-6 flex flex-col gap-3`,children:[n.messages.length===0?(0,m.jsx)(x,{}):n.messages.map(e=>(0,m.jsx)(C,{msg:e,artifact:n.artifact,artifactExpanded:D,onToggleArtifact:()=>O(e=>!e),onAnswer:G,onOpenFile:H,expanded:P.has(e.id),onToggleExpand:()=>I(e.id)},e.id)),(0,m.jsx)(A,{room:n}),(0,m.jsx)(`div`,{ref:R,"aria-hidden":`true`})]})}),(0,m.jsx)(`footer`,{className:`relative z-20 bg-bg/80 backdrop-blur-md border-t border-border shrink-0`,style:{paddingBottom:40},children:(0,m.jsxs)(`div`,{className:`max-w-3xl mx-auto px-4 md:px-6 py-3`,children:[(0,m.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),W()},className:`flex items-center gap-2 bg-bg-secondary/70 border border-border rounded-2xl px-3 py-2`,children:[(0,m.jsx)(`button`,{type:`button`,title:`Add a teammate (coming soon)`,className:`w-9 h-9 rounded-xl bg-bg-tertiary border border-border text-text-muted hover:text-text flex items-center justify-center text-lg font-semibold`,disabled:!0,children:`+`}),(0,m.jsx)(`input`,{value:b,onChange:e=>w(e.target.value),placeholder:`Type to the team β or @Sage to talk to one helper`,className:`flex-1 bg-transparent outline-none text-text placeholder:text-text-muted/60 text-sm py-2 px-1`}),(0,m.jsxs)(`button`,{type:`button`,title:`Voice coming next release`,disabled:!0,"aria-disabled":`true`,className:`relative w-9 h-9 rounded-full flex items-center justify-center cursor-not-allowed transition-colors`,style:{background:`color-mix(in srgb, var(--theme-leather-edge) 60%, transparent)`,border:`1px solid var(--theme-metal-dark)`,color:`var(--theme-metal)`,boxShadow:`inset 0 0 0 1px color-mix(in srgb, var(--theme-metal) 25%, transparent)`,opacity:.7},children:[(0,m.jsx)(`span`,{"aria-hidden":`true`,children:`π€`}),(0,m.jsx)(`span`,{className:`absolute -bottom-3.5 left-1/2 -translate-x-1/2 text-[8px] uppercase tracking-widest`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`,letterSpacing:`0.15em`},children:`soon`})]}),(0,m.jsx)(`button`,{type:`submit`,disabled:!b.trim()||T,className:`w-9 h-9 rounded-xl bg-gradient-to-br from-accent to-accent2 text-bg-deep font-bold shadow-[0_0_16px_rgba(99,102,241,0.5)] disabled:opacity-50 disabled:cursor-not-allowed`,title:`Send`,children:`β`})]}),(0,m.jsxs)(`div`,{className:`mt-2 flex justify-between items-center text-[11px] text-text-muted`,children:[(0,m.jsxs)(`span`,{children:[n.team.map(e=>(0,m.jsx)(`span`,{className:`mr-2`,children:(0,m.jsxs)(`b`,{className:`text-text-secondary`,children:[`@`,e.name]})},e.agentId)),`to address one helper`]}),(0,m.jsxs)(`span`,{children:[`Press `,(0,m.jsx)(`b`,{className:`text-text-secondary`,children:`β΅`}),` to send`]})]})]})}),B&&(0,m.jsx)(f,{state:B,onClose:U}),k&&(0,m.jsxs)(`div`,{className:`fixed top-16 right-5 w-80 bg-bg-secondary/95 border border-border rounded-xl p-4 backdrop-blur-xl shadow-2xl z-30`,children:[(0,m.jsx)(`button`,{onClick:()=>N(!1),className:`absolute top-3 right-3 text-text-muted hover:text-text text-sm`,children:`β`}),(0,m.jsx)(`h3`,{className:`font-semibold text-sm mb-2`,children:`What you're looking at`}),(0,m.jsxs)(`p`,{className:`text-xs text-text-secondary leading-relaxed mb-3`,children:[`It's a group chat with your `,(0,m.jsx)(`b`,{className:`text-text`,children:`AI helpers`}),`. Each one has a job. You stay in charge.`]}),(0,m.jsxs)(`ul`,{className:`space-y-2 text-xs text-text-secondary`,children:[(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(`span`,{children:`π¬`}),(0,m.jsxs)(`span`,{children:[`Helpers `,(0,m.jsx)(`b`,{className:`text-text`,children:`talk in the thread`}),` as they work.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(`span`,{children:`π`}),(0,m.jsxs)(`span`,{children:[`The `,(0,m.jsx)(`b`,{className:`text-text`,children:`document card`}),` shows what they're building.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(`span`,{children:`β`}),(0,m.jsxs)(`span`,{children:[`Decisions appear as `,(0,m.jsx)(`b`,{className:`text-text`,children:`pink messages with buttons`}),`.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(`span`,{children:`@`}),(0,m.jsxs)(`span`,{children:[`Type `,(0,m.jsx)(`b`,{className:`text-text`,children:`@Scout`}),` (or any name) to message one helper.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(`span`,{children:`π€`}),(0,m.jsx)(`span`,{children:(0,m.jsx)(`b`,{className:`text-text`,children:`Voice comes next release.`})})]})]})]})]})}function b({name:e,role:t,at:n,align:r,color:i,colorOverride:a,hint:o}){let s=e[0]??`?`,c=i?`linear-gradient(135deg, ${i}, ${I(i,-25)})`:a??`var(--theme-metal-bright)`;return(0,m.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 ${r===`right`?`flex-row-reverse`:``}`,style:{fontFamily:`var(--theme-font-display)`},children:[(0,m.jsx)(`div`,{className:`w-6 h-6 rounded-md flex items-center justify-center font-bold text-[11px]`,style:{background:c,color:`var(--theme-leather-edge)`},children:s}),(0,m.jsx)(`span`,{className:`text-[12px] font-semibold tracking-tight`,style:{color:`var(--theme-paper-fg)`},children:e}),t&&(0,m.jsx)(`span`,{className:`text-[10px] uppercase tracking-widest`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`},children:t}),(0,m.jsx)(`span`,{className:r===`right`?`text-[10px] mr-auto`:`text-[10px] ml-auto`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`},children:N(n)}),o&&(0,m.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--theme-ink-soft)`,opacity:.6,fontFamily:`var(--theme-font-mono)`},children:o})]})}function x(){return(0,m.jsxs)(`div`,{className:`self-center my-12 max-w-md text-center flex flex-col items-center gap-3`,children:[(0,m.jsxs)(`span`,{className:`inline-flex gap-1`,"aria-hidden":`true`,children:[(0,m.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full animate-bounce`,style:{background:`var(--theme-metal)`,animationDelay:`0ms`}}),(0,m.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full animate-bounce`,style:{background:`var(--theme-metal)`,animationDelay:`150ms`}}),(0,m.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full animate-bounce`,style:{background:`var(--theme-metal)`,animationDelay:`300ms`}})]}),(0,m.jsx)(`p`,{className:`italic text-sm leading-relaxed`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-display)`},children:`Your team will start replying any moment nowβ¦`})]})}function S({room:e}){return(0,m.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 overflow-x-auto min-w-0`,children:[(0,m.jsx)(`span`,{className:`text-[10px] uppercase tracking-widest text-text-muted shrink-0`,children:`your team`}),e.team.map(e=>(0,m.jsxs)(`div`,{title:`${e.name} Β· ${e.role}${e.currentActivity?` Β· `+e.currentActivity:``}`,className:`inline-flex items-center gap-2 px-2.5 py-1 bg-bg-secondary/60 border border-border rounded-full text-xs shrink-0`,children:[(0,m.jsx)(`span`,{className:`w-5 h-5 rounded-md flex items-center justify-center text-[10px] font-bold text-bg-deep`,style:{background:`linear-gradient(135deg, ${e.color}, ${I(e.color,-25)})`},children:e.name[0]}),(0,m.jsx)(`span`,{className:`text-text-secondary`,children:e.name}),(0,m.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${P(e.state)}`,style:{boxShadow:`0 0 6px ${F(e.state)}`}})]},e.agentId))]})}function C({msg:e,artifact:t,artifactExpanded:n,onToggleArtifact:r,onAnswer:i,onOpenFile:a,expanded:o,onToggleExpand:s}){let c=(e,t)=>(0,m.jsx)(`button`,{type:`button`,onClick:s,className:`text-left w-full`,title:o?`Click to hide details`:`Click to see details`,children:e},t);return e.kind===`user`?(0,m.jsxs)(`div`,{className:`self-end max-w-[88%] flex flex-col items-end`,children:[(0,m.jsx)(b,{name:`You`,role:``,at:e.at,align:`right`,colorOverride:`var(--theme-metal-bright)`}),c((0,m.jsx)(`div`,{className:`px-3.5 py-2.5 rounded-2xl rounded-br-md text-sm leading-relaxed cursor-pointer`,style:{background:`color-mix(in srgb, var(--theme-metal-dark) 30%, transparent)`,color:`var(--theme-paper-fg)`,border:`1px solid color-mix(in srgb, var(--theme-metal) 40%, transparent)`,boxShadow:`0 2px 6px var(--theme-shadow)`,fontFamily:`var(--theme-font-display)`},children:e.content})),o&&(0,m.jsx)(w,{msg:e})]}):e.kind===`system`?(0,m.jsxs)(`div`,{className:`self-center flex flex-col items-center max-w-[88%] my-1`,children:[c((0,m.jsxs)(`div`,{className:`italic text-center text-[12px] leading-relaxed cursor-pointer px-3 py-1`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-display)`},children:[(0,m.jsx)(`span`,{className:`not-italic`,style:{fontFamily:`var(--theme-font-mono)`,letterSpacing:`0.08em`,fontSize:`10px`,textTransform:`uppercase`},children:e.tag===`team_formed`?`Team formed`:e.tag===`team_expanded`?`Team change`:e.tag??`note`}),(0,m.jsx)(`span`,{className:`mx-2 opacity-50`,children:`Β·`}),e.content.replace(/^Team formed β\s*/,``).replace(/\.$/,``)]})),o&&(0,m.jsx)(w,{msg:e})]}):e.kind===`artifact_update`?(0,m.jsx)(k,{artifact:t,expanded:n,onToggle:r,latestSummary:e.summary,latestBy:e.by.name,wordCount:e.wordCount}):e.kind===`question`?(0,m.jsxs)(`div`,{className:`max-w-[88%] flex flex-col`,children:[(0,m.jsx)(b,{name:e.from.name,role:e.from.role,at:e.at,align:`left`,color:e.from.color}),(0,m.jsxs)(`span`,{className:`self-start inline-flex items-center gap-1 px-2 py-0.5 mb-1.5 bg-error text-white text-[10px] uppercase tracking-widest font-bold rounded-full`,children:[(0,m.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-white animate-pulse`}),`Needs you`]}),(0,m.jsxs)(`div`,{className:`px-3.5 py-2.5 rounded-2xl rounded-bl-md border-l-[3px] text-sm leading-relaxed cursor-pointer`,onClick:s,title:o?`Click to hide details`:`Click to see details`,style:{background:`linear-gradient(180deg, rgba(239,68,68,0.18), rgba(239,68,68,0.06))`,borderLeftColor:e.from.color,border:`1px solid rgba(239,68,68,0.35)`,borderLeft:`3px solid ${e.from.color}`,color:`var(--theme-paper-fg)`,fontFamily:`var(--theme-font-display)`,boxShadow:`0 2px 6px var(--theme-shadow)`},children:[e.content,!e.answer&&(0,m.jsxs)(m.Fragment,{children:[e.quickReplies.length>0&&(0,m.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-3`,children:e.quickReplies.map((t,n)=>(0,m.jsx)(`button`,{onClick:n=>{n.stopPropagation(),i(e.approvalId,t)},className:`px-3 py-1.5 rounded-lg text-xs font-semibold border ${n===e.quickReplies.length-1?`bg-gradient-to-br from-accent to-accent2 text-bg-deep border-transparent`:`bg-bg-secondary/60 border-error/40 text-text hover:bg-error/15`}`,children:t},t))}),(0,m.jsx)(T,{approvalId:e.approvalId,onSubmit:t=>i(e.approvalId,t)})]}),e.answer&&(0,m.jsxs)(`div`,{className:`mt-3 text-[12px] text-text-muted border-t border-border pt-2`,children:[`You answered: `,(0,m.jsx)(`span`,{className:`text-text`,children:e.answer.content})]})]}),o&&(0,m.jsx)(w,{msg:e})]}):(0,m.jsxs)(`div`,{className:`max-w-[88%] flex flex-col`,children:[(0,m.jsx)(b,{name:e.from.name,role:e.from.role,at:e.at,align:`left`,color:e.from.color,hint:o?`click to hide`:`click for details`}),c((0,m.jsxs)(`div`,{className:`px-3.5 py-2.5 rounded-2xl rounded-bl-md text-sm leading-relaxed backdrop-blur-sm cursor-pointer transition-colors`,style:{background:`color-mix(in srgb, var(--theme-paper) 6%, transparent)`,color:`var(--theme-paper-fg)`,border:`1px solid color-mix(in srgb, var(--theme-metal-dark) 35%, transparent)`,borderLeft:`3px solid ${e.from.color}`,boxShadow:`0 2px 6px var(--theme-shadow)`,fontFamily:`var(--theme-font-display)`},children:[(0,m.jsx)(v,{text:e.content,sources:e.sources,onOpenFile:a}),e.actions&&e.actions.length>0&&(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.actions.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-muted`,children:[(0,m.jsx)(`span`,{children:e.name}),e.detail&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-text-muted`,children:`Β·`}),(0,m.jsx)(`b`,{className:`text-text font-medium`,children:e.detail})]})]},t))})]})),o&&(0,m.jsx)(w,{msg:e})]})}function w({msg:e}){let t=D(e.at),n=[];if(n.push({label:`When`,value:t}),n.push({label:`Message id`,value:(0,m.jsx)(`code`,{className:`text-text-secondary text-[11px]`,children:e.id})}),e.kind===`agent`){n.push({label:`From`,value:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`b`,{children:e.from.name}),` Β· `,e.from.role,` `,(0,m.jsxs)(`span`,{className:`text-text-muted`,children:[`(`,e.from.agentId,`)`]})]})});let t=e.meta;t?.subtaskTitle&&n.push({label:`Working on`,value:(0,m.jsxs)(`i`,{children:[`"`,t.subtaskTitle,`"`]})}),t?.status&&n.push({label:`Outcome`,value:(0,m.jsx)(E,{status:t.status})}),t?.model&&n.push({label:`Brain`,value:(0,m.jsx)(`code`,{className:`text-text-secondary text-[11px]`,children:t.model})}),typeof t?.durationMs==`number`&&n.push({label:`Took`,value:O(t.durationMs)}),typeof t?.tokensUsed==`number`&&t.tokensUsed>0&&n.push({label:`Tokens`,value:t.tokensUsed.toLocaleString()}),typeof t?.costUsd==`number`&&t.costUsd>0&&n.push({label:`Cost`,value:`$`+t.costUsd.toFixed(4)}),e.actions&&e.actions.length>0&&n.push({label:`Used`,value:(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.actions.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 bg-bg-tertiary/60 border border-border rounded-full text-[11px] text-text-muted`,children:[e.name,e.detail&&(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:`text-text-muted/60`,children:` Β· `}),(0,m.jsx)(`b`,{className:`text-text`,children:e.detail})]})]},t))})}),t?.failureDetail&&n.push({label:`Error detail`,value:(0,m.jsxs)(`code`,{className:`block whitespace-pre-wrap bg-bg-tertiary/80 border border-border rounded p-2 text-[11px] text-text-secondary font-mono leading-relaxed max-h-40 overflow-y-auto`,children:[t.failureDetail.slice(0,800),t.failureDetail.length>800?`
|
|
2
|
+
β¦`:``]})})}else e.kind===`question`?(n.push({label:`From`,value:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`b`,{children:e.from.name}),` Β· `,e.from.role]})}),n.push({label:`Approval id`,value:(0,m.jsx)(`code`,{className:`text-text-secondary text-[11px]`,children:e.approvalId})}),e.answer?n.push({label:`Answered`,value:(0,m.jsxs)(`span`,{children:[D(e.answer.at),` β "`,e.answer.content,`"`]})}):n.push({label:`Status`,value:(0,m.jsx)(`span`,{className:`text-warning`,children:`Waiting for your reply`})}),e.quickReplies.length>0&&n.push({label:`Options`,value:e.quickReplies.join(` Β· `)})):e.kind===`user`?n.push({label:`Length`,value:e.content.length+` chars`}):e.kind===`system`&&e.tag&&n.push({label:`Kind`,value:(0,m.jsx)(`code`,{className:`text-text-secondary text-[11px]`,children:e.tag})});return(0,m.jsxs)(`div`,{className:`mt-2 self-stretch bg-bg-secondary/40 border border-border rounded-lg px-3 py-2.5 backdrop-blur-sm`,children:[(0,m.jsx)(`div`,{className:`text-[10px] uppercase tracking-widest text-text-muted mb-1.5`,children:`Details`}),(0,m.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1.5 text-[12px]`,children:n.map((e,t)=>(0,m.jsxs)(p.Fragment,{children:[(0,m.jsx)(`dt`,{className:`text-text-muted`,children:e.label}),(0,m.jsx)(`dd`,{className:`text-text-secondary`,children:e.value})]},t))})]})}function T({approvalId:e,onSubmit:t}){let[n,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)(``),o=(0,p.useRef)(null);(0,p.useEffect)(()=>{n&&o.current&&o.current.focus()},[n]);let s=()=>{let e=i.trim();e&&(t(e),a(``),r(!1))};return n?(0,m.jsxs)(`div`,{className:`mt-3`,onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(`textarea`,{ref:o,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),s()):e.key===`Escape`&&(e.preventDefault(),r(!1))},placeholder:`Tell ${e.slice(0,6)}β¦ anything you want.`,rows:3,className:`w-full bg-bg-secondary/80 border border-border rounded-lg p-2 text-sm text-text placeholder:text-text-muted/60 outline-none focus:border-accent/60 resize-y`}),(0,m.jsxs)(`div`,{className:`flex items-center justify-end gap-2 mt-1.5`,children:[(0,m.jsx)(`span`,{className:`mr-auto text-[10px] text-text-muted`,children:`β+β΅ to send Β· esc to cancel`}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>{r(!1),a(``)},className:`px-3 py-1 text-[11px] text-text-muted hover:text-text`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,onClick:s,disabled:!i.trim(),className:`px-3 py-1 text-[11px] font-semibold rounded-md bg-gradient-to-br from-accent to-accent2 text-bg-deep disabled:opacity-50 disabled:cursor-not-allowed`,children:`Send answer`})]})]}):(0,m.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r(!0)},className:`mt-2 text-[11px] text-text-muted hover:text-text-secondary underline underline-offset-2`,children:`or type a custom answerβ¦`})}function E({status:e}){return(0,m.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-medium border ${{done:`bg-success/15 text-success border-success/30`,failed:`bg-error/15 text-error border-error/30`,needs_info:`bg-warning/15 text-warning border-warning/30`,blocked:`bg-warning/15 text-warning border-warning/30`,cancelled:`bg-text-muted/15 text-text-muted border-border`}[e]??`bg-bg-tertiary/60 text-text-secondary border-border`}`,children:e})}function D(e){try{return new Date(e).toLocaleString([],{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return e}}function O(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function k({artifact:e,expanded:t,onToggle:n,latestSummary:r,latestBy:i,wordCount:a}){let o=e.content.split(`
|
|
3
|
+
`).filter(Boolean).slice(0,2).join(` `).slice(0,240);return(0,m.jsxs)(`div`,{className:`self-stretch my-1 rounded-xl border border-border bg-bg-secondary/40 overflow-hidden relative`,children:[(0,m.jsx)(`div`,{className:`absolute left-0 right-0 top-0 h-[2px] overflow-hidden`,children:(0,m.jsx)(`div`,{className:`h-full w-1/3 bg-gradient-to-r from-transparent via-accent to-transparent animate-pulse`})}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-border`,children:[(0,m.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-bg-tertiary flex items-center justify-center text-sm`,children:`π`}),(0,m.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,m.jsx)(`div`,{className:`text-sm font-semibold truncate`,children:`Live document`}),(0,m.jsxs)(`div`,{className:`text-[11px] text-text-muted truncate`,children:[i,` `,r,` Β· `,a,` words Β· updating live`]})]}),(0,m.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-accent animate-pulse`}),(0,m.jsx)(`button`,{onClick:n,className:`px-2.5 py-1 text-[11px] font-semibold bg-bg-tertiary border border-border rounded-md text-text-secondary hover:text-text`,children:t?`β΄ Collapse`:`βΎ Open`})]}),t?(0,m.jsx)(`div`,{className:`px-5 py-4 font-serif text-sm leading-relaxed whitespace-pre-wrap`,style:{background:`var(--theme-paper, #f7f5ee)`,color:`var(--theme-ink, #1a1f2e)`},children:e.content||(0,m.jsx)(`span`,{className:`italic`,style:{color:`var(--theme-ink-soft, #8a8472)`},children:`empty for nowβ¦`})}):(0,m.jsx)(`div`,{className:`px-4 py-3 text-sm text-text-secondary font-serif italic`,children:o||(0,m.jsx)(`span`,{className:`text-text-muted not-italic`,children:`empty for nowβ¦`})})]})}function A({room:e}){let t=e.team.filter(e=>e.state===`working`&&e.currentActivity);if(t.length===0)return null;let n=t[t.length-1];return(0,m.jsxs)(`div`,{className:`self-start flex items-start gap-2 px-3 py-2 bg-bg-secondary/60 border border-border rounded-2xl backdrop-blur-sm max-w-[640px]`,title:n.currentActivity??void 0,children:[(0,m.jsx)(`div`,{className:`w-5 h-5 rounded-md flex items-center justify-center text-bg-deep font-bold text-[10px] shrink-0 mt-0.5`,style:{background:`linear-gradient(135deg, ${n.color}, ${I(n.color,-25)})`},children:n.name[0]}),(0,m.jsxs)(`span`,{className:`text-xs text-text-muted leading-relaxed break-words flex-1 min-w-0`,children:[(0,m.jsx)(`span`,{className:`text-text font-semibold`,children:n.name}),` `,n.currentActivity??`is working`]}),(0,m.jsxs)(`span`,{className:`inline-flex gap-0.5 ml-1 shrink-0 mt-1.5`,children:[(0,m.jsx)(`span`,{className:`w-1 h-1 rounded-full bg-text-muted animate-bounce [animation-delay:0ms]`}),(0,m.jsx)(`span`,{className:`w-1 h-1 rounded-full bg-text-muted animate-bounce [animation-delay:150ms]`}),(0,m.jsx)(`span`,{className:`w-1 h-1 rounded-full bg-text-muted animate-bounce [animation-delay:300ms]`})]})]})}function j(e){let t=0,n=0;for(let r of e.team)(r.state===`working`||r.state===`editing`)&&t++,r.state===`blocked`&&n++;return{working:t,blocked:n}}function M(e,t,n){return e===`paused`?`Paused`:e===`done`?`Done`:e===`failed`?`Failed`:n>0?`${t} working Β· ${n} needs you`:t>0?`${t} working`:e===`forming`?`Forming teamβ¦`:`Idle`}function N(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{return``}}function P(e){switch(e){case`working`:return`bg-accent animate-pulse`;case`editing`:return`bg-warning animate-pulse`;case`blocked`:return`bg-error animate-pulse`;case`done`:return`bg-success`;default:return`bg-text-muted`}}function F(e){switch(e){case`working`:return`#6366f1`;case`editing`:return`#f59e0b`;case`blocked`:return`#ef4444`;case`done`:return`#22c55e`;default:return`#71717a`}}function I(e,t){let n=e.replace(`#`,``);if(n.length!==6)return e;let r=parseInt(n,16),i=r>>16&255,a=r>>8&255,o=r&255,s=Math.round(t/100*255);return i=Math.max(0,Math.min(255,i+s)),a=Math.max(0,Math.min(255,a+s)),o=Math.max(0,Math.min(255,o+s)),`#`+(i<<16|a<<8|o).toString(16).padStart(6,`0`)}export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{ir as r}from"./index-WI-E4I3h.js";import{o as i,r as a}from"./missions-y-qg_f9b.js";var o=e(t(),1),s=n(),c=258;function l(){let e=r(),[t,n]=(0,o.useState)(null),[l,m]=(0,o.useState)(null),[h,_]=(0,o.useState)(`all`),[v,y]=(0,o.useState)(``);(0,o.useEffect)(()=>{let e=!0;return i().then(({missions:t})=>{e&&n(t)}).catch(t=>{e&&m(t.message)}),()=>{e=!1}},[]);let b=(0,o.useCallback)(()=>{n(null),i().then(({missions:e})=>n(e)).catch(e=>m(e.message))},[]),x=(0,o.useCallback)(async(e,t)=>{if(window.confirm(`Delete this mission?\n\n"${t.slice(0,120)}${t.length>120?`β¦`:``}"\n\nThe file is renamed (not destroyed), so the disk record can be recovered manually.`)){n(t=>(t??[]).filter(t=>t.id!==e));try{await a(e)}catch(e){m(e.message),i().then(({missions:e})=>n(e)).catch(()=>{})}}},[]),S=(0,o.useMemo)(()=>{if(!t)return[];let e=v.trim().toLowerCase();return t.filter(t=>!(h===`live`&&![`working`,`blocked`,`paused`,`forming`].includes(t.status)||h===`done`&&t.status!==`done`||h===`failed`&&t.status!==`failed`||e&&!t.goal.toLowerCase().includes(e)))},[t,h,v]),C=(0,o.useMemo)(()=>{let e={all:0,live:0,done:0,failed:0};for(let n of t??[])e.all++,[`working`,`blocked`,`paused`,`forming`].includes(n.status)&&e.live++,n.status===`done`&&e.done++,n.status===`failed`&&e.failed++;return e},[t]),w=(0,o.useMemo)(()=>{let e=[],t=[],n=[],r=Date.now();for(let i of S){if([`working`,`blocked`,`paused`,`forming`].includes(i.status)){e.push(i);continue}(()=>{try{return r-new Date(i.updatedAt).getTime()}catch{return 1/0}})()<6048e5?t.push(i):n.push(i)}return{active:e,recent:t,archived:n}},[S]),T=S.length>8;return(0,s.jsxs)(`div`,{className:`h-full w-full flex flex-col overflow-hidden`,style:{color:`var(--theme-paper-fg)`,fontFamily:`var(--theme-font-display)`,background:`var(--theme-bg-base)`},children:[(0,s.jsxs)(`header`,{className:`relative z-20 flex items-center gap-4 px-5 py-3`,style:{paddingRight:c,background:`linear-gradient(180deg, var(--theme-leather-edge), var(--theme-leather))`,borderBottom:`1px solid var(--theme-metal-dark)`,boxShadow:`0 2px 12px var(--theme-shadow)`},children:[(0,s.jsx)(`button`,{onClick:()=>e(`/mission`),className:`text-sm`,style:{color:`var(--theme-metal)`},title:`Start a new mission`,children:`β`}),(0,s.jsx)(`button`,{onClick:()=>e(`/space/home`),className:`text-[10px] uppercase tracking-widest rounded-full px-2 py-0.5 shrink-0 inline-flex items-center gap-1 border`,style:{color:`var(--theme-metal)`,borderColor:`var(--theme-metal-dark)`,fontFamily:`var(--theme-font-display)`},title:`Back to the canvas spaces`,children:`π Canvas`}),(0,s.jsxs)(`div`,{className:`font-semibold tracking-tight shrink-0`,style:{color:`var(--theme-paper-fg)`},children:[(0,s.jsx)(`span`,{style:{color:`var(--theme-metal)`},children:`TITAN`}),(0,s.jsx)(`span`,{className:`font-normal`,style:{color:`var(--theme-ink-soft)`},children:` \xA0βΊ\xA0 `}),`Mission Library`]}),(0,s.jsx)(`div`,{className:`flex-1`}),(0,s.jsx)(`button`,{onClick:b,className:`text-xs px-3 py-1.5 rounded-full border transition-colors`,style:{color:`var(--theme-ink-soft)`,background:`var(--theme-leather)`,borderColor:`var(--theme-metal-dark)`,fontFamily:`var(--theme-font-display)`},onMouseEnter:e=>{e.currentTarget.style.color=`var(--theme-metal-bright)`,e.currentTarget.style.borderColor=`var(--theme-metal)`},onMouseLeave:e=>{e.currentTarget.style.color=`var(--theme-ink-soft)`,e.currentTarget.style.borderColor=`var(--theme-metal-dark)`},title:`Reload`,children:`β³ refresh`}),(0,s.jsx)(`button`,{onClick:()=>e(`/mission`),className:`px-3 py-1.5 text-xs rounded-full font-semibold`,style:{background:`linear-gradient(135deg, var(--theme-metal-bright), var(--theme-metal-dark))`,color:`var(--theme-bolt)`,boxShadow:`0 2px 8px var(--theme-shadow)`,fontFamily:`var(--theme-font-display)`},children:`+ New mission`})]}),(0,s.jsxs)(`div`,{className:`relative z-10 px-5 py-3 flex items-center gap-3 border-b`,style:{borderBottomColor:`var(--theme-metal-dark)`,background:`var(--theme-leather-edge)`},children:[(0,s.jsx)(f,{active:h===`all`,label:`All`,count:C.all,onClick:()=>_(`all`)}),(0,s.jsx)(f,{active:h===`live`,label:`In progress`,count:C.live,onClick:()=>_(`live`),dotColor:`var(--theme-accent)`}),(0,s.jsx)(f,{active:h===`done`,label:`Done`,count:C.done,onClick:()=>_(`done`),dotColor:`var(--theme-metal)`}),(0,s.jsx)(f,{active:h===`failed`,label:`Stopped`,count:C.failed,onClick:()=>_(`failed`),dotColor:`var(--theme-ink-soft)`}),(0,s.jsx)(`div`,{className:`flex-1`}),(0,s.jsx)(d,{value:v,onChange:y})]}),(0,s.jsxs)(`main`,{className:`relative z-10 flex-1 overflow-y-auto`,children:[l&&(0,s.jsx)(`div`,{className:`max-w-3xl mx-auto px-5 py-6 text-sm`,style:{color:`var(--theme-accent)`,fontFamily:`var(--theme-font-mono)`},children:l}),t===null&&!l&&(0,s.jsx)(`div`,{className:`max-w-3xl mx-auto px-5 py-6 text-sm`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`},children:`Loading missionsβ¦`}),t!==null&&S.length===0&&(0,s.jsx)(g,{filter:h,query:v,onStart:()=>e(`/mission`)}),t!==null&&S.length>0&&!T&&(0,s.jsx)(`ul`,{className:`max-w-3xl mx-auto px-5 py-4 flex flex-col gap-2`,children:S.map(t=>(0,s.jsx)(p,{mission:t,onClick:()=>e(`/mission/${t.id}`),onDelete:()=>x(t.id,t.goal)},t.id))}),t!==null&&S.length>0&&T&&(0,s.jsxs)(`div`,{className:`max-w-3xl mx-auto px-5 py-4 flex flex-col gap-6`,children:[w.active.length>0&&(0,s.jsx)(u,{title:`Active`,subtitle:`working, blocked, paused, or forming`,children:w.active.map(t=>(0,s.jsx)(p,{mission:t,onClick:()=>e(`/mission/${t.id}`),onDelete:()=>x(t.id,t.goal)},t.id))}),w.recent.length>0&&(0,s.jsx)(u,{title:`Recent`,subtitle:`completed within the last 7 days`,children:w.recent.map(t=>(0,s.jsx)(p,{mission:t,onClick:()=>e(`/mission/${t.id}`),onDelete:()=>x(t.id,t.goal)},t.id))}),w.archived.length>0&&(0,s.jsx)(u,{title:`Archived`,subtitle:`older finished missions`,children:w.archived.map(t=>(0,s.jsx)(p,{mission:t,onClick:()=>e(`/mission/${t.id}`),onDelete:()=>x(t.id,t.goal)},t.id))})]})]})]})}function u({title:e,subtitle:t,children:n}){return(0,s.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,s.jsxs)(`div`,{className:`inline-flex items-baseline gap-3 self-start px-3 py-1 rounded-md border`,style:{background:`linear-gradient(180deg, var(--theme-leather), var(--theme-leather-edge))`,borderColor:`var(--theme-metal-dark)`,boxShadow:`inset 0 0 0 1px var(--theme-metal-dark), 0 1px 4px var(--theme-shadow)`},children:[(0,s.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.18em] font-semibold`,style:{color:`var(--theme-metal-bright)`,fontFamily:`var(--theme-font-display)`},children:e}),t&&(0,s.jsx)(`span`,{className:`text-[10px]`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`},children:t})]}),(0,s.jsx)(`ul`,{className:`flex flex-col gap-2`,children:n})]})}function d({value:e,onChange:t}){let[n,r]=(0,o.useState)(!1);return(0,s.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),onFocus:()=>r(!0),onBlur:()=>r(!1),placeholder:`Search goalsβ¦`,className:`w-72 rounded-full px-4 py-1.5 text-sm outline-none transition-colors`,style:{background:`var(--theme-paper)`,color:`var(--theme-ink)`,border:`1px solid ${n?`var(--theme-metal)`:`var(--theme-metal-dark)`}`,boxShadow:n?`0 0 0 2px var(--theme-menu-hover)`:`none`,fontFamily:`var(--theme-font-display)`}})}function f({active:e,label:t,count:n,onClick:r,dotColor:i}){let[a,c]=(0,o.useState)(!1);return(0,s.jsxs)(`button`,{onClick:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs border transition-colors`,style:{background:e?`var(--theme-menu-active-bg)`:a?`var(--theme-menu-hover)`:`transparent`,color:e?`var(--theme-menu-active-fg)`:`var(--theme-ink-soft)`,borderColor:e?`var(--theme-metal)`:`var(--theme-metal-dark)`,fontFamily:`var(--theme-font-display)`},children:[i&&(0,s.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:i}}),(0,s.jsx)(`span`,{children:t}),(0,s.jsx)(`span`,{style:{color:e?`var(--theme-menu-active-fg)`:`var(--theme-ink-soft)`,opacity:.7,fontFamily:`var(--theme-font-mono)`},children:n})]})}function p({mission:e,onClick:t,onDelete:n}){let[r,i]=(0,o.useState)(!1),a=_(e.updatedAt),c=[`working`,`blocked`,`paused`,`forming`].includes(e.status);return(0,s.jsxs)(`li`,{className:`relative group`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[(0,s.jsxs)(`button`,{onClick:t,className:`w-full text-left rounded-xl px-4 py-3 transition-all`,style:{background:r?`var(--theme-menu-hover)`:`var(--theme-paper)`,color:`var(--theme-ink)`,border:`1px solid ${r?`var(--theme-metal)`:`var(--theme-metal-dark)`}`,boxShadow:r?`0 3px 10px var(--theme-shadow)`:`0 1px 3px var(--theme-shadow)`,transform:r?`translateY(-1px)`:`translateY(0)`},children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,s.jsx)(`div`,{className:`text-sm font-semibold flex-1 truncate`,style:{color:`var(--theme-ink)`,fontFamily:`var(--theme-font-display)`},children:e.goal||`(no goal)`}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 transition-opacity`,style:{opacity:+!r},children:[(0,s.jsx)(h,{status:e.status}),(0,s.jsx)(`div`,{className:`text-[11px] shrink-0`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`},children:a})]})]}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px]`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`},children:[(0,s.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,s.jsx)(`span`,{children:e.team.length}),(0,s.jsxs)(`span`,{children:[`helper`,e.team.length===1?``:`s`]})]}),e.team.length>0&&(0,s.jsxs)(`span`,{className:`flex items-center gap-1 truncate max-w-[40%]`,children:[`Β· `,e.team.slice(0,4).map(e=>e.name).join(`, `),e.team.length>4?`, +${e.team.length-4}`:``]}),e.cost.usd>0&&(0,s.jsxs)(`span`,{children:[`Β· $`,e.cost.usd.toFixed(2),` effort`]}),e.playId&&(0,s.jsx)(`span`,{className:`ml-auto text-[10px] uppercase tracking-widest`,style:{color:`var(--theme-metal-dark)`},children:e.playId})]})]}),(0,s.jsxs)(`div`,{className:`absolute top-2 right-2 flex items-center gap-1.5 transition-opacity`,style:{opacity:+!!r},children:[(0,s.jsx)(m,{label:c?`Resume`:`Open`,icon:c?`βΆ`:`β`,variant:`primary`,onClick:e=>{e.stopPropagation(),t()}}),(0,s.jsx)(m,{label:`Delete`,icon:`π`,variant:`muted`,onClick:e=>{e.stopPropagation(),n()}})]})]})}function m({label:e,icon:t,variant:n,onClick:r}){let[i,a]=(0,o.useState)(!1);return n===`primary`?(0,s.jsxs)(`button`,{type:`button`,onClick:r,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[10px] font-semibold uppercase tracking-widest border transition-colors`,style:{background:i?`var(--theme-metal-bright)`:`var(--theme-metal)`,color:`var(--theme-bolt)`,borderColor:`var(--theme-metal-dark)`,fontFamily:`var(--theme-font-display)`},title:e,"aria-label":e,children:[(0,s.jsx)(`span`,{"aria-hidden":!0,children:t}),(0,s.jsx)(`span`,{children:e})]}):(0,s.jsx)(`button`,{type:`button`,onClick:r,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:`inline-flex items-center justify-center w-7 h-7 rounded-md text-sm border transition-colors`,style:{background:i?`var(--theme-accent)`:`var(--theme-paper)`,color:i?`var(--theme-paper)`:`var(--theme-ink-soft)`,borderColor:i?`var(--theme-accent)`:`var(--theme-metal-dark)`},title:e,"aria-label":e,children:(0,s.jsx)(`span`,{"aria-hidden":!0,children:t})})}function h({status:e}){let t={forming:{label:`forming`,bg:`var(--theme-leather)`,fg:`var(--theme-metal-bright)`,border:`var(--theme-metal-dark)`},working:{label:`live`,bg:`var(--theme-accent)`,fg:`var(--theme-paper)`,border:`var(--theme-accent)`},blocked:{label:`needs you`,bg:`var(--theme-accent)`,fg:`var(--theme-paper)`,border:`var(--theme-accent)`,pulse:!0},paused:{label:`paused`,bg:`var(--theme-metal)`,fg:`var(--theme-bolt)`,border:`var(--theme-metal-dark)`},done:{label:`done`,bg:`var(--theme-menu-active-bg)`,fg:`var(--theme-menu-active-fg)`,border:`var(--theme-metal-dark)`},failed:{label:`stopped`,bg:`var(--theme-leather-edge)`,fg:`var(--theme-ink-soft)`,border:`var(--theme-metal-dark)`}},n=t[e]??t.forming;return(0,s.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold border uppercase tracking-widest ${n.pulse?`animate-pulse`:``}`,style:{background:n.bg,color:n.fg,borderColor:n.border,fontFamily:`var(--theme-font-display)`},children:n.label})}function g({filter:e,query:t,onStart:n}){return t.trim().length>0?(0,s.jsxs)(`div`,{className:`max-w-md mx-auto px-5 py-12 text-center`,children:[(0,s.jsxs)(`div`,{className:`text-sm mb-2`,style:{color:`var(--theme-paper-fg)`,fontFamily:`var(--theme-font-display)`},children:[`No missions match "`,t,`"`]}),(0,s.jsx)(`div`,{className:`text-xs`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-mono)`},children:`Try a shorter search term, or clear the filter.`})]}):e===`all`?(0,s.jsxs)(`div`,{className:`max-w-md mx-auto px-5 py-16 text-center flex flex-col items-center gap-5`,children:[(0,s.jsx)(`div`,{className:`w-20 h-20 rounded-full flex items-center justify-center`,style:{background:`radial-gradient(circle at 30% 25%, var(--theme-metal-bright), var(--theme-metal-dark) 70%)`,boxShadow:`inset 0 -3px 6px var(--theme-shadow), 0 4px 14px var(--theme-shadow)`,border:`1px solid var(--theme-metal-dark)`,color:`var(--theme-bolt)`,fontFamily:`var(--theme-font-display)`,fontSize:28},"aria-hidden":!0,children:`β`}),(0,s.jsx)(`div`,{className:`text-base`,style:{color:`var(--theme-paper-fg)`,fontFamily:`var(--theme-font-display)`},children:`No missions yet.`}),(0,s.jsx)(`div`,{className:`text-sm`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-display)`},children:`Start one from the Mission Start page.`}),(0,s.jsx)(`button`,{onClick:n,className:`px-4 py-2 rounded-xl font-semibold transition-transform`,style:{background:`linear-gradient(135deg, var(--theme-metal-bright), var(--theme-metal-dark))`,color:`var(--theme-bolt)`,boxShadow:`0 4px 14px var(--theme-shadow)`,border:`1px solid var(--theme-metal-dark)`,fontFamily:`var(--theme-font-display)`},onMouseDown:e=>{e.currentTarget.style.transform=`translateY(1px)`},onMouseUp:e=>{e.currentTarget.style.transform=`translateY(0)`},children:`Start your first mission`})]}):(0,s.jsx)(`div`,{className:`max-w-md mx-auto px-5 py-12 text-center`,children:(0,s.jsxs)(`div`,{className:`text-sm`,style:{color:`var(--theme-ink-soft)`,fontFamily:`var(--theme-font-display)`},children:[`No `,e===`live`?`in-progress`:e,` missions right now.`]})})}function _(e){try{let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?Math.floor(t/6e4)+`m ago`:t<864e5?Math.floor(t/36e5)+`h ago`:t<7*864e5?Math.floor(t/864e5)+`d ago`:new Date(e).toLocaleDateString()}catch{return``}}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{ir as r}from"./index-WI-E4I3h.js";import{n as i}from"./missions-y-qg_f9b.js";var a=e(t(),1),o={id:`hourly`,label:`Every hour`,cron:`0 * * * *`,cadence:`24 runs/day`},s={id:`every4h`,label:`Every 4 hours`,cron:`0 */4 * * *`,cadence:`6 runs/day`},c={id:`every6h`,label:`Every 6 hours`,cron:`0 */6 * * *`,cadence:`4 runs/day`},l={id:`daily7`,label:`Daily at 7am`,cron:`0 7 * * *`,cadence:`once/day`},u={id:`weekly`,label:`Weekly (Mon 9am)`,cron:`0 9 * * 1`,cadence:`once/week`},d={id:`nightly`,label:`Nightly at 11pm`,cron:`0 23 * * *`,cadence:`once/day`},f={id:`twice`,label:`Twice daily (7am + 7pm)`,cron:`0 7,19 * * *`,cadence:`2 runs/day`},p=[{id:`research-digest`,icon:`π°`,title:`Daily research digest`,blurb:`Scout researches your topic and writes a fresh briefing for the first run.`,goalTemplate:`Research the latest developments on "{{topic}}" and produce a clear HTML briefing (write_file with a .html extension) with 5 highlights, an inline SVG chart of the most important trend, and clickable source links throughout.`,suggestedPlayId:`research`,fields:[{key:`topic`,label:`Your topic`,hint:`What you want a fresh briefing on each morning`,defaultValue:`AI agents in business`,placeholder:`AI agents in business`}],schedules:[l,f,u],whatItDoes:`Scout searches the web for fresh developments on your topic, reads the top 5 sources end-to-end, and writes a one-page briefing. The briefing lands on your desk as a paper sheet, and the chat thread captures every URL Scout looked at so you can dig in further if anything catches your eye.`,accent:{from:`#6366f1`,to:`#8b5cf6`}},{id:`inbox-triage`,icon:`π¬`,title:`Inbox triage`,blurb:`Sage sorts and summarizes incoming email so important threads stay visible.`,goalTemplate:`Read my inbox and produce a triaged summary: "needs reply within 24h", "informational", "newsletters", and "junk". Cap at 30 messages per run.`,suggestedPlayId:`inbox`,fields:[],schedules:[s,c,l],whatItDoes:`Sage opens your inbox, classifies up to 30 recent threads into four buckets (urgent / informational / newsletters / junk), and pins the urgent ones to the desk as sticky notes. The full triage lands as a paper sheet you can scan in under a minute.`,accent:{from:`#06b6d4`,to:`#0ea5e9`}},{id:`code-review`,icon:`π`,title:`Code review`,blurb:`Builder reviews your repo changes and reports only meaningful findings.`,goalTemplate:`Review the diff in {{repoPath}} since the last review. Flag bugs, regressions, and obvious improvements. Don't nitpick formatting.`,suggestedPlayId:`code-review`,fields:[{key:`repoPath`,label:`Repo path or URL`,hint:`Local path on the host, or a GitHub repo URL`,defaultValue:`~/Desktop/MyProject`,placeholder:`~/projects/repo`}],schedules:[d,f],whatItDoes:`Builder pulls the latest changes from your repo and writes a concise review focused on real defects (logic bugs, regressions, security smells). Formatting nits are skipped. Findings land as a paper sheet; if there's nothing to report, Builder closes silently.`,accent:{from:`#22c55e`,to:`#10b981`}},{id:`lead-scout`,icon:`π―`,title:`Lead scout`,blurb:`Scout scans freelance + opportunity boards and surfaces matches for your skills.`,goalTemplate:'Scan Upwork, Indeed, and HackerNews "who is hiring" for new postings matching: {{skills}}. Filter to budget >= ${{minBudget}} and remote OK.',suggestedPlayId:`lead-scout`,fields:[{key:`skills`,label:`Skills to match`,hint:`Comma-separated keywords. Scout fuzzy-matches.`,defaultValue:`TypeScript, Node.js, AI agents`,placeholder:`React, Python, design`},{key:`minBudget`,label:`Minimum budget (USD)`,hint:`Skip postings paying less.`,defaultValue:`500`}],schedules:[s,c,l],whatItDoes:`Scout sweeps the boards you care about for postings that match your skill keywords and budget floor. New matches land as sticky notes; the running log of every posting seen sits as a paper sheet you can browse anytime.`,accent:{from:`#f59e0b`,to:`#eab308`}},{id:`market-watch`,icon:`π`,title:`Market watch`,blurb:`Analyst tracks tickers + crypto and writes a brief if anything moves >3%.`,goalTemplate:`Check the latest price + 24h move for: {{tickers}}. If any moved more than 3% (up or down) since the last run, produce an HTML brief (write_file with a .html extension) with a sparkline SVG per ticker and a one-paragraph explanation with 2 source links.`,suggestedPlayId:`analyst`,fields:[{key:`tickers`,label:`Tickers / coins`,hint:`Comma-separated. Stocks or crypto.`,defaultValue:`BTC, ETH, NVDA, AAPL`,placeholder:`TSLA, SPY, BTC`}],schedules:[o,s,c],whatItDoes:`Each cycle, Analyst pulls the latest price and 24-hour move for every ticker you listed. If anything jumped or dropped more than 3%, it writes a one-paragraph explanation with 2 source links. Quiet runs close silently β your desk only fills up when something actually moved.`,accent:{from:`#ef4444`,to:`#f97316`}},{id:`creative-prompts`,icon:`π¨`,title:`Daily creative prompt`,blurb:`Writer creates a fresh writing, sketching, or music prompt for the first run.`,goalTemplate:`Generate a fresh {{discipline}} prompt for me today. Make it specific enough to start in 5 minutes but open enough to take in any direction. Include a 1-line warm-up exercise.`,fields:[{key:`discipline`,label:`Discipline`,hint:`What kind of prompt you want.`,defaultValue:`songwriting`,placeholder:`short fiction Β· songwriting Β· sketching`}],schedules:[l,u],whatItDoes:`Writer creates one fresh creative prompt tailored to the discipline you chose, with a quick warm-up exercise to get started. The prompt lands as a sticky note on the desk so you can grab it when you need it.`,accent:{from:`#ec4899`,to:`#8b5cf6`}}];function m(e,t){return e.goalTemplate.replace(/\{\{(\w+)\}\}/g,(e,n)=>{let r=t[n];return r&&r.trim().length>0?r.trim():n})}var h=n(),g=[`Plan my mom's 70th birthday party`,`Write a thank-you note to my landlord`,`Summarize this long email I got`,`Draft the Q1 investor update`,`Review a code change`],_=`var(--theme-font-display, 'Iowan Old Style', 'Charter', Georgia, serif)`,v=`var(--theme-font-mono, 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace)`,y=`var(--theme-paper, #f3e9d0)`,b=`var(--theme-ink-soft, #a0a8d0)`,x=`var(--theme-metal, #c4a35a)`,S=`var(--theme-metal-bright, #f3d27a)`,C=`var(--theme-metal-dark, #8a6a3a)`,w=`var(--theme-bolt, #2a1808)`,T=`var(--theme-leather, #4a2818)`,E=`var(--theme-leather-edge, #2a1408)`,D=`var(--theme-leather-stitch, #d4a060)`,O=`var(--theme-bg-base, #1a1235)`,k=`var(--theme-bg-grain, #0e0820)`,A=`var(--theme-bg-vignette, rgba(0,0,0,0.6))`,j=`var(--theme-shadow, rgba(0,0,0,0.55))`,M=`var(--theme-accent, #c45a30)`;function N(){let[e,t]=(0,a.useState)(``),[n,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(null),[l,u]=(0,a.useState)(null),d=r();async function f(e,t){let r=e.trim();if(!(!r||n)){o(!0),c(null);try{let{mission:e}=await i(r,t);d(`/mission/${e.id}`)}catch(e){c(e.message),o(!1)}}}return(0,h.jsxs)(`div`,{className:`min-h-full w-full flex flex-col items-center`,style:{color:y,fontFamily:_,background:`radial-gradient(120% 80% at 50% -10%, ${k} 0%, ${O} 60%, ${O} 100%)`},children:[(0,h.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:{background:`radial-gradient(circle at 50% 12%, ${M}22 0%, transparent 55%)`}}),(0,h.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:{boxShadow:`inset 0 0 240px 60px ${A}`}}),(0,h.jsxs)(`div`,{className:`relative z-10 flex flex-col items-center gap-8 w-full max-w-5xl px-6 pt-10 pb-28 md:py-14`,children:[(0,h.jsxs)(`div`,{className:`w-full flex items-center`,style:{paddingRight:260},children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] uppercase tracking-[0.3em]`,style:{color:b,fontFamily:v},children:[(0,h.jsx)(`span`,{style:{color:S,fontWeight:700},children:`TITAN`}),(0,h.jsx)(`span`,{style:{opacity:.6},children:`Β·`}),(0,h.jsx)(`span`,{children:`MISSION CONTROL`})]}),(0,h.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,h.jsx)(P,{onClick:()=>d(`/mission/library`),title:`See your past missions`,children:`Past missions β`}),(0,h.jsx)(P,{onClick:()=>d(`/space/home`),title:`Back to the canvas spaces`,children:`π Canvas`})]})]}),(0,h.jsxs)(`section`,{className:`relative w-full max-w-3xl rounded-3xl overflow-hidden`,style:{background:`linear-gradient(180deg, ${T} 0%, ${E} 100%)`,border:`1px solid ${E}`,boxShadow:`0 30px 80px ${j}, inset 0 1px 0 ${x}33`,padding:`36px 36px 28px`},children:[(0,h.jsx)(F,{position:`tl`}),(0,h.jsx)(F,{position:`tr`}),(0,h.jsx)(F,{position:`bl`}),(0,h.jsx)(F,{position:`br`}),(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.4em] mb-3`,style:{color:x,fontFamily:v,fontWeight:600},children:`β New Mission`}),(0,h.jsx)(`h1`,{className:`text-4xl md:text-5xl tracking-tight`,style:{color:y,fontFamily:_,fontWeight:600,letterSpacing:0,textShadow:`0 2px 12px ${j}`},children:`What's the mission?`}),(0,h.jsx)(`p`,{className:`mt-3 text-[15px] leading-relaxed max-w-xl`,style:{color:b},children:`Tell me anything β a thank-you note, a birthday plan, a Q1 report. Iβll assemble a small team of AI specialists and weβll work it out together.`}),(0,h.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),f(e)},className:`mt-6 flex flex-col gap-3`,children:[(0,h.jsx)(`textarea`,{autoFocus:!0,value:e,onChange:e=>t(e.target.value),placeholder:`Try: Help me write a birthday speech for my mom`,rows:3,disabled:n,className:`w-full resize-none outline-none rounded-2xl px-5 py-4 text-base leading-relaxed`,style:{background:`${O}80`,color:y,border:`1px solid ${x}44`,fontFamily:_,boxShadow:`inset 0 2px 8px ${j}`},onKeyDown:t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),f(e))}}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,h.jsx)(`div`,{className:`text-[11px] tracking-wide`,style:{color:b,fontFamily:v},children:`ββ΅ to dispatch`}),(0,h.jsx)(`div`,{className:`flex w-full items-center gap-2 sm:w-auto`,children:(0,h.jsx)(`button`,{type:`submit`,disabled:!e.trim()||n,className:`h-11 flex-1 rounded-xl px-5 text-sm font-bold tracking-wide transition-transform sm:flex-none`,style:{background:e.trim()&&!n?`linear-gradient(180deg, ${S} 0%, ${x} 60%, ${C} 100%)`:`${C}66`,color:e.trim()&&!n?w:b,border:`1px solid ${C}`,boxShadow:e.trim()&&!n?`0 6px 18px ${j}, inset 0 1px 0 ${S}`:`none`,cursor:e.trim()&&!n?`pointer`:`not-allowed`,fontFamily:_,letterSpacing:`0.04em`},onMouseDown:t=>{e.trim()&&!n&&(t.currentTarget.style.transform=`translateY(1px)`)},onMouseUp:e=>{e.currentTarget.style.transform=``},onMouseLeave:e=>{e.currentTarget.style.transform=``},children:n?`Dispatchingβ¦`:`Start mission β`})})]})]}),s&&(0,h.jsx)(`div`,{className:`mt-4 text-sm rounded-lg px-3 py-2`,style:{color:`#ffb4a8`,background:`#5a1a1a55`,border:`1px solid #8a3a3a`},children:s})]}),(0,h.jsxs)(`div`,{className:`w-full max-w-3xl flex flex-col items-center gap-3`,children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.35em]`,style:{color:b,fontFamily:v},children:`β or try a one-shot β`}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:g.map(e=>(0,h.jsx)(`button`,{type:`button`,onClick:()=>f(e),disabled:n,className:`px-3 py-1.5 text-xs rounded-full transition-colors disabled:opacity-50`,style:{background:`${E}99`,color:y,border:`1px solid ${x}33`,fontFamily:_},onMouseEnter:e=>{e.currentTarget.style.borderColor=`${x}88`,e.currentTarget.style.background=`${T}`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`${x}33`,e.currentTarget.style.background=`${E}99`},children:e},e))})]}),(0,h.jsxs)(`section`,{className:`w-full mt-4 flex flex-col gap-4`,children:[(0,h.jsxs)(`header`,{className:`flex items-baseline justify-between pb-3`,style:{borderBottom:`1px solid ${x}33`},children:[(0,h.jsxs)(`h2`,{className:`text-xl tracking-tight`,style:{color:y,fontFamily:_,fontWeight:600},children:[`Mission starters`,(0,h.jsx)(`span`,{className:`ml-3 text-[10px] uppercase tracking-[0.3em]`,style:{color:b,fontFamily:v},children:`saved cadence`})]}),(0,h.jsx)(`span`,{className:`text-[11px] tracking-wide`,style:{color:b,fontFamily:v},children:`click β 3 steps β launch`})]}),(0,h.jsx)(`p`,{className:`text-sm leading-relaxed max-w-2xl`,style:{color:b},children:`Pick a starter recipe, customize it, and launch the first run. TITAN saves the cadence with the mission request.`}),(0,h.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3 mt-2`,children:p.map(e=>(0,h.jsx)(I,{template:e,onClick:()=>u(e)},e.id))})]}),(0,h.jsx)(`div`,{className:`h-20`})]}),l&&(0,h.jsx)(L,{template:l,onClose:()=>u(null),onLaunch:async(e,t,n)=>{try{let n=JSON.parse(localStorage.getItem(`titan-pending-schedules`)??`[]`);n.push({at:new Date().toISOString(),templateId:l.id,goal:e,scheduleId:t}),localStorage.setItem(`titan-pending-schedules`,JSON.stringify(n))}catch{}u(null),await f(e,n)}})]})}function P({onClick:e,title:t,children:n}){return(0,h.jsx)(`button`,{onClick:e,title:t,className:`px-3 py-1 text-[10px] uppercase tracking-[0.2em] rounded-full transition-colors`,style:{color:b,border:`1px solid ${x}33`,background:`transparent`,fontFamily:v},onMouseEnter:e=>{e.currentTarget.style.color=y,e.currentTarget.style.borderColor=`${x}99`},onMouseLeave:e=>{e.currentTarget.style.color=b,e.currentTarget.style.borderColor=`${x}33`},children:n})}function F({position:e}){let t={position:`absolute`};return e===`tl`&&(t.top=10,t.left=10),e===`tr`&&(t.top=10,t.right=10),e===`bl`&&(t.bottom=10,t.left=10),e===`br`&&(t.bottom=10,t.right=10),(0,h.jsx)(`div`,{style:{...t,width:6,height:6,borderRadius:`50%`,background:x,boxShadow:`0 0 6px ${S}, inset 0 1px 0 ${S}`,opacity:.7,pointerEvents:`none`}})}function I({template:e,onClick:t}){let[n,r]=(0,a.useState)(!1);return(0,h.jsxs)(`button`,{type:`button`,onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:`text-left rounded-2xl relative overflow-hidden transition-all`,style:{background:`linear-gradient(180deg, ${T} 0%, ${E} 100%)`,border:`1px solid ${n?x:E}`,boxShadow:n?`0 14px 36px ${j}, inset 0 1px 0 ${x}55`:`0 6px 18px ${j}, inset 0 1px 0 ${x}22`,transform:n?`translateY(-2px)`:`translateY(0)`,padding:`14px 16px 14px`},children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 rounded-md mb-3`,style:{background:`linear-gradient(180deg, ${S} 0%, ${x} 55%, ${C} 100%)`,border:`1px solid ${C}`,boxShadow:`inset 0 1px 0 ${S}aa, 0 1px 3px ${j}`,color:w},children:[(0,h.jsx)(`span`,{className:`text-base leading-none`,children:e.icon}),(0,h.jsx)(`span`,{className:`text-xs uppercase tracking-[0.16em] truncate`,style:{fontFamily:_,fontWeight:700,letterSpacing:`0.12em`},children:e.title})]}),(0,h.jsx)(`p`,{className:`text-[13px] leading-snug mb-3`,style:{color:y,opacity:.88},children:e.blurb}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[e.schedules.slice(0,2).map(e=>(0,h.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full`,style:{background:`${E}cc`,color:y,border:`1px solid ${D}55`,fontFamily:v,opacity:.85},children:e.label},e.id)),(0,h.jsx)(`span`,{className:`ml-auto text-[10px] uppercase tracking-[0.2em] transition-opacity`,style:{color:S,fontFamily:v,opacity:+!!n},children:`Set up β`})]})]})}function L({template:e,onClose:t,onLaunch:n}){let[r,i]=(0,a.useState)(1),[o,s]=(0,a.useState)(()=>Object.fromEntries(e.fields.map(e=>[e.key,e.defaultValue]))),[c,l]=(0,a.useState)(e.schedules[0]),[u,d]=(0,a.useState)(!1),f=m(e,o),p=r!==1||e.fields.every(e=>(o[e.key]??``).trim().length>0);async function g(){if(!u){d(!0);try{await n(f,c.id,e.suggestedPlayId)}finally{d(!1)}}}let D={background:`${O}aa`,color:y,border:`1px solid ${x}33`,fontFamily:_};return(0,h.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm p-4 md:p-8`,style:{background:`${k}cc`},onClick:t,children:(0,h.jsxs)(`div`,{className:`relative w-full max-w-2xl rounded-2xl overflow-hidden flex flex-col`,style:{background:`linear-gradient(180deg, ${T} 0%, ${E} 100%)`,border:`1px solid ${x}55`,boxShadow:`0 40px 100px ${j}, inset 0 1px 0 ${x}55`,color:y,fontFamily:_},onClick:e=>e.stopPropagation(),children:[(0,h.jsx)(`div`,{style:{height:4,background:`linear-gradient(90deg, ${C}, ${S}, ${C})`}}),(0,h.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-3`,style:{borderBottom:`1px solid ${x}22`},children:[(0,h.jsx)(`span`,{className:`text-2xl leading-none`,children:e.icon}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,h.jsx)(`div`,{className:`font-semibold text-sm truncate`,style:{color:y},children:e.title}),(0,h.jsxs)(`div`,{className:`text-[11px]`,style:{color:b,fontFamily:v},children:[`Step `,r,` of 3 Β· `,r===1?`Customize`:r===2?`Cadence`:`Launch`]})]}),(0,h.jsx)(`button`,{onClick:t,className:`w-8 h-8 rounded-full flex items-center justify-center text-sm`,style:{background:`${O}66`,border:`1px solid ${x}33`,color:b},title:`Close`,children:`β`})]}),(0,h.jsx)(`div`,{className:`px-5 py-2 flex items-center gap-2`,style:{borderBottom:`1px solid ${x}11`},children:[1,2,3].map(e=>(0,h.jsx)(`div`,{className:`h-1 flex-1 rounded-full transition-colors`,style:{background:e<=r?`linear-gradient(90deg, ${x}, ${S})`:`${O}66`}},e))}),(0,h.jsxs)(`div`,{className:`p-5 max-h-[60vh] overflow-y-auto`,children:[r===1&&(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`div`,{className:`text-sm`,style:{color:b},children:e.blurb}),e.fields.length===0&&(0,h.jsxs)(`div`,{className:`text-sm italic`,style:{color:b},children:[`This template runs as-is β no setup needed. Click `,(0,h.jsx)(`b`,{style:{color:y},children:`Next`}),` to pick a cadence.`]}),e.fields.map(e=>(0,h.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.2em]`,style:{color:x,fontFamily:v,fontWeight:600},children:e.label}),(0,h.jsx)(`input`,{value:o[e.key]??``,onChange:t=>s(n=>({...n,[e.key]:t.target.value})),placeholder:e.placeholder??e.defaultValue,className:`px-3 py-2 rounded-lg text-sm outline-none`,style:D}),e.hint&&(0,h.jsx)(`span`,{className:`text-[11px]`,style:{color:b},children:e.hint})]},e.key)),(0,h.jsxs)(`div`,{className:`mt-2 px-3 py-2.5 rounded-lg`,style:{background:`${O}66`,border:`1px solid ${x}22`},children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] mb-1`,style:{color:x,fontFamily:v},children:`Preview goal`}),(0,h.jsx)(`div`,{className:`text-sm leading-snug`,style:{color:y},children:f})]})]}),r===2&&(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`div`,{className:`text-sm`,style:{color:b},children:`Which cadence should TITAN remember?`}),e.schedules.map(e=>{let t=e.id===c.id;return(0,h.jsxs)(`button`,{onClick:()=>l(e),className:`flex items-center justify-between p-3 rounded-xl text-left transition-colors`,style:{background:t?`${x}1f`:`${O}55`,border:`1px solid ${t?x:`${x}22`}`,color:t?y:b},children:[(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[(0,h.jsx)(`span`,{className:`font-semibold text-sm`,style:{color:y},children:e.label}),(0,h.jsx)(`span`,{className:`text-[11px]`,style:{color:b,fontFamily:v},children:e.cadence})]}),(0,h.jsx)(`code`,{className:`text-[10px]`,style:{color:b,fontFamily:v},children:e.cron})]},e.id)}),(0,h.jsx)(`div`,{className:`text-[11px] italic px-1 pt-1`,style:{color:b},children:`This starts the first run immediately and saves the cadence selection for recurring mission support.`})]}),r===3&&(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`div`,{className:`text-sm`,style:{color:b},children:`Quick recap before we kick off.`}),(0,h.jsxs)(`div`,{className:`rounded-xl p-4`,style:{background:`${O}55`,border:`1px solid ${x}22`},children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] mb-1`,style:{color:x,fontFamily:v},children:`What I'll do`}),(0,h.jsx)(`div`,{className:`text-sm leading-relaxed`,style:{color:y},children:e.whatItDoes})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[12px]`,children:[(0,h.jsxs)(`div`,{className:`rounded-lg p-3`,style:{background:`${O}55`,border:`1px solid ${x}22`},children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] mb-1`,style:{color:x,fontFamily:v},children:`Goal`}),(0,h.jsx)(`div`,{className:`leading-snug`,style:{color:y},children:f})]}),(0,h.jsxs)(`div`,{className:`rounded-lg p-3`,style:{background:`${O}55`,border:`1px solid ${x}22`},children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] mb-1`,style:{color:x,fontFamily:v},children:`Cadence`}),(0,h.jsx)(`div`,{className:`font-semibold`,style:{color:y},children:c.label}),(0,h.jsx)(`div`,{className:`text-[11px] mt-0.5`,style:{color:b,fontFamily:v},children:c.cadence})]})]})]})]}),(0,h.jsxs)(`div`,{className:`px-5 py-3 flex items-center justify-between`,style:{borderTop:`1px solid ${x}22`,background:`${E}66`},children:[(0,h.jsx)(`button`,{onClick:()=>r>1?i(e=>e-1):t(),className:`px-4 py-2 text-sm`,style:{color:b,background:`transparent`,fontFamily:_},children:r>1?`β Back`:`Cancel`}),r<3?(0,h.jsx)(`button`,{onClick:()=>i(e=>e+1),disabled:!p,className:`px-5 py-2 rounded-lg text-sm font-bold`,style:{background:p?`linear-gradient(180deg, ${S} 0%, ${x} 60%, ${C} 100%)`:`${C}55`,color:w,border:`1px solid ${C}`,opacity:p?1:.5,cursor:p?`pointer`:`not-allowed`,fontFamily:_,letterSpacing:`0.04em`},children:`Next β`}):(0,h.jsx)(`button`,{onClick:g,disabled:u,className:`px-5 py-2 rounded-lg text-sm font-bold`,style:{background:u?`${C}55`:`linear-gradient(180deg, ${S} 0%, ${x} 60%, ${C} 100%)`,color:w,border:`1px solid ${C}`,opacity:u?.6:1,cursor:u?`wait`:`pointer`,fontFamily:_,letterSpacing:`0.04em`},children:u?`Launchingβ¦`:`Launch first run π`})]})]})})}export{N as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./circle-check-big-C-JUM7wb.js";import{t as i}from"./external-link-CpQLWKKE.js";import{t as a}from"./refresh-cw-Disd5wRB.js";import{t as o}from"./save-DP7oNar2.js";import{t as s}from"./search-aNVcX-nv.js";import{At as c,D as l,E as u,H as d,I as f,M as p,Yn as m,h,o as g}from"./index-WI-E4I3h.js";import{t as _}from"./PageHeader-CH85uoZG.js";var v=e(t(),1),y=n(),b={enabled:!1,apiKey:``,cuopt:{enabled:!1,url:`http://localhost:5000`},asr:{enabled:!1,grpcUrl:`localhost:50051`,healthUrl:`http://localhost:9000`},openshell:{enabled:!1,binaryPath:`openshell`,policyPath:``}};function x({status:e}){return(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-text-muted`,children:[(0,y.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${{unknown:`bg-border-light`,checking:`bg-[#eab308] animate-pulse`,healthy:`bg-success`,unhealthy:`bg-error`}[e]}`}),{unknown:`Not checked`,checking:`Checking...`,healthy:`Healthy`,unhealthy:`Unreachable`}[e]]})}function S({title:e,description:t,icon:n,enabled:r,onToggle:i,children:a}){return(0,y.jsxs)(`div`,{className:`rounded-xl border bg-bg-secondary transition-colors ${r?`border-[#76b900]/30`:`border-bg-tertiary`}`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg ${r?`bg-nvidia/15`:`bg-bg-tertiary`}`,children:(0,y.jsx)(n,{className:`h-4.5 w-4.5 ${r?`text-nvidia`:`text-text-muted`}`})}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium text-text`,children:e}),(0,y.jsx)(`p`,{className:`text-xs text-text-muted mt-0.5`,children:t})]})]}),(0,y.jsx)(`button`,{onClick:i,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${r?`bg-nvidia`:`bg-border`}`,children:(0,y.jsx)(`span`,{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${r?`translate-x-6`:`translate-x-1`}`})})]}),r&&(0,y.jsx)(`div`,{className:`border-t border-bg-tertiary px-5 py-4 space-y-3`,children:a})]})}function C({id:e,label:t,value:n,onChange:r,placeholder:i,type:a=`text`,secret:o=!1}){let[s,c]=(0,v.useState)(!1);return(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`label`,{className:`mb-1 block text-xs text-text-muted`,children:t}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(`input`,{id:e,name:e,type:o&&!s?`password`:a,value:n,onChange:e=>r(e.target.value),placeholder:i,className:`w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-[#76b900] transition-colors`}),o&&(0,y.jsx)(`button`,{type:`button`,onClick:()=>c(!s),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary`,children:s?(0,y.jsx)(l,{className:`h-4 w-4`}):(0,y.jsx)(u,{className:`h-4 w-4`})})]})]})}function w(){let[e,t]=(0,v.useState)(b),[n,l]=(0,v.useState)(!0),[u,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)({cuopt:`unknown`,asr:`unknown`,nim:`unknown`}),[k,A]=(0,v.useState)(!1),j=(0,v.useCallback)((e,t)=>{E({type:e,message:t}),setTimeout(()=>E(null),3e3)},[]);(0,v.useEffect)(()=>{(async()=>{try{let e=await c();e.nvidia&&(t({enabled:e.nvidia.enabled??!1,apiKey:``,cuopt:{enabled:e.nvidia.cuopt?.enabled??!1,url:e.nvidia.cuopt?.url??`http://localhost:5000`},asr:{enabled:e.nvidia.asr?.enabled??!1,grpcUrl:e.nvidia.asr?.grpcUrl??`localhost:50051`,healthUrl:e.nvidia.asr?.healthUrl??`http://localhost:9000`},openshell:{enabled:e.nvidia.openshell?.enabled??!1,binaryPath:e.nvidia.openshell?.binaryPath??`openshell`,policyPath:e.nvidia.openshell?.policyPath??``}}),A(e.nvidia.apiKeySet??!1))}catch{}finally{l(!1)}})()},[]);let M=(0,v.useCallback)(async()=>{if(e.cuopt.enabled){O(e=>({...e,cuopt:`checking`}));try{let e=await(await d(`/api/nvidia/health/cuopt`)).json();O(t=>({...t,cuopt:e.healthy?`healthy`:`unhealthy`}))}catch{O(e=>({...e,cuopt:`unhealthy`}))}}if(e.asr.enabled){O(e=>({...e,asr:`checking`}));try{let e=await(await d(`/api/nvidia/health/asr`)).json();O(t=>({...t,asr:e.healthy?`healthy`:`unhealthy`}))}catch{O(e=>({...e,asr:`unhealthy`}))}}if(k||e.apiKey){O(e=>({...e,nim:`checking`}));try{let e=await(await d(`/api/nvidia/health/nim`)).json();O(t=>({...t,nim:e.healthy?`healthy`:`unhealthy`}))}catch{O(e=>({...e,nim:`unhealthy`}))}}},[e.cuopt.enabled,e.asr.enabled,k,e.apiKey]);return n?(0,y.jsx)(`div`,{className:`space-y-4`,children:Array.from({length:4}).map((e,t)=>(0,y.jsx)(`div`,{className:`h-20 animate-pulse rounded-xl border border-border bg-bg-secondary`},t))}):(0,y.jsxs)(`div`,{className:`space-y-6 max-w-3xl`,children:[(0,y.jsx)(_,{title:`NVIDIA`,subtitle:`GPU-accelerated AI services β NIM, cuOpt, Nemotron-ASR, OpenShell`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`System`},{label:`GPU`}],actions:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`button`,{onClick:M,className:`flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary transition-colors`,children:[(0,y.jsx)(a,{className:`h-3.5 w-3.5`}),`Check Health`]}),(0,y.jsxs)(`button`,{onClick:async()=>{w(!0);try{let n={nvidia:{enabled:e.enabled,cuopt:e.cuopt,asr:e.asr,openshell:e.openshell}};e.apiKey&&(n.nvidia.apiKey=e.apiKey),await m(n),j(`success`,`NVIDIA configuration saved`),e.apiKey&&(A(!0),t(e=>({...e,apiKey:``})))}catch(e){j(`error`,e instanceof Error?e.message:`Failed to save`)}finally{w(!1)}},disabled:u,className:`flex items-center gap-2 rounded-lg bg-nvidia px-4 py-1.5 text-xs font-medium text-black transition-colors hover:bg-nvidia/80 disabled:opacity-50`,children:[(0,y.jsx)(o,{className:`h-3.5 w-3.5`}),u?`Saving...`:`Save`]})]})}),T&&(0,y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${T.type===`success`?`border-success/50 text-success`:`border-error/50 text-error`}`,children:[T.type===`success`?(0,y.jsx)(r,{className:`h-4 w-4`}):(0,y.jsx)(p,{className:`h-4 w-4`}),T.message]}),(0,y.jsx)(`div`,{className:`rounded-xl border p-5 transition-colors ${e.enabled?`border-[#76b900]/30 bg-nvidia/5`:`border-bg-tertiary bg-bg-secondary`}`,children:(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-medium text-text`,children:`Enable NVIDIA Skills`}),(0,y.jsxs)(`p`,{className:`text-xs text-text-muted mt-0.5`,children:[`Load NVIDIA GPU-accelerated skills (cuOpt, AI-Q Research, etc.) when TITAN starts. Equivalent to setting `,(0,y.jsx)(`code`,{className:`text-nvidia/70 bg-nvidia/10 px-1 rounded`,children:`TITAN_NVIDIA=1`})]})]}),(0,y.jsx)(`button`,{onClick:()=>t(e=>({...e,enabled:!e.enabled})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${e.enabled?`bg-nvidia`:`bg-border`}`,children:(0,y.jsx)(`span`,{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${e.enabled?`translate-x-6`:`translate-x-1`}`})})]})}),(0,y.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(g,{className:`h-4 w-4 text-nvidia`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium text-text`,children:`NVIDIA NIM API`}),(0,y.jsx)(`p`,{className:`text-xs text-text-muted mt-0.5`,children:`Cloud inference for Nemotron 3 Super and other NIM models`})]})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(x,{status:D.nim}),k&&(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success`,children:[(0,y.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-success`}),`Key configured`]})]})]}),(0,y.jsx)(C,{id:`nvidia-api-key`,label:`API Key`,value:e.apiKey,onChange:e=>t(t=>({...t,apiKey:e})),placeholder:k?`(configured β enter new key to replace)`:`nvapi-...`,secret:!0}),(0,y.jsxs)(`p`,{className:`text-[10px] text-text-muted`,children:[`Get your key at`,` `,(0,y.jsxs)(`a`,{href:`https://build.nvidia.com`,target:`_blank`,rel:`noopener noreferrer`,className:`text-nvidia hover:underline inline-flex items-center gap-0.5`,children:[`build.nvidia.com `,(0,y.jsx)(i,{className:`h-2.5 w-2.5`})]})]})]}),(0,y.jsxs)(S,{title:`cuOpt Optimization`,description:`GPU-accelerated routing, scheduling, and mathematical programming (MILP/LP/QP)`,icon:f,enabled:e.cuopt.enabled,onToggle:()=>t(e=>({...e,cuopt:{...e.cuopt,enabled:!e.cuopt.enabled}})),children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,y.jsx)(`span`,{className:`text-xs text-text-muted`,children:`Service Status`}),(0,y.jsx)(x,{status:D.cuopt})]}),(0,y.jsx)(C,{id:`nvidia-cuopt-url`,label:`cuOpt Server URL`,value:e.cuopt.url,onChange:e=>t(t=>({...t,cuopt:{...t.cuopt,url:e}})),placeholder:`http://localhost:5000`}),(0,y.jsxs)(`p`,{className:`text-[10px] text-text-muted`,children:[`Start cuOpt: `,(0,y.jsx)(`code`,{className:`bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary`,children:`docker compose -f docker-compose.nvidia.yml --profile cuopt up -d`})]})]}),(0,y.jsxs)(S,{title:`Nemotron-ASR Streaming`,description:`NVIDIA speech recognition with 24ms median finalization β replaces faster-whisper for voice chat`,icon:s,enabled:e.asr.enabled,onToggle:()=>t(e=>({...e,asr:{...e.asr,enabled:!e.asr.enabled}})),children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,y.jsx)(`span`,{className:`text-xs text-text-muted`,children:`Service Status`}),(0,y.jsx)(x,{status:D.asr})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,y.jsx)(C,{id:`nvidia-asr-grpc-url`,label:`gRPC Address`,value:e.asr.grpcUrl,onChange:e=>t(t=>({...t,asr:{...t.asr,grpcUrl:e}})),placeholder:`localhost:50051`}),(0,y.jsx)(C,{id:`nvidia-asr-health-url`,label:`Health Check URL`,value:e.asr.healthUrl,onChange:e=>t(t=>({...t,asr:{...t.asr,healthUrl:e}})),placeholder:`http://localhost:9000`})]}),(0,y.jsxs)(`p`,{className:`text-[10px] text-text-muted`,children:[`Start ASR: `,(0,y.jsx)(`code`,{className:`bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary`,children:`docker compose -f docker-compose.nvidia.yml --profile asr up -d`})]}),(0,y.jsxs)(`p`,{className:`text-[10px] text-text-muted`,children:[`VRAM: ~3-4 GB. Set `,(0,y.jsx)(`code`,{className:`bg-bg-tertiary px-1 rounded text-text-secondary`,children:`STT_ENGINE=nemotron-asr`}),` in voice agent env.`]})]}),(0,y.jsxs)(S,{title:`OpenShell Sandbox`,description:`NVIDIA secure sandbox runtime for code execution with declarative policy enforcement`,icon:h,enabled:e.openshell.enabled,onToggle:()=>t(e=>({...e,openshell:{...e.openshell,enabled:!e.openshell.enabled}})),children:[(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,y.jsx)(C,{id:`nvidia-openshell-binary-path`,label:`Binary Path`,value:e.openshell.binaryPath,onChange:e=>t(t=>({...t,openshell:{...t.openshell,binaryPath:e}})),placeholder:`openshell`}),(0,y.jsx)(C,{id:`nvidia-openshell-policy-path`,label:`Policy File Path (optional)`,value:e.openshell.policyPath,onChange:e=>t(t=>({...t,openshell:{...t.openshell,policyPath:e}})),placeholder:`Auto-detected`})]}),(0,y.jsxs)(`p`,{className:`text-[10px] text-text-muted`,children:[`When enabled, code execution uses OpenShell instead of Docker. Set `,(0,y.jsx)(`code`,{className:`bg-bg-tertiary px-1 rounded text-text-secondary`,children:`sandbox.engine: "openshell"`}),` in config.`]})]}),(0,y.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary p-5`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium text-text mb-3`,children:`VRAM Budget (RTX 5090, 32 GB)`}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[[{label:`Nemotron 3 Nano 30B`,vram:`~24 GB`,note:`Full local inference`},{label:`Nemotron 3 Nano 4B`,vram:`~3 GB`,note:`Lightweight variant`},{label:`Nemotron-ASR`,vram:`~3-4 GB`,note:`Speech recognition`},{label:`cuOpt`,vram:`~2-4 GB`,note:`Optimization solver`}].map(({label:e,vram:t,note:n})=>(0,y.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`span`,{className:`text-xs text-text`,children:e}),(0,y.jsx)(`span`,{className:`text-[10px] text-text-muted ml-2`,children:n})]}),(0,y.jsx)(`span`,{className:`text-xs font-mono text-nvidia`,children:t})]},e)),(0,y.jsx)(`div`,{className:`border-t border-bg-tertiary pt-2 mt-2`,children:(0,y.jsx)(`p`,{className:`text-[10px] text-text-muted`,children:`Recommended: Nano 4B + ASR + cuOpt = ~10 GB, leaving room for other models. Or use NIM cloud API for LLM inference (0 GB local).`})})]})]}),(0,y.jsxs)(`div`,{className:`rounded-xl border border-bg-tertiary bg-bg-secondary p-5`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium text-text mb-2`,children:`Quick Start`}),(0,y.jsxs)(`div`,{className:`space-y-2 text-xs text-text-muted`,children:[(0,y.jsx)(`p`,{children:`Start all NVIDIA services:`}),(0,y.jsx)(`code`,{className:`block bg-bg border border-bg-tertiary rounded-lg px-3 py-2 text-text-secondary font-mono text-xs`,children:`docker compose -f docker-compose.nvidia.yml --profile all up -d`}),(0,y.jsx)(`p`,{className:`mt-2`,children:`Or start individual services:`}),(0,y.jsxs)(`div`,{className:`space-y-1 font-mono text-[10px] text-text-muted`,children:[(0,y.jsxs)(`p`,{children:[(0,y.jsx)(`span`,{className:`text-nvidia`,children:`cuopt:`}),` --profile cuopt`]}),(0,y.jsxs)(`p`,{children:[(0,y.jsx)(`span`,{className:`text-nvidia`,children:`asr:`}),` --profile asr (includes Riva bridge)`]}),(0,y.jsxs)(`p`,{children:[(0,y.jsx)(`span`,{className:`text-nvidia`,children:`voice:`}),` --profile voice (ASR + bridge)`]})]})]})]})]})}export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./circle-check-big-C-JUM7wb.js";import{t as i}from"./refresh-cw-Disd5wRB.js";import{Qt as a,Zt as o,a as s,f as c,h as l,z as u}from"./index-WI-E4I3h.js";import{t as d}from"./PageHeader-CH85uoZG.js";var f=e(t(),1),p=n();function m(){let{toast:e}=s(),[t,n]=(0,f.useState)([]),[m,h]=(0,f.useState)({}),[g,_]=(0,f.useState)(!0),v=(0,f.useCallback)(async()=>{_(!0);try{let[e,t]=await Promise.all([o(),a()]);n(e.alerts||[]),h(t)}catch(t){e(`error`,`Couldn't load the organism monitor β try again. ${t.message}`)}_(!1)},[e]);(0,f.useEffect)(()=>{v()},[v]);let y=async t=>{try{await u(t),e(`success`,`Alert acknowledged.`),await v()}catch(t){e(`error`,`Couldn't acknowledge the alert β try again. ${t.message}`)}};return(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsx)(d,{title:`Organism Monitor`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Safety`},{label:`Organism`}]}),(0,p.jsx)(`div`,{className:`flex gap-2`,children:(0,p.jsxs)(`button`,{onClick:v,disabled:g,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50`,children:[(0,p.jsx)(i,{className:`w-4 h-4 ${g?`animate-spin`:``}`}),` Refresh`]})}),Object.keys(m).length>0&&(0,p.jsx)(`div`,{className:`grid grid-cols-4 gap-2`,children:Object.entries(m).map(([e,t])=>(0,p.jsxs)(`div`,{className:`p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,p.jsx)(`div`,{className:`text-xs text-[#52525b] capitalize`,children:e}),(0,p.jsx)(`div`,{className:`text-sm font-semibold text-[#e4e4e7]`,children:typeof t==`number`?t.toFixed(2):t})]},e))}),(0,p.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,p.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg border ${e.severity===`critical`?`bg-red-950/20 border-red-900/50`:e.severity===`warning`?`bg-amber-950/20 border-amber-900/50`:`bg-[#0a0a0f] border-[#27272a]`}`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.severity===`critical`?(0,p.jsx)(c,{className:`w-4 h-4 text-red-400`}):e.severity===`warning`?(0,p.jsx)(c,{className:`w-4 h-4 text-amber-400`}):(0,p.jsx)(l,{className:`w-4 h-4 text-[#6366f1]`}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`text-sm text-[#e4e4e7]`,children:e.message}),(0,p.jsxs)(`div`,{className:`text-xs text-[#52525b]`,children:[e.source,` β’ `,new Date(e.timestamp).toLocaleString()]})]})]}),!e.acknowledged&&(0,p.jsxs)(`button`,{onClick:()=>y(e.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] text-xs hover:bg-[#3f3f46]`,children:[(0,p.jsx)(r,{className:`w-3.5 h-3.5`}),` Ack`]})]},e.id))})]})}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./clock-DSPgndSD.js";import{t as i}from"./layers-BPu5SRjI.js";import{t as a}from"./message-square-BpzrINHz.js";import{t as o}from"./server-DFfeYjoM.js";import{I as s,O as c,ln as l,o as u,w as d}from"./index-WI-E4I3h.js";import{t as f}from"./PageHeader-CH85uoZG.js";import{t as p}from"./SkeletonLoader-9H7QWa9E.js";import{t as m}from"./StatCard-wmSgMAM3.js";var h=e(t(),1),g=n();function _(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function v(e){let t=e/1024/1024;return t>1024?`${(t/1024).toFixed(1)} GB`:`${t.toFixed(0)} MB`}function y(){let[e,t]=(0,h.useState)(null),[n,y]=(0,h.useState)(null),[b,x]=(0,h.useState)(!0),S=async()=>{try{let e=await l();t(e),y(null)}catch(e){y(e instanceof Error?e.message:`Failed to fetch stats`)}finally{x(!1)}};return(0,h.useEffect)(()=>{S();let e=setInterval(S,1e4);return()=>clearInterval(e)},[]),b?(0,g.jsxs)(`div`,{className:`space-y-4 md:space-y-6`,children:[(0,g.jsx)(f,{title:`System Overview`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Monitoring`},{label:`Overview`}]}),(0,g.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:(0,g.jsx)(p,{variant:`metric`,count:8})})]}):n?(0,g.jsx)(`div`,{className:`rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error`,children:n}):e?(0,g.jsxs)(`div`,{className:`space-y-4 md:space-y-6`,children:[(0,g.jsx)(f,{title:`System Overview`,subtitle:`Real-time system health and metrics`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Monitoring`},{label:`Overview`}]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,g.jsx)(m,{title:`Uptime`,value:_(e.uptime),icon:(0,g.jsx)(r,{className:`h-5 w-5`})}),(0,g.jsx)(m,{title:`Total Requests`,value:e.totalRequests.toLocaleString(),icon:(0,g.jsx)(u,{className:`h-5 w-5`})}),(0,g.jsx)(m,{title:`Active Agents`,value:e.activeAgents,icon:(0,g.jsx)(s,{className:`h-5 w-5`})}),(0,g.jsx)(m,{title:`Active Sessions`,value:e.activeSessions,icon:(0,g.jsx)(a,{className:`h-5 w-5`})}),(0,g.jsx)(m,{title:`Memory Usage`,value:v(e.memoryUsage.heapUsed),icon:(0,g.jsx)(d,{className:`h-5 w-5`}),subtitle:`${v(e.memoryUsage.heapTotal)} total`}),(0,g.jsx)(m,{title:`Model`,value:e.model,icon:(0,g.jsx)(c,{className:`h-5 w-5`})}),(0,g.jsx)(m,{title:`Provider`,value:e.provider,icon:(0,g.jsx)(o,{className:`h-5 w-5`})}),(0,g.jsx)(m,{title:`Version`,value:e.version,icon:(0,g.jsx)(i,{className:`h-5 w-5`})})]})]}):null}export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-B15e6lOy.js";import{t}from"./chevron-right-A_pvnRh_.js";import{$n as n}from"./index-WI-E4I3h.js";var r=e();function i({title:e,subtitle:i,breadcrumbs:a,actions:o}){return(0,r.jsxs)(`header`,{className:`titan-window-titlebar mb-4 md:mb-6`,children:[(0,r.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[a&&a.length>0&&(0,r.jsx)(`nav`,{className:`flex items-center gap-1 overflow-x-auto pb-1 text-[10px] text-text-muted scrollbar-thin md:text-xs`,"aria-label":`Breadcrumb`,children:a.map((e,i)=>(0,r.jsxs)(`span`,{className:`flex items-center gap-1 flex-shrink-0`,children:[i>0&&(0,r.jsx)(t,{size:12,className:`opacity-50 flex-shrink-0`}),e.href?(0,r.jsx)(n,{to:e.href,className:`whitespace-nowrap transition-colors hover:text-text`,children:e.label}):(0,r.jsx)(`span`,{className:i===a.length-1?`text-text-secondary whitespace-nowrap`:``,children:e.label})]},i))}),(0,r.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,r.jsxs)(`div`,{className:`mt-1 hidden h-3.5 w-11 shrink-0 items-center gap-1.5 md:flex`,"aria-hidden":`true`,children:[(0,r.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-error/80`}),(0,r.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-warning/80`}),(0,r.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-success/80`})]}),(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`h1`,{className:`truncate text-lg font-semibold text-text md:text-xl`,children:e}),i&&(0,r.jsx)(`p`,{className:`mt-1 max-w-3xl text-[11px] leading-5 text-text-muted md:text-sm`,children:i})]})]})]}),o&&(0,r.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 sm:justify-end`,children:o})]})}export{i as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{n as i}from"./pencil-Dd_vzHE-.js";import{t as a}from"./clock-DSPgndSD.js";import{t as o}from"./pause-C4TDJSfA.js";import{t as s}from"./refresh-cw-Disd5wRB.js";import{t as c}from"./volume-2-BVlfVl2U.js";import{a as l,d as u,en as d,ut as f}from"./index-WI-E4I3h.js";import{t as p}from"./PageHeader-CH85uoZG.js";var m=r(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),h=e(t(),1),g=n();function _(){let{toast:e}=l(),[t,n]=(0,h.useState)(null),[r,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!0),b=(0,h.useCallback)(async()=>{y(!0);try{let[e,t]=await Promise.all([d(),f()]);n(e),_(t)}catch(t){e(`error`,`Couldn't load persona profiles β try again. (${t.message})`)}y(!1)},[e]);(0,h.useEffect)(()=>{b()},[b]);let x=t?.enabled??!1,S=t?.profiles??[];return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(p,{title:`Persona Profiles`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Identity`},{label:`Personas`}]}),(0,g.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,g.jsxs)(`button`,{onClick:b,disabled:v,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50`,children:[(0,g.jsx)(s,{className:`w-4 h-4 ${v?`animate-spin`:``}`}),` Refresh`]})}),x?(0,g.jsxs)(`div`,{className:`p-4 rounded-lg border border-[#27272a] bg-[#0a0a0f] text-sm flex items-start gap-3`,children:[(0,g.jsx)(i,{className:`w-4 h-4 text-emerald-400 mt-0.5 shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`font-semibold text-emerald-300 mb-1`,children:`Personas enabled`}),(0,g.jsxs)(`div`,{className:`text-[#a1a1aa]`,children:[`Active right now: `,(0,g.jsx)(`span`,{className:`text-[#e4e4e7] font-medium`,children:r?.activeName??`β`}),r?.windDown&&(0,g.jsxs)(`span`,{className:`ml-2 inline-flex items-center gap-1 text-amber-300`,children:[(0,g.jsx)(o,{className:`w-3 h-3`}),` wind-down active`]})]}),(0,g.jsx)(`div`,{className:`text-xs text-[#52525b] mt-1`,children:r?.reason})]})]}):(0,g.jsxs)(`div`,{className:`p-4 rounded-lg border border-amber-900/50 bg-amber-950/20 text-sm`,children:[(0,g.jsx)(`div`,{className:`font-semibold text-amber-300 mb-1`,children:`Personas disabled`}),(0,g.jsxs)(`div`,{className:`text-[#a1a1aa]`,children:[`TITAN behaves as a single default persona. To enable Dad Mode (and any other defined profiles), add to `,(0,g.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-[#0a0a0f] text-[#e4e4e7]`,children:`~/.titan/titan.json`}),`:`]}),(0,g.jsx)(`pre`,{className:`mt-2 p-2 rounded bg-[#0a0a0f] text-xs text-[#a1a1aa] overflow-x-auto`,children:`{
|
|
2
|
+
"personas": { "enabled": true }
|
|
3
|
+
}`}),(0,g.jsxs)(`div`,{className:`text-[#a1a1aa] mt-1`,children:[`Then restart `,(0,g.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-[#0a0a0f]`,children:`titan.service`}),`.`]})]}),x&&t&&Object.keys(t.channelPins).length>0&&(0,g.jsxs)(`div`,{className:`p-3 rounded-lg border border-[#27272a] bg-[#0a0a0f]`,children:[(0,g.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-[#52525b] mb-2`,children:`Channel pins`}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.entries(t.channelPins).map(([e,t])=>(0,g.jsxs)(`span`,{className:`text-xs px-2 py-1 rounded bg-[#27272a] text-[#a1a1aa]`,children:[e,` β `,(0,g.jsx)(`span`,{className:`text-[#e4e4e7]`,children:t})]},e))})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[S.map(e=>{let t=x&&r?.activeId===e.id;return(0,g.jsxs)(`div`,{className:`p-4 rounded-lg border ${t?`border-emerald-700 bg-emerald-950/20`:`border-[#27272a] bg-[#0a0a0f]`}`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(u,{className:`w-4 h-4 text-[#6366f1]`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold text-[#e4e4e7]`,children:e.name}),(0,g.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:e.id})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.windDown&&(0,g.jsxs)(`span`,{title:`windDown=true: pauses autopilot when active`,className:`text-xs px-1.5 py-0.5 rounded bg-amber-950/40 text-amber-300 inline-flex items-center gap-1`,children:[(0,g.jsx)(o,{className:`w-3 h-3`}),` wind-down`]}),e.voiceId&&(0,g.jsxs)(`span`,{title:`voiceId: ${e.voiceId}`,className:`text-xs px-1.5 py-0.5 rounded bg-[#27272a] text-[#a1a1aa] inline-flex items-center gap-1`,children:[(0,g.jsx)(c,{className:`w-3 h-3`}),` voice`]}),t&&(0,g.jsxs)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-emerald-950/40 text-emerald-300 inline-flex items-center gap-1`,children:[(0,g.jsx)(i,{className:`w-3 h-3`}),` active`]})]})]}),e.description&&(0,g.jsx)(`div`,{className:`text-xs text-[#a1a1aa] mb-3`,children:e.description}),e.schedule&&(0,g.jsxs)(`div`,{className:`text-xs text-[#a1a1aa] flex items-center gap-1 mb-2`,children:[(0,g.jsx)(a,{className:`w-3 h-3`}),` `,e.schedule.from,` β `,e.schedule.to,` local`]}),(e.allowedTools.length>0||e.deniedTools.length>0)&&(0,g.jsxs)(`div`,{className:`space-y-1.5 mt-2`,children:[e.allowedTools.length>0&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`text-[10px] uppercase tracking-wide text-[#52525b] mb-1 flex items-center gap-1`,children:[(0,g.jsx)(m,{className:`w-3 h-3`}),` allowed only`]}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.allowedTools.map(e=>(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-[#27272a] text-[#a1a1aa]`,children:e},e))})]}),e.deniedTools.length>0&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-[#52525b] mb-1`,children:`denied`}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.deniedTools.map(e=>(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-red-950/30 text-red-300`,children:e},e))})]})]})]},e.id)}),S.length===0&&!v&&(0,g.jsx)(`div`,{className:`text-sm text-[#52525b] p-3`,children:`No persona profiles defined.`})]})]})}export{_ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{tn as r,zn as i}from"./index-WI-E4I3h.js";var a=e(t(),1),o=n();function s(){let[e,t]=(0,a.useState)([]),[n,s]=(0,a.useState)(`default`),[c,l]=(0,a.useState)(!0),[u,d]=(0,a.useState)(null),[f,p]=(0,a.useState)(null),[m,h]=(0,a.useState)(`all`);(0,a.useEffect)(()=>{(async()=>{try{let e=await r();t(e.personas),s(e.active)}catch(e){d(e instanceof Error?e.message:`Failed to fetch personas`)}finally{l(!1)}})()},[]);let g=(0,a.useMemo)(()=>{let t=new Set(e.map(e=>e.division));return[`all`,...Array.from(t).sort()]},[e]),_=(0,a.useMemo)(()=>m===`all`?e:e.filter(e=>e.division===m),[e,m]),v=async e=>{if(!(e===n||f)){p(e);try{let t=await i(e);s(t.active)}catch(e){d(e instanceof Error?e.message:`Failed to switch persona`)}finally{p(null)}}};return c?(0,o.jsx)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,o.jsx)(`div`,{className:`h-32 animate-pulse rounded-xl border border-border bg-bg-secondary`},t))}):u?(0,o.jsx)(`div`,{className:`rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error`,children:u}):(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsx)(`h2`,{className:`text-lg font-semibold text-text`,children:`Personas`}),(0,o.jsxs)(`span`,{className:`text-sm text-text-muted`,children:[e.length,` available`]})]}),(0,o.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:g.map(e=>(0,o.jsx)(`button`,{onClick:()=>h(e),className:`rounded-lg px-3 py-1.5 text-sm font-medium capitalize transition-colors ${m===e?`bg-accent text-white`:`bg-bg-tertiary text-text-secondary hover:text-text`}`,children:e},e))}),(0,o.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:[_.map(e=>{let t=e.id===n,r=e.id===f;return(0,o.jsxs)(`button`,{onClick:()=>v(e.id),disabled:t||!!f,className:`rounded-xl border p-4 text-left transition-all ${t?`border-accent bg-accent/10 ring-1 ring-accent/30`:`border-border bg-bg-secondary hover:border-border-light hover:bg-bg-secondary`} ${r?`opacity-60`:``} disabled:cursor-default`,children:[(0,o.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,o.jsx)(`h3`,{className:`font-medium text-text`,children:e.name}),t&&(0,o.jsx)(`span`,{className:`rounded-full bg-accent/20 px-2 py-0.5 text-xs font-medium text-accent-hover`,children:`Active`}),r&&(0,o.jsx)(`span`,{className:`text-xs text-text-secondary`,children:`Switching...`})]}),(0,o.jsx)(`p`,{className:`text-sm text-text-secondary line-clamp-2`,children:e.description}),(0,o.jsx)(`p`,{className:`mt-2 text-xs capitalize text-text-muted`,children:e.division})]},e.id)}),_.length===0&&(0,o.jsx)(`p`,{className:`col-span-full py-12 text-center text-text-muted`,children:`No personas in this division`})]})]})}export{s as default};
|