titan-agent 5.0.2 → 5.0.3
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/dist/agent/agent.js +48 -3
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/agentLoop.js +83 -5
- package/dist/agent/agentLoop.js.map +1 -1
- package/dist/agent/commandPost.js +1 -1
- 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/missionDriver.js +1 -1
- package/dist/agent/missionDriver.js.map +1 -1
- package/dist/agent/promptBudget.js +85 -0
- package/dist/agent/promptBudget.js.map +1 -0
- package/dist/agent/structuredSpawn.js +1 -1
- package/dist/agent/structuredSpawn.js.map +1 -1
- package/dist/agent/subtaskTaxonomy.js +1 -1
- package/dist/agent/subtaskTaxonomy.js.map +1 -1
- package/dist/agent/systemPromptParts.js +10 -1
- package/dist/agent/systemPromptParts.js.map +1 -1
- package/dist/agent/toolRunner.js +16 -0
- package/dist/agent/toolRunner.js.map +1 -1
- package/dist/agent/toolSearch.js +4 -1
- package/dist/agent/toolSearch.js.map +1 -1
- package/dist/analytics/bugReports.js +1 -1
- package/dist/analytics/bugReports.js.map +1 -1
- package/dist/channels/messenger.js +1 -1
- package/dist/channels/messenger.js.map +1 -1
- package/dist/eval/harness.js +141 -0
- package/dist/eval/harness.js.map +1 -0
- package/dist/gateway/server.js +374 -74
- package/dist/gateway/server.js.map +1 -1
- package/dist/hooks/shellHooks.js +1 -1
- package/dist/hooks/shellHooks.js.map +1 -1
- package/dist/lib/auto-heal/repair-strategies.js.map +1 -1
- package/dist/memory/promptIncludes.js +58 -0
- package/dist/memory/promptIncludes.js.map +1 -0
- package/dist/organism/alertsStore.js +70 -0
- package/dist/organism/alertsStore.js.map +1 -0
- package/dist/plugins/memoryRetrieval.js.map +1 -1
- package/dist/providers/ollama.js +7 -7
- package/dist/providers/ollama.js.map +1 -1
- package/dist/safety/invariants.js +60 -0
- package/dist/safety/invariants.js.map +1 -0
- package/dist/safety/opusReview.js +1 -1
- package/dist/safety/opusReview.js.map +1 -1
- package/dist/security/commandScanner.js +2 -2
- package/dist/security/commandScanner.js.map +1 -1
- package/dist/security/secretGuard.js +4 -4
- package/dist/security/secretGuard.js.map +1 -1
- package/dist/skills/builtin/widget_gallery.js +28 -1
- package/dist/skills/builtin/widget_gallery.js.map +1 -1
- package/dist/skills/frontmatterLoader.js +119 -0
- package/dist/skills/frontmatterLoader.js.map +1 -0
- package/dist/skills/registry.js +20 -0
- package/dist/skills/registry.js.map +1 -1
- package/dist/testing/testHealthMonitor.js +1 -2
- package/dist/testing/testHealthMonitor.js.map +1 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/replyQuality.js +1 -1
- package/dist/utils/replyQuality.js.map +1 -1
- package/dist/utils/tokens.js +1 -1
- package/dist/utils/tokens.js.map +1 -1
- package/docs/bleeding-edge-agents-2026.md +450 -0
- package/docs/langchain-analysis.md +598 -0
- package/docs/langchain-code-analysis.md +363 -0
- package/docs/space-agent-analysis.md +300 -0
- package/package.json +1 -1
- package/ui/dist/assets/{AuditPanel-G7YA1HzV.js → AuditPanel-B84Mp16G.js} +2 -2
- package/ui/dist/assets/AutonomyPanel-DOtiTFxV.js +11 -0
- package/ui/dist/assets/{AutopilotPanel-CHRjxdh0.js → AutopilotPanel-nTb1Dnru.js} +1 -1
- package/ui/dist/assets/AutoresearchPanel-D46mX8VF.js +6 -0
- package/ui/dist/assets/BackupPanel-DGM1XXbG.js +1 -0
- package/ui/dist/assets/BrowserPanel-Cn1tTN3y.js +6 -0
- package/ui/dist/assets/{CPAgents-D5533PhK.js → CPAgents-CEraUkME.js} +1 -1
- package/ui/dist/assets/{CPDashboard-C-GgqDsI.js → CPDashboard-B_yidGAe.js} +2 -2
- package/ui/dist/assets/CPFiles-BBS8jtYH.js +1 -0
- package/ui/dist/assets/CPGoals-DL5v21TZ.js +1 -0
- package/ui/dist/assets/CPInbox-CyLQJBYF.js +11 -0
- package/ui/dist/assets/{CPSocial-mUQsrSh5.js → CPSocial-BkEtQ1Um.js} +3 -3
- package/ui/dist/assets/ChannelsPanel-CD2kHhA5.js +1 -0
- package/ui/dist/assets/CheckpointsPanel-BrUTFPu_.js +1 -0
- package/ui/dist/assets/CommandPostHub-BPPaUv1B.js +29 -0
- package/ui/dist/assets/CronPanel-CsfQctFp.js +1 -0
- package/ui/dist/assets/DaemonPanel-CNUggBbL.js +1 -0
- package/ui/dist/assets/DataTable-DuAEp_QJ.js +1 -0
- package/ui/dist/assets/{EmptyState-D60-wQrz.js → EmptyState-DFrAEZDm.js} +1 -1
- package/ui/dist/assets/EvalPanel-DEX0a5-b.js +1 -0
- package/ui/dist/assets/{FilesPanel-BNN3h_HW.js → FilesPanel-DATsiAqG.js} +1 -1
- package/ui/dist/assets/FleetPanel-QYQKqx4W.js +1 -0
- package/ui/dist/assets/{HomelabPanel-1mfhRBh6.js → HomelabPanel-DhuXd3ZD.js} +2 -2
- package/ui/dist/assets/{InfraView-Df6SFI7b.js → InfraView-eS7cpESw.js} +2 -2
- package/ui/dist/assets/InlineEditableField-zIAnW4AR.js +1 -0
- package/ui/dist/assets/{Input-DYukme8A.js → Input-bFsLI0fq.js} +1 -1
- package/ui/dist/assets/IntegrationsPanel-C_FswSRN.js +1 -0
- package/ui/dist/assets/IntelligenceView-smQ6aBwx.js +2 -0
- package/ui/dist/assets/{LearningPanel-BPx05bBu.js → LearningPanel-BEgF_iND.js} +1 -1
- package/ui/dist/assets/{LogsPanel-D3Qfp2SE.js → LogsPanel-Br1P8ST6.js} +1 -1
- package/ui/dist/assets/McpPanel-ByvQ12J_.js +1 -0
- package/ui/dist/assets/{MemoryGraphPanel-BFovwaSG.js → MemoryGraphPanel-BGOeSaET.js} +1 -1
- package/ui/dist/assets/MemoryWikiPanel-CR8btd66.js +11 -0
- package/ui/dist/assets/MeshPanel-BjkcSOMz.js +11 -0
- package/ui/dist/assets/NvidiaPanel-NYt42w7L.js +1 -0
- package/ui/dist/assets/OrganismPanel-PHvISvVn.js +1 -0
- package/ui/dist/assets/OverviewPanel-q35zdMr6.js +6 -0
- package/ui/dist/assets/{PageHeader-BdvxKoad.js → PageHeader-Cwn3OALc.js} +1 -1
- package/ui/dist/assets/PaperclipPanel-BDpQki0d.js +1 -0
- package/ui/dist/assets/{PersonasPanel-BpI6Npxv.js → PersonasPanel-DxrGW5C4.js} +1 -1
- package/ui/dist/assets/RecipesPanel-CYRdBx5u.js +1 -0
- package/ui/dist/assets/{SecurityPanel-CBDsEAFz.js → SecurityPanel-i1QMctV0.js} +1 -1
- package/ui/dist/assets/SelfImprovePanel-DbybAZWp.js +1 -0
- package/ui/dist/assets/SelfProposalsPanel-DtcTUDDd.js +2 -0
- package/ui/dist/assets/SessionsPanel-B7QmOizR.js +1 -0
- package/ui/dist/assets/SessionsTab-BdJj_vsI.js +1 -0
- package/ui/dist/assets/{SettingsPanel-BiWHsOAJ.js → SettingsPanel-DnEvJUFe.js} +1 -1
- package/ui/dist/assets/SettingsView-C39dk_yr.js +2 -0
- package/ui/dist/assets/{SkeletonLoader-CGtpZJ-7.js → SkeletonLoader-CsiR8ED9.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-Z_9jA6dU.js → SkillsPanel-DM4qBFDS.js} +1 -1
- package/ui/dist/assets/{SomaView-AP3BXqf-.js → SomaView-CWnPKEQI.js} +1 -1
- package/ui/dist/assets/{StatCard-CrnvXPg5.js → StatCard-CY8lgeWm.js} +1 -1
- package/ui/dist/assets/{StatusBadge-B6r5EWBA.js → StatusBadge-CGvKbP7R.js} +1 -1
- package/ui/dist/assets/TeamsPanel-Bf6GaUni.js +1 -0
- package/ui/dist/assets/{TelemetryPanel-D6o14H-i.js → TelemetryPanel-JZ90gJXC.js} +1 -1
- package/ui/dist/assets/TitanCanvas-Hk49NFcA.js +1092 -0
- package/ui/dist/assets/ToolsView-Cq7Fuq3i.js +2 -0
- package/ui/dist/assets/{Tooltip-DNsYGHC9.js → Tooltip-CcoZrKsl.js} +1 -1
- package/ui/dist/assets/{TraceViewer-TOpdmqLF.js → TraceViewer-ojGf0drx.js} +1 -1
- package/ui/dist/assets/TrainingPanel-CWnP4H2l.js +1 -0
- package/ui/dist/assets/{VoiceOverlay-XIyCbAP7.js → VoiceOverlay-Dn6iaYgd.js} +1 -1
- package/ui/dist/assets/VramPanel-CLd9Ggck.js +1 -0
- package/ui/dist/assets/WatchView-CQBemwsm.js +13 -0
- package/ui/dist/assets/WorkTab-BOfTN-Bd.js +1 -0
- package/ui/dist/assets/WorkflowsPanel-qzNS0p0u.js +11 -0
- package/ui/dist/assets/{arrow-left-CQF-yBIU.js → arrow-left-c-8OFZUV.js} +1 -1
- package/ui/dist/assets/{chart-column-1smg0GbX.js → chart-column-x6L66Qw7.js} +1 -1
- package/ui/dist/assets/{circle-check-big-BiMDFx6C.js → circle-check-big-WaW3U3Xl.js} +1 -1
- package/ui/dist/assets/{dollar-sign-DMYH4Q_a.js → dollar-sign-D2Oce4Ru.js} +1 -1
- package/ui/dist/assets/{download-BYFd-yl6.js → download-YvPDLlFJ.js} +1 -1
- package/ui/dist/assets/eye-off-DIMcxsdQ.js +6 -0
- package/ui/dist/assets/{funnel-pWBglhfw.js → funnel-DqD9srZu.js} +1 -1
- package/ui/dist/assets/{git-branch-Cgqic2Us.js → git-branch-0FamUEbU.js} +1 -1
- package/ui/dist/assets/index-D932CbpQ.css +1 -0
- package/ui/dist/assets/index-NatBSFxj.js +227 -0
- package/ui/dist/assets/{legacy-BHbi-Nm_.js → legacy-DOO7F5cq.js} +1 -1
- package/ui/dist/assets/{lightbulb-D_y0Mtyq.js → lightbulb-Bk6KlR6q.js} +1 -1
- package/ui/dist/assets/pause-DDC_zUiJ.js +6 -0
- package/ui/dist/assets/{play-2xR4_zUG.js → play-BPXbHToG.js} +1 -1
- package/ui/dist/assets/{plug-DhvhYYy_.js → plug-Dxp-sWVF.js} +1 -1
- package/ui/dist/assets/proxy-vU7v4NVM.js +9 -0
- package/ui/dist/assets/square-Bn_0tYME.js +6 -0
- package/ui/dist/assets/target-BrtxUtzl.js +6 -0
- package/ui/dist/assets/toggle-right-CYphlpN5.js +11 -0
- package/ui/dist/assets/{trash-2-DmRaMz9e.js → trash-2-C_Jsp23A.js} +1 -1
- package/ui/dist/assets/{trending-up-DsDcs3Jo.js → trending-up-DrtLViSm.js} +1 -1
- package/ui/dist/assets/trophy-DdRzAOfo.js +6 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/CPFiles-G7veSjMg.js +0 -6
- package/ui/dist/assets/CPGoals-C3DlKJrJ.js +0 -1
- package/ui/dist/assets/CPInbox-D10curQs.js +0 -16
- package/ui/dist/assets/ChannelsPanel-M3pO2htW.js +0 -1
- package/ui/dist/assets/CommandPostHub-CW9OY1A4.js +0 -37
- package/ui/dist/assets/InlineEditableField-CH-jR3LC.js +0 -11
- package/ui/dist/assets/IntegrationsPanel-EaN999Te.js +0 -1
- package/ui/dist/assets/IntelligenceView-Q4DBmJpJ.js +0 -2
- package/ui/dist/assets/McpPanel-zC7jTaSx.js +0 -6
- package/ui/dist/assets/MeshPanel-CqtYZ74K.js +0 -11
- package/ui/dist/assets/NvidiaPanel-BVIZFHet.js +0 -1
- package/ui/dist/assets/SelfImprovePanel-PSCYO6sx.js +0 -11
- package/ui/dist/assets/SessionsTab-Cn3dGgjX.js +0 -1
- package/ui/dist/assets/SettingsView-3BSIzAfW.js +0 -2
- package/ui/dist/assets/TitanCanvas-cnb7R1gS.js +0 -1056
- package/ui/dist/assets/ToolsView-Dp-xUWJG.js +0 -2
- package/ui/dist/assets/WorkTab-Pgq-iLz9.js +0 -1
- package/ui/dist/assets/WorkflowsPanel-B91LeW7r.js +0 -21
- package/ui/dist/assets/eye-BfW7UcEC.js +0 -11
- package/ui/dist/assets/index-BWSnB6Kr.js +0 -227
- package/ui/dist/assets/index-Dtw1pbjc.css +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkTab-BOfTN-Bd.js","assets/index-NatBSFxj.js","assets/index-D932CbpQ.css","assets/proxy-vU7v4NVM.js","assets/TitanCanvas-Hk49NFcA.js","assets/VoiceOverlay-Dn6iaYgd.js","assets/TitanCanvas-BfitWg9R.css","assets/play-BPXbHToG.js","assets/trash-2-C_Jsp23A.js","assets/pause-DDC_zUiJ.js","assets/SessionsTab-BdJj_vsI.js","assets/CPInbox-CyLQJBYF.js","assets/Input-bFsLI0fq.js","assets/PageHeader-Cwn3OALc.js","assets/EmptyState-DFrAEZDm.js","assets/SkeletonLoader-CsiR8ED9.js","assets/funnel-DqD9srZu.js","assets/square-Bn_0tYME.js","assets/CPFiles-BBS8jtYH.js","assets/TraceViewer-ojGf0drx.js","assets/trending-up-DrtLViSm.js","assets/git-branch-0FamUEbU.js","assets/chart-column-x6L66Qw7.js","assets/arrow-left-c-8OFZUV.js","assets/CPSocial-BkEtQ1Um.js","assets/lightbulb-Bk6KlR6q.js","assets/CPDashboard-B_yidGAe.js","assets/StatusBadge-CGvKbP7R.js","assets/dollar-sign-D2Oce4Ru.js","assets/target-BrtxUtzl.js","assets/CPGoals-DL5v21TZ.js","assets/InlineEditableField-zIAnW4AR.js","assets/Tooltip-CcoZrKsl.js","assets/CPAgents-CEraUkME.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as E,r as s,j as e,n as ne,k as le,f as A,h as L,A as P,T as F,o as K,p as oe,q as ce,s as ie,_,b as O,v as de,w as xe,x as ue,y as me,z as pe,B as he,D as be,E as ge,I as je}from"./index-NatBSFxj.js";import{B as q}from"./Input-bFsLI0fq.js";import{A as fe,m as G}from"./proxy-vU7v4NVM.js";import{I as $}from"./InlineEditableField-zIAnW4AR.js";import{H as ye}from"./Tooltip-CcoZrKsl.js";import{C as H}from"./VoiceOverlay-Dn6iaYgd.js";import{B as ve,W as Q,C as X,M as Y,U as Ne,F as we,T as Ce,R as ke,S as Se,P as V}from"./TitanCanvas-Hk49NFcA.js";import{P as ze}from"./pause-DDC_zUiJ.js";import{D as W}from"./dollar-sign-D2Oce4Ru.js";import{G as ee}from"./git-branch-0FamUEbU.js";import{C as te}from"./chart-column-x6L66Qw7.js";import{T as Te}from"./target-BrtxUtzl.js";import{T as se}from"./trash-2-C_Jsp23A.js";/**
|
|
3
|
+
* @license lucide-react v0.513.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const _e=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],B=E("briefcase",_e);/**
|
|
8
|
+
* @license lucide-react v0.513.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/const $e=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],U=E("building-2",$e);/**
|
|
13
|
+
* @license lucide-react v0.513.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/const Pe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],De=E("circle-stop",Pe);/**
|
|
18
|
+
* @license lucide-react v0.513.0 - ISC
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the ISC license.
|
|
21
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/const Ee=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Me=E("mail",Ee);/**
|
|
23
|
+
* @license lucide-react v0.513.0 - ISC
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the ISC license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/const Ae=[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]],ae=E("scale",Ae),Le={sm:"max-w-sm",md:"max-w-lg",lg:"max-w-2xl"};function M({open:t,onClose:l,title:a,children:m,footer:i,size:j="md"}){const p=s.useCallback(n=>{n.key==="Escape"&&l()},[l]);return s.useEffect(()=>{if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,p]),e.jsx(fe,{children:t&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",children:[e.jsx(G.div,{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:l,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15}}),e.jsxs(G.div,{className:ne("relative w-full mx-4 rounded-xl border border-border bg-bg-secondary shadow-2xl",Le[j]),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:[a&&e.jsx("div",{className:"border-b border-border px-5 py-4",children:e.jsx("h2",{className:"text-base font-semibold text-text",children:a})}),e.jsx("div",{className:"px-5 py-4",children:m}),i&&e.jsx("div",{className:"flex items-center justify-end gap-2 border-t border-border px-5 py-3",children:i})]})]})})}function re({open:t,title:l,message:a,confirmLabel:m="Confirm",cancelLabel:i="Cancel",variant:j="danger",onConfirm:p,onCancel:n}){const[g,h]=s.useState(!1),c=async()=>{h(!0);try{await p()}finally{h(!1)}};return e.jsx(M,{open:t,onClose:()=>!g&&n(),title:l,size:"sm",footer:e.jsxs(e.Fragment,{children:[e.jsx(q,{variant:"ghost",size:"sm",onClick:n,disabled:g,children:i}),e.jsx(q,{variant:j==="danger"?"danger":"primary",size:"sm",onClick:c,loading:g,children:m})]}),children:e.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:a})})}function Re(t){switch(t){case"active":return e.jsx(P,{size:12,className:"text-success animate-pulse"});case"paused":return e.jsx(ze,{size:12,className:"text-warning"});case"error":return e.jsx(F,{size:12,className:"text-error"});default:return e.jsx(ve,{size:12,className:"text-text-muted"})}}function Ie(t){switch(t){case"active":return"border-success/30 bg-success/5";case"paused":return"border-warning/30 bg-warning/5";case"error":return"border-error/30 bg-error/5";default:return"border-border bg-bg-secondary"}}function Oe({agents:t,runs:l,collapsed:a=!1,onToggle:m,onAgentClick:i}){const[j,p]=s.useState(null);return a?e.jsxs("div",{className:"w-10 border-l border-border bg-bg-secondary flex flex-col items-center py-3 gap-3 shrink-0",children:[e.jsx("button",{onClick:m,className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted",children:e.jsx(le,{size:14})}),t.map(n=>e.jsxs("button",{className:"relative",title:n.name,onClick:()=>i==null?void 0:i(n),children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-bold ${n.status==="error"?"bg-error/20 text-error":n.status==="active"?"bg-success/20 text-success":"bg-bg-tertiary text-text-muted"}`,children:n.name.charAt(0).toUpperCase()}),n.status==="active"&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-success animate-pulse"})]},n.id))]}):e.jsxs("div",{className:"w-64 border-l border-border bg-bg-secondary flex flex-col h-full shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[e.jsx("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Agents"}),e.jsx("button",{onClick:m,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted",children:e.jsx(H,{size:14})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:[t.length===0&&e.jsx("div",{className:"text-center py-4 text-xs text-text-muted",children:"No agents registered"}),t.map(n=>{var f;const g=j===n.id,h=l.filter(y=>y.agentId===n.id),c=h[0],d=h.filter(y=>y.status==="failed"||y.status==="error").length;return e.jsxs("div",{className:`rounded-lg border p-2 cursor-pointer transition-colors ${Ie(n.status)}`,onClick:y=>{y.target.closest(".expand-toggle")?p(g?null:n.id):i==null||i(n)},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center text-[10px] font-bold ${n.status==="error"?"bg-error/20 text-error":n.status==="active"?"bg-success/20 text-success":"bg-bg-tertiary text-text-muted"}`,children:n.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-medium truncate",children:n.name}),e.jsxs("div",{className:"text-[10px] text-text-muted flex items-center gap-1",children:[Re(n.status),e.jsx("span",{className:"capitalize",children:n.status}),n.model&&e.jsxs("span",{className:"truncate",children:["· ",n.model.split("/").pop()]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n.status==="active"&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),e.jsx("button",{className:"expand-toggle p-0.5 rounded hover:bg-bg-tertiary text-text-muted",onClick:y=>{y.stopPropagation(),p(g?null:n.id)},children:e.jsx(H,{size:12,className:`transition-transform ${g?"rotate-90":""}`})})]})]}),g&&e.jsxs("div",{className:"mt-2 space-y-2 border-t border-border/50 pt-2",children:[e.jsxs("div",{className:"text-[10px] text-text-muted space-y-0.5",children:[e.jsxs("div",{children:["Role: ",n.role||"general"]}),e.jsxs("div",{children:["Tasks: ",n.totalTasksCompleted??0," completed"]}),n.totalCostUsd!==void 0&&e.jsxs("div",{children:["Cost: $",n.totalCostUsd.toFixed(2)]}),d>0&&e.jsxs("div",{className:"text-error",children:[d," failed run",d===1?"":"s"]})]}),c&&e.jsxs("div",{className:"text-[10px] bg-bg rounded p-1.5 border border-border",children:[e.jsxs("div",{className:"font-medium text-text-secondary flex items-center gap-1",children:[c.status==="succeeded"?e.jsx(A,{size:10,className:"text-success"}):c.status==="failed"||c.status==="error"?e.jsx(L,{size:10,className:"text-error"}):e.jsx(P,{size:10,className:"text-cyan animate-pulse"}),"Latest run"]}),e.jsxs("div",{className:c.status==="failed"||c.status==="error"?"text-error":"text-success",children:[c.status," · ",((f=c.toolsUsed)==null?void 0:f.length)??0," tools"]}),c.error&&e.jsx("div",{className:"text-error truncate mt-0.5",children:c.error})]})]})]},n.id)})]})]})}function J(t){const l={active:"bg-success/10 text-success border-success/20",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",paused:"bg-warning/10 text-warning border-warning/20",error:"bg-error/10 text-error border-error/20",stopped:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"};return l[t]||l.idle}function I(t){const l=Math.floor((Date.now()-new Date(t).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}function Be({agent:t,onClose:l}){const[a,m]=s.useState([]),[i,j]=s.useState([]),[p,n]=s.useState(!0),[g,h]=s.useState(null),c=s.useCallback(async()=>{try{const[r,u]=await Promise.all([K(t.id,10),oe(20,void 0)]);m(r),j(u.traces||[])}catch{}n(!1)},[t.id]);s.useEffect(()=>{c();const r=setInterval(c,1e4);return()=>clearInterval(r)},[c]);const d=a[0],f=a.filter(r=>r.status==="failed"||r.status==="error"),y=a.reduce((r,u)=>r+u.toolsUsed.length,0);return e.jsx(M,{open:!0,onClose:l,size:"lg",title:t.name,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold border ${J(t.status)}`,children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border capitalize ${J(t.status)}`,children:t.status})]}),e.jsxs("div",{className:"text-[11px] text-text-muted mt-0.5",children:[t.title||t.role," · ",t.model.split("/").pop()," · heartbeat ",I(t.lastHeartbeat)," ago"]})]})]}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:[{icon:A,label:"Tasks",value:t.totalTasksCompleted,color:"text-success"},{icon:W,label:"Cost",value:`$${t.totalCostUsd.toFixed(2)}`,color:"text-warning"},{icon:Q,label:"Tools",value:y,color:"text-accent"},{icon:L,label:"Failed",value:f.length,color:f.length>0?"text-error":"text-text-muted"}].map(r=>e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg p-2.5 text-center",children:[e.jsx(r.icon,{size:14,className:`mx-auto mb-1 ${r.color}`}),e.jsx("div",{className:"text-sm font-bold text-text",children:r.value}),e.jsx("div",{className:"text-[9px] text-text-muted uppercase tracking-wider",children:r.label})]},r.label))}),t.status==="active"&&d&&d.status==="running"&&e.jsxs("div",{className:"bg-success/5 border border-success/20 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-success mb-1",children:[e.jsx(P,{size:12,className:"animate-pulse"}),e.jsx("span",{className:"font-medium",children:"Currently working"})]}),e.jsxs("div",{className:"text-[11px] text-text-secondary",children:["Run started ",I(d.startedAt)," ago · ",d.toolsUsed.length," tools used so far"]})]}),t.status==="error"&&(d==null?void 0:d.error)&&e.jsxs("div",{className:"bg-error/5 border border-error/20 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-error mb-1",children:[e.jsx(F,{size:12}),e.jsx("span",{className:"font-medium",children:"Last error"})]}),e.jsx("div",{className:"text-[11px] text-text-secondary font-mono",children:d.error})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-text-secondary",children:[e.jsx(ee,{size:12,className:"text-accent"}),"Recent Runs"]}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[a.length," total"]})]}),p?e.jsx("div",{className:"space-y-1.5",children:[1,2,3].map(r=>e.jsx("div",{className:"h-10 rounded-lg bg-bg-secondary animate-pulse"},r))}):a.length===0?e.jsx("div",{className:"text-center py-4 text-[11px] text-text-muted",children:"No runs recorded yet"}):e.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto pr-1",children:a.map(r=>e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2 rounded-lg bg-bg-secondary border border-border",children:[r.status==="succeeded"?e.jsx(A,{size:12,className:"text-success shrink-0"}):r.status==="failed"||r.status==="error"?e.jsx(L,{size:12,className:"text-error shrink-0"}):e.jsx(Ue,{size:12,className:"text-cyan animate-spin shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-[11px] text-text-secondary truncate",children:[r.source," · ",r.toolsUsed.length," tools"]}),e.jsxs("div",{className:"text-[10px] text-text-muted",children:[r.durationMs?`${r.durationMs}ms`:"..."," · ",I(r.startedAt)," ago"]})]}),r.error&&e.jsx("span",{className:"text-[10px] text-error truncate max-w-[120px]",title:r.error,children:r.error})]},r.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-text-secondary",children:[e.jsx(te,{size:12,className:"text-accent"}),"Recent Traces"]}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[i.length," loaded"]})]}),i.length===0?e.jsx("div",{className:"text-center py-4 text-[11px] text-text-muted",children:"No traces available"}):e.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto pr-1",children:i.slice(0,10).map(r=>e.jsxs("button",{onClick:()=>h(r),className:"w-full text-left px-2.5 py-2 rounded-lg bg-bg-secondary border border-border hover:bg-bg-secondary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r.status==="running"?e.jsx(P,{size:12,className:"text-cyan animate-pulse shrink-0"}):r.status==="completed"?e.jsx(A,{size:12,className:"text-success shrink-0"}):e.jsx(L,{size:12,className:"text-error shrink-0"}),e.jsx("span",{className:"text-[11px] text-text-secondary truncate flex-1",children:r.message}),e.jsx("span",{className:"text-[10px] text-text-muted shrink-0",children:r.totalMs?`${r.totalMs}ms`:"..."})]}),e.jsxs("div",{className:"flex gap-2 mt-0.5 text-[10px] text-text-muted ml-5",children:[e.jsxs("span",{children:[r.toolCalls.length," tools"]}),e.jsxs("span",{children:[r.rounds," rounds"]}),r.error&&e.jsx("span",{className:"text-error truncate",children:r.error})]})]},r.traceId))})]}),g&&e.jsx(Fe,{trace:g,onClose:()=>h(null)})]})})}function Ue({size:t,className:l}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",className:`animate-spin ${l||""}`,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",fill:"none",strokeDasharray:"31.4 31.4",opacity:"0.3"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",fill:"none"})]})}function Fe({trace:t,onClose:l}){return e.jsx(M,{open:!0,onClose:l,size:"md",title:`Trace ${t.traceId.slice(0,8)}`,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-xs text-text-secondary truncate",children:t.message}),e.jsxs("div",{className:"flex gap-3 text-[10px] text-text-muted",children:[e.jsx("span",{className:t.status==="completed"?"text-success":t.status==="failed"?"text-error":"text-cyan",children:t.status}),e.jsxs("span",{children:[t.totalMs,"ms"]}),e.jsxs("span",{children:[t.rounds," rounds"]}),t.model&&e.jsx("span",{children:t.model.split("/").pop()})]}),t.spans.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted mb-1",children:"Spans"}),e.jsx("div",{className:"space-y-1",children:t.spans.map((a,m)=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx(X,{size:10,className:"text-text-muted shrink-0"}),e.jsx("span",{className:"text-text-secondary font-mono",children:a.name}),e.jsxs("span",{className:"text-text-muted",children:[a.durationMs,"ms"]})]},m))})]}),t.toolCalls.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted mb-1",children:"Tool Calls"}),e.jsx("div",{className:"space-y-1",children:t.toolCalls.map((a,m)=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx(Q,{size:10,className:a.success?"text-success":"text-error"}),e.jsx("span",{className:"text-text-secondary font-mono",children:a.tool}),e.jsxs("span",{className:"text-text-muted",children:[a.durationMs,"ms"]}),e.jsxs("span",{className:"text-text-muted",children:["round ",a.round]})]},m))})]}),t.error&&e.jsxs("div",{className:"bg-error/5 border border-error/20 rounded-lg p-2.5",children:[e.jsx("div",{className:"text-[10px] text-error uppercase tracking-wider mb-1",children:"Error"}),e.jsx("div",{className:"text-[11px] text-text-secondary font-mono",children:t.error})]})]})})}function T({label:t}){return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin"}),e.jsxs("span",{className:"text-sm text-text-muted",children:["Loading ",t,"…"]})]})})}function Ve(t){const l=Math.floor((Date.now()-new Date(t).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}function Z({status:t}){const l={active:"bg-success/10 text-success",idle:"bg-warning/10 text-warning",running:"bg-cyan/10 text-cyan",paused:"bg-info/10 text-info",error:"bg-error/10 text-error",stopped:"bg-bg-tertiary text-text-muted",pending:"bg-warning/10 text-warning",approved:"bg-success/10 text-success",rejected:"bg-error/10 text-error",succeeded:"bg-success/10 text-success",failed:"bg-error/10 text-error",backlog:"bg-bg-tertiary text-text-muted",todo:"bg-info/10 text-info",in_progress:"bg-cyan/10 text-cyan",in_review:"bg-purple/10 text-purple-light",done:"bg-success/10 text-success",blocked:"bg-error/10 text-error",cancelled:"bg-bg-tertiary text-text-muted",critical:"bg-error/10 text-error",high:"bg-warning/10 text-warning",medium:"bg-warning/10 text-warning",low:"bg-bg-tertiary text-text-muted"},a=t||"unknown";return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium ${l[a]||"bg-bg-tertiary text-text-muted"}`,children:a.replace("_"," ")})}function D({icon:t,title:l,count:a,action:m,help:i}){return e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t,{size:14,className:"text-accent-light"}),e.jsx("h2",{className:"text-sm font-semibold text-text",children:l}),a!==void 0&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-accent/10 text-accent-light",children:a}),i&&e.jsx(ye,{title:i.title,description:i.description})]}),m]})}function We({agents:t}){const[l,a]=s.useState([]),[m,i]=s.useState([]),[j,p]=s.useState(!1),[n,g]=s.useState(""),[h,c]=s.useState(""),[d,f]=s.useState(null),y=s.useCallback(()=>{de().then(a).catch(()=>{}),xe().then(o=>i(o)).catch(()=>{})},[]);s.useEffect(()=>{y()},[y]);const r=async()=>{n.trim()&&(await me({name:n.trim(),mission:h.trim()||void 0}),g(""),c(""),p(!1),y())},u=async(o,k,z)=>{try{await pe(o,{[k]:z}),y()}catch(S){alert(`Save failed: ${S.message}`)}},x=async()=>{d&&(await he(d.id),f(null),y())},v=async(o,k,z)=>{try{await je(o,{[k]:z||void 0}),y()}catch(S){alert(`Save failed: ${S.message}`)}},C=["ceo","manager","engineer","researcher","general"];function b(o,k=0){var S;const z=((S=t.find(N=>N.id===o.id))==null?void 0:S.reportsTo)||"";return o.model&&o.model.split("/").pop(),e.jsxs("div",{className:k>0?"ml-6 border-l border-border pl-4":"",children:[e.jsxs("div",{className:"bg-bg-tertiary/30 border border-border rounded-xl p-3.5 mb-2 max-w-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("span",{className:"text-[14px] font-semibold text-text min-w-0",children:e.jsx($,{value:o.name,onSave:N=>v(o.id,"name",N),placeholder:"Agent name"})}),e.jsx(Z,{status:o.status})]}),e.jsxs("div",{className:"grid grid-cols-[72px_1fr] gap-x-3 gap-y-1.5 text-[11px]",children:[e.jsx("span",{className:"text-text-muted",children:"Title"}),e.jsx("span",{className:"text-text-secondary min-w-0",children:e.jsx($,{value:o.title||"",onSave:N=>v(o.id,"title",N),placeholder:"Add a title",emptyLabel:"—"})}),e.jsx("span",{className:"text-text-muted",children:"Role"}),e.jsx("select",{value:o.role,onChange:N=>v(o.id,"role",N.target.value),className:"bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[11px] text-text-secondary capitalize focus:outline-none focus:border-accent/30 justify-self-start",children:C.map(N=>e.jsx("option",{value:N,children:N},N))}),e.jsx("span",{className:"text-text-muted",children:"Reports to"}),e.jsxs("select",{value:z,onChange:N=>v(o.id,"reportsTo",N.target.value),className:"bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[11px] text-text-secondary focus:outline-none focus:border-accent/30 justify-self-start",children:[e.jsx("option",{value:"",children:"— nobody"}),t.filter(N=>N.id!==o.id).map(N=>e.jsx("option",{value:N.id,children:N.name},N.id))]}),e.jsx("span",{className:"text-text-muted",children:"Model"}),e.jsx("span",{className:"text-text-secondary min-w-0",children:e.jsx($,{value:o.model||"",onSave:N=>v(o.id,"model",N),placeholder:"e.g. ollama/qwen3.5:cloud",emptyLabel:"—"})})]})]}),o.reports.map(N=>b(N,k+1))]},o.id)}return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(D,{icon:U,title:"Organization Chart",count:t.length}),e.jsx("div",{className:"p-4",children:l.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(U,{size:24,className:"mx-auto mb-2 text-text/10"}),e.jsx("p",{className:"text-[12px] text-text-muted",children:"No agents in org chart yet"}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:'Spawn agents from the Agents tab, then set "Reports to" on each to build the hierarchy.'})]}):l.map(o=>b(o))})]}),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(D,{icon:B,title:"Companies",count:m.length,action:e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(V,{size:10})," New"]})}),j&&e.jsxs("div",{className:"p-4 border-b border-border bg-bg-secondary/30 space-y-2",children:[e.jsx("input",{value:n,onChange:o=>g(o.target.value),placeholder:"Company name...",className:"w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[13px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30",onKeyDown:o=>o.key==="Enter"&&r()}),e.jsx("input",{value:h,onChange:o=>c(o.target.value),placeholder:"Mission (optional)...",className:"w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[12px] text-text-secondary placeholder-white/15 focus:outline-none focus:border-accent/30"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:r,className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded-lg",children:"Create"}),e.jsx("button",{onClick:()=>p(!1),className:"px-3 py-1.5 text-[11px] text-text-muted",children:"Cancel"})]})]}),e.jsx("div",{className:"divide-y divide-border/30",children:m.length===0?e.jsx("div",{className:"py-6 text-center text-[12px] text-text-muted",children:'No companies yet — click "+ New" to create one.'}):m.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 hover:bg-bg-secondary/30 transition-colors",children:[e.jsx(B,{size:14,className:"text-accent-light flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsx("div",{className:"text-[13px] text-text font-medium",children:e.jsx($,{value:o.name,onSave:k=>u(o.id,"name",k),placeholder:"Company name"})}),e.jsx("div",{className:"text-[10px] text-text-muted",children:e.jsx($,{value:o.mission||"",onSave:k=>u(o.id,"mission",k),placeholder:"Add a mission",emptyLabel:"(no mission — click to add)"})})]}),e.jsx(Z,{status:o.status||"active"}),e.jsx("button",{onClick:()=>f({id:o.id,name:o.name}),className:"p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors",title:"Delete company",children:e.jsx(se,{size:12})})]},o.id))})]}),e.jsx(re,{open:!!d,title:`Delete company "${(d==null?void 0:d.name)||""}"?`,message:"This removes the company record. Agents and goals linked to it stay; they just lose the company association. This can't be undone.",confirmLabel:"Delete",onConfirm:x,onCancel:()=>f(null)})]})}function qe({budgets:t,onRefresh:l}){const[a,m]=s.useState(null),[i,j]=s.useState(!1),[p,n]=s.useState(null),g=async()=>{p&&(await ue(p.id),n(null),l())};return e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(D,{icon:W,title:"Budget Policies",count:t.length,action:e.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(V,{size:10})," New Budget"]})}),e.jsx("div",{className:"p-4 space-y-3",children:t.length===0?e.jsx("div",{className:"text-center py-6 text-[12px] text-text-muted",children:'No budget policies yet — click "+ New Budget" to set spending limits per agent, goal, or globally.'}):t.map(h=>{const c=h.limitUsd>0?Math.min(100,h.currentSpend/h.limitUsd*100):0,d=c>=100?"bg-error":c>=80?"bg-warning":"bg-success";return e.jsxs("div",{className:"bg-bg-tertiary/30 border border-border rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-[12px] font-medium text-text",children:h.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-text-muted capitalize",children:h.scope.type}),e.jsx("span",{className:"text-[10px] text-text-muted",children:h.period}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${h.enabled?"text-success bg-success/10":"text-text-muted bg-bg-tertiary"}`,children:h.enabled?"on":"off"}),e.jsx("button",{onClick:()=>m(h),className:"text-[10px] text-text-muted hover:text-text-secondary px-1",title:"Edit budget",children:"Edit"}),e.jsx("button",{onClick:()=>n(h),className:"p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors",title:"Delete budget",children:e.jsx(se,{size:12})})]})]}),e.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden mb-1.5",children:e.jsx("div",{className:`h-full ${d} rounded-full transition-all`,style:{width:`${c}%`}})}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted",children:[e.jsxs("span",{children:["$",h.currentSpend.toFixed(2)," spent"]}),e.jsxs("span",{children:["$",h.limitUsd.toFixed(2)," limit · action: ",h.action]})]})]},h.id)})}),(i||a)&&e.jsx(Ge,{existing:a,onClose:()=>{j(!1),m(null)},onSaved:()=>{j(!1),m(null),l()}}),e.jsx(re,{open:!!p,title:`Delete budget "${(p==null?void 0:p.name)||""}"?`,message:"The policy and its spend history are removed. Agents/goals it covered will no longer be budget-enforced unless another policy applies.",confirmLabel:"Delete",onConfirm:g,onCancel:()=>n(null)})]})}function Ge({existing:t,onClose:l,onSaved:a}){var S,N;const m=!!t,[i,j]=s.useState((t==null?void 0:t.name)||""),[p,n]=s.useState((t==null?void 0:t.scope.type)||"global"),[g,h]=s.useState((t==null?void 0:t.scope.targetId)||""),[c,d]=s.useState((t==null?void 0:t.period)||"daily"),[f,y]=s.useState(((S=t==null?void 0:t.limitUsd)==null?void 0:S.toString())||"10"),[r,u]=s.useState(((N=t==null?void 0:t.warningThresholdPercent)==null?void 0:N.toString())||"80"),[x,v]=s.useState((t==null?void 0:t.action)||"warn"),[C,b]=s.useState((t==null?void 0:t.enabled)??!0),[o,k]=s.useState(!1),z=async()=>{if(i.trim()){k(!0);try{const w={name:i.trim(),scope:{type:p,targetId:p==="global"?void 0:g||void 0},period:c,limitUsd:Number(f)||0,warningThresholdPercent:Number(r)||80,action:x,enabled:C};m&&t?await be(t.id,w):await ge(w),a()}catch(w){alert(`Save failed: ${w.message}`)}finally{k(!1)}}};return e.jsx(M,{open:!0,onClose:l,size:"md",title:m?"Edit Budget Policy":"New Budget Policy",footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:l,className:"px-3 py-1.5 text-[11px] text-text-secondary hover:text-text",children:"Cancel"}),e.jsx("button",{onClick:z,disabled:o||!i.trim(),className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50",children:o?"Saving…":m?"Save changes":"Create budget"})]}),children:e.jsxs("div",{className:"space-y-3 text-[12px]",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Name"}),e.jsx("input",{value:i,onChange:w=>j(w.target.value),placeholder:"e.g. Daily global cap",className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Scope"}),e.jsxs("select",{value:p,onChange:w=>n(w.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"global",children:"Global (all agents)"}),e.jsx("option",{value:"agent",children:"Per-agent"}),e.jsx("option",{value:"goal",children:"Per-goal"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Target ID"}),e.jsx("input",{value:g,onChange:w=>h(w.target.value),placeholder:p==="global"?"n/a":p==="agent"?"agent-id":"goal-id",disabled:p==="global",className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none disabled:opacity-40"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Period"}),e.jsxs("select",{value:c,onChange:w=>d(w.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Limit (USD)"}),e.jsx("input",{type:"number",step:"0.01",value:f,onChange:w=>y(w.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Warn at %"}),e.jsx("input",{type:"number",min:"1",max:"100",value:r,onChange:w=>u(w.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Action at limit"}),e.jsxs("select",{value:x,onChange:w=>v(w.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"warn",children:"Warn only"}),e.jsx("option",{value:"pause",children:"Pause agent"}),e.jsx("option",{value:"stop",children:"Stop agent"})]})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsxs("label",{className:"flex items-center gap-2 text-text-secondary cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:w=>b(w.target.checked),className:"accent-accent"}),e.jsx("span",{children:"Enabled"})]})})]})]})})}function He({dashboard:t}){const[l,a]=s.useState([]),[m,i]=s.useState(""),[j,p]=s.useState(!1),[n,g]=s.useState(""),[h,c]=s.useState(),d=s.useRef(null),f=s.useRef(null),y=s.useCallback(()=>{var v;const u=t,x=u.agents.map(C=>`${C.name} (${C.status}, ${C.role}, cost=$${C.totalCostUsd.toFixed(2)})`).join("; ")||"none";return`[COMMAND POST] ${u.totalAgents} agents (${u.activeAgents} active), ${u.activeCheckouts} locked tasks, budget ${Math.round(u.budgetUtilization??0)}% used, ${((v=u.goalTree)==null?void 0:v.length)??0} goals. Agents: ${x}. You manage this agent organization. Be concise.
|
|
28
|
+
|
|
29
|
+
`},[t]),r=s.useCallback(async()=>{const u=m.trim();if(!u||j)return;i(""),a(b=>[...b,{role:"user",content:u}]),p(!0),g("");const x=new AbortController;d.current=x;let v="",C=h;try{await ie(y()+u,h,b=>{b.type==="token"&&(v+=b.data,g(v)),b.type==="done"&&b.sessionId&&(C=b.sessionId)},x.signal),C&&c(C),v&&a(b=>[...b,{role:"assistant",content:v}])}catch(b){b.name!=="AbortError"&&a(o=>[...o,{role:"assistant",content:`Error: ${b.message}`}])}finally{p(!1),g(""),d.current=null}},[m,j,h,y]);return s.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[l,n]),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden flex flex-col",style:{height:400},children:[e.jsx(D,{icon:Y,title:"Console",action:j?e.jsxs("button",{onClick:()=>{var u;return(u=d.current)==null?void 0:u.abort()},className:"text-[10px] text-error flex items-center gap-1",children:[e.jsx(De,{size:12}),"Stop"]}):void 0}),e.jsxs("div",{ref:f,className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:[l.length===0&&!j&&e.jsxs("div",{className:"text-center py-6",children:[e.jsx("p",{className:"text-[11px] text-text-muted mb-3",children:"Manage your organization through natural language"}),e.jsx("div",{className:"flex flex-wrap justify-center gap-1.5",children:["Status report","Create issue: Research competitors","Spawn a research agent","Set $50/day budget"].map(u=>e.jsx("button",{onClick:()=>i(u),className:"text-[10px] text-text-muted hover:text-text-muted px-2.5 py-1 rounded-full border border-border hover:border-border-light",children:u},u))})]}),l.map((u,x)=>e.jsx("div",{className:`flex ${u.role==="user"?"justify-end":"justify-start"}`,children:e.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-xl text-[12px] leading-relaxed whitespace-pre-wrap ${u.role==="user"?"bg-accent/80 text-text rounded-br-sm":"bg-bg-tertiary text-text-secondary border border-border rounded-bl-sm"}`,children:u.content})},x)),j&&n&&e.jsx("div",{className:"flex justify-start",children:e.jsxs("div",{className:"max-w-[85%] px-3 py-2 rounded-xl rounded-bl-sm bg-bg-tertiary text-text-secondary border border-border text-[12px] whitespace-pre-wrap",children:[n,e.jsx("span",{className:"inline-block w-1 h-3.5 bg-accent-light ml-0.5 animate-pulse"})]})}),j&&!n&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"px-3 py-2 rounded-xl bg-bg-tertiary border border-border",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce"}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce",style:{animationDelay:"300ms"}})]})})})]}),e.jsx("div",{className:"px-3 py-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:m,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),r())},placeholder:"Tell Command Post what to do...",className:"flex-1 bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[12px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30"}),e.jsx("button",{onClick:r,disabled:!m.trim()||j,className:"p-2 rounded-lg bg-accent text-text hover:bg-accent-hover disabled:opacity-30",children:e.jsx(Se,{size:14})})]})})]})}function Je({onClose:t,onCreated:l}){const[a,m]=s.useState(""),[i,j]=s.useState([{role:"pragmatist",model:""},{role:"skeptic",model:""}]),[p,n]=s.useState(2),[g,h]=s.useState("judge"),[c,d]=s.useState(!1),f=()=>{i.length>=5||j([...i,{role:`participant-${i.length+1}`,model:""}])},y=x=>{i.length<=2||j(i.filter((v,C)=>C!==x))},r=(x,v)=>{j(i.map((C,b)=>b===x?{...C,...v}:C))},u=async()=>{if(!(!a.trim()||i.length<2)){d(!0);try{const x=await O("/api/command-post/debates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:a.trim(),participants:i.map(v=>({role:v.role.trim()||"participant",model:v.model.trim()||void 0})),rounds:p,resolution:g})});if(!x.ok)throw new Error(`${x.status} ${x.statusText}`);l()}catch(x){alert(`Debate failed: ${x.message}`)}finally{d(!1)}}};return e.jsx(M,{open:!0,onClose:t,title:"Start a new debate",size:"lg",footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t,className:"px-3 py-1.5 text-[11px] text-text-secondary hover:text-text",children:"Cancel"}),e.jsx("button",{onClick:u,disabled:c||!a.trim()||i.length<2,className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50",children:c?"Running debate…":"Run debate"})]}),children:e.jsxs("div",{className:"space-y-3 text-[12px]",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Question"}),e.jsx("textarea",{value:a,onChange:x=>m(x.target.value),placeholder:"e.g. Should we cache the Ollama probe results for 7 days or 30 days?",rows:2,className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40 resize-none"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:["Participants (",i.length,"/5)"]}),e.jsx("button",{onClick:f,disabled:i.length>=5,className:"text-[10px] text-accent-light/70 hover:text-accent-light disabled:opacity-40",children:"+ Add participant"})]}),e.jsx("div",{className:"space-y-2",children:i.map((x,v)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("input",{value:x.role,onChange:C=>r(v,{role:C.target.value}),placeholder:"role (e.g. pragmatist)",className:"flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none"}),e.jsx("input",{value:x.model,onChange:C=>r(v,{model:C.target.value}),placeholder:"model (optional — defaults to agent.model)",className:"flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text-secondary focus:outline-none"}),e.jsx("button",{onClick:()=>y(v),disabled:i.length<=2,className:"text-text-muted hover:text-error disabled:opacity-20 px-1",title:"Remove",children:"×"})]},v))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Rounds"}),e.jsx("select",{value:p,onChange:x=>n(Number(x.target.value)),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[1,2,3,4].map(x=>e.jsxs("option",{value:x,children:[x," round",x===1?"":"s"]},x))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Resolution"}),e.jsxs("select",{value:g,onChange:x=>h(x.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"judge",children:"Judge (LLM picks winner)"}),e.jsx("option",{value:"synthesize",children:"Synthesize (LLM merges)"}),e.jsx("option",{value:"vote",children:"Vote (word-overlap consensus)"})]})]})]}),e.jsx("div",{className:"text-[10px] text-text-muted/70 italic",children:"Runs live — 1-3 minutes depending on model + rounds. Transcript saves automatically."})]})})}function Ze(){const[t,l]=s.useState([]),[a,m]=s.useState(null),[i,j]=s.useState(!1),[p,n]=s.useState(!1),g=s.useCallback(async()=>{j(!0);try{const c=await O("/api/command-post/debates");if(c.ok){const d=await c.json();l((d==null?void 0:d.items)||[])}}catch{}j(!1)},[]);s.useEffect(()=>{g()},[g]);const h=async c=>{try{const d=await O(`/api/command-post/debates/${c}`);if(d.ok){const f=await d.json();m(f)}}catch{}};if(a){const c=new Map;for(const d of a.turns){const f=c.get(d.round)||[];f.push(d),c.set(d.round,f)}return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{onClick:()=>m(null),className:"text-[11px] text-text-muted hover:text-text-secondary",children:"← Back to debates"}),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl p-4",children:[e.jsx("div",{className:"text-[13px] font-semibold text-text mb-1",children:a.question}),e.jsxs("div",{className:"text-[10px] text-text-muted/70",children:[a.resolution," • ",a.rounds," round",a.rounds===1?"":"s"," • ",(a.durationMs/1e3).toFixed(1),"s"]}),a.winner&&e.jsxs("div",{className:"mt-3 p-3 bg-success/[0.06] border border-success/30 rounded-lg",children:[e.jsxs("div",{className:"text-[11px] text-success/80/80 uppercase tracking-wider",children:["Winner: ",a.winner.role]}),e.jsx("div",{className:"text-[12px] text-text mt-1",children:a.winner.content}),a.winner.justification&&e.jsx("div",{className:"text-[10px] text-text-muted italic mt-2",children:a.winner.justification})]})]}),[...c.entries()].sort((d,f)=>d[0]-f[0]).map(([d,f])=>e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2 border-b border-border/50 text-[11px] font-medium text-text-secondary uppercase tracking-wider",children:["Round ",d]}),e.jsx("div",{className:"divide-y divide-border/30",children:f.map((y,r)=>e.jsxs("div",{className:"px-4 py-3",children:[e.jsx("div",{className:"text-[11px] font-semibold text-accent-light/80 mb-1",children:y.role}),e.jsx("div",{className:"text-[11px] text-text-secondary whitespace-pre-wrap",children:y.content}),e.jsxs("div",{className:"text-[9px] text-text-muted mt-1",children:[y.model.split("/").pop()," • ",y.durationMs,"ms"]})]},r))})]},d))]})}return e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(D,{icon:ae,title:"Debates",count:t.length,help:{title:"Debates",description:"Pit two or more agents against each other to explore different sides of a decision. Useful for risk assessment and trade-off analysis."},action:e.jsxs("button",{onClick:()=>n(!0),className:"flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(V,{size:10})," New Debate"]})}),p&&e.jsx(Je,{onClose:()=>n(!1),onCreated:()=>{n(!1),g()}}),e.jsx("div",{className:"divide-y divide-border/30",children:i?e.jsx("div",{className:"py-8 text-center text-[12px] text-text-muted",children:"Loading..."}):t.length===0?e.jsxs("div",{className:"py-8 text-center text-[12px] text-text-muted",children:["No debates yet. Call the ",e.jsx("code",{className:"text-accent-light/70",children:"agent_debate"})," tool to start one."]}):t.map(c=>e.jsxs("button",{onClick:()=>h(c.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("div",{className:"text-[12px] text-text flex-1 truncate pr-2",children:c.question}),e.jsxs("span",{className:"text-[10px] text-text-muted whitespace-nowrap",children:[Ve(c.startedAt)," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[e.jsx("span",{children:c.resolution}),e.jsxs("span",{children:[c.rounds," round",c.rounds===1?"":"s"]}),e.jsxs("span",{children:[(c.durationMs/1e3).toFixed(1),"s"]}),c.winnerRole&&e.jsxs("span",{className:"text-success/80/70",children:["winner: ",c.winnerRole]})]})]},c.id))})]})}const Ke=[{label:"Overview",tabs:[{id:"Dashboard",label:"Dashboard",icon:te}]},{label:"Operations",tabs:[{id:"Social",label:"Social",icon:Y},{id:"Inbox",label:"Inbox",icon:Me},{id:"Goals",label:"Goals",icon:Te},{id:"Work",label:"Work",icon:B},{id:"Sessions",label:"Sessions",icon:X}]},{label:"Governance",tabs:[{id:"Org Chart",label:"Org Chart",icon:ee},{id:"Agents",label:"Agents",icon:Ne},{id:"Files",label:"Files",icon:we},{id:"Debates",label:"Debates",icon:ae},{id:"Costs",label:"Costs",icon:W}]},{label:"System",tabs:[{id:"Traces",label:"Traces",icon:P},{id:"Console",label:"Console",icon:Ce}]}],Qe=s.lazy(()=>_(()=>import("./WorkTab-BOfTN-Bd.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Xe=s.lazy(()=>_(()=>import("./SessionsTab-BdJj_vsI.js"),__vite__mapDeps([10,1,2,3]))),Ye=s.lazy(()=>_(()=>import("./CPInbox-CyLQJBYF.js"),__vite__mapDeps([11,1,2,12,4,5,6,13,14,15,16,17]))),et=s.lazy(()=>_(()=>import("./CPFiles-BBS8jtYH.js"),__vite__mapDeps([18,1,2,4,5,6]))),tt=s.lazy(()=>_(()=>import("./TraceViewer-ojGf0drx.js"),__vite__mapDeps([19,1,2,20,4,5,6,21,22,23]))),st=s.lazy(()=>_(()=>import("./CPSocial-BkEtQ1Um.js"),__vite__mapDeps([24,1,2,4,5,6,25]))),at=s.lazy(()=>_(()=>import("./CPDashboard-B_yidGAe.js"),__vite__mapDeps([26,1,2,12,4,5,6,27,13,15,28,29]))),rt=s.lazy(()=>_(()=>import("./CPGoals-DL5v21TZ.js"),__vite__mapDeps([30,1,2,12,4,5,6,27,13,14,15,29,8,3,31,32,9,28,21,22]))),nt=s.lazy(()=>_(()=>import("./CPAgents-CEraUkME.js"),__vite__mapDeps([33,1,2,12,4,5,6,27,13,14,15])));function lt(){const[t,l]=s.useState("Dashboard"),[a,m]=s.useState(null),[i,j]=s.useState([]),[p,n]=s.useState(!0),[g,h]=s.useState(null),[c,d]=s.useState([]),[f,y]=s.useState(!1),[r,u]=s.useState(null),x=s.useCallback(async()=>{try{const[b,o]=await Promise.allSettled([ce(),K()]);b.status==="fulfilled"&&(m(b.value),d(b.value.recentActivity||[])),o.status==="fulfilled"&&j(o.value),h(null)}catch(b){h(b.message)}n(!1)},[]);if(s.useEffect(()=>{x()},[x]),s.useEffect(()=>{if(!a)return;const b=localStorage.getItem("titan-token"),o=b?`/api/command-post/stream?token=${b}`:"/api/command-post/stream",k=new EventSource(o);let z=0;return k.addEventListener("commandpost:activity",S=>{z=0;try{d(N=>[...N.slice(-49),JSON.parse(S.data)])}catch{}}),k.addEventListener("commandpost:agent:status",S=>{z=0;try{const N=JSON.parse(S.data);m(w=>w&&{...w,agents:w.agents.map(R=>R.id===N.agentId?{...R,status:N.status}:R)})}catch{}}),k.onerror=()=>{z++,z>5&&k.close()},()=>k.close()},[a]),s.useEffect(()=>{const b=setInterval(x,3e4);return()=>clearInterval(b)},[x]),p)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading Command Post..."})]})});if(g)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(F,{className:"mx-auto mb-3 text-warning",size:32}),e.jsx("p",{className:"text-sm text-text-secondary mb-4",children:g}),e.jsx("button",{onClick:x,className:"px-4 py-2 text-sm bg-bg-tertiary rounded-lg hover:bg-border text-text-secondary transition-colors",children:"Retry"})]})});const v=a??{agents:[],totalAgents:0,activeAgents:0,activeCheckouts:0,budgetUtilization:0,recentActivity:[],checkouts:[],budgets:[],goalTree:[],companies:[]},C=()=>{switch(t){case"Dashboard":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"dashboard"}),children:e.jsx(at,{})});case"Social":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"social"}),children:e.jsx(st,{})});case"Inbox":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"inbox"}),children:e.jsx(Ye,{})});case"Goals":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"goals"}),children:e.jsx(rt,{})});case"Work":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"work"}),children:e.jsx(Qe,{})});case"Sessions":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"sessions"}),children:e.jsx(Xe,{})});case"Org Chart":return e.jsx(We,{agents:v.agents});case"Agents":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"agents"}),children:e.jsx(nt,{})});case"Files":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"files"}),children:e.jsx(et,{})});case"Debates":return e.jsx(Ze,{});case"Costs":return e.jsx(qe,{budgets:v.budgets,onRefresh:x});case"Traces":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"traces"}),children:e.jsx(tt,{})});case"Console":return e.jsx(He,{dashboard:v});default:return null}};return e.jsxs("div",{className:"h-full flex overflow-hidden",children:[e.jsxs("div",{className:"w-52 shrink-0 flex flex-col border-r border-border bg-bg-secondary/30",children:[e.jsx("div",{className:"px-4 py-4 border-b border-border",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-accent/10 border border-accent/20",children:e.jsx(U,{size:16,className:"text-accent-light"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-sm font-bold text-text",children:"Command Post"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:"Agent governance"})]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto py-2 space-y-4",children:Ke.map(b=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 mb-1 text-[10px] font-semibold text-text-muted uppercase tracking-wider",children:b.label}),e.jsx("div",{className:"px-2 space-y-0.5",children:b.tabs.map(o=>{const k=t===o.id;return e.jsxs("button",{onClick:()=>l(o.id),className:`w-full flex items-center gap-2.5 px-2.5 py-1.5 rounded-lg text-[12px] transition-all duration-150 ${k?"bg-accent/10 text-accent-light font-medium":"text-text-secondary hover:text-text hover:bg-bg-tertiary/50"}`,children:[e.jsx(o.icon,{size:14,className:k?"text-accent-light":"text-text-muted"}),e.jsx("span",{children:o.label})]},o.id)})})]},b.label))}),e.jsx("div",{className:"px-3 py-2 border-t border-border",children:e.jsxs("button",{onClick:x,className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-[11px] text-text-muted bg-bg-tertiary/50 border border-border rounded-lg hover:bg-bg-tertiary transition-colors",children:[e.jsx(ke,{size:12,className:p?"animate-spin":""}),"Refresh"]})})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 md:px-6 py-4 md:py-6",children:e.jsx(C,{})})}),e.jsx(Oe,{collapsed:f,onToggle:()=>y(!f),agents:v.agents,runs:i,onAgentClick:b=>u(b)}),r&&e.jsx(Be,{agent:r,onClose:()=>u(null)})]})}const yt=Object.freeze(Object.defineProperty({__proto__:null,default:lt},Symbol.toStringTag,{value:"Module"}));export{yt as C,M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,aS as d,j as e,aT as m,aU as x}from"./index-NatBSFxj.js";import{P as h}from"./PageHeader-Cwn3OALc.js";import{R as f,C as b}from"./TitanCanvas-Hk49NFcA.js";import{T as g,a as p}from"./toggle-right-CYphlpN5.js";import{T as u}from"./trash-2-C_Jsp23A.js";import"./VoiceOverlay-Dn6iaYgd.js";function T(){const[c,o]=t.useState([]),[r,l]=t.useState(!0),s=t.useCallback(async()=>{l(!0);try{const a=await d();o(a.jobs||[])}catch{}l(!1)},[]);t.useEffect(()=>{s()},[s]);const n=async a=>{try{await m(a),await s()}catch{}},i=async a=>{if(confirm("Delete this cron job?"))try{await x(a),await s()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{title:"Cron Scheduler",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Cron"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:s,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(f,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:c.map(a=>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(b,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:a.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[a.schedule," • ",a.command]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>n(a.id),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46]",children:a.enabled?e.jsx(g,{className:"w-4 h-4 text-emerald-400"}):e.jsx(p,{className:"w-4 h-4 text-[#52525b]"})}),e.jsx("button",{onClick:()=>i(a.id),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(u,{className:"w-3.5 h-3.5"})})]})]},a.id))})]})}export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,j as e,T as m,f as j,A as N,aw as f,ax as y,ay as w}from"./index-NatBSFxj.js";import{i as R,R as S,C as P}from"./TitanCanvas-Hk49NFcA.js";import{P as k}from"./pause-DDC_zUiJ.js";import{P as E}from"./play-BPXbHToG.js";import"./VoiceOverlay-Dn6iaYgd.js";function M(){const[s,v]=n.useState(null),[h,o]=n.useState(!0),[i,x]=n.useState([]),g=n.useRef(null),r=async()=>{o(!0);try{v(await f())}catch{}o(!1)};n.useEffect(()=>{r();const a=new EventSource("/api/daemon/stream");g.current=a,a.onmessage=d=>{try{const t=JSON.parse(d.data);x(l=>[{event:t.event||"message",data:JSON.stringify(t.data||t,null,0),time:new Date().toLocaleTimeString()},...l].slice(0,50))}catch{}};for(const d of["daemon:started","daemon:stopped","daemon:paused","daemon:resumed","daemon:heartbeat","goal:subtask:ready","health:ollama:down","health:ollama:degraded","cron:stuck"])a.addEventListener(d,t=>{x(l=>[{event:d,data:t.data||"",time:new Date().toLocaleTimeString()},...l].slice(0,50))});const c=setInterval(r,15e3);return()=>{a.close(),clearInterval(c)}},[]);const u=async()=>{await y(),r()},p=async()=>{await w(),r()},b=a=>a<6e4?`${Math.round(a/1e3)}s`:a<36e5?`${Math.round(a/6e4)}m`:`${Math.round(a/36e5)}h ${Math.round(a%36e5/6e4)}m`;return h&&!s?e.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading daemon status..."}):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(R,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"Daemon"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Persistent background watchers and event loop"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:r,className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(S,{size:14})}),(s==null?void 0:s.running)&&!s.paused&&e.jsxs("button",{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-md bg-[var(--warning)]/15 text-[var(--warning)] border border-[var(--warning)]/25 hover:bg-[var(--warning)]/25 transition-colors",children:[e.jsx(k,{size:14})," Pause"]}),(s==null?void 0:s.running)&&s.paused&&e.jsxs("button",{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-md bg-[var(--success)]/15 text-[var(--success)] border border-[var(--success)]/25 hover:bg-[var(--success)]/25 transition-colors",children:[e.jsx(E,{size:14})," Resume"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 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:"Status"}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:s!=null&&s.running?s.paused?e.jsxs(e.Fragment,{children:[e.jsx(m,{size:18,className:"text-[var(--warning)]"}),e.jsx("span",{className:"text-lg font-semibold text-[var(--warning)]",children:"Paused"})]}):e.jsxs(e.Fragment,{children:[e.jsx(j,{size:18,className:"text-[var(--success)]"}),e.jsx("span",{className:"text-lg font-semibold text-[var(--success)]",children:"Running"})]}):e.jsx(e.Fragment,{children:e.jsx("span",{className:"text-lg font-semibold text-[var(--text-muted)]",children:"Stopped"})})})]}),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:"Uptime"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(P,{size:18,className:"text-[var(--text-muted)]"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:s?b(s.uptimeMs):"-"})]})]}),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:"Actions / Hour"}),e.jsxs("p",{className:"text-lg font-semibold text-[var(--text)] mt-1",children:[(s==null?void 0:s.actionsThisHour)??0," ",e.jsxs("span",{className:"text-sm font-normal text-[var(--text-muted)]",children:["/ ",(s==null?void 0:s.maxActionsPerHour)??10]})]})]}),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:"Error Rate"}),e.jsxs("p",{className:`text-lg font-semibold mt-1 ${((s==null?void 0:s.errorRatePercent)??0)>30?"text-[var(--error)]":"text-[var(--text)]"}`,children:[(s==null?void 0:s.errorRatePercent)??0,"%"]})]})]}),(s==null?void 0:s.pauseReason)&&e.jsxs("div",{className:"bg-[var(--warning)]/10 border border-[var(--warning)]/25 rounded-lg p-3 flex items-center gap-2",children:[e.jsx(m,{size:16,className:"text-[var(--warning)] flex-shrink-0"}),e.jsx("span",{className:"text-sm text-[var(--warning)]",children:s.pauseReason})]}),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-3",children:"Active Watchers"}),s!=null&&s.activeWatchers&&s.activeWatchers.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:s.activeWatchers.map(a=>e.jsxs("span",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-[var(--success)]/10 text-[var(--success)] border border-[var(--success)]/20",children:[e.jsx(N,{size:12})," ",a]},a))}):e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No active watchers"})]}),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-3",children:"Event Feed"}),i.length>0?e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto font-mono text-xs",children:i.map((a,c)=>e.jsxs("div",{className:"flex gap-3 py-1 border-b border-[var(--border)]/50 last:border-0",children:[e.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 w-16",children:a.time}),e.jsx("span",{className:"text-[var(--accent)] flex-shrink-0",children:a.event}),e.jsx("span",{className:"text-[var(--text-secondary)] truncate",children:a.data})]},c))}):e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Waiting for events..."})]})]})}export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./index-NatBSFxj.js";function i({columns:s,data:d,onRowClick:a,emptyMessage:x="No data available"}){return e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-bg-secondary",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-bg-tertiary",children:s.map(t=>e.jsx("th",{className:`px-4 py-3 text-sm font-medium text-text-secondary ${t.className??""}`,children:t.header},t.key))})}),e.jsx("tbody",{children:d.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length,className:"px-4 py-12 text-center text-text-muted",children:x})}):d.map((t,n)=>e.jsx("tr",{onClick:()=>a==null?void 0:a(t),className:`border-t border-border transition-colors hover:bg-bg-tertiary/50 ${a?"cursor-pointer":""}`,children:s.map(r=>e.jsx("td",{className:`px-4 py-3 text-text ${r.className??""}`,children:r.render?r.render(t):String(t[r.key]??"")},r.key))},n))})]})})}export{i as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./index-
|
|
1
|
+
import{j as t}from"./index-NatBSFxj.js";import{B as r}from"./Input-bFsLI0fq.js";function n({icon:s,title:x,description:m,action:e,className:a}){return t.jsxs("div",{className:`flex flex-col items-center justify-center py-16 text-center ${a??""}`,children:[s&&t.jsx("div",{className:"mb-4 text-text-muted opacity-50",children:s}),t.jsx("h3",{className:"text-sm font-medium text-text-secondary",children:x}),m&&t.jsx("p",{className:"mt-1 max-w-sm text-xs text-text-muted",children:m}),e&&t.jsx(r,{variant:"secondary",size:"sm",onClick:e.onClick,className:"mt-4",children:e.label})]})}export{n as E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,b3 as u,b4 as p,b5 as j,j as e,e as N,T as v,b6 as y}from"./index-NatBSFxj.js";import{P as T}from"./PageHeader-Cwn3OALc.js";import{R as w}from"./TitanCanvas-Hk49NFcA.js";import{P as k}from"./play-BPXbHToG.js";import"./VoiceOverlay-Dn6iaYgd.js";function E(){const[t,x]=a.useState(null),[r,o]=a.useState([]),[i,b]=a.useState([]),[d,n]=a.useState(!0),[c,m]=a.useState(!1),l=a.useCallback(async()=>{n(!0);try{const[s,h,f]=await Promise.all([u(),p(),j()]);x(s),o(h.tests||[]),b(f.tests||[])}catch{}n(!1)},[]);a.useEffect(()=>{l()},[l]);const g=async()=>{m(!0);try{await y(),await l()}catch{}m(!1)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(T,{title:"Test Lab",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Quality"},{label:"Tests"}]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:l,disabled:d,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(w,{className:`w-4 h-4 ${d?"animate-spin":""}`})," Refresh"]}),e.jsxs("button",{onClick:g,disabled:c,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(k,{className:"w-4 h-4"})," ",c?"Running...":"Run Tests"]})]}),t&&e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsx("div",{className:"text-xs text-[#52525b]",children:"Total"}),e.jsx("div",{className:"text-sm font-semibold text-[#e4e4e7]",children:t.total})]}),e.jsxs("div",{className:"p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsx("div",{className:"text-xs text-[#52525b]",children:"Passing"}),e.jsx("div",{className:"text-sm font-semibold text-emerald-400",children:t.passing})]}),e.jsxs("div",{className:"p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsx("div",{className:"text-xs text-[#52525b]",children:"Failing"}),e.jsx("div",{className:"text-sm font-semibold text-red-400",children:t.failing})]}),e.jsxs("div",{className:"p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsx("div",{className:"text-xs text-[#52525b]",children:"Flaky"}),e.jsx("div",{className:"text-sm font-semibold text-amber-400",children:t.flaky})]})]}),r.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium text-[#e4e4e7] flex items-center gap-2",children:[e.jsx(N,{className:"w-4 h-4 text-red-400"})," Failing Tests"]}),r.map(s=>e.jsxs("div",{className:"p-2 rounded-lg bg-red-950/20 border border-red-900/50",children:[e.jsx("div",{className:"text-xs text-[#e4e4e7]",children:s.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.suite," • ",s.error.slice(0,60)]})]},s.name))]}),i.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium text-[#e4e4e7] flex items-center gap-2",children:[e.jsx(v,{className:"w-4 h-4 text-amber-400"})," Flaky Tests"]}),i.map(s=>e.jsxs("div",{className:"p-2 rounded-lg bg-amber-950/20 border border-amber-900/50",children:[e.jsx("div",{className:"text-xs text-[#e4e4e7]",children:s.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.suite," • ",s.passRate.toFixed(1),"% pass rate"]})]},s.name))]})]})}export{E as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as E,r,
|
|
1
|
+
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 ve,aa as fe}from"./index-NatBSFxj.js";import{P as be,R as ge,H as je,C as Ne,j as U,c as ye,k as J,D as Z,F as X,f as we}from"./TitanCanvas-Hk49NFcA.js";import{C as G}from"./VoiceOverlay-Dn6iaYgd.js";import{A as ke}from"./arrow-left-c-8OFZUV.js";import{T as Q}from"./trash-2-C_Jsp23A.js";import{D as Ce}from"./download-YvPDLlFJ.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,a_ as c,j as e}from"./index-NatBSFxj.js";import{P as x}from"./PageHeader-Cwn3OALc.js";import{R as n,g as o}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.js";function h(){const[i,d]=a.useState([]),[r,l]=a.useState(!0),t=a.useCallback(async()=>{l(!0);try{const s=await c();d(s.nodes||[])}catch{}l(!1)},[]);return a.useEffect(()=>{t()},[t]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{title:"Fleet Router",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Mesh"},{label:"Fleet"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:t,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(n,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:i.map(s=>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(o,{className:`w-4 h-4 ${s.status==="online"?"text-emerald-400":s.status==="busy"?"text-amber-400":"text-red-400"}`}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:s.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.address," • ",s.capabilities.join(", ")]})]})]}),e.jsx("div",{className:"text-xs text-[#52525b]",children:s.status})]},s.id))})]})}export{h as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as ee,r as d,b as m,j as e,Z as I,
|
|
1
|
+
import{c as ee,r as d,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 le}from"./index-NatBSFxj.js";import{P as B}from"./PageHeader-Cwn3OALc.js";import{S as h}from"./StatCard-CY8lgeWm.js";import{S as re}from"./SkeletonLoader-CsiR8ED9.js";import{R as ie,C as ce,M as de,h as oe,N as D,b as xe,U as me}from"./TitanCanvas-Hk49NFcA.js";import{C as he}from"./chart-column-x6L66Qw7.js";import{C as A}from"./circle-check-big-WaW3U3Xl.js";import{D as ue}from"./dollar-sign-D2Oce4Ru.js";import"./VoiceOverlay-Dn6iaYgd.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 He(){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([]),[H,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 C=!!i&&typeof i.totalVRAM=="number"&&Number.isFinite(i.totalVRAM)&&i.totalVRAM>0&&typeof i.usedVRAM=="number"&&Number.isFinite(i.usedVRAM),y=C?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:C?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:H.length>0?e.jsx("div",{className:"space-y-2",children:H.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{He as default};
|
|
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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomelabPanel-
|
|
2
|
-
import{r as s,j as e,n as o,_ as a}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomelabPanel-DhuXd3ZD.js","assets/index-NatBSFxj.js","assets/index-D932CbpQ.css","assets/PageHeader-Cwn3OALc.js","assets/VoiceOverlay-Dn6iaYgd.js","assets/StatCard-CY8lgeWm.js","assets/SkeletonLoader-CsiR8ED9.js","assets/TitanCanvas-Hk49NFcA.js","assets/TitanCanvas-BfitWg9R.css","assets/chart-column-x6L66Qw7.js","assets/circle-check-big-WaW3U3Xl.js","assets/dollar-sign-D2Oce4Ru.js","assets/NvidiaPanel-NYt42w7L.js","assets/eye-off-DIMcxsdQ.js","assets/FilesPanel-DATsiAqG.js","assets/arrow-left-c-8OFZUV.js","assets/trash-2-C_Jsp23A.js","assets/download-YvPDLlFJ.js","assets/LogsPanel-Br1P8ST6.js","assets/TelemetryPanel-JZ90gJXC.js","assets/git-branch-0FamUEbU.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,j as e,n as o,_ as a}from"./index-NatBSFxj.js";const r=s.lazy(()=>a(()=>import("./HomelabPanel-DhuXd3ZD.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),n=s.lazy(()=>a(()=>import("./NvidiaPanel-NYt42w7L.js"),__vite__mapDeps([12,1,2,7,4,8,10,13]))),d=s.lazy(()=>a(()=>import("./FilesPanel-DATsiAqG.js"),__vite__mapDeps([14,1,2,7,4,8,15,16,17]))),c=s.lazy(()=>a(()=>import("./LogsPanel-Br1P8ST6.js"),__vite__mapDeps([18,1,2,7,4,8]))),m=s.lazy(()=>a(()=>import("./TelemetryPanel-JZ90gJXC.js"),__vite__mapDeps([19,1,2,5,7,4,8,20,9]))),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(n,{}),l==="files"&&e.jsx(d,{}),l==="logs"&&e.jsx(c,{}),l==="telemetry"&&e.jsx(m,{})]})})]})}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,n as m,j as t,X as N}from"./index-NatBSFxj.js";import{k as w,j as S}from"./TitanCanvas-Hk49NFcA.js";function I({value:s,onSave:h,placeholder:p,multiline:a=!1,className:k,displayValue:j,emptyLabel:E="—",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)},g=e=>{e.key==="Enter"&&!a||e.key==="Enter"&&a&&e.metaKey?(e.preventDefault(),u()):e.key==="Escape"&&(e.preventDefault(),b())};if(i){const e=m("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:g,placeholder:p,maxLength:x,className:e,disabled:f}):t.jsx("input",{ref:n,type:"text",value:o,onChange:d=>l(d.target.value),onKeyDown:g,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=j??(s&&s.length>0?s:E);return t.jsxs("span",{className:m("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{I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e,n as d}from"./index-
|
|
1
|
+
import{r as n,j as e,n as d}from"./index-NatBSFxj.js";import{L as b}from"./TitanCanvas-Hk49NFcA.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,K as S,b as C,$ as K}from"./index-NatBSFxj.js";import{P as A}from"./plug-Dxp-sWVF.js";import{C as U}from"./circle-check-big-WaW3U3Xl.js";import{E as T}from"./eye-off-DIMcxsdQ.js";import{i as I,c as O}from"./TitanCanvas-Hk49NFcA.js";import{a as R,C as q}from"./VoiceOverlay-Dn6iaYgd.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:p,saving:v}){const[f,y]=l.useState(!1),[c,d]=l.useState(a.fieldType==="url"&&o||""),[x,u]=l.useState(!1),h=a.fieldType==="key",i=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:h?"API Key":"Base URL"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`integration-${a.id}`,name:`integration-${a.id}`,type:h&&!x?"password":"text",value:c,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"}),h&&e.jsx("button",{type:"button",onClick:()=>u(!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:()=>p(a.fieldKey,c),disabled:i||!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"}),i?"Saving...":"Save"]})})]})]})}function Q(){const[a,b]=l.useState({}),[o,p]=l.useState({clientIdSet:!1,clientSecretSet:!1}),[v,f]=l.useState(!0),[y,c]=l.useState(null),[d,x]=l.useState(null),[u,h]=l.useState(""),[i,j]=l.useState(""),[N,G]=l.useState(!1);l.useEffect(()=>{(async()=>{var t;try{const n=await S();if(n.providers&&b(n.providers),(t=n.oauth)!=null&&t.google){const g=n.oauth.google;try{const r=await(await C("/api/auth/google/status")).json();g.connected=r.connected,g.email=r.email}catch{}p(g)}}catch{}finally{f(!1)}})()},[]);const E=()=>{window.location.href="/api/auth/google/start"},$=async()=>{try{await C("/api/auth/google/disconnect",{method:"POST"}),p(s=>({...s,connected:!1,email:void 0})),m("success","Google account disconnected")}catch{m("error","Failed to disconnect")}},m=(s,t)=>{x({type:s,message:t}),setTimeout(()=>x(null),3e3)},D=async(s,t)=>{var g,w;const n=((g=k.find(r=>r.fieldKey===s))==null?void 0:g.id)||s;c(n);try{await K({[s]:t});const r=await S();r.providers&&b(r.providers),m("success",`${((w=k.find(B=>B.fieldKey===s))==null?void 0:w.label)||"Provider"} saved`)}catch(r){m("error",r instanceof Error?r.message:"Failed to save")}finally{c(null)}},L=async()=>{var s;c("oauth");try{const t={};u&&(t.googleOAuthClientId=u),i&&(t.googleOAuthClientSecret=i),await K(t);const n=await S();(s=n.oauth)!=null&&s.google&&p(n.oauth.google),m("success","Google OAuth settings saved"),h(""),j("")}catch(t){m("error",t instanceof Error?t.message:"Failed to save")}finally{c(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],n=s.id==="ollama"?!!(t!=null&&t.baseUrl):!!(t!=null&&t.configured);return e.jsx(M,{provider:s,configured:n,currentUrl:s.fieldType==="url"?(t==null?void 0:t.baseUrl)||"":void 0,onSave:D,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:$,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:u,onChange:s=>h(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:i,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"||!u&&!i,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{Q as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AutopilotPanel-nTb1Dnru.js","assets/index-NatBSFxj.js","assets/index-D932CbpQ.css","assets/PageHeader-Cwn3OALc.js","assets/VoiceOverlay-Dn6iaYgd.js","assets/WorkflowsPanel-qzNS0p0u.js","assets/Input-bFsLI0fq.js","assets/TitanCanvas-Hk49NFcA.js","assets/TitanCanvas-BfitWg9R.css","assets/InlineEditableField-zIAnW4AR.js","assets/target-BrtxUtzl.js","assets/play-BPXbHToG.js","assets/pause-DDC_zUiJ.js","assets/trash-2-C_Jsp23A.js","assets/toggle-right-CYphlpN5.js","assets/LearningPanel-BEgF_iND.js","assets/lightbulb-Bk6KlR6q.js","assets/trending-up-DrtLViSm.js","assets/MemoryGraphPanel-BGOeSaET.js","assets/SelfImprovePanel-DbybAZWp.js","assets/circle-check-big-WaW3U3Xl.js","assets/trophy-DdRzAOfo.js","assets/PersonasPanel-DxrGW5C4.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,j as e,n as a,_ as t}from"./index-NatBSFxj.js";const i=s.lazy(()=>t(()=>import("./AutopilotPanel-nTb1Dnru.js"),__vite__mapDeps([0,1,2,3,4]))),n=s.lazy(()=>t(()=>import("./WorkflowsPanel-qzNS0p0u.js"),__vite__mapDeps([5,1,2,3,4,6,7,8,9,10,11,12,13,14]))),d=s.lazy(()=>t(()=>import("./LearningPanel-BEgF_iND.js"),__vite__mapDeps([15,1,2,3,4,7,8,16,17]))),c=s.lazy(()=>t(()=>import("./MemoryGraphPanel-BGOeSaET.js"),__vite__mapDeps([18,1,2,7,4,8,13]))),m=s.lazy(()=>t(()=>import("./SelfImprovePanel-DbybAZWp.js"),__vite__mapDeps([19,1,2,7,4,8,20,21,17,11,13]))),x=s.lazy(()=>t(()=>import("./PersonasPanel-DxrGW5C4.js"),__vite__mapDeps([22,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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e,T as g,b as x}from"./index-
|
|
1
|
+
import{r as o,j as e,T as g,b as x}from"./index-NatBSFxj.js";import{P as j}from"./PageHeader-Cwn3OALc.js";import{R as f,d as p,W as N,D as v}from"./TitanCanvas-Hk49NFcA.js";import{L as y}from"./lightbulb-Bk6KlR6q.js";import{T as C}from"./trending-up-DrtLViSm.js";import"./VoiceOverlay-Dn6iaYgd.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 l({icon:t,label:i,value:r,color:n,sub:a}){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:n+"15"},children:e.jsx(t,{className:"h-3.5 w-3.5",style:{color:n}})}),e.jsx("p",{className:"text-xs text-text-muted",children:i})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:r}),a&&e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:a})]})}function R(){const[t,i]=o.useState(null),[r,n]=o.useState(null),[a,b]=o.useState(null),[h,m]=o.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,d])=>{i(s),n(c),b(d?{nodeCount:d.nodeCount||0,edgeCount:d.edgeCount||0,episodeCount:d.episodeCount||0}:null)}).finally(()=>m(!1))};return o.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(l,{icon:p,label:"Knowledge Entries",value:(t==null?void 0:t.knowledgeEntries)??0,color:"#6366f1",sub:"Facts, patterns, corrections"}),e.jsx(l,{icon:N,label:"Tools Tracked",value:(t==null?void 0:t.toolsTracked)??0,color:"#22d3ee",sub:"Success rates learned"}),e.jsx(l,{icon:g,label:"Error Patterns",value:(t==null?void 0:t.errorPatterns)??0,color:"#f59e0b",sub:"Known failure modes"}),e.jsx(l,{icon:y,label:"Corrections",value:(t==null?void 0:t.corrections)??0,color:"#34d399",sub:"User-taught improvements"})]})]}),a&&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(l,{icon:v,label:"Entities",value:a.nodeCount,color:"#818cf8",sub:"People, topics, projects"}),e.jsx(l,{icon:C,label:"Relationships",value:a.edgeCount,color:"#22d3ee",sub:"Connections between entities"}),e.jsx(l,{icon:p,label:"Episodes",value:a.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{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,
|
|
1
|
+
import{r,ab as v,j as e}from"./index-NatBSFxj.js";import{R as j}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.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 L(){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{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as e,G as k,ai as z,aj as $,ak as b,al as R,am as I,an as E}from"./index-NatBSFxj.js";import{P as h}from"./plug-Dxp-sWVF.js";import{R as D,P as L,h as g,l as G,m as B}from"./TitanCanvas-Hk49NFcA.js";import{T as F}from"./trash-2-C_Jsp23A.js";import"./VoiceOverlay-Dn6iaYgd.js";function J(){const[n,j]=d.useState([]),[N,y]=d.useState([]),[f,x]=d.useState(!0),[m,c]=d.useState(!1),[v,p]=d.useState(null),[l,i]=d.useState(null),[s,a]=d.useState({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),o=async()=>{x(!0);try{const[t,r]=await Promise.all([z(),$()]);j(t),y(r)}catch{}x(!1)};d.useEffect(()=>{o()},[]);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:""}),o()}catch(t){alert(t.message)}},P=async t=>{try{await b({presetId:t}),o()}catch(r){alert(r.message)}},w=async t=>{confirm(`Remove MCP server "${t}"?`)&&(await E(t),o())},M=async(t,r)=>{await I(t,r),o()},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)},S=t=>t==="connected"?"text-[var(--success)]":t==="error"?"text-[var(--error)]":"text-[var(--text-muted)]",A=t=>t==="connected"?"bg-[var(--success)]":t==="error"?"bg-[var(--error)]":"bg-[var(--text-muted)]",u=N.filter(t=>!n.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:o,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:n.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:n.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:n.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..."}):n.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:n.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 ${A(t.status)}`}),e.jsx("span",{className:S(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(G,{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(B,{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})})]})]}),(l==null?void 0:l.id)===t.id&&e.jsx("div",{className:`mt-3 px-3 py-2 rounded-md text-xs ${l.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:l.ok?`Connected successfully — ${l.tools} tools discovered`:`Connection failed: ${l.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{J 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-NatBSFxj.js";import{N as ve,R as Ce,a as ke}from"./TitanCanvas-Hk49NFcA.js";import{T as $e}from"./trash-2-C_Jsp23A.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as g,r as n,b as h,j as e}from"./index-NatBSFxj.js";import{P as u}from"./PageHeader-Cwn3OALc.js";import{A as v}from"./arrow-left-c-8OFZUV.js";import{C as w,a as k,d as S}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.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 d(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 R(){const[a,l]=n.useState([]),[t,i]=n.useState(null),[f,j]=n.useState(!0),[c,y]=n.useState(""),[o,N]=n.useState(""),x=n.useCallback(async()=>{try{const s=new URLSearchParams;c&&s.set("q",c),o&&s.set("type",o);const r=await h(`/api/wiki/entities?${s}`);r.ok&&l(await r.json())}catch{}finally{j(!1)}},[c,o]),m=async s=>{try{const r=await h(`/api/wiki/entity/${encodeURIComponent(s)}`);r.ok&&i(await r.json())}catch{}};n.useEffect(()=>{x()},[x]);const p=[...new Set(a.map(s=>s.type))].sort();return t?e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:t.name,breadcrumbs:[{label:"Memory"},{label:"Wiki",href:"/memory-wiki"},{label:t.name}],actions:e.jsxs("button",{onClick:()=>i(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:d(t.type),boxShadow:`0 0 10px ${d(t.type)}50`}}),e.jsx("h2",{className:"text-xl font-bold text-text",children:t.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:t.type})]}),t.summary&&e.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.summary}),t.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: ",t.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(t.firstSeen).toLocaleDateString()]}),e.jsxs("span",{children:["Last seen: ",b(t.lastSeen)]})]})]}),t.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 (",t.facts.length,")"]}),e.jsx("div",{className:"space-y-2",children:t.facts.map((s,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:s})]},r))})]}),t.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 (",t.related.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.related.map(s=>e.jsxs("button",{onClick:()=>m(s.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:d(s.type)}}),e.jsx("span",{className:"text-text",children:s.name}),e.jsxs("span",{className:"text-text-muted",children:["(",s.relation,")"]})]},s.id))})]}),t.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 (",t.episodes.length,")"]}),e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:t.episodes.map(s=>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(s.createdAt).toLocaleString()}),e.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:s.source})]}),e.jsx("p",{className:"text-xs text-text-secondary",children:s.content})]},s.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:c,onChange:s=>y(s.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:o,onChange:s=>N(s.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(s=>e.jsx("option",{value:s,children:s},s))]})]}),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((s,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(s=>e.jsxs("button",{onClick:()=>m(s.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:d(s.type)}}),e.jsx("span",{className:"font-medium text-sm text-text truncate",children:s.name})]}),e.jsx("p",{className:"text-xs text-text-secondary line-clamp-2 mb-2",children:s.summary||"No summary"}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-text-muted",children:[e.jsx("span",{className:"capitalize",children:s.type}),e.jsxs("span",{children:[s.factCount," facts"]}),e.jsx("span",{children:b(s.lastSeen)})]})]},s.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{R as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
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-NatBSFxj.js";import{D as v}from"./DataTable-DuAEp_QJ.js";import{R as w,n as P}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.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:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],R=l("shield-x",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 E=[["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"}]],M=l("unplug",E);function _(){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(M,{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{_ as default};
|