titan-agent 5.4.2 → 5.5.6
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 +1 -1
- package/dist/agent/agent.js +9 -5
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/agentLoop.js +7 -3
- package/dist/agent/agentLoop.js.map +1 -1
- package/dist/agent/checkpoint.js +2 -2
- package/dist/agent/checkpoint.js.map +1 -1
- package/dist/agent/commandPost.js +3 -3
- package/dist/agent/commandPost.js.map +1 -1
- package/dist/agent/goalProposer.js +2 -2
- package/dist/agent/goalProposer.js.map +1 -1
- package/dist/agent/goals.js +3 -3
- package/dist/agent/goals.js.map +1 -1
- package/dist/agent/peerAdvise.js +1 -1
- package/dist/agent/peerAdvise.js.map +1 -1
- package/dist/agent/planner.js +4 -4
- package/dist/agent/planner.js.map +1 -1
- package/dist/agent/userProfile.js +2 -2
- package/dist/agent/userProfile.js.map +1 -1
- package/dist/cli/doctor.js +33 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/onboard.js +4 -4
- package/dist/cli/onboard.js.map +1 -1
- package/dist/config/config.js +3 -3
- package/dist/config/config.js.map +1 -1
- package/dist/config/schema.js +8 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/gateway/routes/adminRouter.js +500 -0
- package/dist/gateway/routes/adminRouter.js.map +1 -0
- package/dist/gateway/routes/agents.js +231 -0
- package/dist/gateway/routes/agents.js.map +1 -0
- package/dist/gateway/routes/agentsRouter.js +32 -0
- package/dist/gateway/routes/agentsRouter.js.map +1 -0
- package/dist/gateway/routes/checkpoints.js +41 -0
- package/dist/gateway/routes/checkpoints.js.map +1 -0
- package/dist/gateway/routes/commandPost.js +755 -0
- package/dist/gateway/routes/commandPost.js.map +1 -0
- package/dist/gateway/routes/companies.js +166 -0
- package/dist/gateway/routes/companies.js.map +1 -0
- package/dist/gateway/routes/files.js +295 -0
- package/dist/gateway/routes/files.js.map +1 -0
- package/dist/gateway/routes/hardwareRouter.js +151 -0
- package/dist/gateway/routes/hardwareRouter.js.map +1 -0
- package/dist/gateway/routes/mcpRouter.js +88 -0
- package/dist/gateway/routes/mcpRouter.js.map +1 -0
- package/dist/gateway/routes/mesh.js +464 -0
- package/dist/gateway/routes/mesh.js.map +1 -0
- package/dist/gateway/routes/metricsRouter.js +131 -0
- package/dist/gateway/routes/metricsRouter.js.map +1 -0
- package/dist/gateway/routes/organism.js +82 -0
- package/dist/gateway/routes/organism.js.map +1 -0
- package/dist/gateway/routes/paperclip.js +101 -0
- package/dist/gateway/routes/paperclip.js.map +1 -0
- package/dist/gateway/routes/sessions.js +227 -0
- package/dist/gateway/routes/sessions.js.map +1 -0
- package/dist/gateway/routes/skills.js +295 -0
- package/dist/gateway/routes/skills.js.map +1 -0
- package/dist/gateway/routes/socialRouter.js +145 -0
- package/dist/gateway/routes/socialRouter.js.map +1 -0
- package/dist/gateway/routes/systemRouter.js +220 -0
- package/dist/gateway/routes/systemRouter.js.map +1 -0
- package/dist/gateway/routes/teamsRecipes.js +297 -0
- package/dist/gateway/routes/teamsRecipes.js.map +1 -0
- package/dist/gateway/routes/tests.js +401 -0
- package/dist/gateway/routes/tests.js.map +1 -0
- package/dist/gateway/routes/traces.js +33 -0
- package/dist/gateway/routes/traces.js.map +1 -0
- package/dist/gateway/routes/voiceRouter.js +770 -0
- package/dist/gateway/routes/voiceRouter.js.map +1 -0
- package/dist/gateway/routes/watchRouter.js +131 -0
- package/dist/gateway/routes/watchRouter.js.map +1 -0
- package/dist/gateway/server.js +1179 -7379
- package/dist/gateway/server.js.map +1 -1
- package/dist/mcp/registry.js +2 -2
- package/dist/mcp/registry.js.map +1 -1
- package/dist/memory/episodic.js +2 -2
- package/dist/memory/episodic.js.map +1 -1
- package/dist/memory/learning.js +3 -3
- package/dist/memory/learning.js.map +1 -1
- package/dist/memory/memory.js +3 -3
- package/dist/memory/memory.js.map +1 -1
- package/dist/organism/drives.js +2 -2
- package/dist/organism/drives.js.map +1 -1
- package/dist/providers/errorTaxonomy.js +13 -0
- package/dist/providers/errorTaxonomy.js.map +1 -1
- package/dist/providers/ollama.js +3 -1
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai_compat.js +4 -3
- package/dist/providers/openai_compat.js.map +1 -1
- package/dist/providers/router.js +13 -0
- package/dist/providers/router.js.map +1 -1
- package/dist/safety/fixOscillation.js +15 -0
- package/dist/safety/fixOscillation.js.map +1 -1
- package/dist/safety/killSwitch.js +2 -2
- package/dist/safety/killSwitch.js.map +1 -1
- package/dist/safety/selfRepair.js +7 -3
- package/dist/safety/selfRepair.js.map +1 -1
- package/dist/skills/builtin/agent_debate.js +2 -2
- package/dist/skills/builtin/agent_debate.js.map +1 -1
- package/dist/skills/builtin/apply_patch.js +3 -3
- package/dist/skills/builtin/apply_patch.js.map +1 -1
- package/dist/skills/builtin/shell.js +2 -2
- package/dist/skills/builtin/shell.js.map +1 -1
- package/dist/skills/builtin/voice_control.js +49 -0
- package/dist/skills/builtin/voice_control.js.map +1 -0
- package/dist/skills/builtin/widget_gallery.js +6 -1
- package/dist/skills/builtin/widget_gallery.js.map +1 -1
- package/dist/skills/registry.js +15 -4
- package/dist/skills/registry.js.map +1 -1
- package/dist/storage/JsonStorage.js +4 -4
- package/dist/storage/JsonStorage.js.map +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/helpers.js +3 -1
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/lifecycle.js +86 -0
- package/dist/utils/lifecycle.js.map +1 -0
- package/dist/voice/bridge.js +136 -0
- package/dist/voice/bridge.js.map +1 -0
- package/docs/COO-MASTER-PLAN-2026-05-02.md +474 -0
- package/docs/HANDOFF/2026-04-29.md +141 -0
- package/docs/HANDOFF-2026-04-30.md +144 -0
- package/docs/HANDOFF-2026-05-03.md +114 -0
- package/docs/adr/2026-04-29-widget-pipeline-traceability.md +49 -0
- package/docs/agent-memory/README.md +45 -0
- package/docs/agent-memory/commands.md +100 -0
- package/docs/agent-memory/context-tree.md +101 -0
- package/docs/agent-memory/current-state.md +54 -0
- package/docs/agent-memory/decisions.md +78 -0
- package/docs/agent-memory/known-issues.md +76 -0
- package/docs/agent-memory/reflections.md +52 -0
- package/docs/agent-memory/skills-candidates.md +80 -0
- package/docs/superpowers/plans/2026-04-29-comprehensive-audit.md +256 -0
- package/docs/superpowers/plans/2026-04-29-comprehensive-test-plan.md +396 -0
- package/docs/superpowers/plans/2026-04-29-fix-all-prs.md +251 -0
- package/docs/superpowers/plans/2026-04-29-gitnexus-gap-remediation.md +969 -0
- package/package.json +5 -2
- package/ui/dist/assets/{AuditPanel-CM6Wg9hO.js → AuditPanel-VzSndmDN.js} +2 -2
- package/ui/dist/assets/{AutonomyPanel-CESx3ANg.js → AutonomyPanel-BiFouzAV.js} +2 -2
- package/ui/dist/assets/AutopilotPanel-fjOfM668.js +1 -0
- package/ui/dist/assets/{AutoresearchPanel-DR47NqT5.js → AutoresearchPanel-CVCxzAH3.js} +2 -2
- package/ui/dist/assets/BackupPanel-CHVTG--q.js +1 -0
- package/ui/dist/assets/{BrowserPanel-C15x9bLn.js → BrowserPanel-D5mvMKFU.js} +2 -2
- package/ui/dist/assets/CPActivity-B12mt35m.js +1 -0
- package/ui/dist/assets/CPAgentDetail-DsdShc-1.js +1 -0
- package/ui/dist/assets/CPAgents-j_7C-oQV.js +1 -0
- package/ui/dist/assets/CPApprovals-BShKSX9X.js +1 -0
- package/ui/dist/assets/CPCosts-CKPlhBDs.js +1 -0
- package/ui/dist/assets/CPDashboard-11c0nkxK.js +1 -0
- package/ui/dist/assets/CPFiles-BhLEOnXy.js +1 -0
- package/ui/dist/assets/CPGoals-Bi3t1b2P.js +1 -0
- package/ui/dist/assets/CPInbox-Bbr7khp6.js +11 -0
- package/ui/dist/assets/CPIssueDetail-DSdgNK8r.js +1 -0
- package/ui/dist/assets/CPIssues-DDEVKhX6.js +1 -0
- package/ui/dist/assets/CPLayout-DgPOfyGv.js +17 -0
- package/ui/dist/assets/CPOrg-Df73RrRJ.js +8 -0
- package/ui/dist/assets/CPRuns-ByioAz8w.js +1 -0
- package/ui/dist/assets/{CPSocial-nb-j7sOE.js → CPSocial-Dlnr_w1X.js} +2 -2
- package/ui/dist/assets/ChannelsPanel-DQjQCTK5.js +1 -0
- package/ui/dist/assets/CheckpointsPanel-C4vKjlAJ.js +1 -0
- package/ui/dist/assets/CommandPostHub-C9pp5Giq.js +24 -0
- package/ui/dist/assets/CronPanel-C6bzUfrD.js +1 -0
- package/ui/dist/assets/DaemonPanel-BA5Tb_UO.js +1 -0
- package/ui/dist/assets/{DataTable-B2Ma8hfi.js → DataTable-CH7IYJJh.js} +1 -1
- package/ui/dist/assets/{EmptyState-CcKyk5Yn.js → EmptyState-jU6yNDnF.js} +1 -1
- package/ui/dist/assets/{EvalHarnessPanel-BqtMc1ZM.js → EvalHarnessPanel-DnYqredY.js} +2 -2
- package/ui/dist/assets/EvalPanel-ChO7CD1r.js +1 -0
- package/ui/dist/assets/{FilesPanel-3QKvrWPo.js → FilesPanel-CaUkv2is.js} +2 -2
- package/ui/dist/assets/FleetPanel-DC_5uj0N.js +1 -0
- package/ui/dist/assets/{HomelabPanel-DhrjTX9m.js → HomelabPanel-CE5PGRpL.js} +2 -2
- package/ui/dist/assets/InfraView-C-uSlvb9.js +2 -0
- package/ui/dist/assets/InlineEditableField-BMQjiE6-.js +1 -0
- package/ui/dist/assets/Input-Bu_b3qmY.js +1 -0
- package/ui/dist/assets/IntegrationsPanel-DsYpAq43.js +1 -0
- package/ui/dist/assets/IntelligenceView-DUdIO1K7.js +2 -0
- package/ui/dist/assets/LearningPanel-UpQZC-mA.js +1 -0
- package/ui/dist/assets/LogsPanel-ClXJ4fcr.js +1 -0
- package/ui/dist/assets/McpPanel-JKgtIERQ.js +1 -0
- package/ui/dist/assets/{MemoryGraphPanel-Bzvjmzvk.js → MemoryGraphPanel-Bo2OrvA6.js} +2 -2
- package/ui/dist/assets/MemoryWikiPanel-BqJ1AmYm.js +11 -0
- package/ui/dist/assets/{MeshPanel-C3LJSlht.js → MeshPanel-BJVGYvwk.js} +2 -2
- package/ui/dist/assets/Modal-CAAooiZU.js +1 -0
- package/ui/dist/assets/NvidiaPanel-BtCg3G4w.js +1 -0
- package/ui/dist/assets/OrganismPanel-DgrTTzcF.js +1 -0
- package/ui/dist/assets/OverviewPanel-rVav1Hox.js +1 -0
- package/ui/dist/assets/{PageHeader-BimceqQo.js → PageHeader-CnZtP8ek.js} +1 -1
- package/ui/dist/assets/PaperclipPanel-C-FKdhiF.js +1 -0
- package/ui/dist/assets/{PersonasPanel-L1j78p6H.js → PersonasPanel-BmlxokfB.js} +1 -1
- package/ui/dist/assets/RecipesPanel-BNKKChis.js +1 -0
- package/ui/dist/assets/SecurityPanel-I7JRHiNy.js +1 -0
- package/ui/dist/assets/SelfImprovePanel-u9h0Lt3p.js +1 -0
- package/ui/dist/assets/{SelfProposalsPanel-lNmiDThB.js → SelfProposalsPanel-DKl9iBjM.js} +2 -2
- package/ui/dist/assets/SessionsPanel-BhRiWI_g.js +1 -0
- package/ui/dist/assets/{SessionsTab-JQbltWww.js → SessionsTab-Bk08wyeY.js} +1 -1
- package/ui/dist/assets/SettingsPanel-haLfmG2k.js +1 -0
- package/ui/dist/assets/SettingsView--gi3fxI8.js +2 -0
- package/ui/dist/assets/{SkeletonLoader-atQtpcF5.js → SkeletonLoader-B5v09EF_.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-DlFs2ih7.js → SkillsPanel-BlAHFLcQ.js} +1 -1
- package/ui/dist/assets/SomaView-CExtS3zw.js +5 -0
- package/ui/dist/assets/{StatCard-DciE_Iqc.js → StatCard-BIsyMybM.js} +1 -1
- package/ui/dist/assets/{StatusBadge-BtfSPoW2.js → StatusBadge-D5nU7El8.js} +1 -1
- package/ui/dist/assets/Tabs-BBYZrBI8.js +1 -0
- package/ui/dist/assets/TeamsPanel-LPXJg823.js +1 -0
- package/ui/dist/assets/TelemetryPanel-EqpRBmOI.js +1 -0
- package/ui/dist/assets/TitanCanvas-BCbWnLMd.js +985 -0
- package/ui/dist/assets/ToolsView-CeP0Zz-N.js +2 -0
- package/ui/dist/assets/{Tooltip-70UK0E2I.js → Tooltip-BSO2XVpF.js} +1 -1
- package/ui/dist/assets/TraceViewer-BKI7o5B0.js +1 -0
- package/ui/dist/assets/TrainingPanel-c-RhjdE1.js +1 -0
- package/ui/dist/assets/VoiceOverlay-D-gc58b0.js +27 -0
- package/ui/dist/assets/VramPanel-C6xc7zgd.js +1 -0
- package/ui/dist/assets/{WatchView-C-sGFpVy.js → WatchView-dqBVCVH0.js} +1 -1
- package/ui/dist/assets/WorkTab-CBoLNrTM.js +1 -0
- package/ui/dist/assets/{WorkflowsPanel-CvgQU1xI.js → WorkflowsPanel-BAnSTOYe.js} +2 -2
- package/ui/dist/assets/approvalHeadline-DB9SgR-9.js +1 -0
- package/ui/dist/assets/{arrow-left-DwqHtJiU.js → arrow-left-5chqas7J.js} +1 -1
- package/ui/dist/assets/briefcase-D4vLzudp.js +6 -0
- package/ui/dist/assets/{chart-column-BtNO6sRy.js → chart-column-CdFlBpoP.js} +1 -1
- package/ui/dist/assets/check-Bpm1IONe.js +6 -0
- package/ui/dist/assets/chevron-down-D7OLjvuD.js +6 -0
- package/ui/dist/assets/chevron-right-aQEw2mUW.js +6 -0
- package/ui/dist/assets/chevron-up-C5g6pEj8.js +6 -0
- package/ui/dist/assets/{circle-check-big-DZRE_MbN.js → circle-check-big-fPhEdP88.js} +1 -1
- package/ui/dist/assets/clock-CTsgP_Sn.js +6 -0
- package/ui/dist/assets/{dollar-sign-aVG3a5eL.js → dollar-sign-CudFVYFc.js} +1 -1
- package/ui/dist/assets/{download-BxiWJU4G.js → download-DZRxDn67.js} +1 -1
- package/ui/dist/assets/external-link-BZ0y_Ahx.js +6 -0
- package/ui/dist/assets/{eye-off-CkgfFYhm.js → eye-off-BmJF0YYx.js} +1 -1
- package/ui/dist/assets/folder-DA43TRCm.js +11 -0
- package/ui/dist/assets/{funnel-PkLdxKyC.js → funnel-J3mULzrz.js} +1 -1
- package/ui/dist/assets/{git-branch-BM-Gw95X.js → git-branch-oHibJqDq.js} +1 -1
- package/ui/dist/assets/{index-D0RJ8701.css → index-BR0vfkIi.css} +1 -1
- package/ui/dist/assets/{index-CahJbWSR.js → index-DzwowwSI.js} +20 -20
- package/ui/dist/assets/{layers-BuGf4FIJ.js → layers-DsyEyu7z.js} +1 -1
- package/ui/dist/assets/{legacy-CR6o4t-y.js → legacy-8ITl64sV.js} +1 -1
- package/ui/dist/assets/{lightbulb-n8gc_XAL.js → lightbulb-C54Ske-p.js} +1 -1
- package/ui/dist/assets/list-todo-Cnd4rdoK.js +6 -0
- package/ui/dist/assets/loader-circle-1YOBsoQp.js +6 -0
- package/ui/dist/assets/network-DbGDAdrn.js +6 -0
- package/ui/dist/assets/{pause-DCV52koX.js → pause-CYhO_uQo.js} +1 -1
- package/ui/dist/assets/{play-CcJ9BnCh.js → play-DVY9c5Ck.js} +1 -1
- package/ui/dist/assets/{plug-CfWBXfCl.js → plug-BcXjlPUL.js} +1 -1
- package/ui/dist/assets/plus-Csu2v9GN.js +6 -0
- package/ui/dist/assets/{proxy-CzZDfLmm.js → proxy-DxS2_9D7.js} +1 -1
- package/ui/dist/assets/rotate-ccw-Co-_W04j.js +6 -0
- package/ui/dist/assets/save-Btx-kpoW.js +6 -0
- package/ui/dist/assets/search-0hXTwEZR.js +6 -0
- package/ui/dist/assets/send-TEpapzQR.js +6 -0
- package/ui/dist/assets/shield-check-DjBJXZUr.js +6 -0
- package/ui/dist/assets/{square-DJpUhlxi.js → square-OweUvjP-.js} +1 -1
- package/ui/dist/assets/{target-DWcmM_9m.js → target-BRW80Xer.js} +1 -1
- package/ui/dist/assets/terminal-BtiqJ628.js +16 -0
- package/ui/dist/assets/{toggle-right-YusFQ69L.js → toggle-right-CKtSrl28.js} +1 -1
- package/ui/dist/assets/{trash-2-CK7yQ55V.js → trash-2-DgWrHVax.js} +1 -1
- package/ui/dist/assets/{trending-up-DGjFyubC.js → trending-up-MpIrE4j6.js} +1 -1
- package/ui/dist/assets/{trophy-uQv_NgDB.js → trophy-CECuZNhX.js} +1 -1
- package/ui/dist/assets/users-dZgv4ePG.js +16 -0
- package/ui/dist/assets/wrench-CDz3xYve.js +11 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/AutopilotPanel-DtEet1hJ.js +0 -1
- package/ui/dist/assets/BackupPanel-BGP8p3l3.js +0 -1
- package/ui/dist/assets/CPAgents-DYUtPzSq.js +0 -1
- package/ui/dist/assets/CPDashboard-Bf0-SyCh.js +0 -6
- package/ui/dist/assets/CPFiles-CxgxjQcO.js +0 -1
- package/ui/dist/assets/CPGoals-BsmCMTvT.js +0 -1
- package/ui/dist/assets/CPInbox-tMSbmQ9H.js +0 -11
- package/ui/dist/assets/ChannelsPanel-DP5C2OKd.js +0 -1
- package/ui/dist/assets/CheckpointsPanel-DlranVLZ.js +0 -1
- package/ui/dist/assets/CommandPostHub-BgxIa4Ev.js +0 -29
- package/ui/dist/assets/CronPanel-LoT5yKwJ.js +0 -1
- package/ui/dist/assets/DaemonPanel-DBGMqaE_.js +0 -1
- package/ui/dist/assets/EvalPanel-Bc33j0pN.js +0 -1
- package/ui/dist/assets/FleetPanel-CSsXuQYj.js +0 -1
- package/ui/dist/assets/InfraView-CR6HyrL6.js +0 -2
- package/ui/dist/assets/InlineEditableField-CnvF-yFR.js +0 -1
- package/ui/dist/assets/Input-GTHp2Rkr.js +0 -1
- package/ui/dist/assets/IntegrationsPanel-CymCRE3T.js +0 -1
- package/ui/dist/assets/IntelligenceView-C1IHxJRC.js +0 -2
- package/ui/dist/assets/LearningPanel-DOCES3lH.js +0 -1
- package/ui/dist/assets/LogsPanel-BLnAqEaZ.js +0 -1
- package/ui/dist/assets/McpPanel-ChUzmr3z.js +0 -1
- package/ui/dist/assets/MemoryWikiPanel-Dwk3Aqwd.js +0 -11
- package/ui/dist/assets/NvidiaPanel-CeZK_-CV.js +0 -1
- package/ui/dist/assets/OrganismPanel-BB6YOiQV.js +0 -1
- package/ui/dist/assets/OverviewPanel-BmtBhQnv.js +0 -1
- package/ui/dist/assets/PaperclipPanel-C-brgwA3.js +0 -1
- package/ui/dist/assets/RecipesPanel-34lCfynJ.js +0 -1
- package/ui/dist/assets/SecurityPanel-CBTPWLj6.js +0 -1
- package/ui/dist/assets/SelfImprovePanel-BrPbFHhG.js +0 -1
- package/ui/dist/assets/SessionsPanel-DAEYIn83.js +0 -1
- package/ui/dist/assets/SettingsPanel-CzRROAYQ.js +0 -1
- package/ui/dist/assets/SettingsView-CN7ii2uw.js +0 -2
- package/ui/dist/assets/SomaView-Ba642Oqb.js +0 -5
- package/ui/dist/assets/TeamsPanel-DKQ5z2Qe.js +0 -1
- package/ui/dist/assets/TelemetryPanel-B6KAc55Q.js +0 -1
- package/ui/dist/assets/TitanCanvas-C-s0A-lv.js +0 -1092
- package/ui/dist/assets/ToolsView-Dei0KMP0.js +0 -2
- package/ui/dist/assets/TraceViewer-BniolyBx.js +0 -1
- package/ui/dist/assets/TrainingPanel-Bz4CTPGW.js +0 -1
- package/ui/dist/assets/VoiceOverlay-CmNCrLcd.js +0 -37
- package/ui/dist/assets/VramPanel-Xh_OtRDR.js +0 -1
- package/ui/dist/assets/WorkTab-BjLNmgIK.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as E,r,
|
|
1
|
+
import{c as E,r,ai as me,aj as pe,j as e,X as q,ak as ue,al as he,am as I,an as ve,ao as fe}from"./index-DzwowwSI.js";import{P as be}from"./plus-Csu2v9GN.js";import{R as ge,P as U}from"./terminal-BtiqJ628.js";import{H as je,D as J,S as Ne}from"./TitanCanvas-BCbWnLMd.js";import{C as Z}from"./chevron-right-aQEw2mUW.js";import{A as ye}from"./arrow-left-5chqas7J.js";import{C as we}from"./clock-CTsgP_Sn.js";import{T as X}from"./trash-2-DgWrHVax.js";import{S as ke}from"./save-Btx-kpoW.js";import{D as Ce}from"./download-DZRxDn67.js";import{C as G}from"./check-Bpm1IONe.js";import{F as Q}from"./users-dZgv4ePG.js";import"./chevron-up-C5g6pEj8.js";import"./wrench-CDz3xYve.js";import"./network-DbGDAdrn.js";import"./rotate-ccw-Co-_W04j.js";import"./search-0hXTwEZR.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./chevron-down-D7OLjvuD.js";import"./folder-DA43TRCm.js";import"./shield-check-DjBJXZUr.js";import"./external-link-BZ0y_Ahx.js";import"./loader-circle-1YOBsoQp.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{c as E,r,a4 as me,a5 as ue,j as e,X as q,a6 as he,a7 as pe,a8 as I,a9 as
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Ee=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],De=E("folder-plus",Ee);function Te(){var O;const[w,Y]=r.useState([]),[n,D]=r.useState(""),[o,R]=r.useState(""),[$,ee]=r.useState([]),[s,d]=r.useState(null),[te,P]=r.useState(!0),[ae,L]=r.useState(!1),[k,x]=r.useState(!1),[b,C]=r.useState(""),[W,B]=r.useState(!1),[se,g]=r.useState(!1),[re,j]=r.useState(!1),[i,m]=r.useState(""),[u,N]=r.useState(null),[v,T]=r.useState(""),z=r.useRef(null),[h,f]=r.useState(null),[M,l]=r.useState("");r.useEffect(()=>{me().then(t=>{Y(t.roots),t.roots.length>0&&!n&&D(t.roots[0].path)}).catch(()=>{})},[]);const p=r.useCallback(async t=>{P(!0);try{const a=await ue(t??o,n||void 0);ee(a.entries)}catch{}P(!1)},[o,n]);r.useEffect(()=>{n&&p(o)},[o,n]);const y=t=>{R(t),d(null),x(!1)},ne=()=>{const t=o.split("/").filter(Boolean);t.pop(),y(t.join("/"))},oe=async t=>{if(t.type==="directory"){y(t.path);return}L(!0),x(!1);try{const a=await pe(t.path,n||void 0);d(a)}catch{}L(!1)},le=async()=>{if(s){B(!0),l("");try{await I(s.path,b,n||void 0),d({...s,content:b,size:new Blob([b]).size}),x(!1)}catch(t){l(t.message)}B(!1)}},A=async()=>{if(i.trim()){l("");try{const t=o?`${o}/${i.trim()}`:i.trim();await I(t,"",n||void 0),g(!1),m(""),p()}catch(t){l(t.message)}}},H=async()=>{if(i.trim()){l("");try{const t=o?`${o}/${i.trim()}`:i.trim();await ve(t,n||void 0),j(!1),m(""),p()}catch(t){l(t.message)}}},_=async t=>{if(!v.trim()||v===t.name){N(null);return}l("");try{const a=t.path.split("/").slice(0,-1).join("/"),c=a?`${a}/${v.trim()}`:v.trim();await he(t.path,c,n||void 0),N(null),p()}catch(a){l(a.message)}},ie=async()=>{if(h){l("");try{await fe(h.path,n||void 0),f(null),(s==null?void 0:s.path)===h.path&&d(null),p()}catch(t){l(t.message),f(null)}}};r.useEffect(()=>{u&&z.current&&z.current.focus()},[u]);const V=t=>t===0?"0 B":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`,ce=t=>{if(!t)return"";try{const a=new Date(t),c=Date.now()-a.getTime();return c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:c<6048e5?`${Math.round(c/864e5)}d ago`:a.toLocaleDateString()}catch{return""}},K=t=>t.endsWith(".json")||t.endsWith(".jsonl")?e.jsx(Z,{size:14,className:"text-yellow-400"}):t.endsWith(".md")?e.jsx(X,{size:14,className:"text-blue-400"}):t.endsWith(".db")?e.jsx(Z,{size:14,className:"text-purple-400"}):t.endsWith(".log")?e.jsx(X,{size:14,className:"text-[var(--text-muted)]"}):t==="titan.json"?e.jsx(we,{size:14,className:"text-[var(--accent)]"}):e.jsx(Fe,{size:14,className:"text-[var(--text-muted)]"}),de=t=>t.endsWith(".json")||t.endsWith(".jsonl")?"json":t.endsWith(".md")?"markdown":t.endsWith(".ts")||t.endsWith(".tsx")?"typescript":t.endsWith(".js")?"javascript":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":"text",F=o?o.split("/").filter(Boolean):[],xe=((O=w.find(t=>t.path===n))==null?void 0:O.label)||"~/.titan";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"File Manager"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Browse, edit, and manage TITAN files"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{g(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New File",children:[e.jsx(be,{size:12})," File"]}),e.jsxs("button",{onClick:()=>{j(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New Folder",children:[e.jsx(De,{size:12})," Folder"]}),e.jsx("button",{onClick:()=>p(),className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(ge,{size:14})})]})]}),M&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-lg text-sm text-red-400",children:[e.jsx("span",{children:M}),e.jsx("button",{onClick:()=>l(""),children:e.jsx(q,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[w.length>1&&e.jsx("select",{value:n,onChange:t=>{D(t.target.value),R(""),d(null)},className:"px-2 py-1.5 rounded-md border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text)] text-xs",children:w.map(t=>e.jsx("option",{value:t.path,children:t.label},t.path))}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg px-3 py-2 overflow-x-auto",children:[e.jsxs("button",{onClick:()=>y(""),className:"flex items-center gap-1 text-[var(--accent)] hover:underline flex-shrink-0",children:[e.jsx(je,{size:14})," ",xe]}),F.map((t,a)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(G,{size:12,className:"text-[var(--text-muted)]"}),e.jsx("button",{onClick:()=>y(F.slice(0,a+1).join("/")),className:a===F.length-1?"text-[var(--text)] font-medium":"text-[var(--accent)] hover:underline",children:t})]},a))]})]}),e.jsxs("div",{className:"flex gap-4",style:{height:"calc(100vh - 280px)"},children:[e.jsxs("div",{className:`${s?"w-1/3":"w-full"} bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col transition-all`,children:[o&&e.jsxs("button",{onClick:ne,className:"flex items-center gap-2 px-4 py-2 text-sm text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)] transition-colors",children:[e.jsx(ke,{size:14})," Back"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:te?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading..."}):$.length===0?e.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[e.jsx(S,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Empty directory"})]}):$.map(t=>e.jsxs("div",{className:`group w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)]/30 transition-colors cursor-pointer ${(s==null?void 0:s.path)===t.path?"bg-[var(--accent)]/10 border-l-2 border-l-[var(--accent)]":""}`,onClick:()=>u!==t.path&&oe(t),children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-[var(--accent)] flex-shrink-0"}):K(t.name),e.jsx("div",{className:"flex-1 min-w-0",children:u===t.path?e.jsx("input",{ref:z,value:v,onChange:a=>T(a.target.value),onKeyDown:a=>{a.key==="Enter"&&_(t),a.key==="Escape"&&N(null)},onBlur:()=>_(t),className:"text-sm bg-[var(--bg-tertiary)] border border-[var(--accent)] rounded px-1.5 py-0.5 text-[var(--text)] w-full outline-none",onClick:a=>a.stopPropagation()}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`text-sm truncate ${t.type==="directory"?"text-[var(--accent)] font-medium":"text-[var(--text)]"}`,children:t.name}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[t.type==="file"&&e.jsx("span",{children:V(t.size)}),t.modified&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ne,{size:10})," ",ce(t.modified)]})]})]})}),u!==t.path&&e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[e.jsx("button",{onClick:a=>{a.stopPropagation(),N(t.path),T(t.name)},className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)]",title:"Rename",children:e.jsx(U,{size:12})}),e.jsx("button",{onClick:a=>{a.stopPropagation(),f(t)},className:"p-1 rounded text-[var(--text-muted)] hover:text-red-400 hover:bg-red-500/10",title:"Delete",children:e.jsx(Q,{size:12})})]}),t.type==="directory"&&u!==t.path&&e.jsx(G,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"})]},t.path))})]}),s&&e.jsxs("div",{className:"flex-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] bg-[var(--bg-tertiary)]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[K(s.path),e.jsx("span",{className:"text-sm font-medium text-[var(--text)] truncate",children:s.path.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:V(s.size)}),s.truncated&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--warning)]/15 text-[var(--warning)] border border-[var(--warning)]/20 flex-shrink-0",children:"Truncated (1MB limit)"}),k&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--accent)]/15 text-[var(--accent)] border border-[var(--accent)]/20 flex-shrink-0",children:"Editing"})]}),e.jsx("div",{className:"flex gap-1.5",children:k?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:le,disabled:W,className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-[var(--accent)] text-white hover:opacity-90 disabled:opacity-50",children:[e.jsx(ye,{size:12})," ",W?"Saving...":"Save"]}),e.jsxs("button",{onClick:()=>{x(!1),C("")},className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)]",children:[e.jsx(q,{size:12})," Cancel"]})]}):e.jsxs(e.Fragment,{children:[!s.truncated&&e.jsx("button",{onClick:()=>{x(!0),C(s.content)},className:"flex items-center gap-1 p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Edit",children:e.jsx(U,{size:14})}),e.jsx("button",{onClick:()=>{const t=new Blob([s.content],{type:"text/plain"}),a=document.createElement("a");a.href=URL.createObjectURL(t),a.download=s.path.split("/").pop()||"file.txt",a.click()},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Download",children:e.jsx(Ce,{size:14})}),e.jsx("button",{onClick:()=>{d(null),x(!1)},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text)] px-1",children:"Close"})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:ae?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading file..."}):k?e.jsx("textarea",{value:b,onChange:t=>C(t.target.value),className:"w-full h-full p-4 text-xs font-mono text-[var(--text-secondary)] bg-transparent resize-none outline-none leading-relaxed",spellCheck:!1}):de(s.path)==="json"?e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:(()=>{try{return JSON.stringify(JSON.parse(s.content),null,2)}catch{return s.content}})()}):e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:s.content})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>g(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New File"}),e.jsx("input",{autoFocus:!0,value:i,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&A(),placeholder:"filename.txt",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>g(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:A,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(J,{size:12})," Create"]})]})]})}),re&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>j(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New Folder"}),e.jsx("input",{autoFocus:!0,value:i,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&H(),placeholder:"folder-name",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:H,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(J,{size:12})," Create"]})]})]})}),h&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>f(null),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsxs("h3",{className:"text-sm font-semibold text-[var(--text)]",children:["Delete ",h.type==="directory"?"Folder":"File","?"]}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Are you sure you want to delete ",e.jsx("span",{className:"font-mono text-[var(--text)]",children:h.name}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>f(null),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:ie,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-500 text-white rounded-md hover:opacity-90",children:[e.jsx(Q,{size:12})," Delete"]})]})]})})]})}export{Te as default};
|
|
16
|
+
*/const Ee=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],De=E("folder-plus",Ee);function tt(){var O;const[w,Y]=r.useState([]),[n,D]=r.useState(""),[o,P]=r.useState(""),[R,ee]=r.useState([]),[s,d]=r.useState(null),[te,$]=r.useState(!0),[ae,L]=r.useState(!1),[k,x]=r.useState(!1),[b,C]=r.useState(""),[W,B]=r.useState(!1),[se,g]=r.useState(!1),[re,j]=r.useState(!1),[l,m]=r.useState(""),[p,N]=r.useState(null),[v,T]=r.useState(""),z=r.useRef(null),[u,f]=r.useState(null),[M,i]=r.useState("");r.useEffect(()=>{me().then(t=>{Y(t.roots),t.roots.length>0&&!n&&D(t.roots[0].path)}).catch(()=>{})},[]);const h=r.useCallback(async t=>{$(!0);try{const a=await pe(t??o,n||void 0);ee(a.entries)}catch{}$(!1)},[o,n]);r.useEffect(()=>{n&&h(o)},[o,n]);const y=t=>{P(t),d(null),x(!1)},ne=()=>{const t=o.split("/").filter(Boolean);t.pop(),y(t.join("/"))},oe=async t=>{if(t.type==="directory"){y(t.path);return}L(!0),x(!1);try{const a=await he(t.path,n||void 0);d(a)}catch{}L(!1)},ie=async()=>{if(s){B(!0),i("");try{await I(s.path,b,n||void 0),d({...s,content:b,size:new Blob([b]).size}),x(!1)}catch(t){i(t.message)}B(!1)}},A=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await I(t,"",n||void 0),g(!1),m(""),h()}catch(t){i(t.message)}}},H=async()=>{if(l.trim()){i("");try{const t=o?`${o}/${l.trim()}`:l.trim();await ve(t,n||void 0),j(!1),m(""),h()}catch(t){i(t.message)}}},_=async t=>{if(!v.trim()||v===t.name){N(null);return}i("");try{const a=t.path.split("/").slice(0,-1).join("/"),c=a?`${a}/${v.trim()}`:v.trim();await ue(t.path,c,n||void 0),N(null),h()}catch(a){i(a.message)}},le=async()=>{if(u){i("");try{await fe(u.path,n||void 0),f(null),(s==null?void 0:s.path)===u.path&&d(null),h()}catch(t){i(t.message),f(null)}}};r.useEffect(()=>{p&&z.current&&z.current.focus()},[p]);const V=t=>t===0?"0 B":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`,ce=t=>{if(!t)return"";try{const a=new Date(t),c=Date.now()-a.getTime();return c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:c<6048e5?`${Math.round(c/864e5)}d ago`:a.toLocaleDateString()}catch{return""}},K=t=>t.endsWith(".json")||t.endsWith(".jsonl")?e.jsx(J,{size:14,className:"text-yellow-400"}):t.endsWith(".md")?e.jsx(Q,{size:14,className:"text-blue-400"}):t.endsWith(".db")?e.jsx(J,{size:14,className:"text-purple-400"}):t.endsWith(".log")?e.jsx(Q,{size:14,className:"text-[var(--text-muted)]"}):t==="titan.json"?e.jsx(Ne,{size:14,className:"text-[var(--accent)]"}):e.jsx(Fe,{size:14,className:"text-[var(--text-muted)]"}),de=t=>t.endsWith(".json")||t.endsWith(".jsonl")?"json":t.endsWith(".md")?"markdown":t.endsWith(".ts")||t.endsWith(".tsx")?"typescript":t.endsWith(".js")?"javascript":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":"text",F=o?o.split("/").filter(Boolean):[],xe=((O=w.find(t=>t.path===n))==null?void 0:O.label)||"~/.titan";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"File Manager"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Browse, edit, and manage TITAN files"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{g(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New File",children:[e.jsx(be,{size:12})," File"]}),e.jsxs("button",{onClick:()=>{j(!0),m("")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-[var(--border)] text-xs text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",title:"New Folder",children:[e.jsx(De,{size:12})," Folder"]}),e.jsx("button",{onClick:()=>h(),className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(ge,{size:14})})]})]}),M&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-lg text-sm text-red-400",children:[e.jsx("span",{children:M}),e.jsx("button",{onClick:()=>i(""),children:e.jsx(q,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[w.length>1&&e.jsx("select",{value:n,onChange:t=>{D(t.target.value),P(""),d(null)},className:"px-2 py-1.5 rounded-md border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text)] text-xs",children:w.map(t=>e.jsx("option",{value:t.path,children:t.label},t.path))}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg px-3 py-2 overflow-x-auto",children:[e.jsxs("button",{onClick:()=>y(""),className:"flex items-center gap-1 text-[var(--accent)] hover:underline flex-shrink-0",children:[e.jsx(je,{size:14})," ",xe]}),F.map((t,a)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(Z,{size:12,className:"text-[var(--text-muted)]"}),e.jsx("button",{onClick:()=>y(F.slice(0,a+1).join("/")),className:a===F.length-1?"text-[var(--text)] font-medium":"text-[var(--accent)] hover:underline",children:t})]},a))]})]}),e.jsxs("div",{className:"flex gap-4",style:{height:"calc(100vh - 280px)"},children:[e.jsxs("div",{className:`${s?"w-1/3":"w-full"} bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col transition-all`,children:[o&&e.jsxs("button",{onClick:ne,className:"flex items-center gap-2 px-4 py-2 text-sm text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)] transition-colors",children:[e.jsx(ye,{size:14})," Back"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:te?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading..."}):R.length===0?e.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[e.jsx(S,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Empty directory"})]}):R.map(t=>e.jsxs("div",{className:`group w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-[var(--bg-tertiary)] border-b border-[var(--border)]/30 transition-colors cursor-pointer ${(s==null?void 0:s.path)===t.path?"bg-[var(--accent)]/10 border-l-2 border-l-[var(--accent)]":""}`,onClick:()=>p!==t.path&&oe(t),children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-[var(--accent)] flex-shrink-0"}):K(t.name),e.jsx("div",{className:"flex-1 min-w-0",children:p===t.path?e.jsx("input",{ref:z,value:v,onChange:a=>T(a.target.value),onKeyDown:a=>{a.key==="Enter"&&_(t),a.key==="Escape"&&N(null)},onBlur:()=>_(t),className:"text-sm bg-[var(--bg-tertiary)] border border-[var(--accent)] rounded px-1.5 py-0.5 text-[var(--text)] w-full outline-none",onClick:a=>a.stopPropagation()}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`text-sm truncate ${t.type==="directory"?"text-[var(--accent)] font-medium":"text-[var(--text)]"}`,children:t.name}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[t.type==="file"&&e.jsx("span",{children:V(t.size)}),t.modified&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{size:10})," ",ce(t.modified)]})]})]})}),p!==t.path&&e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[e.jsx("button",{onClick:a=>{a.stopPropagation(),N(t.path),T(t.name)},className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)]",title:"Rename",children:e.jsx(U,{size:12})}),e.jsx("button",{onClick:a=>{a.stopPropagation(),f(t)},className:"p-1 rounded text-[var(--text-muted)] hover:text-red-400 hover:bg-red-500/10",title:"Delete",children:e.jsx(X,{size:12})})]}),t.type==="directory"&&p!==t.path&&e.jsx(Z,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"})]},t.path))})]}),s&&e.jsxs("div",{className:"flex-1 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] bg-[var(--bg-tertiary)]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[K(s.path),e.jsx("span",{className:"text-sm font-medium text-[var(--text)] truncate",children:s.path.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:V(s.size)}),s.truncated&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--warning)]/15 text-[var(--warning)] border border-[var(--warning)]/20 flex-shrink-0",children:"Truncated (1MB limit)"}),k&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--accent)]/15 text-[var(--accent)] border border-[var(--accent)]/20 flex-shrink-0",children:"Editing"})]}),e.jsx("div",{className:"flex gap-1.5",children:k?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ie,disabled:W,className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-[var(--accent)] text-white hover:opacity-90 disabled:opacity-50",children:[e.jsx(ke,{size:12})," ",W?"Saving...":"Save"]}),e.jsxs("button",{onClick:()=>{x(!1),C("")},className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)]",children:[e.jsx(q,{size:12})," Cancel"]})]}):e.jsxs(e.Fragment,{children:[!s.truncated&&e.jsx("button",{onClick:()=>{x(!0),C(s.content)},className:"flex items-center gap-1 p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Edit",children:e.jsx(U,{size:14})}),e.jsx("button",{onClick:()=>{const t=new Blob([s.content],{type:"text/plain"}),a=document.createElement("a");a.href=URL.createObjectURL(t),a.download=s.path.split("/").pop()||"file.txt",a.click()},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-secondary)] transition-colors",title:"Download",children:e.jsx(Ce,{size:14})}),e.jsx("button",{onClick:()=>{d(null),x(!1)},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text)] px-1",children:"Close"})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:ae?e.jsx("div",{className:"p-4 text-[var(--text-muted)] text-sm",children:"Loading file..."}):k?e.jsx("textarea",{value:b,onChange:t=>C(t.target.value),className:"w-full h-full p-4 text-xs font-mono text-[var(--text-secondary)] bg-transparent resize-none outline-none leading-relaxed",spellCheck:!1}):de(s.path)==="json"?e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:(()=>{try{return JSON.stringify(JSON.parse(s.content),null,2)}catch{return s.content}})()}):e.jsx("pre",{className:"p-4 text-xs font-mono text-[var(--text-secondary)] whitespace-pre-wrap break-words leading-relaxed",children:s.content})})]})]}),se&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>g(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New File"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&A(),placeholder:"filename.txt",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>g(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:A,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(G,{size:12})," Create"]})]})]})}),re&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>j(!1),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text)]",children:"New Folder"}),e.jsx("input",{autoFocus:!0,value:l,onChange:t=>m(t.target.value),onKeyDown:t=>t.key==="Enter"&&H(),placeholder:"folder-name",className:"w-full px-3 py-2 rounded-md border border-[var(--border)] bg-[var(--bg-tertiary)] text-sm text-[var(--text)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:H,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--accent)] text-white rounded-md hover:opacity-90",children:[e.jsx(G,{size:12})," Create"]})]})]})}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:()=>f(null),children:e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl p-5 w-80 space-y-4",onClick:t=>t.stopPropagation(),children:[e.jsxs("h3",{className:"text-sm font-semibold text-[var(--text)]",children:["Delete ",u.type==="directory"?"Folder":"File","?"]}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Are you sure you want to delete ",e.jsx("span",{className:"font-mono text-[var(--text)]",children:u.name}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>f(null),className:"px-3 py-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)]",children:"Cancel"}),e.jsxs("button",{onClick:le,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-500 text-white rounded-md hover:opacity-90",children:[e.jsx(X,{size:12})," Delete"]})]})]})})]})}export{tt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,bb as l,j as e}from"./index-DzwowwSI.js";import{P as d}from"./PageHeader-CnZtP8ek.js";import{R as c}from"./terminal-BtiqJ628.js";import{R as p}from"./TitanCanvas-BCbWnLMd.js";import"./chevron-right-aQEw2mUW.js";import"./chevron-up-C5g6pEj8.js";import"./plus-Csu2v9GN.js";import"./users-dZgv4ePG.js";import"./wrench-CDz3xYve.js";import"./network-DbGDAdrn.js";import"./save-Btx-kpoW.js";import"./rotate-ccw-Co-_W04j.js";import"./search-0hXTwEZR.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./chevron-down-D7OLjvuD.js";import"./folder-DA43TRCm.js";import"./clock-CTsgP_Sn.js";import"./check-Bpm1IONe.js";import"./shield-check-DjBJXZUr.js";import"./external-link-BZ0y_Ahx.js";import"./loader-circle-1YOBsoQp.js";function L(){const[o,m]=s.useState([]),[r,i]=s.useState(!0),a=s.useCallback(async()=>{i(!0);try{const t=await l();m(t.nodes||[])}catch{}i(!1)},[]);return s.useEffect(()=>{a()},[a]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(d,{title:"Fleet Router",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Mesh"},{label:"Fleet"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:a,disabled:r,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:[e.jsx(c,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:o.map(t=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(p,{className:`w-4 h-4 ${t.status==="online"?"text-emerald-400":t.status==="busy"?"text-amber-400":"text-red-400"}`}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:t.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[t.address," • ",t.capabilities.join(", ")]})]})]}),e.jsx("div",{className:"text-xs text-[#52525b]",children:t.status})]},t.id))})]})}export{L as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as ee,r as
|
|
1
|
+
import{c as ee,r as o,b as m,j as e,Z as I,C as se,H as te,A as w,W as ae,h as ne,T as re}from"./index-DzwowwSI.js";import{P as B}from"./PageHeader-CnZtP8ek.js";import{S as h}from"./StatCard-BIsyMybM.js";import{S as le}from"./SkeletonLoader-B5v09EF_.js";import{R as ie}from"./terminal-BtiqJ628.js";import{C as ce}from"./clock-CTsgP_Sn.js";import{M as oe,U as de}from"./users-dZgv4ePG.js";import{b as xe,W as me}from"./TitanCanvas-BCbWnLMd.js";import{C as he}from"./chart-column-CdFlBpoP.js";import{N as D}from"./network-DbGDAdrn.js";import{C as A}from"./circle-check-big-fPhEdP88.js";import{D as pe}from"./dollar-sign-CudFVYFc.js";import"./chevron-right-aQEw2mUW.js";import"./chevron-up-C5g6pEj8.js";import"./plus-Csu2v9GN.js";import"./wrench-CDz3xYve.js";import"./save-Btx-kpoW.js";import"./rotate-ccw-Co-_W04j.js";import"./search-0hXTwEZR.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./chevron-down-D7OLjvuD.js";import"./folder-DA43TRCm.js";import"./check-Bpm1IONe.js";import"./shield-check-DjBJXZUr.js";import"./external-link-BZ0y_Ahx.js";import"./loader-circle-1YOBsoQp.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const pe=[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]],ge=ee("kanban",pe),je=15e3;function be(n){const r=Math.floor(n/86400),g=Math.floor(n%86400/3600),N=Math.floor(n%3600/60);return r>0?`${r}d ${g}h ${N}m`:g>0?`${g}h ${N}m`:`${N}m`}function Ne(n){return n>=1024?`${(n/1024).toFixed(1)} GB`:`${Math.round(n)} MB`}function M(n){return Ne(n/1024/1024)}function fe(n){const r=Math.floor((Date.now()-new Date(n).getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function S({status:n}){const r={online:"bg-success shadow-success/40",offline:"bg-error shadow-error/40",working:"bg-warning shadow-warning/40 animate-pulse",unknown:"bg-text-muted shadow-none"};return e.jsx("div",{className:`h-2.5 w-2.5 rounded-full shadow-lg ${r[n]}`})}function b({title:n,icon:r,children:g}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(r,{className:"h-4 w-4 text-accent-hover"}),e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-text-secondary",children:n})]}),g]})}function Ce(){var L,U,T;const[n,r]=d.useState(!0),[g,N]=d.useState([]),[i,P]=d.useState(null),[c,E]=d.useState(null),[x,F]=d.useState(null),[k,q]=d.useState([]),[G,O]=d.useState([]),[R,_]=d.useState([]),[$,W]=d.useState([]),[C,z]=d.useState([]),[K,Z]=d.useState(new Date),v=d.useCallback(async()=>{try{const[s,l,a,u,o,j,p,V,f]=await Promise.all([m("/api/homelab/machines").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/vram").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/stats").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/activity/summary").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/agents").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/issues").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/activity?limit=15").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/budgets").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/mesh/peers").then(t=>t.ok?t.json():null).catch(()=>null)]);Array.isArray(s==null?void 0:s.machines)&&N(s.machines.map(t=>({name:String(t.name??"Unknown"),ip:String(t.ip??""),role:String(t.role??""),online:t.online===!0}))),l&&P(l),a&&E(a),u&&F(u),Array.isArray(o)&&q(o);const J=Array.isArray(j)?j:(j==null?void 0:j.issues)??[];O(J);const Q=Array.isArray(p)?p:(p==null?void 0:p.feed)??(p==null?void 0:p.activity)??[];_(Q),Array.isArray(V)&&W(V);const Y=(f==null?void 0:f.peers)??(Array.isArray(f)?f:[]);z(Y),Z(new Date)}finally{r(!1)}},[]);if(d.useEffect(()=>{v();const s=setInterval(v,je);return()=>clearInterval(s)},[v]),n)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(B,{title:"Homelab",breadcrumbs:[{label:"Monitoring"},{label:"Homelab"}]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:e.jsx(re,{variant:"metric",count:8})})]});const H=!!i&&typeof i.totalVRAM=="number"&&Number.isFinite(i.totalVRAM)&&i.totalVRAM>0&&typeof i.usedVRAM=="number"&&Number.isFinite(i.usedVRAM),y=H?Math.round(i.usedVRAM/i.totalVRAM*100):0,X=s=>G.filter(l=>l.status===s);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(B,{title:"Homelab",breadcrumbs:[{label:"Monitoring"},{label:"Homelab"}],actions:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:v,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:[e.jsx(ie,{className:"h-3.5 w-3.5"})," Refresh"]}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:["Updated ",K.toLocaleTimeString()]})]})}),c&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(h,{title:"Uptime",value:be(c.uptime??0),icon:e.jsx(ce,{className:"h-4 w-4"})}),e.jsx(h,{title:"Total Requests",value:(c.totalRequests??0).toLocaleString(),icon:e.jsx(I,{className:"h-4 w-4"})}),e.jsx(h,{title:"Active Sessions",value:c.activeSessions??0,icon:e.jsx(de,{className:"h-4 w-4"})}),e.jsx(h,{title:"Active Model",value:((L=c.model)==null?void 0:L.split("/").pop())??"unknown",icon:e.jsx(se,{className:"h-4 w-4"}),subtitle:c.provider})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(b,{title:"Machines",icon:oe,children:e.jsx("div",{className:"grid gap-2",children:g.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{status:s.online===null?"unknown":s.online?"online":"offline"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:s.name}),e.jsx("p",{className:"text-[11px] text-text-muted",children:s.role})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-xs font-mono text-text-secondary",children:s.ip}),e.jsx("p",{className:"text-[10px] text-text-muted",children:s.online?"Online":s.online===!1?"Offline":"Checking..."})]})]},s.ip))})}),e.jsx(b,{title:"GPU / VRAM",icon:te,children:H?e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-text-secondary",children:"VRAM Usage"}),e.jsxs("span",{className:"text-text-muted",children:[M(i.usedVRAM)," / ",M(i.totalVRAM)," (",y,"%)"]})]}),e.jsx("div",{className:"h-3 rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${y>90?"bg-error":y>70?"bg-warning":"bg-accent"}`,style:{width:`${y}%`}})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(S,{status:i.state==="idle"?"online":"working"}),e.jsx("span",{className:"text-text-secondary capitalize",children:i.state})]}),((U=i.models)==null?void 0:U.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-text-muted mb-1",children:"Loaded Models"}),i.models.map(s=>e.jsxs("div",{className:"flex justify-between text-xs py-0.5",children:[e.jsx("span",{className:"text-text-secondary",children:s.name}),e.jsx("span",{className:"text-text-muted font-mono",children:M(s.vram)})]},s.id))]}),((T=i.leases)==null?void 0:T.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-text-muted mb-1",children:"Active Leases"}),i.leases.map(s=>e.jsxs("div",{className:"flex justify-between text-xs py-0.5",children:[e.jsx("span",{className:"text-text-secondary",children:s.service}),e.jsxs("span",{className:"text-text-muted font-mono",children:[s.requiredMB," MB"]})]},s.leaseId))]})]}):e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4 text-center text-xs text-text-muted",children:"No GPU detected on this gateway host. VRAM orchestration is inactive."})})]}),x&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-5",children:[e.jsx(h,{title:"Tool Calls (24h)",value:x.toolCallsLast24h,icon:e.jsx(I,{className:"h-4 w-4"})}),e.jsx(h,{title:"Active Goals",value:x.activeGoals,icon:e.jsx(he,{className:"h-4 w-4"})}),e.jsx(h,{title:"Autopilot",value:x.autopilotEnabled?"On":"Off",icon:e.jsx(w,{className:"h-4 w-4"}),subtitle:`${x.autopilotRunsToday} runs today`}),e.jsx(h,{title:"Knowledge Graph",value:x.graphStats.entities,icon:e.jsx(D,{className:"h-4 w-4"}),subtitle:`${x.graphStats.edges} edges`}),e.jsx(h,{title:"System Status",value:x.status==="idle"?"Idle":x.status,icon:x.status==="idle"?e.jsx(A,{className:"h-4 w-4"}):e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(b,{title:"Mesh Network",icon:D,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:C.length>0?e.jsx("div",{className:"space-y-2",children:C.map(s=>{var l;return e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-3.5 w-3.5 text-success"}),e.jsx("span",{className:"text-text-secondary",children:s.host||s.nodeId.slice(0,12)})]}),e.jsxs("span",{className:"text-text-muted",children:[((l=s.models)==null?void 0:l.length)??0," models"]})]},s.nodeId)})}):e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),"No mesh peers connected"]})})}),e.jsx(b,{title:"Active Agents",icon:me,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:k.length>0?e.jsx("div",{className:"space-y-2",children:k.map(s=>{const l=s.status==="active"||s.status==="running",a=s.lastHeartbeat&&Date.now()-new Date(s.lastHeartbeat).getTime()>36e5;return e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{status:a?"offline":l?"working":"online"}),e.jsx("span",{className:"text-text font-medium",children:s.name||s.id.slice(0,12)}),s.role&&e.jsxs("span",{className:"text-text-muted",children:["(",s.role,")"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"capitalize text-text-secondary",children:s.status}),s.lastHeartbeat&&e.jsx("span",{className:"text-text-muted",children:fe(s.lastHeartbeat)})]})]},s.id)})}):e.jsx("p",{className:"text-xs text-text-muted",children:"No agents registered"})})})]}),e.jsx(b,{title:"Task Board",icon:ge,children:e.jsx("div",{className:"grid grid-cols-3 gap-3",children:["todo","in_progress","done"].map(s=>{const l=s==="in_progress"?"In Progress":s.charAt(0).toUpperCase()+s.slice(1),a=X(s),u=s==="todo"?"text-text-muted":s==="in_progress"?"text-warning":"text-success";return e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary/50 p-3 min-h-[120px]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-wider ${u}`,children:l}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:["(",a==null?void 0:a.length,")"]})]}),(a==null?void 0:a.length)>0?e.jsxs("div",{className:"space-y-1.5",children:[a.slice(0,8).map(o=>e.jsxs("div",{className:"rounded-lg border border-border bg-bg p-2 text-xs",children:[e.jsxs("div",{className:"flex items-start gap-1.5",children:[e.jsx("span",{className:"text-accent font-semibold shrink-0",children:o.id.slice(0,6)}),e.jsx("span",{className:"text-text-secondary",children:o.title||o.description||"Untitled"})]}),o.assigneeAgentId&&e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["→ ",o.assigneeAgentId]})]},o.id)),(a==null?void 0:a.length)>8&&e.jsxs("p",{className:"text-[10px] text-text-muted text-center",children:["+",(a==null?void 0:a.length)-8," more"]})]}):e.jsx("p",{className:"text-[10px] text-text-muted italic text-center py-4",children:"Empty"})]},s)})})}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(b,{title:"Live Activity",icon:w,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-3 max-h-[320px] overflow-y-auto",children:R.length>0?e.jsx("div",{className:"space-y-0",children:R.slice(0,15).map((s,l)=>{const a=s.timestamp?new Date(s.timestamp).toLocaleTimeString():"",u=s.type||"event",o=u.includes("agent"),j=u.includes("tool");return e.jsxs("div",{className:"flex gap-2.5 py-1.5 border-b border-border/50 last:border-0 text-xs",children:[e.jsx("span",{className:"text-text-muted shrink-0 w-[52px] text-[10px]",children:a}),e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase ${j?"bg-accent/15 text-accent":o?"bg-success/15 text-success":"bg-warning/15 text-warning"}`,children:u.slice(0,10)}),e.jsx("span",{className:"text-text-secondary truncate",children:s.message||s.detail||s.content||""})]},l)})}):e.jsx("p",{className:"text-xs text-text-muted italic text-center py-6",children:"No recent activity"})})}),e.jsx(b,{title:"Budget Tracking",icon:ue,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:$.length>0?e.jsx("div",{className:"space-y-3",children:$.map(s=>{const l=s.limitUsd>0?Math.round(s.currentSpend/s.limitUsd*100):0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-text-secondary font-medium",children:s.name}),e.jsxs("span",{className:"text-text-muted",children:["$",s.currentSpend.toFixed(2)," / $",s.limitUsd.toFixed(2)," (",s.period,")"]})]}),e.jsx("div",{className:"h-2 rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${l>90?"bg-error":l>70?"bg-warning":"bg-success"}`,style:{width:`${Math.min(l,100)}%`}})})]},s.id)})}):e.jsx("p",{className:"text-xs text-text-muted",children:"No budget policies configured"})})})]}),(c==null?void 0:c.health)&&e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[c.health.ollamaHealthy?e.jsx(A,{className:"h-4 w-4 text-success"}):e.jsx(ne,{className:"h-4 w-4 text-error"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-text",children:"Ollama"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:c.health.ollamaHealthy?"Healthy":"Unhealthy"})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[c.health.ttsHealthy?e.jsx(A,{className:"h-4 w-4 text-success"}):e.jsx(le,{className:"h-4 w-4 text-warning"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-text",children:"TTS"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:c.health.ttsHealthy?"Healthy":"Unavailable"})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[e.jsx(w,{className:"h-4 w-4 text-accent"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-text",children:"LLM Requests"}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:[c.health.activeLlmRequests," active"]})]})]})]})]})}export{Ce as default};
|
|
6
|
+
*/const ue=[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]],ge=ee("kanban",ue),je=15e3;function be(n){const l=Math.floor(n/86400),g=Math.floor(n%86400/3600),f=Math.floor(n%3600/60);return l>0?`${l}d ${g}h ${f}m`:g>0?`${g}h ${f}m`:`${f}m`}function fe(n){return n>=1024?`${(n/1024).toFixed(1)} GB`:`${Math.round(n)} MB`}function M(n){return fe(n/1024/1024)}function Ne(n){const l=Math.floor((Date.now()-new Date(n).getTime())/1e3);return l<60?`${l}s ago`:l<3600?`${Math.floor(l/60)}m ago`:l<86400?`${Math.floor(l/3600)}h ago`:`${Math.floor(l/86400)}d ago`}function S({status:n}){const l={online:"bg-success shadow-success/40",offline:"bg-error shadow-error/40",working:"bg-warning shadow-warning/40 animate-pulse",unknown:"bg-text-muted shadow-none"};return e.jsx("div",{className:`h-2.5 w-2.5 rounded-full shadow-lg ${l[n]}`})}function b({title:n,icon:l,children:g}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(l,{className:"h-4 w-4 text-accent-hover"}),e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-text-secondary",children:n})]}),g]})}function Ke(){var L,U,T;const[n,l]=o.useState(!0),[g,f]=o.useState([]),[i,P]=o.useState(null),[c,E]=o.useState(null),[x,F]=o.useState(null),[k,q]=o.useState([]),[G,O]=o.useState([]),[R,_]=o.useState([]),[$,W]=o.useState([]),[C,z]=o.useState([]),[K,Z]=o.useState(new Date),v=o.useCallback(async()=>{try{const[s,r,a,p,d,j,u,V,N]=await Promise.all([m("/api/homelab/machines").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/vram").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/stats").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/activity/summary").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/agents").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/issues").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/activity?limit=15").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/command-post/budgets").then(t=>t.ok?t.json():null).catch(()=>null),m("/api/mesh/peers").then(t=>t.ok?t.json():null).catch(()=>null)]);Array.isArray(s==null?void 0:s.machines)&&f(s.machines.map(t=>({name:String(t.name??"Unknown"),ip:String(t.ip??""),role:String(t.role??""),online:t.online===!0}))),r&&P(r),a&&E(a),p&&F(p),Array.isArray(d)&&q(d);const J=Array.isArray(j)?j:(j==null?void 0:j.issues)??[];O(J);const Q=Array.isArray(u)?u:(u==null?void 0:u.feed)??(u==null?void 0:u.activity)??[];_(Q),Array.isArray(V)&&W(V);const Y=(N==null?void 0:N.peers)??(Array.isArray(N)?N:[]);z(Y),Z(new Date)}finally{l(!1)}},[]);if(o.useEffect(()=>{v();const s=setInterval(v,je);return()=>clearInterval(s)},[v]),n)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(B,{title:"Homelab",breadcrumbs:[{label:"Monitoring"},{label:"Homelab"}]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:e.jsx(le,{variant:"metric",count:8})})]});const H=!!i&&typeof i.totalVRAM=="number"&&Number.isFinite(i.totalVRAM)&&i.totalVRAM>0&&typeof i.usedVRAM=="number"&&Number.isFinite(i.usedVRAM),y=H?Math.round(i.usedVRAM/i.totalVRAM*100):0,X=s=>G.filter(r=>r.status===s);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(B,{title:"Homelab",breadcrumbs:[{label:"Monitoring"},{label:"Homelab"}],actions:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:v,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:[e.jsx(ie,{className:"h-3.5 w-3.5"})," Refresh"]}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:["Updated ",K.toLocaleTimeString()]})]})}),c&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(h,{title:"Uptime",value:be(c.uptime??0),icon:e.jsx(ce,{className:"h-4 w-4"})}),e.jsx(h,{title:"Total Requests",value:(c.totalRequests??0).toLocaleString(),icon:e.jsx(I,{className:"h-4 w-4"})}),e.jsx(h,{title:"Active Sessions",value:c.activeSessions??0,icon:e.jsx(oe,{className:"h-4 w-4"})}),e.jsx(h,{title:"Active Model",value:((L=c.model)==null?void 0:L.split("/").pop())??"unknown",icon:e.jsx(se,{className:"h-4 w-4"}),subtitle:c.provider})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(b,{title:"Machines",icon:xe,children:e.jsx("div",{className:"grid gap-2",children:g.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{status:s.online===null?"unknown":s.online?"online":"offline"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:s.name}),e.jsx("p",{className:"text-[11px] text-text-muted",children:s.role})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-xs font-mono text-text-secondary",children:s.ip}),e.jsx("p",{className:"text-[10px] text-text-muted",children:s.online?"Online":s.online===!1?"Offline":"Checking..."})]})]},s.ip))})}),e.jsx(b,{title:"GPU / VRAM",icon:te,children:H?e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-text-secondary",children:"VRAM Usage"}),e.jsxs("span",{className:"text-text-muted",children:[M(i.usedVRAM)," / ",M(i.totalVRAM)," (",y,"%)"]})]}),e.jsx("div",{className:"h-3 rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${y>90?"bg-error":y>70?"bg-warning":"bg-accent"}`,style:{width:`${y}%`}})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(S,{status:i.state==="idle"?"online":"working"}),e.jsx("span",{className:"text-text-secondary capitalize",children:i.state})]}),((U=i.models)==null?void 0:U.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-text-muted mb-1",children:"Loaded Models"}),i.models.map(s=>e.jsxs("div",{className:"flex justify-between text-xs py-0.5",children:[e.jsx("span",{className:"text-text-secondary",children:s.name}),e.jsx("span",{className:"text-text-muted font-mono",children:M(s.vram)})]},s.id))]}),((T=i.leases)==null?void 0:T.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-text-muted mb-1",children:"Active Leases"}),i.leases.map(s=>e.jsxs("div",{className:"flex justify-between text-xs py-0.5",children:[e.jsx("span",{className:"text-text-secondary",children:s.service}),e.jsxs("span",{className:"text-text-muted font-mono",children:[s.requiredMB," MB"]})]},s.leaseId))]})]}):e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4 text-center text-xs text-text-muted",children:"No GPU detected on this gateway host. VRAM orchestration is inactive."})})]}),x&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-5",children:[e.jsx(h,{title:"Tool Calls (24h)",value:x.toolCallsLast24h,icon:e.jsx(I,{className:"h-4 w-4"})}),e.jsx(h,{title:"Active Goals",value:x.activeGoals,icon:e.jsx(he,{className:"h-4 w-4"})}),e.jsx(h,{title:"Autopilot",value:x.autopilotEnabled?"On":"Off",icon:e.jsx(w,{className:"h-4 w-4"}),subtitle:`${x.autopilotRunsToday} runs today`}),e.jsx(h,{title:"Knowledge Graph",value:x.graphStats.entities,icon:e.jsx(D,{className:"h-4 w-4"}),subtitle:`${x.graphStats.edges} edges`}),e.jsx(h,{title:"System Status",value:x.status==="idle"?"Idle":x.status,icon:x.status==="idle"?e.jsx(A,{className:"h-4 w-4"}):e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(b,{title:"Mesh Network",icon:D,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:C.length>0?e.jsx("div",{className:"space-y-2",children:C.map(s=>{var r;return e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-3.5 w-3.5 text-success"}),e.jsx("span",{className:"text-text-secondary",children:s.host||s.nodeId.slice(0,12)})]}),e.jsxs("span",{className:"text-text-muted",children:[((r=s.models)==null?void 0:r.length)??0," models"]})]},s.nodeId)})}):e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(me,{className:"h-3.5 w-3.5"}),"No mesh peers connected"]})})}),e.jsx(b,{title:"Active Agents",icon:de,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:k.length>0?e.jsx("div",{className:"space-y-2",children:k.map(s=>{const r=s.status==="active"||s.status==="running",a=s.lastHeartbeat&&Date.now()-new Date(s.lastHeartbeat).getTime()>36e5;return e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{status:a?"offline":r?"working":"online"}),e.jsx("span",{className:"text-text font-medium",children:s.name||s.id.slice(0,12)}),s.role&&e.jsxs("span",{className:"text-text-muted",children:["(",s.role,")"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"capitalize text-text-secondary",children:s.status}),s.lastHeartbeat&&e.jsx("span",{className:"text-text-muted",children:Ne(s.lastHeartbeat)})]})]},s.id)})}):e.jsx("p",{className:"text-xs text-text-muted",children:"No agents registered"})})})]}),e.jsx(b,{title:"Task Board",icon:ge,children:e.jsx("div",{className:"grid grid-cols-3 gap-3",children:["todo","in_progress","done"].map(s=>{const r=s==="in_progress"?"In Progress":s.charAt(0).toUpperCase()+s.slice(1),a=X(s),p=s==="todo"?"text-text-muted":s==="in_progress"?"text-warning":"text-success";return e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary/50 p-3 min-h-[120px]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-wider ${p}`,children:r}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:["(",a==null?void 0:a.length,")"]})]}),(a==null?void 0:a.length)>0?e.jsxs("div",{className:"space-y-1.5",children:[a.slice(0,8).map(d=>e.jsxs("div",{className:"rounded-lg border border-border bg-bg p-2 text-xs",children:[e.jsxs("div",{className:"flex items-start gap-1.5",children:[e.jsx("span",{className:"text-accent font-semibold shrink-0",children:d.id.slice(0,6)}),e.jsx("span",{className:"text-text-secondary",children:d.title||d.description||"Untitled"})]}),d.assigneeAgentId&&e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["→ ",d.assigneeAgentId]})]},d.id)),(a==null?void 0:a.length)>8&&e.jsxs("p",{className:"text-[10px] text-text-muted text-center",children:["+",(a==null?void 0:a.length)-8," more"]})]}):e.jsx("p",{className:"text-[10px] text-text-muted italic text-center py-4",children:"Empty"})]},s)})})}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(b,{title:"Live Activity",icon:w,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-3 max-h-[320px] overflow-y-auto",children:R.length>0?e.jsx("div",{className:"space-y-0",children:R.slice(0,15).map((s,r)=>{const a=s.timestamp?new Date(s.timestamp).toLocaleTimeString():"",p=s.type||"event",d=p.includes("agent"),j=p.includes("tool");return e.jsxs("div",{className:"flex gap-2.5 py-1.5 border-b border-border/50 last:border-0 text-xs",children:[e.jsx("span",{className:"text-text-muted shrink-0 w-[52px] text-[10px]",children:a}),e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase ${j?"bg-accent/15 text-accent":d?"bg-success/15 text-success":"bg-warning/15 text-warning"}`,children:p.slice(0,10)}),e.jsx("span",{className:"text-text-secondary truncate",children:s.message||s.detail||s.content||""})]},r)})}):e.jsx("p",{className:"text-xs text-text-muted italic text-center py-6",children:"No recent activity"})})}),e.jsx(b,{title:"Budget Tracking",icon:pe,children:e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:$.length>0?e.jsx("div",{className:"space-y-3",children:$.map(s=>{const r=s.limitUsd>0?Math.round(s.currentSpend/s.limitUsd*100):0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-text-secondary font-medium",children:s.name}),e.jsxs("span",{className:"text-text-muted",children:["$",s.currentSpend.toFixed(2)," / $",s.limitUsd.toFixed(2)," (",s.period,")"]})]}),e.jsx("div",{className:"h-2 rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${r>90?"bg-error":r>70?"bg-warning":"bg-success"}`,style:{width:`${Math.min(r,100)}%`}})})]},s.id)})}):e.jsx("p",{className:"text-xs text-text-muted",children:"No budget policies configured"})})})]}),(c==null?void 0:c.health)&&e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[c.health.ollamaHealthy?e.jsx(A,{className:"h-4 w-4 text-success"}):e.jsx(ne,{className:"h-4 w-4 text-error"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-text",children:"Ollama"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:c.health.ollamaHealthy?"Healthy":"Unhealthy"})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[c.health.ttsHealthy?e.jsx(A,{className:"h-4 w-4 text-success"}):e.jsx(re,{className:"h-4 w-4 text-warning"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-text",children:"TTS"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:c.health.ttsHealthy?"Healthy":"Unavailable"})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[e.jsx(w,{className:"h-4 w-4 text-accent"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-text",children:"LLM Requests"}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:[c.health.activeLlmRequests," active"]})]})]})]})]})}export{Ke as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomelabPanel-CE5PGRpL.js","assets/index-DzwowwSI.js","assets/index-BR0vfkIi.css","assets/PageHeader-CnZtP8ek.js","assets/chevron-right-aQEw2mUW.js","assets/StatCard-BIsyMybM.js","assets/SkeletonLoader-B5v09EF_.js","assets/terminal-BtiqJ628.js","assets/clock-CTsgP_Sn.js","assets/users-dZgv4ePG.js","assets/TitanCanvas-BCbWnLMd.js","assets/chevron-up-C5g6pEj8.js","assets/plus-Csu2v9GN.js","assets/wrench-CDz3xYve.js","assets/network-DbGDAdrn.js","assets/save-Btx-kpoW.js","assets/rotate-ccw-Co-_W04j.js","assets/search-0hXTwEZR.js","assets/send-TEpapzQR.js","assets/VoiceOverlay-D-gc58b0.js","assets/chevron-down-D7OLjvuD.js","assets/folder-DA43TRCm.js","assets/check-Bpm1IONe.js","assets/shield-check-DjBJXZUr.js","assets/external-link-BZ0y_Ahx.js","assets/loader-circle-1YOBsoQp.js","assets/TitanCanvas-BfitWg9R.css","assets/chart-column-CdFlBpoP.js","assets/circle-check-big-fPhEdP88.js","assets/dollar-sign-CudFVYFc.js","assets/NvidiaPanel-BtCg3G4w.js","assets/eye-off-BmJF0YYx.js","assets/FilesPanel-CaUkv2is.js","assets/arrow-left-5chqas7J.js","assets/trash-2-DgWrHVax.js","assets/download-DZRxDn67.js","assets/LogsPanel-ClXJ4fcr.js","assets/TelemetryPanel-EqpRBmOI.js","assets/git-branch-oHibJqDq.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,j as e,l as o,_ as a}from"./index-DzwowwSI.js";const r=s.lazy(()=>a(()=>import("./HomelabPanel-CE5PGRpL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]))),d=s.lazy(()=>a(()=>import("./NvidiaPanel-BtCg3G4w.js"),__vite__mapDeps([30,1,2,7,15,28,24,17,31,10,11,12,9,13,14,16,18,19,4,20,21,8,22,23,25,26]))),n=s.lazy(()=>a(()=>import("./FilesPanel-CaUkv2is.js"),__vite__mapDeps([32,1,2,12,7,10,11,9,13,14,15,16,17,18,19,4,20,21,8,22,23,24,25,26,33,34,35]))),c=s.lazy(()=>a(()=>import("./LogsPanel-ClXJ4fcr.js"),__vite__mapDeps([36,1,2,7]))),m=s.lazy(()=>a(()=>import("./TelemetryPanel-EqpRBmOI.js"),__vite__mapDeps([37,1,2,5,8,38,27,10,11,12,9,13,14,7,15,16,17,18,19,4,20,21,22,23,24,25,26]))),x=[{id:"homelab",label:"Homelab"},{id:"gpu",label:"GPU / NVIDIA"},{id:"files",label:"Files"},{id:"logs",label:"Logs"},{id:"telemetry",label:"Telemetry"}];function u(){const[l,i]=s.useState("homelab");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Infrastructure"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:x.map(t=>e.jsxs("button",{onClick:()=>i(t.id),className:o("px-3 py-2 text-xs font-medium transition-colors relative",l===t.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[t.label,l===t.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},t.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(s.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[l==="homelab"&&e.jsx(r,{}),l==="gpu"&&e.jsx(d,{}),l==="files"&&e.jsx(n,{}),l==="logs"&&e.jsx(c,{}),l==="telemetry"&&e.jsx(m,{})]})})]})}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,l as g,j as t,X as N}from"./index-DzwowwSI.js";import{C as w}from"./check-Bpm1IONe.js";import{P as S}from"./terminal-BtiqJ628.js";function R({value:s,onSave:h,placeholder:p,multiline:a=!1,className:k,displayValue:E,emptyLabel:j="—",hidePencil:C=!1,maxLength:x,title:v}){const[i,c]=r.useState(!1),[o,l]=r.useState(s),[f,y]=r.useState(!1),n=r.useRef(null);r.useEffect(()=>{i&&n.current&&(n.current.focus(),"select"in n.current&&n.current.select())},[i]),r.useEffect(()=>{i||l(s)},[s,i]);const u=async()=>{if(o===s){c(!1);return}y(!0);try{await h(o),c(!1)}catch{}finally{y(!1)}},b=()=>{l(s),c(!1)},m=e=>{e.key==="Enter"&&!a||e.key==="Enter"&&a&&e.metaKey?(e.preventDefault(),u()):e.key==="Escape"&&(e.preventDefault(),b())};if(i){const e=g("bg-bg-tertiary border border-accent/60 rounded px-2 py-1 text-sm text-text","focus:outline-none focus:border-accent","w-full",a&&"resize-none min-h-[60px]");return t.jsxs("span",{className:"inline-flex items-start gap-1 w-full",children:[a?t.jsx("textarea",{ref:n,value:o,onChange:d=>l(d.target.value),onKeyDown:m,placeholder:p,maxLength:x,className:e,disabled:f}):t.jsx("input",{ref:n,type:"text",value:o,onChange:d=>l(d.target.value),onKeyDown:m,placeholder:p,maxLength:x,className:e,disabled:f}),t.jsx("button",{onClick:u,disabled:f,className:"text-success hover:bg-success/10 rounded p-1 shrink-0",title:a?"Save (Cmd+Enter)":"Save (Enter)",type:"button",children:t.jsx(w,{size:14})}),t.jsx("button",{onClick:b,disabled:f,className:"text-text-muted hover:bg-bg-tertiary rounded p-1 shrink-0",title:"Cancel (Esc)",type:"button",children:t.jsx(N,{size:14})})]})}const D=E??(s&&s.length>0?s:j);return t.jsxs("span",{className:g("inline-flex items-center gap-1 cursor-pointer group","hover:bg-bg-tertiary rounded px-1 -mx-1",k),onClick:()=>c(!0),title:v??"Click to edit",role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),c(!0))},children:[t.jsx("span",{children:D}),!C&&t.jsx(S,{size:10,className:"text-text-muted opacity-0 group-hover:opacity-60 transition-opacity shrink-0"})]})}export{R as I};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,j as e,l as d}from"./index-DzwowwSI.js";import{L as b}from"./loader-circle-1YOBsoQp.js";const m={primary:"text-white shadow-sm glow-accent-hover bg-[image:var(--gradient-accent)] hover:brightness-110",secondary:"bg-bg-tertiary text-text border border-border hover:border-border-light hover:bg-bg-secondary",ghost:"text-text-secondary hover:text-text hover:bg-bg-tertiary",danger:"bg-error/10 text-error border border-error/20 hover:bg-error/20"},p={sm:"px-2.5 py-1 text-xs gap-1.5 rounded-md",md:"px-3.5 py-2 text-sm gap-2 rounded-lg",lg:"px-5 py-2.5 text-sm gap-2 rounded-lg"},g=n.forwardRef(({variant:r="primary",size:t="md",icon:o,loading:s,disabled:a,children:i,className:l,...x},c)=>e.jsxs("button",{ref:c,disabled:a||s,className:d("inline-flex items-center justify-center font-medium transition-all","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50","disabled:opacity-50 disabled:pointer-events-none",m[r],p[t],l),...x,children:[s?e.jsx(b,{size:t==="sm"?14:16,className:"animate-spin"}):o,i]}));g.displayName="Button";const u=n.forwardRef(({icon:r,error:t,className:o,...s},a)=>e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"relative",children:[r&&e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted pointer-events-none",children:r}),e.jsx("input",{ref:a,className:d("w-full rounded-lg border bg-bg py-2 text-sm text-text outline-none transition-colors","placeholder:text-text-muted",r?"pl-10 pr-3":"px-3",t?"border-error focus:border-error":"border-border focus:border-accent",o),...s})]}),t&&e.jsx("p",{className:"mt-1 text-xs text-error",children:t})]}));u.displayName="Input";export{g as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,j as e,e as F,a4 as S,b as C,ad as K}from"./index-DzwowwSI.js";import{P as A}from"./plug-BcXjlPUL.js";import{C as U}from"./circle-check-big-fPhEdP88.js";import{E as T}from"./eye-off-BmJF0YYx.js";import{E as I}from"./TitanCanvas-BCbWnLMd.js";import{S as O}from"./save-Btx-kpoW.js";import{C as R}from"./chevron-down-D7OLjvuD.js";import{C as q}from"./chevron-right-aQEw2mUW.js";import"./chevron-up-C5g6pEj8.js";import"./plus-Csu2v9GN.js";import"./users-dZgv4ePG.js";import"./wrench-CDz3xYve.js";import"./network-DbGDAdrn.js";import"./terminal-BtiqJ628.js";import"./rotate-ccw-Co-_W04j.js";import"./search-0hXTwEZR.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./folder-DA43TRCm.js";import"./clock-CTsgP_Sn.js";import"./check-Bpm1IONe.js";import"./shield-check-DjBJXZUr.js";import"./external-link-BZ0y_Ahx.js";import"./loader-circle-1YOBsoQp.js";const k=[{id:"anthropic",label:"Anthropic",fieldKey:"anthropicKey",fieldType:"key",placeholder:"sk-ant-..."},{id:"openai",label:"OpenAI",fieldKey:"openaiKey",fieldType:"key",placeholder:"sk-..."},{id:"google",label:"Google AI",fieldKey:"googleKey",fieldType:"key",placeholder:"AIza..."},{id:"groq",label:"Groq",fieldKey:"groqKey",fieldType:"key",placeholder:"gsk_..."},{id:"mistral",label:"Mistral",fieldKey:"mistralKey",fieldType:"key",placeholder:"API key"},{id:"openrouter",label:"OpenRouter",fieldKey:"openrouterKey",fieldType:"key",placeholder:"sk-or-..."},{id:"fireworks",label:"Fireworks AI",fieldKey:"fireworksKey",fieldType:"key",placeholder:"API key"},{id:"xai",label:"xAI (Grok)",fieldKey:"xaiKey",fieldType:"key",placeholder:"xai-..."},{id:"together",label:"Together AI",fieldKey:"togetherKey",fieldType:"key",placeholder:"API key"},{id:"deepseek",label:"DeepSeek",fieldKey:"deepseekKey",fieldType:"key",placeholder:"sk-..."},{id:"perplexity",label:"Perplexity",fieldKey:"perplexityKey",fieldType:"key",placeholder:"pplx-..."},{id:"ollama",label:"Ollama",fieldKey:"ollamaUrl",fieldType:"url",placeholder:"http://localhost:11434"}];function P({configured:a}){return e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${a?"bg-success/10 text-success":"bg-border-light/20 text-text-muted"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${a?"bg-success":"bg-border-light"}`}),a?"Configured":"Not configured"]})}function M({provider:a,configured:b,currentUrl:o,onSave:g,saving:v}){const[f,y]=l.useState(!1),[n,d]=l.useState(a.fieldType==="url"&&o||""),[x,m]=l.useState(!1),u=a.fieldType==="key",c=v===a.id;return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary",children:[e.jsxs("button",{onClick:()=>y(!f),className:"flex w-full items-center justify-between px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[f?e.jsx(R,{className:"h-4 w-4 text-text-muted"}):e.jsx(q,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-text",children:a.label})]}),e.jsx(P,{configured:b})]}),f&&e.jsxs("div",{className:"border-t border-bg-tertiary px-4 py-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:u?"API Key":"Base URL"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`integration-${a.id}`,name:`integration-${a.id}`,type:u&&!x?"password":"text",value:n,onChange:j=>d(j.target.value),placeholder:a.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),u&&e.jsx("button",{type:"button",onClick:()=>m(!x),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:x?e.jsx(T,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:()=>g(a.fieldKey,n),disabled:c||!n,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(O,{className:"h-3.5 w-3.5"}),c?"Saving...":"Save"]})})]})]})}function pe(){const[a,b]=l.useState({}),[o,g]=l.useState({clientIdSet:!1,clientSecretSet:!1}),[v,f]=l.useState(!0),[y,n]=l.useState(null),[d,x]=l.useState(null),[m,u]=l.useState(""),[c,j]=l.useState(""),[N,G]=l.useState(!1);l.useEffect(()=>{(async()=>{var t;try{const r=await S();if(r.providers&&b(r.providers),(t=r.oauth)!=null&&t.google){const h=r.oauth.google;try{const i=await(await C("/api/auth/google/status")).json();h.connected=i.connected,h.email=i.email}catch{}g(h)}}catch{}finally{f(!1)}})()},[]);const E=()=>{window.location.href="/api/auth/google/start"},D=async()=>{try{await C("/api/auth/google/disconnect",{method:"POST"}),g(s=>({...s,connected:!1,email:void 0})),p("success","Google account disconnected")}catch{p("error","Failed to disconnect")}},p=(s,t)=>{x({type:s,message:t}),setTimeout(()=>x(null),3e3)},$=async(s,t)=>{var h,w;const r=((h=k.find(i=>i.fieldKey===s))==null?void 0:h.id)||s;n(r);try{await K({[s]:t});const i=await S();i.providers&&b(i.providers),p("success",`${((w=k.find(B=>B.fieldKey===s))==null?void 0:w.label)||"Provider"} saved`)}catch(i){p("error",i instanceof Error?i.message:"Failed to save")}finally{n(null)}},L=async()=>{var s;n("oauth");try{const t={};m&&(t.googleOAuthClientId=m),c&&(t.googleOAuthClientSecret=c),await K(t);const r=await S();(s=r.oauth)!=null&&s.google&&g(r.oauth.google),p("success","Google OAuth settings saved"),u(""),j("")}catch(t){p("error",t instanceof Error?t.message:"Failed to save")}finally{n(null)}};return v?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((s,t)=>e.jsx("div",{className:"h-14 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10",children:e.jsx(A,{className:"h-4 w-4 text-accent-hover"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"Integrations"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Configure LLM providers and external service connections"})]})]}),d&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${d.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[d.type==="success"?e.jsx(U,{className:"h-4 w-4"}):e.jsx(F,{className:"h-4 w-4"}),d.message]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"LLM Providers"}),e.jsx("div",{className:"space-y-2",children:k.map(s=>{const t=a[s.id],r=s.id==="ollama"?!!(t!=null&&t.baseUrl):!!(t!=null&&t.configured);return e.jsx(M,{provider:s,configured:r,currentUrl:s.fieldType==="url"?(t==null?void 0:t.baseUrl)||"":void 0,onSave:$,saving:y},s.id)})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Google Services (OAuth)"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"Google OAuth 2.0"}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:o.connected&&o.email?`Connected as ${o.email}`:"Gmail, Drive, Calendar, Docs, Sheets, Tasks"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{configured:!!o.connected}),o.clientIdSet&&!o.connected&&e.jsxs("button",{onClick:E,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white hover:bg-accent/80 transition-colors",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),"Connect Google"]}),o.connected&&e.jsx("button",{onClick:D,className:"flex items-center gap-1.5 rounded-lg border border-red-500/30 px-3 py-1.5 text-xs font-medium text-red-400 hover:bg-red-500/10 transition-colors",children:"Disconnect"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Client ID"}),e.jsx("input",{id:"integration-google-client-id",name:"integration-google-client-id",type:"text",value:m,onChange:s=>u(s.target.value),placeholder:o.clientIdSet?"(configured)":"your-client-id.apps.googleusercontent.com",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Client Secret"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"integration-google-client-secret",name:"integration-google-client-secret",type:N?"text":"password",value:c,onChange:s=>j(s.target.value),placeholder:o.clientSecretSet?"(configured)":"GOCSPX-...",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>G(!N),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:N?e.jsx(T,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:L,disabled:y==="oauth"||!m&&!c,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(O,{className:"h-3.5 w-3.5"}),y==="oauth"?"Saving...":"Save OAuth Settings"]})})]})]})]})}export{pe as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AutopilotPanel-fjOfM668.js","assets/index-DzwowwSI.js","assets/index-BR0vfkIi.css","assets/PageHeader-CnZtP8ek.js","assets/chevron-right-aQEw2mUW.js","assets/WorkflowsPanel-BAnSTOYe.js","assets/Input-Bu_b3qmY.js","assets/loader-circle-1YOBsoQp.js","assets/InlineEditableField-BMQjiE6-.js","assets/check-Bpm1IONe.js","assets/terminal-BtiqJ628.js","assets/target-BRW80Xer.js","assets/plus-Csu2v9GN.js","assets/chevron-down-D7OLjvuD.js","assets/play-DVY9c5Ck.js","assets/pause-CYhO_uQo.js","assets/trash-2-DgWrHVax.js","assets/clock-CTsgP_Sn.js","assets/toggle-right-CKtSrl28.js","assets/TitanCanvas-BCbWnLMd.js","assets/chevron-up-C5g6pEj8.js","assets/users-dZgv4ePG.js","assets/wrench-CDz3xYve.js","assets/network-DbGDAdrn.js","assets/save-Btx-kpoW.js","assets/rotate-ccw-Co-_W04j.js","assets/search-0hXTwEZR.js","assets/send-TEpapzQR.js","assets/VoiceOverlay-D-gc58b0.js","assets/folder-DA43TRCm.js","assets/shield-check-DjBJXZUr.js","assets/external-link-BZ0y_Ahx.js","assets/TitanCanvas-BfitWg9R.css","assets/LearningPanel-UpQZC-mA.js","assets/lightbulb-C54Ske-p.js","assets/trending-up-MpIrE4j6.js","assets/MemoryGraphPanel-Bo2OrvA6.js","assets/SelfImprovePanel-u9h0Lt3p.js","assets/circle-check-big-fPhEdP88.js","assets/trophy-CECuZNhX.js","assets/PersonasPanel-BmlxokfB.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,j as e,l as a,_ as t}from"./index-DzwowwSI.js";const i=s.lazy(()=>t(()=>import("./AutopilotPanel-fjOfM668.js"),__vite__mapDeps([0,1,2,3,4]))),n=s.lazy(()=>t(()=>import("./WorkflowsPanel-BAnSTOYe.js"),__vite__mapDeps([5,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]))),d=s.lazy(()=>t(()=>import("./LearningPanel-UpQZC-mA.js"),__vite__mapDeps([33,1,2,3,4,10,19,20,12,21,22,23,24,25,26,27,28,13,29,17,9,30,31,7,32,34,35]))),c=s.lazy(()=>t(()=>import("./MemoryGraphPanel-Bo2OrvA6.js"),__vite__mapDeps([36,1,2,23,10,16,26]))),m=s.lazy(()=>t(()=>import("./SelfImprovePanel-u9h0Lt3p.js"),__vite__mapDeps([37,1,2,19,20,12,21,22,23,10,24,25,26,27,28,4,13,29,17,9,30,31,7,32,38,39,35,14,16]))),x=s.lazy(()=>t(()=>import("./PersonasPanel-BmlxokfB.js"),__vite__mapDeps([40,1,2]))),p=[{id:"autopilot",label:"Autopilot"},{id:"workflows",label:"Workflows"},{id:"learning",label:"Learning"},{id:"memory",label:"Memory & Graph"},{id:"self-improve",label:"Self-Improve"},{id:"personas",label:"Personas"}];function u(){const[l,r]=s.useState("autopilot");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Intelligence"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:p.map(o=>e.jsxs("button",{onClick:()=>r(o.id),className:a("px-3 py-2 text-xs font-medium transition-colors relative",l===o.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[o.label,l===o.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},o.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(s.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[l==="autopilot"&&e.jsx(i,{}),l==="workflows"&&e.jsx(n,{}),l==="learning"&&e.jsx(d,{}),l==="memory"&&e.jsx(c,{}),l==="self-improve"&&e.jsx(m,{}),l==="personas"&&e.jsx(x,{})]})})]})}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,j as e,T as g,b as x}from"./index-DzwowwSI.js";import{P as j}from"./PageHeader-CnZtP8ek.js";import{R as f}from"./terminal-BtiqJ628.js";import{B as p,D as N}from"./TitanCanvas-BCbWnLMd.js";import{W as v}from"./wrench-CDz3xYve.js";import{L as y}from"./lightbulb-C54Ske-p.js";import{T as C}from"./trending-up-MpIrE4j6.js";import"./chevron-right-aQEw2mUW.js";import"./chevron-up-C5g6pEj8.js";import"./plus-Csu2v9GN.js";import"./users-dZgv4ePG.js";import"./network-DbGDAdrn.js";import"./save-Btx-kpoW.js";import"./rotate-ccw-Co-_W04j.js";import"./search-0hXTwEZR.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./chevron-down-D7OLjvuD.js";import"./folder-DA43TRCm.js";import"./clock-CTsgP_Sn.js";import"./check-Bpm1IONe.js";import"./shield-check-DjBJXZUr.js";import"./external-link-BZ0y_Ahx.js";import"./loader-circle-1YOBsoQp.js";function w(t){return t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}function k(t){return t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}K`:`${(t/1e6).toFixed(2)}M`}function a({icon:t,label:d,value:r,color:i,sub:o}){return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md",style:{backgroundColor:i+"15"},children:e.jsx(t,{className:"h-3.5 w-3.5",style:{color:i}})}),e.jsx("p",{className:"text-xs text-text-muted",children:d})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:r}),o&&e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:o})]})}function V(){const[t,d]=l.useState(null),[r,i]=l.useState(null),[o,b]=l.useState(null),[h,m]=l.useState(!0),u=()=>{m(!0),Promise.all([x("/api/learning").then(s=>s.ok?s.json():null).catch(()=>null),x("/api/stats").then(s=>s.ok?s.json():null).catch(()=>null),x("/api/graphiti").then(s=>s.ok?s.json():null).catch(()=>null)]).then(([s,c,n])=>{d(s),i(c),b(n?{nodeCount:n.nodeCount||0,edgeCount:n.edgeCount||0,episodeCount:n.episodeCount||0}:null)}).finally(()=>m(!1))};return l.useEffect(()=>{u()},[]),h?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 animate-pulse rounded-xl bg-bg-secondary"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:8}).map((s,c)=>e.jsx("div",{className:"h-24 animate-pulse rounded-xl bg-bg-secondary"},c))})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(j,{title:"Learning",subtitle:"Knowledge base, tool mastery, and memory systems",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Memory"},{label:"Learning"}],actions:e.jsxs("button",{onClick:u,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:[e.jsx(f,{className:"h-3.5 w-3.5"})," Refresh"]})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Knowledge Base"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(a,{icon:p,label:"Knowledge Entries",value:(t==null?void 0:t.knowledgeEntries)??0,color:"#6366f1",sub:"Facts, patterns, corrections"}),e.jsx(a,{icon:v,label:"Tools Tracked",value:(t==null?void 0:t.toolsTracked)??0,color:"#22d3ee",sub:"Success rates learned"}),e.jsx(a,{icon:g,label:"Error Patterns",value:(t==null?void 0:t.errorPatterns)??0,color:"#f59e0b",sub:"Known failure modes"}),e.jsx(a,{icon:y,label:"Corrections",value:(t==null?void 0:t.corrections)??0,color:"#34d399",sub:"User-taught improvements"})]})]}),o&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Memory Graph"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(a,{icon:N,label:"Entities",value:o.nodeCount,color:"#818cf8",sub:"People, topics, projects"}),e.jsx(a,{icon:C,label:"Relationships",value:o.edgeCount,color:"#22d3ee",sub:"Connections between entities"}),e.jsx(a,{icon:p,label:"Episodes",value:o.episodeCount,color:"#34d399",sub:"Conversation memories"})]})]}),r&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"System"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Tokens Used"}),e.jsx("p",{className:"text-xl font-bold text-text",children:k(r.totalTokens)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Requests"}),e.jsx("p",{className:"text-xl font-bold text-text",children:r.totalRequests})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Uptime"}),e.jsx("p",{className:"text-xl font-bold text-text",children:w(r.uptime)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Memory"}),e.jsxs("p",{className:"text-xl font-bold text-text",children:[r.memoryMB,"MB"]})]})]})]})]})}export{V as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,ap as v,j as e}from"./index-DzwowwSI.js";import{R as j}from"./terminal-BtiqJ628.js";const x={debug:"bg-text-muted/20 text-text-secondary",info:"bg-info/20 text-info",warn:"bg-warning/20 text-warning",warning:"bg-warning/20 text-warning",error:"bg-error/20 text-error"};function w(){const[c,u]=r.useState([]),[g,m]=r.useState(!0),[i,d]=r.useState(null),[a,b]=r.useState(""),[o,h]=r.useState(100),[l,p]=r.useState(!1),s=r.useRef(null),n=r.useCallback(async()=>{try{const t=await v(a||void 0,o);u(t),d(null)}catch(t){d(t instanceof Error?t.message:"Failed to fetch logs")}finally{m(!1)}},[a,o]);return r.useEffect(()=>{n()},[n]),r.useEffect(()=>(l?s.current=setInterval(n,5e3):s.current&&(clearInterval(s.current),s.current=null),()=>{s.current&&clearInterval(s.current)}),[l,n]),g?e.jsx("div",{className:"h-96 animate-pulse rounded-xl border border-border bg-bg-secondary"}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-text",children:"Logs"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:a,onChange:t=>b(t.target.value),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"All levels"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]}),e.jsxs("select",{value:o,onChange:t=>h(Number(t.target.value)),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:50,children:"50 entries"}),e.jsx("option",{value:100,children:"100 entries"}),e.jsx("option",{value:200,children:"200 entries"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:t=>p(t.target.checked),className:"h-4 w-4 rounded border-border accent-accent"}),"Auto-refresh (5s)"]}),e.jsx("button",{onClick:n,className:"ml-auto rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(j,{className:"h-4 w-4"})})]}),i&&e.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:i}),e.jsx("div",{className:"max-h-[600px] overflow-y-auto rounded-xl border border-border bg-bg-secondary",children:c.length===0?e.jsx("p",{className:"px-4 py-12 text-center text-text-muted",children:"No logs found"}):e.jsx("div",{className:"divide-y divide-border",children:c.map((t,f)=>e.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5",children:[e.jsx("span",{className:"shrink-0 font-mono text-xs text-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium uppercase ${x[t.level]??x.debug}`,children:t.level}),e.jsx("span",{className:"min-w-0 break-all text-sm text-text",children:t.message})]},f))})})]})}export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as e,G as k,aw as z,ax as $,ay as b,az as R,aA as I,aB as E}from"./index-DzwowwSI.js";import{P as h}from"./plug-BcXjlPUL.js";import{R as D}from"./terminal-BtiqJ628.js";import{P as L}from"./plus-Csu2v9GN.js";import{b as g,T as B,P as G}from"./TitanCanvas-BCbWnLMd.js";import{T as F}from"./trash-2-DgWrHVax.js";import"./chevron-up-C5g6pEj8.js";import"./users-dZgv4ePG.js";import"./wrench-CDz3xYve.js";import"./network-DbGDAdrn.js";import"./save-Btx-kpoW.js";import"./rotate-ccw-Co-_W04j.js";import"./search-0hXTwEZR.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./chevron-right-aQEw2mUW.js";import"./chevron-down-D7OLjvuD.js";import"./folder-DA43TRCm.js";import"./clock-CTsgP_Sn.js";import"./check-Bpm1IONe.js";import"./shield-check-DjBJXZUr.js";import"./external-link-BZ0y_Ahx.js";import"./loader-circle-1YOBsoQp.js";function ie(){const[l,j]=d.useState([]),[N,y]=d.useState([]),[f,x]=d.useState(!0),[m,c]=d.useState(!1),[v,p]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),n=async()=>{x(!0);try{const[t,r]=await Promise.all([z(),$()]);j(t),y(r)}catch{}x(!1)};d.useEffect(()=>{n()},[]);const C=async()=>{try{await b({id:s.id,name:s.name,description:s.description,type:s.type,...s.type==="stdio"?{command:s.command,args:s.args.split(/\s+/).filter(Boolean)}:{url:s.url}}),c(!1),a({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),n()}catch(t){alert(t.message)}},P=async t=>{try{await b({presetId:t}),n()}catch(r){alert(r.message)}},w=async t=>{confirm(`Remove MCP server "${t}"?`)&&(await E(t),n())},M=async(t,r)=>{await I(t,r),n()},T=async t=>{p(t),i(null);try{const r=await R(t);i({id:t,...r})}catch(r){i({id:t,ok:!1,tools:0,error:r.message})}p(null)},A=t=>t==="connected"?"text-[var(--success)]":t==="error"?"text-[var(--error)]":"text-[var(--text-muted)]",S=t=>t==="connected"?"bg-[var(--success)]":t==="error"?"bg-[var(--error)]":"bg-[var(--text-muted)]",u=N.filter(t=>!l.some(r=>r.id===t.id));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"MCP Connections"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connect to external tools via Model Context Protocol"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:n,className:"px-3 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(D,{size:14})}),e.jsxs("button",{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] transition-colors",children:[e.jsx(L,{size:14})," Add Server"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Configured Servers"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--text)]",children:l.length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connected"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--success)]",children:l.filter(t=>t.status==="connected").length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"External Tools"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--accent)]",children:l.reduce((t,r)=>t+r.toolCount,0)})]})]}),m&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Add MCP Server"}),u.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)] mb-2",children:"Quick Add Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(t=>e.jsxs("button",{onClick:()=>P(t.id),className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:[e.jsx(g,{size:12})," ",t.name]},t.id))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"ID"}),e.jsx("input",{id:"mcp-server-id",name:"mcp-server-id",value:s.id,onChange:t=>a({...s,id:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"my-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Name"}),e.jsx("input",{id:"mcp-server-name",name:"mcp-server-name",value:s.name,onChange:t=>a({...s,name:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"My MCP Server"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Description"}),e.jsx("input",{id:"mcp-server-description",name:"mcp-server-description",value:s.description,onChange:t=>a({...s,description:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"What does this server do?"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Type"}),e.jsxs("select",{id:"mcp-server-type",name:"mcp-server-type",value:s.type,onChange:t=>a({...s,type:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",children:[e.jsx("option",{value:"stdio",children:"stdio (local process)"}),e.jsx("option",{value:"http",children:"HTTP (remote server)"})]})]}),s.type==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Command"}),e.jsx("input",{id:"mcp-server-command",name:"mcp-server-command",value:s.command,onChange:t=>a({...s,command:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"npx @modelcontextprotocol/server-xxx"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Arguments (space-separated)"}),e.jsx("input",{id:"mcp-server-args",name:"mcp-server-args",value:s.args,onChange:t=>a({...s,args:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"--port 3000"})]})]}):e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Server URL"}),e.jsx("input",{id:"mcp-server-url",name:"mcp-server-url",value:s.url,onChange:t=>a({...s,url:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"http://localhost:3000/mcp"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:C,disabled:!s.id||!s.name,className:"px-4 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] disabled:opacity-40 transition-colors",children:"Add Server"}),e.jsx("button",{onClick:()=>c(!1),className:"px-4 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:"Cancel"})]})]}),f?e.jsx("div",{className:"text-[var(--text-muted)] text-sm",children:"Loading MCP servers..."}):l.length===0?e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center",children:[e.jsx(h,{className:"w-10 h-10 text-[var(--text-muted)] mx-auto mb-3"}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:"No MCP servers configured"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Add an MCP server to connect TITAN to external tools like databases, APIs, and services."})]}):e.jsx("div",{className:"space-y-3",children:l.map(t=>e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:t.type==="stdio"?e.jsx(g,{size:18,className:"text-[var(--text-muted)]"}):e.jsx(k,{size:18,className:"text-[var(--text-muted)]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-[var(--text)]",children:t.name}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${S(t.status)}`}),e.jsx("span",{className:A(t.status),children:t.status})]}),t.toolCount>0&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--accent)]/10 text-[var(--accent)]",children:[t.toolCount," tools"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:t.description}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-1 font-mono",children:t.type==="stdio"?`${t.command} ${(t.args||[]).join(" ")}`:t.url})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>T(t.id),disabled:v===t.id,title:"Test connection",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-tertiary)] transition-colors disabled:opacity-40",children:e.jsx(B,{size:14,className:v===t.id?"animate-pulse":""})}),e.jsx("button",{onClick:()=>M(t.id,!t.enabled),title:t.enabled?"Disable":"Enable",className:`p-1.5 rounded-md transition-colors hover:bg-[var(--bg-tertiary)] ${t.enabled?"text-[var(--success)]":"text-[var(--text-muted)]"}`,children:e.jsx(G,{size:14})}),e.jsx("button",{onClick:()=>w(t.id),title:"Remove",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--error)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(F,{size:14})})]})]}),(o==null?void 0:o.id)===t.id&&e.jsx("div",{className:`mt-3 px-3 py-2 rounded-md text-xs ${o.ok?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:o.ok?`Connected successfully — ${o.tools} tools discovered`:`Connection failed: ${o.error}`})]},t.id))}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"About MCP"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)] leading-relaxed",children:["Model Context Protocol (MCP) is the universal standard for connecting AI agents to external tools. TITAN acts as both an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"server"})," (exposing its tools to other agents) and an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"client"})," (connecting to external MCP servers). Add any MCP-compatible server and its tools automatically become available in TITAN."]})]})]})}export{ie as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ye,r as j,b as be,j as o,X as Se}from"./index-
|
|
1
|
+
import{c as ye,r as j,b as be,j as o,X as Se}from"./index-DzwowwSI.js";import{N as ve}from"./network-DbGDAdrn.js";import{R as Ce}from"./terminal-BtiqJ628.js";import{T as ke}from"./trash-2-DgWrHVax.js";import{S as $e}from"./search-0hXTwEZR.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{c as ye,r as j,b as be,j as o,X as Se}from"./index-CahJbWSR.js";import{N
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Te=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Ee=ye("zoom-out",Te),we={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"},Ie={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"},je=["#f0abfc","#86efac","#fda4af","#7dd3fc","#d9f99d","#fcd34d"];function se(n){const g=n==null?void 0:n.toLowerCase();if(we[g])return we[g];let z=0;for(let P=0;P<((g==null?void 0:g.length)??0);P++)z=(z<<5)-z+g.charCodeAt(P)|0;return je[Math.abs(z)%je.length]}function Me(n){const g=parseInt(n.slice(1),16);return[g>>16&255,g>>8&255,g&255]}function Fe(n,g,z,P){var me,K,_;const S=n.length;if(S===0)return;const q=z/2,h=P/2,C=new Map;for(let d=0;d<S;d++){const $=((me=n[d].type)==null?void 0:me.toLowerCase())??"unknown";C.has($)||C.set($,[]),C.get($).push(d)}const T=[...C.keys()],k=new Map,v=Math.min(z,P)*.3;for(let d=0;d<T.length;d++){const $=d/T.length*Math.PI*2-Math.PI/2;k.set(T[d],{x:q+Math.cos($)*v,y:h+Math.sin($)*v})}for(let d=0;d<S;d++){const $=n[d];if($.x!==void 0)continue;const V=k.get(((K=$.type)==null?void 0:K.toLowerCase())??"unknown")??{x:q,y:h},J=Math.min(z,P)*.12;$.x=V.x+(Math.random()-.5)*J,$.y=V.y+(Math.random()-.5)*J,$.vx=0,$.vy=0}const G=new Map(n.map(d=>[d.id,d])),W=Math.sqrt(S/50),le=Math.min(200,Math.max(80,Math.round(60+S*.2))),ne=4e3*W,fe=.003/W,O=.003/W,de=.015,Y=new Map;for(const d of g)Y.has(d.from)||Y.set(d.from,new Set),Y.has(d.to)||Y.set(d.to,new Set),Y.get(d.from).add(d.to),Y.get(d.to).add(d.from);for(let d=0;d<le;d++){const $=.9-d/le*.35,V=d/le;if(S>200)for(let l=0;l<S;l++){const u=n[l],t=Y.get(u.id)??new Set;for(let e=l+1;e<S;e++){if(!t.has(n[e].id)&&Math.random()>.2)continue;const s=n[e];let c=u.x-s.x,r=u.y-s.y;const i=c*c+r*r,x=Math.sqrt(i)||1,L=ne/(i+100),f=c/x*L,y=r/x*L;u.vx+=f,u.vy+=y,s.vx-=f,s.vy-=y}}else for(let l=0;l<S;l++)for(let u=l+1;u<S;u++){const t=n[l],e=n[u];let s=t.x-e.x,c=t.y-e.y;const r=s*s+c*c,i=Math.sqrt(r)||1,x=ne/(r+100),L=s/i*x,f=c/i*x;t.vx+=L,t.vy+=f,e.vx-=L,e.vy-=f}for(const l of g){const u=G.get(l.from),t=G.get(l.to);if(!u||!t)continue;const e=t.x-u.x,s=t.y-u.y,c=Math.sqrt(e*e+s*s)||1,r=c*fe,i=e/c*r,x=s/c*r;u.vx+=i,u.vy+=x,t.vx-=i,t.vy-=x}const J=de*(1-V*.5);for(const l of n){const u=k.get(((_=l.type)==null?void 0:_.toLowerCase())??"unknown");u&&(l.vx+=(u.x-l.x)*J,l.vy+=(u.y-l.y)*J)}for(const l of n)l.vx+=(q-l.x)*O,l.vy+=(h-l.y)*O;const re=40;for(const l of n)l.vx*=$,l.vy*=$,l.x+=l.vx,l.y+=l.vy,l.x=Math.max(re,Math.min(z-re,l.x)),l.y=Math.max(re,Math.min(P-re,l.y))}}function Ae(n,g,z,P,S){const q=(n+z)/2,h=(g+P)/2,C=z-n,k=-(P-g),v=C,G=Math.sqrt(k*k+v*v)||1;return{cx:q+k/G*S,cy:h+v/G*S}}function qe(n,g,z,P,S,q,h){const C=Math.atan2(z-S,g-P),T=8,k=g-Math.cos(C)*q,v=z-Math.sin(C)*q;n.beginPath(),n.moveTo(k,v),n.lineTo(k-Math.cos(C-Math.PI/6)*T,v-Math.sin(C-Math.PI/6)*T),n.lineTo(k-Math.cos(C)*T*.5,v-Math.sin(C)*T*.5),n.lineTo(k-Math.cos(C+Math.PI/6)*T,v-Math.sin(C+Math.PI/6)*T),n.closePath(),n.fillStyle=h,n.fill()}function Xe(){const[n,g]=j.useState(null),[z,P]=j.useState(!0),[S,q]=j.useState(null),[h,C]=j.useState(null),[T,k]=j.useState(null),[v,G]=j.useState(""),[W,le]=j.useState(new Set),ne=j.useRef(null),fe=j.useRef(null),O=j.useRef({x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0}),de=j.useRef(0),Y=j.useRef(0),me=j.useRef(new Map),K=j.useCallback(async()=>{var t;try{const e=await be("/api/graphiti",{headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`${e.status}: ${e.statusText}`);const s=await e.json();if((t=s.nodes)!=null&&t.length){const c=fe.current,r=(c==null?void 0:c.clientWidth)??1200,i=(c==null?void 0:c.clientHeight)??600;for(const x of s.nodes){const L=me.current.get(x.id);L&&(x.x=L.x,x.y=L.y)}Fe(s.nodes,s.edges??[],r,i);for(const x of s.nodes)x.x!==void 0&&x.y!==void 0&&me.current.set(x.id,{x:x.x,y:x.y})}g(s),q(null)}catch(e){q(e instanceof Error?e.message:"Failed to load graph"),g(null)}finally{P(!1)}},[]);j.useEffect(()=>{K()},[K]);const _=j.useMemo(()=>{if(!n)return{nodes:[],edges:[]};const t=v.toLowerCase().trim();let e=n.nodes;if(W.size>0&&(e=e.filter(r=>{var i;return!W.has((i=r.type)==null?void 0:i.toLowerCase())})),t){const r=new Set;for(const i of e)(i.label.toLowerCase().includes(t)||i.facts.some(x=>x.toLowerCase().includes(t)))&&r.add(i.id);for(const i of n.edges)r.has(i.from)&&r.add(i.to),r.has(i.to)&&r.add(i.from);e=e.filter(i=>r.has(i.id))}const s=new Set(e.map(r=>r.id)),c=(n.edges??[]).filter(r=>s.has(r.from)&&s.has(r.to));return{nodes:e,edges:c}},[n,v,W]),d=j.useMemo(()=>{if(!v.trim()||!n)return null;const t=v.toLowerCase().trim(),e=n.nodes.find(s=>s.label.toLowerCase().includes(t));return(e==null?void 0:e.id)??null},[v,n]),$=async()=>{if(confirm("Clear the entire memory graph? This cannot be undone."))try{await be("/api/graphiti",{method:"DELETE"}),K(),C(null)}catch{}},V=t=>{const e=O.current;e.zoom=Math.max(.2,Math.min(4,e.zoom*t)),k(s=>s)},J=()=>{O.current={x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0},k(t=>t)},re=t=>{le(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})};j.useEffect(()=>{const t=ne.current;if(!t||!_.nodes.length)return;const e=t.getContext("2d");if(!e)return;const s=window.devicePixelRatio||1,c=t.getBoundingClientRect();t.width=c.width*s,t.height=c.height*s,e.scale(s,s);const r=c.width,i=c.height,{nodes:x,edges:L}=_,f=new Map(x.map(M=>[M.id,M])),y=()=>{Y.current++;const M=Y.current,m=O.current;e.clearRect(0,0,r,i);const B=e.createRadialGradient(r/2,i/2,0,r/2,i/2,r*.7);B.addColorStop(0,"#0c0c14"),B.addColorStop(1,"#09090b"),e.fillStyle=B,e.fillRect(0,0,r,i),e.fillStyle="rgba(255,255,255,0.02)";const E=35*m.zoom,ae=(m.x%E+E)%E,ue=(m.y%E+E)%E;for(let a=ae;a<r;a+=E)for(let A=ue;A<i;A+=E)e.fillRect(a,A,1,1);for(let a=0;a<15;a++){const A=(M*.15+a*127)%r,N=(M*.1+a*173)%i,w=.02+Math.sin(M*.008+a)*.01;e.beginPath(),e.arc(A,N,1,0,Math.PI*2),e.fillStyle=`rgba(99,102,241,${w})`,e.fill()}const ee=new Set,D=(h==null?void 0:h.id)??T??d;if(D){ee.add(D);for(const a of L)a.from===D&&ee.add(a.to),a.to===D&&ee.add(a.from)}const te=D!=null;for(const a of L){const A=f.get(a.from),N=f.get(a.to);if(!A||!N)continue;const w=te&&(a.from===D||a.to===D);if(te&&!w&&x.length>100)continue;const Z=A.x*m.zoom+m.x,Q=A.y*m.zoom+m.y,p=N.x*m.zoom+m.x,b=N.y*m.zoom+m.y;if(Z<-50&&p<-50||Q<-50&&b<-50||Z>r+50&&p>r+50||Q>i+50&&b>i+50)continue;const R=L.indexOf(a),ge=15+R%3*6,{cx:oe,cy:ce}=Ae(Z,Q,p,b,ge*(R%2===0?1:-1));if(w&&(e.beginPath(),e.moveTo(Z,Q),e.quadraticCurveTo(oe,ce,p,b),e.strokeStyle="rgba(99,102,241,0.12)",e.lineWidth=5,e.stroke()),e.beginPath(),e.moveTo(Z,Q),e.quadraticCurveTo(oe,ce,p,b),w){const F=se(A.type),[X,H,ie]=Me(F);e.strokeStyle=`rgba(${X},${H},${ie},0.5)`,e.lineWidth=1.8}else e.strokeStyle="rgba(100,116,139,0.04)",e.lineWidth=.5;if(e.stroke(),w){const F=Math.max(10,Math.min(24,N.size||14))*m.zoom;qe(e,p,b,oe,ce,F+3,"rgba(148,163,184,0.6)")}if(w&&a.label&&a.label!=="co_mentioned"){const X=.25*Z+.5*oe+.25*p,H=(1-.5)*(1-.5)*Q+2*(1-.5)*.5*ce+.5*.5*b;e.font=`${Math.max(9,10*m.zoom)}px "Inter", system-ui, sans-serif`;const ie=e.measureText(a.label).width+12;e.fillStyle="rgba(15,15,25,0.85)",e.beginPath(),e.roundRect(X-ie/2,H-11,ie,18,4),e.fill(),e.strokeStyle="rgba(99,102,241,0.3)",e.lineWidth=.5,e.stroke(),e.fillStyle="var(--color-accent-light)",e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,X,H)}}for(const a of x){const A=se(a.type),[N,w,I]=Me(A),Z=Math.max(8,Math.min(24,a.size||12)),Q=Math.sin(M*.025+a.id.charCodeAt(0)*.5)*1,p=(Z+Q)*m.zoom,b=a.x*m.zoom+m.x,R=a.y*m.zoom+m.y;if(b<-p*3||R<-p*3||b>r+p*3||R>i+p*3)continue;const ge=T===a.id,oe=(h==null?void 0:h.id)===a.id,ce=d===a.id,F=ge||oe||ce,X=te&&!ee.has(a.id);if(!X){const xe=F?.2:.05+Math.sin(M*.02+a.id.charCodeAt(0))*.015,he=F?p*3.5:p*2,U=e.createRadialGradient(b,R,p*.3,b,R,he);U.addColorStop(0,`rgba(${N},${w},${I},${xe})`),U.addColorStop(.5,`rgba(${N},${w},${I},${xe*.3})`),U.addColorStop(1,`rgba(${N},${w},${I},0)`),e.fillStyle=U,e.beginPath(),e.arc(b,R,he,0,Math.PI*2),e.fill()}const H=e.createRadialGradient(b-p*.3,R-p*.35,0,b,R,p);X?(H.addColorStop(0,`rgba(${N},${w},${I},0.06)`),H.addColorStop(1,`rgba(${N},${w},${I},0.02)`)):(H.addColorStop(0,`rgba(${N},${w},${I},${F?.45:.25})`),H.addColorStop(1,`rgba(${N},${w},${I},${F?.18:.07})`)),e.beginPath(),e.arc(b,R,p,0,Math.PI*2),e.fillStyle=H,e.fill(),e.beginPath(),e.arc(b,R,p,0,Math.PI*2),X?(e.strokeStyle=`rgba(${N},${w},${I},0.08)`,e.lineWidth=.5):F?(e.strokeStyle=`rgba(${N},${w},${I},0.9)`,e.lineWidth=2.5):(e.strokeStyle=`rgba(${N},${w},${I},0.4)`,e.lineWidth=1),e.stroke(),oe&&(e.beginPath(),e.arc(b,R,p+5,0,Math.PI*2),e.setLineDash([4,4]),e.lineDashOffset=-M*.3,e.strokeStyle=`rgba(${N},${w},${I},0.4)`,e.lineWidth=1,e.stroke(),e.setLineDash([]));const ie=a.facts.length>=3;if(!X&&(F||te&&ee.has(a.id)||m.zoom>=1.3||m.zoom>=.8&&ie)){const xe=m.zoom>1?20:12,he=a.label.length>xe?a.label.slice(0,xe-1)+"…":a.label,U=Math.max(9,11*m.zoom);e.font=`600 ${U}px "Inter", system-ui, sans-serif`;const pe=e.measureText(he).width+8;if(e.fillStyle="rgba(9,9,11,0.75)",e.beginPath(),e.roundRect(b-pe/2,R-U/2-1,pe,U+2,3),e.fill(),e.fillStyle=F?"#fafafa":"#a1a1aa",e.textAlign="center",e.textBaseline="middle",e.fillText(he,b,R),m.zoom>.7){const Ne=Math.max(7,8*m.zoom);e.font=`500 ${Ne}px "Inter", system-ui, sans-serif`,e.fillStyle=`rgba(${N},${w},${I},${F?.9:.5})`,e.fillText(a.type,b,R+p+Math.max(9,11*m.zoom))}}}de.current=requestAnimationFrame(y)};return de.current=requestAnimationFrame(y),()=>cancelAnimationFrame(de.current)},[_,T,h,d]),j.useEffect(()=>{const t=ne.current;if(!t||!_.nodes.length)return;const e=O.current,s=(f,y)=>{const M=t.getBoundingClientRect(),m=f-M.left,B=y-M.top;for(const E of[..._.nodes].reverse()){const ae=Math.max(8,Math.min(24,E.size||12))*e.zoom,ue=E.x*e.zoom+e.x,ee=E.y*e.zoom+e.y,D=m-ue,te=B-ee;if(D*D+te*te<=(ae+6)*(ae+6))return E}return null},c=f=>{f.preventDefault();const y=t.getBoundingClientRect(),M=f.clientX-y.left,m=f.clientY-y.top,B=e.zoom,E=f.deltaY>0?.92:1.08;e.zoom=Math.max(.2,Math.min(4,e.zoom*E)),e.x=M-(M-e.x)*(e.zoom/B),e.y=m-(m-e.y)*(e.zoom/B),k(ae=>ae)},r=f=>{e.dragging=!0,e.startX=f.clientX-e.x,e.startY=f.clientY-e.y,t.style.cursor="grabbing"},i=f=>{if(e.dragging)e.x=f.clientX-e.startX,e.y=f.clientY-e.startY,k(y=>y);else{const y=s(f.clientX,f.clientY);k((y==null?void 0:y.id)??null),t.style.cursor=y?"pointer":"grab"}},x=()=>{e.dragging=!1,t.style.cursor="grab"},L=f=>{if(e.dragging)return;const y=s(f.clientX,f.clientY);C(M=>(M==null?void 0:M.id)===(y==null?void 0:y.id)?null:y??null)};return t.addEventListener("wheel",c,{passive:!1}),t.addEventListener("mousedown",r),t.addEventListener("mousemove",i),t.addEventListener("mouseup",x),t.addEventListener("mouseleave",x),t.addEventListener("click",L),()=>{t.removeEventListener("wheel",c),t.removeEventListener("mousedown",r),t.removeEventListener("mousemove",i),t.removeEventListener("mouseup",x),t.removeEventListener("mouseleave",x),t.removeEventListener("click",L)}},[_]);const l=j.useMemo(()=>{var e;if(!n)return[];const t=new Map;for(const s of n.nodes){const c=((e=s.type)==null?void 0:e.toLowerCase())??"unknown";t.set(c,(t.get(c)??0)+1)}return[...t.entries()].sort((s,c)=>c[1]-s[1]).map(([s,c])=>({type:s,count:c}))},[n]);if(z)return o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"h-12 animate-pulse rounded-xl bg-bg-secondary"}),o.jsx("div",{className:"animate-pulse rounded-xl border border-border bg-bg",style:{height:"60vh",minHeight:400}})]});const u=n&&n.nodes.length>0;return o.jsxs("div",{className:"space-y-4",ref:fe,children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10",children:o.jsx(ve,{className:"h-4 w-4 text-accent-hover"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-text",children:"Memory Graph"}),o.jsx("p",{className:"text-xs text-text-muted",children:"Temporal knowledge graph powered by entity extraction"})]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[u&&o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>V(1.2),className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Zoom in",children:o.jsx(Pe,{className:"h-4 w-4"})}),o.jsx("button",{onClick:()=>V(.8),className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Zoom out",children:o.jsx(Ee,{className:"h-4 w-4"})}),o.jsx("button",{onClick:J,className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Fit view",children:o.jsx(Le,{className:"h-4 w-4"})}),o.jsx("div",{className:"mx-1 h-4 w-px bg-bg-tertiary"})]}),o.jsxs("button",{onClick:K,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:[o.jsx(Ce,{className:"h-3.5 w-3.5"})," Refresh"]}),o.jsxs("button",{onClick:$,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:[o.jsx($e,{className:"h-3.5 w-3.5"})," Clear"]})]})]}),S&&o.jsx("div",{className:"rounded-xl border border-error/50 bg-error/5 p-4 text-sm text-error",children:S}),o.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Entities",value:(n==null?void 0:n.nodeCount)??0,color:"var(--color-accent-hover)"},{label:"Relationships",value:(n==null?void 0:n.edgeCount)??0,color:"var(--color-cyan)"},{label:"Episodes",value:(n==null?void 0:n.episodeCount)??0,color:"var(--color-emerald)"}].map(({label:t,value:e,color:s})=>o.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[o.jsx("p",{className:"text-xs text-text-muted",children:t}),o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("p",{className:"text-2xl font-bold",style:{color:s},children:e.toLocaleString()}),e>0&&o.jsx("div",{className:"h-1.5 w-1.5 rounded-full animate-pulse",style:{backgroundColor:s}})]})]},t))}),u&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ke,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted"}),o.jsx("input",{type:"text",value:v,onChange:t=>G(t.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"}),v&&o.jsx("button",{onClick:()=>G(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-text-muted hover:text-text",children:o.jsx(Se,{className:"h-3.5 w-3.5"})})]}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(({type:t,count:e})=>{const s=se(t),c=W.has(t);return o.jsxs("button",{onClick:()=>re(t),className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] font-medium transition-all ${c?"bg-bg-tertiary/50 text-text-muted opacity-40":"bg-bg-tertiary text-text-secondary hover:brightness-110"}`,children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:c?"var(--color-border-light)":s}}),Ie[t]??t.charAt(0).toUpperCase()+t.slice(1),o.jsx("span",{className:"text-text-muted",children:e})]},t)})})]}),u?o.jsxs("div",{className:"relative rounded-xl border border-border bg-bg overflow-hidden shadow-2xl shadow-black/50",style:{height:"60vh",minHeight:400},children:[o.jsx("canvas",{ref:ne,style:{width:"100%",height:"100%",cursor:"grab"}}),o.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(O.current.zoom*100),"%"]}),(v||W.size>0)&&o.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 ",_.nodes.length," of ",(n==null?void 0:n.nodes.length)??0," entities"]})]}):o.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:[o.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl bg-accent/10 border border-accent/20 mb-4",children:o.jsx(ve,{className:"h-7 w-7 text-accent-hover"})}),o.jsx("p",{className:"text-sm font-medium text-text-secondary",children:"No entities in the graph yet"}),o.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."})]}),h&&o.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b border-bg-tertiary px-4 py-3",children:[o.jsx("div",{className:"h-3.5 w-3.5 rounded-full shadow-lg",style:{backgroundColor:se(h.type),boxShadow:`0 0 8px ${se(h.type)}40`}}),o.jsx("span",{className:"font-semibold text-text",children:h.label}),o.jsx("span",{className:"rounded-md bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-text-secondary",children:h.type})]}),o.jsxs("div",{className:"space-y-3 p-4",children:[h.facts.length>0&&o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-text-muted",children:"Facts"}),o.jsx("div",{className:"space-y-1.5",children:h.facts.map((t,e)=>o.jsx("p",{className:"text-xs text-[#d4d4d8] pl-3 border-l-2",style:{borderColor:se(h.type)+"40"},children:t},e))})]}),n&&(()=>{const t=n.edges.filter(s=>s.from===h.id||s.to===h.id);if(!t.length)return null;const e=new Map(n.nodes.map(s=>[s.id,s]));return o.jsxs("div",{children:[o.jsxs("p",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-text-muted",children:["Relationships (",t.length,")"]}),o.jsxs("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:[t.slice(0,30).map((s,c)=>{const r=e.get(s.from===h.id?s.to:s.from),i=r?se(r.type):"#64748b";return o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsx("span",{className:"text-text-secondary",children:s.label}),o.jsx("span",{className:"text-text-muted",children:"→"}),o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:i}}),o.jsx("span",{className:"text-[#d4d4d8]",children:(r==null?void 0:r.label)??"?"})]})]},c)}),t.length>30&&o.jsxs("p",{className:"text-[10px] text-text-muted",children:["+ ",t.length-30," more"]})]})]})})()]})]})]})}export{Xe as default};
|
|
16
|
+
*/const Te=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Ee=ye("zoom-out",Te),we={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"},Ie={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"},je=["#f0abfc","#86efac","#fda4af","#7dd3fc","#d9f99d","#fcd34d"];function se(n){const g=n==null?void 0:n.toLowerCase();if(we[g])return we[g];let z=0;for(let P=0;P<((g==null?void 0:g.length)??0);P++)z=(z<<5)-z+g.charCodeAt(P)|0;return je[Math.abs(z)%je.length]}function Me(n){const g=parseInt(n.slice(1),16);return[g>>16&255,g>>8&255,g&255]}function Fe(n,g,z,P){var me,K,_;const S=n.length;if(S===0)return;const q=z/2,h=P/2,C=new Map;for(let d=0;d<S;d++){const $=((me=n[d].type)==null?void 0:me.toLowerCase())??"unknown";C.has($)||C.set($,[]),C.get($).push(d)}const T=[...C.keys()],k=new Map,v=Math.min(z,P)*.3;for(let d=0;d<T.length;d++){const $=d/T.length*Math.PI*2-Math.PI/2;k.set(T[d],{x:q+Math.cos($)*v,y:h+Math.sin($)*v})}for(let d=0;d<S;d++){const $=n[d];if($.x!==void 0)continue;const V=k.get(((K=$.type)==null?void 0:K.toLowerCase())??"unknown")??{x:q,y:h},J=Math.min(z,P)*.12;$.x=V.x+(Math.random()-.5)*J,$.y=V.y+(Math.random()-.5)*J,$.vx=0,$.vy=0}const G=new Map(n.map(d=>[d.id,d])),W=Math.sqrt(S/50),le=Math.min(200,Math.max(80,Math.round(60+S*.2))),ne=4e3*W,fe=.003/W,O=.003/W,de=.015,Y=new Map;for(const d of g)Y.has(d.from)||Y.set(d.from,new Set),Y.has(d.to)||Y.set(d.to,new Set),Y.get(d.from).add(d.to),Y.get(d.to).add(d.from);for(let d=0;d<le;d++){const $=.9-d/le*.35,V=d/le;if(S>200)for(let l=0;l<S;l++){const u=n[l],t=Y.get(u.id)??new Set;for(let e=l+1;e<S;e++){if(!t.has(n[e].id)&&Math.random()>.2)continue;const s=n[e];let c=u.x-s.x,r=u.y-s.y;const i=c*c+r*r,x=Math.sqrt(i)||1,L=ne/(i+100),f=c/x*L,y=r/x*L;u.vx+=f,u.vy+=y,s.vx-=f,s.vy-=y}}else for(let l=0;l<S;l++)for(let u=l+1;u<S;u++){const t=n[l],e=n[u];let s=t.x-e.x,c=t.y-e.y;const r=s*s+c*c,i=Math.sqrt(r)||1,x=ne/(r+100),L=s/i*x,f=c/i*x;t.vx+=L,t.vy+=f,e.vx-=L,e.vy-=f}for(const l of g){const u=G.get(l.from),t=G.get(l.to);if(!u||!t)continue;const e=t.x-u.x,s=t.y-u.y,c=Math.sqrt(e*e+s*s)||1,r=c*fe,i=e/c*r,x=s/c*r;u.vx+=i,u.vy+=x,t.vx-=i,t.vy-=x}const J=de*(1-V*.5);for(const l of n){const u=k.get(((_=l.type)==null?void 0:_.toLowerCase())??"unknown");u&&(l.vx+=(u.x-l.x)*J,l.vy+=(u.y-l.y)*J)}for(const l of n)l.vx+=(q-l.x)*O,l.vy+=(h-l.y)*O;const re=40;for(const l of n)l.vx*=$,l.vy*=$,l.x+=l.vx,l.y+=l.vy,l.x=Math.max(re,Math.min(z-re,l.x)),l.y=Math.max(re,Math.min(P-re,l.y))}}function Ae(n,g,z,P,S){const q=(n+z)/2,h=(g+P)/2,C=z-n,k=-(P-g),v=C,G=Math.sqrt(k*k+v*v)||1;return{cx:q+k/G*S,cy:h+v/G*S}}function qe(n,g,z,P,S,q,h){const C=Math.atan2(z-S,g-P),T=8,k=g-Math.cos(C)*q,v=z-Math.sin(C)*q;n.beginPath(),n.moveTo(k,v),n.lineTo(k-Math.cos(C-Math.PI/6)*T,v-Math.sin(C-Math.PI/6)*T),n.lineTo(k-Math.cos(C)*T*.5,v-Math.sin(C)*T*.5),n.lineTo(k-Math.cos(C+Math.PI/6)*T,v-Math.sin(C+Math.PI/6)*T),n.closePath(),n.fillStyle=h,n.fill()}function Ge(){const[n,g]=j.useState(null),[z,P]=j.useState(!0),[S,q]=j.useState(null),[h,C]=j.useState(null),[T,k]=j.useState(null),[v,G]=j.useState(""),[W,le]=j.useState(new Set),ne=j.useRef(null),fe=j.useRef(null),O=j.useRef({x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0}),de=j.useRef(0),Y=j.useRef(0),me=j.useRef(new Map),K=j.useCallback(async()=>{var t;try{const e=await be("/api/graphiti",{headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`${e.status}: ${e.statusText}`);const s=await e.json();if((t=s.nodes)!=null&&t.length){const c=fe.current,r=(c==null?void 0:c.clientWidth)??1200,i=(c==null?void 0:c.clientHeight)??600;for(const x of s.nodes){const L=me.current.get(x.id);L&&(x.x=L.x,x.y=L.y)}Fe(s.nodes,s.edges??[],r,i);for(const x of s.nodes)x.x!==void 0&&x.y!==void 0&&me.current.set(x.id,{x:x.x,y:x.y})}g(s),q(null)}catch(e){q(e instanceof Error?e.message:"Failed to load graph"),g(null)}finally{P(!1)}},[]);j.useEffect(()=>{K()},[K]);const _=j.useMemo(()=>{if(!n)return{nodes:[],edges:[]};const t=v.toLowerCase().trim();let e=n.nodes;if(W.size>0&&(e=e.filter(r=>{var i;return!W.has((i=r.type)==null?void 0:i.toLowerCase())})),t){const r=new Set;for(const i of e)(i.label.toLowerCase().includes(t)||i.facts.some(x=>x.toLowerCase().includes(t)))&&r.add(i.id);for(const i of n.edges)r.has(i.from)&&r.add(i.to),r.has(i.to)&&r.add(i.from);e=e.filter(i=>r.has(i.id))}const s=new Set(e.map(r=>r.id)),c=(n.edges??[]).filter(r=>s.has(r.from)&&s.has(r.to));return{nodes:e,edges:c}},[n,v,W]),d=j.useMemo(()=>{if(!v.trim()||!n)return null;const t=v.toLowerCase().trim(),e=n.nodes.find(s=>s.label.toLowerCase().includes(t));return(e==null?void 0:e.id)??null},[v,n]),$=async()=>{if(confirm("Clear the entire memory graph? This cannot be undone."))try{await be("/api/graphiti",{method:"DELETE"}),K(),C(null)}catch{}},V=t=>{const e=O.current;e.zoom=Math.max(.2,Math.min(4,e.zoom*t)),k(s=>s)},J=()=>{O.current={x:0,y:0,zoom:1,dragging:!1,startX:0,startY:0},k(t=>t)},re=t=>{le(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})};j.useEffect(()=>{const t=ne.current;if(!t||!_.nodes.length)return;const e=t.getContext("2d");if(!e)return;const s=window.devicePixelRatio||1,c=t.getBoundingClientRect();t.width=c.width*s,t.height=c.height*s,e.scale(s,s);const r=c.width,i=c.height,{nodes:x,edges:L}=_,f=new Map(x.map(M=>[M.id,M])),y=()=>{Y.current++;const M=Y.current,m=O.current;e.clearRect(0,0,r,i);const B=e.createRadialGradient(r/2,i/2,0,r/2,i/2,r*.7);B.addColorStop(0,"#0c0c14"),B.addColorStop(1,"#09090b"),e.fillStyle=B,e.fillRect(0,0,r,i),e.fillStyle="rgba(255,255,255,0.02)";const E=35*m.zoom,ae=(m.x%E+E)%E,ue=(m.y%E+E)%E;for(let a=ae;a<r;a+=E)for(let A=ue;A<i;A+=E)e.fillRect(a,A,1,1);for(let a=0;a<15;a++){const A=(M*.15+a*127)%r,N=(M*.1+a*173)%i,w=.02+Math.sin(M*.008+a)*.01;e.beginPath(),e.arc(A,N,1,0,Math.PI*2),e.fillStyle=`rgba(99,102,241,${w})`,e.fill()}const ee=new Set,D=(h==null?void 0:h.id)??T??d;if(D){ee.add(D);for(const a of L)a.from===D&&ee.add(a.to),a.to===D&&ee.add(a.from)}const te=D!=null;for(const a of L){const A=f.get(a.from),N=f.get(a.to);if(!A||!N)continue;const w=te&&(a.from===D||a.to===D);if(te&&!w&&x.length>100)continue;const Z=A.x*m.zoom+m.x,Q=A.y*m.zoom+m.y,p=N.x*m.zoom+m.x,b=N.y*m.zoom+m.y;if(Z<-50&&p<-50||Q<-50&&b<-50||Z>r+50&&p>r+50||Q>i+50&&b>i+50)continue;const R=L.indexOf(a),ge=15+R%3*6,{cx:oe,cy:ce}=Ae(Z,Q,p,b,ge*(R%2===0?1:-1));if(w&&(e.beginPath(),e.moveTo(Z,Q),e.quadraticCurveTo(oe,ce,p,b),e.strokeStyle="rgba(99,102,241,0.12)",e.lineWidth=5,e.stroke()),e.beginPath(),e.moveTo(Z,Q),e.quadraticCurveTo(oe,ce,p,b),w){const F=se(A.type),[X,H,ie]=Me(F);e.strokeStyle=`rgba(${X},${H},${ie},0.5)`,e.lineWidth=1.8}else e.strokeStyle="rgba(100,116,139,0.04)",e.lineWidth=.5;if(e.stroke(),w){const F=Math.max(10,Math.min(24,N.size||14))*m.zoom;qe(e,p,b,oe,ce,F+3,"rgba(148,163,184,0.6)")}if(w&&a.label&&a.label!=="co_mentioned"){const X=.25*Z+.5*oe+.25*p,H=(1-.5)*(1-.5)*Q+2*(1-.5)*.5*ce+.5*.5*b;e.font=`${Math.max(9,10*m.zoom)}px "Inter", system-ui, sans-serif`;const ie=e.measureText(a.label).width+12;e.fillStyle="rgba(15,15,25,0.85)",e.beginPath(),e.roundRect(X-ie/2,H-11,ie,18,4),e.fill(),e.strokeStyle="rgba(99,102,241,0.3)",e.lineWidth=.5,e.stroke(),e.fillStyle="var(--color-accent-light)",e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,X,H)}}for(const a of x){const A=se(a.type),[N,w,I]=Me(A),Z=Math.max(8,Math.min(24,a.size||12)),Q=Math.sin(M*.025+a.id.charCodeAt(0)*.5)*1,p=(Z+Q)*m.zoom,b=a.x*m.zoom+m.x,R=a.y*m.zoom+m.y;if(b<-p*3||R<-p*3||b>r+p*3||R>i+p*3)continue;const ge=T===a.id,oe=(h==null?void 0:h.id)===a.id,ce=d===a.id,F=ge||oe||ce,X=te&&!ee.has(a.id);if(!X){const xe=F?.2:.05+Math.sin(M*.02+a.id.charCodeAt(0))*.015,he=F?p*3.5:p*2,U=e.createRadialGradient(b,R,p*.3,b,R,he);U.addColorStop(0,`rgba(${N},${w},${I},${xe})`),U.addColorStop(.5,`rgba(${N},${w},${I},${xe*.3})`),U.addColorStop(1,`rgba(${N},${w},${I},0)`),e.fillStyle=U,e.beginPath(),e.arc(b,R,he,0,Math.PI*2),e.fill()}const H=e.createRadialGradient(b-p*.3,R-p*.35,0,b,R,p);X?(H.addColorStop(0,`rgba(${N},${w},${I},0.06)`),H.addColorStop(1,`rgba(${N},${w},${I},0.02)`)):(H.addColorStop(0,`rgba(${N},${w},${I},${F?.45:.25})`),H.addColorStop(1,`rgba(${N},${w},${I},${F?.18:.07})`)),e.beginPath(),e.arc(b,R,p,0,Math.PI*2),e.fillStyle=H,e.fill(),e.beginPath(),e.arc(b,R,p,0,Math.PI*2),X?(e.strokeStyle=`rgba(${N},${w},${I},0.08)`,e.lineWidth=.5):F?(e.strokeStyle=`rgba(${N},${w},${I},0.9)`,e.lineWidth=2.5):(e.strokeStyle=`rgba(${N},${w},${I},0.4)`,e.lineWidth=1),e.stroke(),oe&&(e.beginPath(),e.arc(b,R,p+5,0,Math.PI*2),e.setLineDash([4,4]),e.lineDashOffset=-M*.3,e.strokeStyle=`rgba(${N},${w},${I},0.4)`,e.lineWidth=1,e.stroke(),e.setLineDash([]));const ie=a.facts.length>=3;if(!X&&(F||te&&ee.has(a.id)||m.zoom>=1.3||m.zoom>=.8&&ie)){const xe=m.zoom>1?20:12,he=a.label.length>xe?a.label.slice(0,xe-1)+"…":a.label,U=Math.max(9,11*m.zoom);e.font=`600 ${U}px "Inter", system-ui, sans-serif`;const pe=e.measureText(he).width+8;if(e.fillStyle="rgba(9,9,11,0.75)",e.beginPath(),e.roundRect(b-pe/2,R-U/2-1,pe,U+2,3),e.fill(),e.fillStyle=F?"#fafafa":"#a1a1aa",e.textAlign="center",e.textBaseline="middle",e.fillText(he,b,R),m.zoom>.7){const Ne=Math.max(7,8*m.zoom);e.font=`500 ${Ne}px "Inter", system-ui, sans-serif`,e.fillStyle=`rgba(${N},${w},${I},${F?.9:.5})`,e.fillText(a.type,b,R+p+Math.max(9,11*m.zoom))}}}de.current=requestAnimationFrame(y)};return de.current=requestAnimationFrame(y),()=>cancelAnimationFrame(de.current)},[_,T,h,d]),j.useEffect(()=>{const t=ne.current;if(!t||!_.nodes.length)return;const e=O.current,s=(f,y)=>{const M=t.getBoundingClientRect(),m=f-M.left,B=y-M.top;for(const E of[..._.nodes].reverse()){const ae=Math.max(8,Math.min(24,E.size||12))*e.zoom,ue=E.x*e.zoom+e.x,ee=E.y*e.zoom+e.y,D=m-ue,te=B-ee;if(D*D+te*te<=(ae+6)*(ae+6))return E}return null},c=f=>{f.preventDefault();const y=t.getBoundingClientRect(),M=f.clientX-y.left,m=f.clientY-y.top,B=e.zoom,E=f.deltaY>0?.92:1.08;e.zoom=Math.max(.2,Math.min(4,e.zoom*E)),e.x=M-(M-e.x)*(e.zoom/B),e.y=m-(m-e.y)*(e.zoom/B),k(ae=>ae)},r=f=>{e.dragging=!0,e.startX=f.clientX-e.x,e.startY=f.clientY-e.y,t.style.cursor="grabbing"},i=f=>{if(e.dragging)e.x=f.clientX-e.startX,e.y=f.clientY-e.startY,k(y=>y);else{const y=s(f.clientX,f.clientY);k((y==null?void 0:y.id)??null),t.style.cursor=y?"pointer":"grab"}},x=()=>{e.dragging=!1,t.style.cursor="grab"},L=f=>{if(e.dragging)return;const y=s(f.clientX,f.clientY);C(M=>(M==null?void 0:M.id)===(y==null?void 0:y.id)?null:y??null)};return t.addEventListener("wheel",c,{passive:!1}),t.addEventListener("mousedown",r),t.addEventListener("mousemove",i),t.addEventListener("mouseup",x),t.addEventListener("mouseleave",x),t.addEventListener("click",L),()=>{t.removeEventListener("wheel",c),t.removeEventListener("mousedown",r),t.removeEventListener("mousemove",i),t.removeEventListener("mouseup",x),t.removeEventListener("mouseleave",x),t.removeEventListener("click",L)}},[_]);const l=j.useMemo(()=>{var e;if(!n)return[];const t=new Map;for(const s of n.nodes){const c=((e=s.type)==null?void 0:e.toLowerCase())??"unknown";t.set(c,(t.get(c)??0)+1)}return[...t.entries()].sort((s,c)=>c[1]-s[1]).map(([s,c])=>({type:s,count:c}))},[n]);if(z)return o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"h-12 animate-pulse rounded-xl bg-bg-secondary"}),o.jsx("div",{className:"animate-pulse rounded-xl border border-border bg-bg",style:{height:"60vh",minHeight:400}})]});const u=n&&n.nodes.length>0;return o.jsxs("div",{className:"space-y-4",ref:fe,children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10",children:o.jsx(ve,{className:"h-4 w-4 text-accent-hover"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-text",children:"Memory Graph"}),o.jsx("p",{className:"text-xs text-text-muted",children:"Temporal knowledge graph powered by entity extraction"})]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[u&&o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>V(1.2),className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Zoom in",children:o.jsx(Pe,{className:"h-4 w-4"})}),o.jsx("button",{onClick:()=>V(.8),className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Zoom out",children:o.jsx(Ee,{className:"h-4 w-4"})}),o.jsx("button",{onClick:J,className:"rounded-lg p-1.5 text-text-muted hover:bg-bg-tertiary hover:text-text transition-colors",title:"Fit view",children:o.jsx(Le,{className:"h-4 w-4"})}),o.jsx("div",{className:"mx-1 h-4 w-px bg-bg-tertiary"})]}),o.jsxs("button",{onClick:K,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:[o.jsx(Ce,{className:"h-3.5 w-3.5"})," Refresh"]}),o.jsxs("button",{onClick:$,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:[o.jsx(ke,{className:"h-3.5 w-3.5"})," Clear"]})]})]}),S&&o.jsx("div",{className:"rounded-xl border border-error/50 bg-error/5 p-4 text-sm text-error",children:S}),o.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Entities",value:(n==null?void 0:n.nodeCount)??0,color:"var(--color-accent-hover)"},{label:"Relationships",value:(n==null?void 0:n.edgeCount)??0,color:"var(--color-cyan)"},{label:"Episodes",value:(n==null?void 0:n.episodeCount)??0,color:"var(--color-emerald)"}].map(({label:t,value:e,color:s})=>o.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary px-4 py-3",children:[o.jsx("p",{className:"text-xs text-text-muted",children:t}),o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("p",{className:"text-2xl font-bold",style:{color:s},children:e.toLocaleString()}),e>0&&o.jsx("div",{className:"h-1.5 w-1.5 rounded-full animate-pulse",style:{backgroundColor:s}})]})]},t))}),u&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative",children:[o.jsx($e,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted"}),o.jsx("input",{type:"text",value:v,onChange:t=>G(t.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"}),v&&o.jsx("button",{onClick:()=>G(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-text-muted hover:text-text",children:o.jsx(Se,{className:"h-3.5 w-3.5"})})]}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(({type:t,count:e})=>{const s=se(t),c=W.has(t);return o.jsxs("button",{onClick:()=>re(t),className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] font-medium transition-all ${c?"bg-bg-tertiary/50 text-text-muted opacity-40":"bg-bg-tertiary text-text-secondary hover:brightness-110"}`,children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:c?"var(--color-border-light)":s}}),Ie[t]??t.charAt(0).toUpperCase()+t.slice(1),o.jsx("span",{className:"text-text-muted",children:e})]},t)})})]}),u?o.jsxs("div",{className:"relative rounded-xl border border-border bg-bg overflow-hidden shadow-2xl shadow-black/50",style:{height:"60vh",minHeight:400},children:[o.jsx("canvas",{ref:ne,style:{width:"100%",height:"100%",cursor:"grab"}}),o.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(O.current.zoom*100),"%"]}),(v||W.size>0)&&o.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 ",_.nodes.length," of ",(n==null?void 0:n.nodes.length)??0," entities"]})]}):o.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:[o.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl bg-accent/10 border border-accent/20 mb-4",children:o.jsx(ve,{className:"h-7 w-7 text-accent-hover"})}),o.jsx("p",{className:"text-sm font-medium text-text-secondary",children:"No entities in the graph yet"}),o.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."})]}),h&&o.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b border-bg-tertiary px-4 py-3",children:[o.jsx("div",{className:"h-3.5 w-3.5 rounded-full shadow-lg",style:{backgroundColor:se(h.type),boxShadow:`0 0 8px ${se(h.type)}40`}}),o.jsx("span",{className:"font-semibold text-text",children:h.label}),o.jsx("span",{className:"rounded-md bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-text-secondary",children:h.type})]}),o.jsxs("div",{className:"space-y-3 p-4",children:[h.facts.length>0&&o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-text-muted",children:"Facts"}),o.jsx("div",{className:"space-y-1.5",children:h.facts.map((t,e)=>o.jsx("p",{className:"text-xs text-[#d4d4d8] pl-3 border-l-2",style:{borderColor:se(h.type)+"40"},children:t},e))})]}),n&&(()=>{const t=n.edges.filter(s=>s.from===h.id||s.to===h.id);if(!t.length)return null;const e=new Map(n.nodes.map(s=>[s.id,s]));return o.jsxs("div",{children:[o.jsxs("p",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-text-muted",children:["Relationships (",t.length,")"]}),o.jsxs("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:[t.slice(0,30).map((s,c)=>{const r=e.get(s.from===h.id?s.to:s.from),i=r?se(r.type):"#64748b";return o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsx("span",{className:"text-text-secondary",children:s.label}),o.jsx("span",{className:"text-text-muted",children:"→"}),o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:i}}),o.jsx("span",{className:"text-[#d4d4d8]",children:(r==null?void 0:r.label)??"?"})]})]},c)}),t.length>30&&o.jsxs("p",{className:"text-[10px] text-text-muted",children:["+ ",t.length-30," more"]})]})]})})()]})]})]})}export{Ge as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as g,r as n,b as h,j as e}from"./index-DzwowwSI.js";import{P as u}from"./PageHeader-CnZtP8ek.js";import{A as v}from"./arrow-left-5chqas7J.js";import{C as w}from"./clock-CTsgP_Sn.js";import{S as k}from"./search-0hXTwEZR.js";import{B as S}from"./TitanCanvas-BCbWnLMd.js";import"./chevron-right-aQEw2mUW.js";import"./chevron-up-C5g6pEj8.js";import"./plus-Csu2v9GN.js";import"./users-dZgv4ePG.js";import"./wrench-CDz3xYve.js";import"./network-DbGDAdrn.js";import"./terminal-BtiqJ628.js";import"./save-Btx-kpoW.js";import"./rotate-ccw-Co-_W04j.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./chevron-down-D7OLjvuD.js";import"./folder-DA43TRCm.js";import"./check-Bpm1IONe.js";import"./shield-check-DjBJXZUr.js";import"./external-link-BZ0y_Ahx.js";import"./loader-circle-1YOBsoQp.js";/**
|
|
2
|
+
* @license lucide-react v0.513.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const C=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],M=g("link",C);/**
|
|
7
|
+
* @license lucide-react v0.513.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const L=[["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"}]],A=g("tag",L),E={person:"var(--color-accent-hover)",topic:"var(--color-cyan)",project:"var(--color-emerald)",place:"#fbbf24",company:"#facc15",technology:"#2dd4bf",event:"#fb7185"};function i(a){return E[a==null?void 0:a.toLowerCase()]??"#94a3b8"}function b(a){const l=Math.floor((Date.now()-new Date(a).getTime())/1e3);return l<60?"just now":l<3600?`${Math.floor(l/60)}m ago`:l<86400?`${Math.floor(l/3600)}h ago`:`${Math.floor(l/86400)}d ago`}function ee(){const[a,l]=n.useState([]),[s,d]=n.useState(null),[f,j]=n.useState(!0),[o,y]=n.useState(""),[c,N]=n.useState(""),x=n.useCallback(async()=>{try{const t=new URLSearchParams;o&&t.set("q",o),c&&t.set("type",c);const r=await h(`/api/wiki/entities?${t}`);r.ok&&l(await r.json())}catch{}finally{j(!1)}},[o,c]),m=async t=>{try{const r=await h(`/api/wiki/entity/${encodeURIComponent(t)}`);r.ok&&d(await r.json())}catch{}};n.useEffect(()=>{x()},[x]);const p=[...new Set(a.map(t=>t.type))].sort();return s?e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:s.name,breadcrumbs:[{label:"Memory"},{label:"Wiki",href:"/memory-wiki"},{label:s.name}],actions:e.jsxs("button",{onClick:()=>d(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:[e.jsx(v,{className:"h-3.5 w-3.5"})," Back to list"]})}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"h-4 w-4 rounded-full",style:{backgroundColor:i(s.type),boxShadow:`0 0 10px ${i(s.type)}50`}}),e.jsx("h2",{className:"text-xl font-bold text-text",children:s.name}),e.jsx("span",{className:"rounded-md bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-text-secondary",children:s.type})]}),s.summary&&e.jsx("p",{className:"text-sm text-text-secondary mb-2",children:s.summary}),s.aliases.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(A,{className:"h-3 w-3"})," Also known as: ",s.aliases.join(", ")]}),e.jsxs("div",{className:"flex gap-4 mt-3 text-[10px] text-text-muted",children:[e.jsxs("span",{children:["First seen: ",new Date(s.firstSeen).toLocaleDateString()]}),e.jsxs("span",{children:["Last seen: ",b(s.lastSeen)]})]})]}),s.facts.length>0&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:["Facts (",s.facts.length,")"]}),e.jsx("div",{className:"space-y-2",children:s.facts.map((t,r)=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"text-accent mt-0.5",children:"•"}),e.jsx("span",{className:"text-text-secondary",children:t})]},r))})]}),s.related.length>0&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:[e.jsx(M,{className:"h-3 w-3 inline mr-1"})," Related (",s.related.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.related.map(t=>e.jsxs("button",{onClick:()=>m(t.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:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:i(t.type)}}),e.jsx("span",{className:"text-text",children:t.name}),e.jsxs("span",{className:"text-text-muted",children:["(",t.relation,")"]})]},t.id))})]}),s.episodes.length>0&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:[e.jsx(w,{className:"h-3 w-3 inline mr-1"})," Episode History (",s.episodes.length,")"]}),e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:s.episodes.map(t=>e.jsxs("div",{className:"border-l-2 border-border pl-3 py-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-muted mb-0.5",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleString()}),e.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:t.source})]}),e.jsx("p",{className:"text-xs text-text-secondary",children:t.content})]},t.id))})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:"Memory Wiki",breadcrumbs:[{label:"Memory"},{label:"Wiki"}]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(k,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted"}),e.jsx("input",{type:"text",value:o,onChange:t=>y(t.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"})]}),e.jsxs("select",{value:c,onChange:t=>N(t.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:[e.jsx("option",{value:"",children:"All types"}),p.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),e.jsxs("div",{className:"flex gap-3 text-xs text-text-muted",children:[e.jsxs("span",{children:[a.length," entities"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[p.length," types"]})]}),f?e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:9}).map((t,r)=>e.jsx("div",{className:"h-24 animate-pulse rounded-xl border border-border bg-bg-secondary"},r))}):e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[a.map(t=>e.jsxs("button",{onClick:()=>m(t.name),className:"rounded-xl border border-border bg-bg-secondary p-4 text-left hover:border-accent transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:i(t.type)}}),e.jsx("span",{className:"font-medium text-sm text-text truncate",children:t.name})]}),e.jsx("p",{className:"text-xs text-text-secondary line-clamp-2 mb-2",children:t.summary||"No summary"}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-text-muted",children:[e.jsx("span",{className:"capitalize",children:t.type}),e.jsxs("span",{children:[t.factCount," facts"]}),e.jsx("span",{children:b(t.lastSeen)})]})]},t.id)),a.length===0&&e.jsxs("div",{className:"col-span-full py-12 text-center",children:[e.jsx(S,{className:"h-8 w-8 text-text-muted mx-auto mb-2"}),e.jsx("p",{className:"text-text-muted",children:"No entities found"})]})]})]})}export{ee as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as l,r as n,j as e,
|
|
1
|
+
import{c as l,r as n,j as e,aF as y,aG as j,aH as N,aI as f,aJ as k}from"./index-DzwowwSI.js";import{D as v}from"./DataTable-CH7IYJJh.js";import{R as w}from"./terminal-BtiqJ628.js";import{S as P}from"./shield-check-DjBJXZUr.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{c as l,r as n,j as e,ar as y,as as j,at as N,au as f,av as k}from"./index
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const S=[["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"}]],E=l("unplug",S);function L(){const[d,i]=n.useState([]),[o,x]=n.useState([]),[m,h]=n.useState(!0),[c,a]=n.useState(null),r=async()=>{try{const[s,t]=await Promise.all([y(),j()]);i(s),x(t),a(null)}catch(s){a(s instanceof Error?s.message:"Failed to fetch mesh data")}finally{h(!1)}};n.useEffect(()=>{r()},[]);const p=async s=>{try{await N(s),await r()}catch(t){a(t instanceof Error?t.message:"Failed to approve peer")}},g=async s=>{try{await f(s),await r()}catch(t){a(t instanceof Error?t.message:"Failed to reject peer")}},u=async s=>{try{await k(s),await r()}catch(t){a(t instanceof Error?t.message:"Failed to revoke peer")}},b=[{key:"nodeId",header:"Node ID",render:s=>e.jsx("span",{className:"font-mono text-xs",children:s.nodeId})},{key:"url",header:"URL"},{key:"status",header:"Status",render:s=>e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-success"}),e.jsx("span",{className:"capitalize",children:s.status})]})},{key:"connectedAt",header:"Connected At",render:s=>s.connectedAt?e.jsx("span",{children:new Date(s.connectedAt).toLocaleString()}):e.jsx("span",{className:"text-text-muted",children:"-"})},{key:"_actions",header:"",className:"w-16",render:s=>e.jsx("button",{onClick:t=>{t.stopPropagation(),u(s.id)},className:"rounded-md p-1.5 text-error transition-colors hover:bg-bg-tertiary",title:"Revoke peer",children:e.jsx(E,{className:"h-4 w-4"})})}];return m?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"}),e.jsx("div",{className:"h-48 animate-pulse rounded-xl border border-border bg-bg-secondary"})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-text",children:"Mesh Network"}),e.jsx("button",{onClick:r,className:"rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(w,{className:"h-4 w-4"})})]}),c&&e.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:c}),e.jsxs("div",{children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium text-text-secondary",children:["Pending Requests (",o.length,")"]}),o.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-bg-secondary p-6 text-center text-text-muted",children:"No pending requests"}):e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:o.map(s=>e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsx("p",{className:"font-mono text-sm text-text",children:s.nodeId}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:s.url}),s.name&&e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:s.name}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsxs("button",{onClick:()=>p(s.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:[e.jsx(P,{className:"h-3.5 w-3.5"}),"Approve"]}),e.jsxs("button",{onClick:()=>g(s.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:[e.jsx(R,{className:"h-3.5 w-3.5"}),"Reject"]})]})]},s.id))})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium text-text-secondary",children:["Connected Peers (",d.length,")"]}),e.jsx(v,{columns:b,data:d,emptyMessage:"No connected peers"})]})]})}export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as e,l as m}from"./index-DzwowwSI.js";import{A as x,m as n}from"./proxy-DxS2_9D7.js";const b={sm:"max-w-sm",md:"max-w-lg",lg:"max-w-2xl"};function u({open:s,onClose:a,title:i,children:c,footer:r,size:l="md"}){const t=d.useCallback(o=>{o.key==="Escape"&&a()},[a]);return d.useEffect(()=>{if(s)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s,t]),e.jsx(x,{children:s&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",children:[e.jsx(n.div,{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15}}),e.jsxs(n.div,{className:m("relative w-full mx-4 rounded-xl border border-border bg-bg-secondary shadow-2xl",b[l]),initial:{opacity:0,y:-16,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-16,scale:.97},transition:{duration:.2,ease:"easeOut"},children:[i&&e.jsx("div",{className:"border-b border-border px-5 py-4",children:e.jsx("h2",{className:"text-base font-semibold text-text",children:i})}),e.jsx("div",{className:"px-5 py-4",children:c}),r&&e.jsx("div",{className:"flex items-center justify-end gap-2 border-t border-border px-5 py-3",children:r})]})]})})}export{u as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as c,b as y,j as e,C as U,e as K,Z as O,A as E,d as B,a4 as G,ad as T}from"./index-DzwowwSI.js";import{R as D}from"./terminal-BtiqJ628.js";import{S as L}from"./save-Btx-kpoW.js";import{C as V}from"./circle-check-big-fPhEdP88.js";import{E as $}from"./external-link-BZ0y_Ahx.js";import{S as M}from"./search-0hXTwEZR.js";import{E as F}from"./eye-off-BmJF0YYx.js";import{E as H}from"./TitanCanvas-BCbWnLMd.js";import"./chevron-up-C5g6pEj8.js";import"./plus-Csu2v9GN.js";import"./users-dZgv4ePG.js";import"./wrench-CDz3xYve.js";import"./network-DbGDAdrn.js";import"./rotate-ccw-Co-_W04j.js";import"./send-TEpapzQR.js";import"./VoiceOverlay-D-gc58b0.js";import"./chevron-right-aQEw2mUW.js";import"./chevron-down-D7OLjvuD.js";import"./folder-DA43TRCm.js";import"./clock-CTsgP_Sn.js";import"./check-Bpm1IONe.js";import"./shield-check-DjBJXZUr.js";import"./loader-circle-1YOBsoQp.js";const _={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 f({status:s}){const l={unknown:"bg-border-light",checking:"bg-[#eab308] animate-pulse",healthy:"bg-success",unhealthy:"bg-error"},d={unknown:"Not checked",checking:"Checking...",healthy:"Healthy",unhealthy:"Unreachable"};return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-text-muted",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${l[s]}`}),d[s]]})}function v({title:s,description:l,icon:d,enabled:i,onToggle:h,children:p}){return e.jsxs("div",{className:`rounded-xl border bg-bg-secondary transition-colors ${i?"border-[#76b900]/30":"border-bg-tertiary"}`,children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-9 w-9 items-center justify-center rounded-lg ${i?"bg-nvidia/15":"bg-bg-tertiary"}`,children:e.jsx(d,{className:`h-4.5 w-4.5 ${i?"text-nvidia":"text-text-muted"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:l})]})]}),e.jsx("button",{onClick:h,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${i?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${i?"translate-x-6":"translate-x-1"}`})})]}),i&&e.jsx("div",{className:"border-t border-bg-tertiary px-5 py-4 space-y-3",children:p})]})}function u({id:s,label:l,value:d,onChange:i,placeholder:h,type:p="text",secret:x=!1}){const[m,b]=c.useState(!1);return e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:l}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:s,name:s,type:x&&!m?"password":p,value:d,onChange:n=>i(n.target.value),placeholder:h,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"}),x&&e.jsx("button",{type:"button",onClick:()=>b(!m),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:m?e.jsx(F,{className:"h-4 w-4"}):e.jsx(H,{className:"h-4 w-4"})})]})]})}function ue(){const[s,l]=c.useState(_),[d,i]=c.useState(!0),[h,p]=c.useState(!1),[x,m]=c.useState(null),[b,n]=c.useState({cuopt:"unknown",asr:"unknown",nim:"unknown"}),[g,j]=c.useState(!1),N=c.useCallback((t,a)=>{m({type:t,message:a}),setTimeout(()=>m(null),3e3)},[]);c.useEffect(()=>{(async()=>{var a,o,w,S,k,A,I,C;try{const r=await G();r.nvidia&&(l({enabled:r.nvidia.enabled??!1,apiKey:"",cuopt:{enabled:((a=r.nvidia.cuopt)==null?void 0:a.enabled)??!1,url:((o=r.nvidia.cuopt)==null?void 0:o.url)??"http://localhost:5000"},asr:{enabled:((w=r.nvidia.asr)==null?void 0:w.enabled)??!1,grpcUrl:((S=r.nvidia.asr)==null?void 0:S.grpcUrl)??"localhost:50051",healthUrl:((k=r.nvidia.asr)==null?void 0:k.healthUrl)??"http://localhost:9000"},openshell:{enabled:((A=r.nvidia.openshell)==null?void 0:A.enabled)??!1,binaryPath:((I=r.nvidia.openshell)==null?void 0:I.binaryPath)??"openshell",policyPath:((C=r.nvidia.openshell)==null?void 0:C.policyPath)??""}}),j(r.nvidia.apiKeySet??!1))}catch{}finally{i(!1)}})()},[]);const P=c.useCallback(async()=>{if(s.cuopt.enabled){n(t=>({...t,cuopt:"checking"}));try{const a=await(await y("/api/nvidia/health/cuopt")).json();n(o=>({...o,cuopt:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,cuopt:"unhealthy"}))}}if(s.asr.enabled){n(t=>({...t,asr:"checking"}));try{const a=await(await y("/api/nvidia/health/asr")).json();n(o=>({...o,asr:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,asr:"unhealthy"}))}}if(g||s.apiKey){n(t=>({...t,nim:"checking"}));try{const a=await(await y("/api/nvidia/health/nim")).json();n(o=>({...o,nim:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,nim:"unhealthy"}))}}},[s.cuopt.enabled,s.asr.enabled,g,s.apiKey]),R=async()=>{p(!0);try{const t={nvidia:{enabled:s.enabled,cuopt:s.cuopt,asr:s.asr,openshell:s.openshell}};s.apiKey&&(t.nvidia.apiKey=s.apiKey),await T(t),N("success","NVIDIA configuration saved"),s.apiKey&&(j(!0),l(a=>({...a,apiKey:""})))}catch(t){N("error",t instanceof Error?t.message:"Failed to save")}finally{p(!1)}};return d?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((t,a)=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},a))}):e.jsxs("div",{className:"space-y-6 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-nvidia/15",children:e.jsx(U,{className:"h-5 w-5 text-nvidia"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"NVIDIA"}),e.jsx("p",{className:"text-xs text-text-muted",children:"GPU-accelerated AI services — NIM, cuOpt, Nemotron-ASR, OpenShell"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:P,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:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Check Health"]}),e.jsxs("button",{onClick:R,disabled:h,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:[e.jsx(L,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save"]})]})]}),x&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${x.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[x.type==="success"?e.jsx(V,{className:"h-4 w-4"}):e.jsx(K,{className:"h-4 w-4"}),x.message]}),e.jsx("div",{className:`rounded-xl border p-5 transition-colors ${s.enabled?"border-[#76b900]/30 bg-nvidia/5":"border-bg-tertiary bg-bg-secondary"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-medium text-text",children:"Enable NVIDIA Skills"}),e.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 ",e.jsx("code",{className:"text-nvidia/70 bg-nvidia/10 px-1 rounded",children:"TITAN_NVIDIA=1"})]})]}),e.jsx("button",{onClick:()=>l(t=>({...t,enabled:!t.enabled})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s.enabled?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${s.enabled?"translate-x-6":"translate-x-1"}`})})]})}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{className:"h-4 w-4 text-nvidia"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"NVIDIA NIM API"}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:"Cloud inference for Nemotron 3 Super and other NIM models"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{status:b.nim}),g&&e.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:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Key configured"]})]})]}),e.jsx(u,{id:"nvidia-api-key",label:"API Key",value:s.apiKey,onChange:t=>l(a=>({...a,apiKey:t})),placeholder:g?"(configured — enter new key to replace)":"nvapi-...",secret:!0}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Get your key at"," ",e.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 ",e.jsx($,{className:"h-2.5 w-2.5"})]})]})]}),e.jsxs(v,{title:"cuOpt Optimization",description:"GPU-accelerated routing, scheduling, and mathematical programming (MILP/LP/QP)",icon:E,enabled:s.cuopt.enabled,onToggle:()=>l(t=>({...t,cuopt:{...t.cuopt,enabled:!t.cuopt.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(f,{status:b.cuopt})]}),e.jsx(u,{id:"nvidia-cuopt-url",label:"cuOpt Server URL",value:s.cuopt.url,onChange:t=>l(a=>({...a,cuopt:{...a.cuopt,url:t}})),placeholder:"http://localhost:5000"}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start cuOpt: ",e.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"})]})]}),e.jsxs(v,{title:"Nemotron-ASR Streaming",description:"NVIDIA speech recognition with 24ms median finalization — replaces faster-whisper for voice chat",icon:M,enabled:s.asr.enabled,onToggle:()=>l(t=>({...t,asr:{...t.asr,enabled:!t.asr.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(f,{status:b.asr})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-asr-grpc-url",label:"gRPC Address",value:s.asr.grpcUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,grpcUrl:t}})),placeholder:"localhost:50051"}),e.jsx(u,{id:"nvidia-asr-health-url",label:"Health Check URL",value:s.asr.healthUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,healthUrl:t}})),placeholder:"http://localhost:9000"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start ASR: ",e.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"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["VRAM: ~3-4 GB. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:"STT_ENGINE=nemotron-asr"})," in voice agent env."]})]}),e.jsxs(v,{title:"OpenShell Sandbox",description:"NVIDIA secure sandbox runtime for code execution with declarative policy enforcement",icon:B,enabled:s.openshell.enabled,onToggle:()=>l(t=>({...t,openshell:{...t.openshell,enabled:!t.openshell.enabled}})),children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-openshell-binary-path",label:"Binary Path",value:s.openshell.binaryPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,binaryPath:t}})),placeholder:"openshell"}),e.jsx(u,{id:"nvidia-openshell-policy-path",label:"Policy File Path (optional)",value:s.openshell.policyPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,policyPath:t}})),placeholder:"Auto-detected"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["When enabled, code execution uses OpenShell instead of Docker. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:'sandbox.engine: "openshell"'})," in config."]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:"VRAM Budget (RTX 5090, 32 GB)"}),e.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:t,vram:a,note:o})=>e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-text",children:t}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2",children:o})]}),e.jsx("span",{className:"text-xs font-mono text-nvidia",children:a})]},t)),e.jsx("div",{className:"border-t border-bg-tertiary pt-2 mt-2",children:e.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)."})})]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-2",children:"Quick Start"}),e.jsxs("div",{className:"space-y-2 text-xs text-text-muted",children:[e.jsx("p",{children:"Start all NVIDIA services:"}),e.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"}),e.jsx("p",{className:"mt-2",children:"Or start individual services:"}),e.jsxs("div",{className:"space-y-1 font-mono text-[10px] text-text-muted",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"cuopt:"})," --profile cuopt"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"asr:"})," --profile asr (includes Riva bridge)"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"voice:"})," --profile voice (ASR + bridge)"]})]})]})]})]})}export{ue as default};
|