titan-agent 5.1.2 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/gateway/metrics.js +20 -1
- package/dist/gateway/metrics.js.map +1 -1
- package/dist/gateway/server.js +5 -1
- package/dist/gateway/server.js.map +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/package.json +1 -1
- package/ui/dist/assets/{AuditPanel-B84Mp16G.js → AuditPanel-DLy0WJQZ.js} +1 -1
- package/ui/dist/assets/{AutonomyPanel-DOtiTFxV.js → AutonomyPanel-DjFAQGns.js} +1 -1
- package/ui/dist/assets/{AutopilotPanel-nTb1Dnru.js → AutopilotPanel-nBluaHA4.js} +1 -1
- package/ui/dist/assets/{AutoresearchPanel-D46mX8VF.js → AutoresearchPanel-BDy8y_Cs.js} +1 -1
- package/ui/dist/assets/{BackupPanel-DGM1XXbG.js → BackupPanel-B_Fv2pJA.js} +1 -1
- package/ui/dist/assets/{BrowserPanel-Cn1tTN3y.js → BrowserPanel-DOCT3-Rq.js} +1 -1
- package/ui/dist/assets/{CPAgents-CEraUkME.js → CPAgents-CpkHf0b8.js} +1 -1
- package/ui/dist/assets/{CPDashboard-B_yidGAe.js → CPDashboard-CnMd6qNK.js} +1 -1
- package/ui/dist/assets/{CPFiles-BBS8jtYH.js → CPFiles-BDRjJpYl.js} +1 -1
- package/ui/dist/assets/{CPGoals-DL5v21TZ.js → CPGoals-2DrwHk62.js} +1 -1
- package/ui/dist/assets/{CPInbox-CyLQJBYF.js → CPInbox-C6l2o4FD.js} +1 -1
- package/ui/dist/assets/{CPSocial-BkEtQ1Um.js → CPSocial-Cea6NptR.js} +1 -1
- package/ui/dist/assets/{ChannelsPanel-CD2kHhA5.js → ChannelsPanel-5EhhyXeg.js} +1 -1
- package/ui/dist/assets/{CheckpointsPanel-BrUTFPu_.js → CheckpointsPanel-BVt2oEUe.js} +1 -1
- package/ui/dist/assets/{CommandPostHub-BPPaUv1B.js → CommandPostHub-PXKE62DN.js} +3 -3
- package/ui/dist/assets/{CronPanel-CsfQctFp.js → CronPanel-lAsoKavq.js} +1 -1
- package/ui/dist/assets/{DaemonPanel-CNUggBbL.js → DaemonPanel-xt08Rs10.js} +1 -1
- package/ui/dist/assets/{DataTable-DuAEp_QJ.js → DataTable-BHOu7fZP.js} +1 -1
- package/ui/dist/assets/{EmptyState-DFrAEZDm.js → EmptyState-Dk7BBthD.js} +1 -1
- package/ui/dist/assets/EvalHarnessPanel-CJv8CUDy.js +1 -0
- package/ui/dist/assets/{EvalPanel-DEX0a5-b.js → EvalPanel-D9rDf1bk.js} +1 -1
- package/ui/dist/assets/{FilesPanel-DATsiAqG.js → FilesPanel-CNrDLmix.js} +1 -1
- package/ui/dist/assets/{FleetPanel-QYQKqx4W.js → FleetPanel-DP_ji0AE.js} +1 -1
- package/ui/dist/assets/{HomelabPanel-DhuXd3ZD.js → HomelabPanel-B4bCsrBw.js} +1 -1
- package/ui/dist/assets/{InfraView-eS7cpESw.js → InfraView-C5OYx_9s.js} +2 -2
- package/ui/dist/assets/{InlineEditableField-zIAnW4AR.js → InlineEditableField-DyBCbIoN.js} +1 -1
- package/ui/dist/assets/{Input-bFsLI0fq.js → Input-DWnbv1Yh.js} +1 -1
- package/ui/dist/assets/{IntegrationsPanel-C_FswSRN.js → IntegrationsPanel-DsB6hjvE.js} +1 -1
- package/ui/dist/assets/{IntelligenceView-smQ6aBwx.js → IntelligenceView-PIFGvIg_.js} +2 -2
- package/ui/dist/assets/{LearningPanel-BEgF_iND.js → LearningPanel-D_S4HFX5.js} +1 -1
- package/ui/dist/assets/{LogsPanel-Br1P8ST6.js → LogsPanel-BnWNREPX.js} +1 -1
- package/ui/dist/assets/{McpPanel-ByvQ12J_.js → McpPanel-CIMxZ2Am.js} +1 -1
- package/ui/dist/assets/{MemoryGraphPanel-BGOeSaET.js → MemoryGraphPanel-DD7x4rrm.js} +1 -1
- package/ui/dist/assets/{MemoryWikiPanel-CR8btd66.js → MemoryWikiPanel-BPPVAH0b.js} +1 -1
- package/ui/dist/assets/{MeshPanel-BjkcSOMz.js → MeshPanel-CiuwR3oV.js} +1 -1
- package/ui/dist/assets/{NvidiaPanel-NYt42w7L.js → NvidiaPanel-DVntoRrH.js} +1 -1
- package/ui/dist/assets/{OrganismPanel-PHvISvVn.js → OrganismPanel-pqIKtHrW.js} +1 -1
- package/ui/dist/assets/{OverviewPanel-q35zdMr6.js → OverviewPanel-gqYRhmpF.js} +1 -1
- package/ui/dist/assets/{PageHeader-Cwn3OALc.js → PageHeader-CF75km05.js} +1 -1
- package/ui/dist/assets/{PaperclipPanel-BDpQki0d.js → PaperclipPanel-CwN5-cKg.js} +1 -1
- package/ui/dist/assets/{PersonasPanel-DxrGW5C4.js → PersonasPanel-ClC_TTGX.js} +1 -1
- package/ui/dist/assets/{RecipesPanel-CYRdBx5u.js → RecipesPanel-Di2l-eOe.js} +1 -1
- package/ui/dist/assets/{SecurityPanel-i1QMctV0.js → SecurityPanel-DjC4pXGM.js} +1 -1
- package/ui/dist/assets/{SelfImprovePanel-DbybAZWp.js → SelfImprovePanel-CNpCp5N4.js} +1 -1
- package/ui/dist/assets/{SelfProposalsPanel-DtcTUDDd.js → SelfProposalsPanel-BJL6Fjxo.js} +1 -1
- package/ui/dist/assets/{SessionsPanel-B7QmOizR.js → SessionsPanel-EAGKDQp0.js} +1 -1
- package/ui/dist/assets/{SessionsTab-BdJj_vsI.js → SessionsTab-tc0njI15.js} +1 -1
- package/ui/dist/assets/{SettingsPanel-DnEvJUFe.js → SettingsPanel-BdSGImIa.js} +1 -1
- package/ui/dist/assets/{SettingsView-C39dk_yr.js → SettingsView-DQB64bjy.js} +2 -2
- package/ui/dist/assets/{SkeletonLoader-CsiR8ED9.js → SkeletonLoader-P8SFCyGi.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-DM4qBFDS.js → SkillsPanel-lDMl_8da.js} +1 -1
- package/ui/dist/assets/{SomaView-CWnPKEQI.js → SomaView-BG7YvBu2.js} +1 -1
- package/ui/dist/assets/{StatCard-CY8lgeWm.js → StatCard-Cv2u-yqA.js} +1 -1
- package/ui/dist/assets/{StatusBadge-CGvKbP7R.js → StatusBadge-JJeoEdCm.js} +1 -1
- package/ui/dist/assets/{TeamsPanel-Bf6GaUni.js → TeamsPanel-D-iCyyYd.js} +1 -1
- package/ui/dist/assets/{TelemetryPanel-JZ90gJXC.js → TelemetryPanel-DHNFyCwn.js} +1 -1
- package/ui/dist/assets/{TitanCanvas-Hk49NFcA.js → TitanCanvas-BhurNMK3.js} +3 -3
- package/ui/dist/assets/ToolsView-C8sWxLny.js +2 -0
- package/ui/dist/assets/{Tooltip-CcoZrKsl.js → Tooltip-D4IeQDJL.js} +1 -1
- package/ui/dist/assets/{TraceViewer-ojGf0drx.js → TraceViewer-CMd-Wi0z.js} +1 -1
- package/ui/dist/assets/{TrainingPanel-CWnP4H2l.js → TrainingPanel-CLtiBq2h.js} +1 -1
- package/ui/dist/assets/{VoiceOverlay-Dn6iaYgd.js → VoiceOverlay-BXPVdnJc.js} +1 -1
- package/ui/dist/assets/{VramPanel-CLd9Ggck.js → VramPanel-DjuwGUzA.js} +1 -1
- package/ui/dist/assets/{WatchView-CQBemwsm.js → WatchView-B7sDnMpl.js} +1 -1
- package/ui/dist/assets/{WorkTab-BOfTN-Bd.js → WorkTab-B5nQ4Y7A.js} +1 -1
- package/ui/dist/assets/{WorkflowsPanel-qzNS0p0u.js → WorkflowsPanel-2z0TeXyR.js} +1 -1
- package/ui/dist/assets/{arrow-left-c-8OFZUV.js → arrow-left-BKOkzkae.js} +1 -1
- package/ui/dist/assets/{chart-column-x6L66Qw7.js → chart-column-D39PCk17.js} +1 -1
- package/ui/dist/assets/{circle-check-big-WaW3U3Xl.js → circle-check-big-CMz0QouP.js} +1 -1
- package/ui/dist/assets/{dollar-sign-D2Oce4Ru.js → dollar-sign-Bu8fZOQl.js} +1 -1
- package/ui/dist/assets/{download-YvPDLlFJ.js → download-vvx6zJ-U.js} +1 -1
- package/ui/dist/assets/{eye-off-DIMcxsdQ.js → eye-off-BPXFIzlW.js} +1 -1
- package/ui/dist/assets/{funnel-DqD9srZu.js → funnel-Bqns-i8I.js} +1 -1
- package/ui/dist/assets/{git-branch-0FamUEbU.js → git-branch-CdmeqL8d.js} +1 -1
- package/ui/dist/assets/{index-NatBSFxj.js → index-C6oarzis.js} +2 -2
- package/ui/dist/assets/index-DsFoD9SP.css +1 -0
- package/ui/dist/assets/{legacy-DOO7F5cq.js → legacy-DFIaZTiF.js} +1 -1
- package/ui/dist/assets/{lightbulb-Bk6KlR6q.js → lightbulb-DOL6Q-iP.js} +1 -1
- package/ui/dist/assets/{pause-DDC_zUiJ.js → pause-B0XymOnS.js} +1 -1
- package/ui/dist/assets/{play-BPXbHToG.js → play-Dwp2l5HG.js} +1 -1
- package/ui/dist/assets/{plug-Dxp-sWVF.js → plug-DRlTjWqQ.js} +1 -1
- package/ui/dist/assets/{proxy-vU7v4NVM.js → proxy-sXxWK7WF.js} +1 -1
- package/ui/dist/assets/{square-Bn_0tYME.js → square-yh0jffQZ.js} +1 -1
- package/ui/dist/assets/{target-BrtxUtzl.js → target-GxtNG2RW.js} +1 -1
- package/ui/dist/assets/{toggle-right-CYphlpN5.js → toggle-right-CYQd_Ux1.js} +1 -1
- package/ui/dist/assets/{trash-2-C_Jsp23A.js → trash-2-B4jp_pAQ.js} +1 -1
- package/ui/dist/assets/{trending-up-DrtLViSm.js → trending-up-B26tNhFP.js} +1 -1
- package/ui/dist/assets/{trophy-DdRzAOfo.js → trophy-Bf3ZeSeb.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/ToolsView-Cq7Fuq3i.js +0 -2
- package/ui/dist/assets/index-D932CbpQ.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e,A as G,Z as S,C as I,d as T,ac as V,p as B,ad as $,ae as F,af as q,ag as U}from"./index-
|
|
1
|
+
import{r as o,j as e,A as G,Z as S,C as I,d as T,ac as V,p as B,ad as $,ae as F,af as q,ag as U}from"./index-C6oarzis.js";import{S as l}from"./StatCard-Cv2u-yqA.js";import{C as W,e as x,h as Z}from"./TitanCanvas-BhurNMK3.js";import{G as O}from"./git-branch-CdmeqL8d.js";import{C as _}from"./chart-column-D39PCk17.js";import"./VoiceOverlay-BXPVdnJc.js";function Y(){var m,u,h,g,j,p,v;const[s,C]=o.useState(null),[i,w]=o.useState(null),[a,M]=o.useState(null),[R,A]=o.useState(0),[L,P]=o.useState(0),[n,k]=o.useState(null),[D,E]=o.useState(!0);return o.useEffect(()=>{const t=async()=>{try{const[c,d,f,N,y,b]=await Promise.allSettled([V(),B(1),$(),F(100),q(100),U()]);c.status==="fulfilled"&&C(c.value),d.status==="fulfilled"&&w(d.value.stats),f.status==="fulfilled"&&M(f.value),N.status==="fulfilled"&&A((N.value.alerts||[]).length),y.status==="fulfilled"&&P((y.value.violations||[]).length),b.status==="fulfilled"&&k(b.value)}catch{}E(!1)};t();const r=setInterval(t,15e3);return()=>clearInterval(r)},[]),D?e.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:Array.from({length:8}).map((t,r)=>e.jsx("div",{className:"h-28 animate-pulse rounded-xl border border-border bg-bg-secondary"},r))}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-text",children:"Telemetry & Monitoring"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(l,{title:"Total Requests",value:((m=s==null?void 0:s.totalRequests)==null?void 0:m.toLocaleString())??"0",icon:e.jsx(G,{className:"h-5 w-5"})}),e.jsx(l,{title:"Avg Latency",value:s!=null&&s.avgLatencyMs?`${Math.round(s.avgLatencyMs)}ms`:"—",icon:e.jsx(W,{className:"h-5 w-5"})}),e.jsx(l,{title:"Error Rate",value:(s==null?void 0:s.errorRate)!==void 0?`${(s.errorRate*100).toFixed(1)}%`:"0%",icon:e.jsx(S,{className:"h-5 w-5"})}),e.jsx(l,{title:"Total Tokens",value:(()=>{const t=s==null?void 0:s.totalTokens;return typeof t=="number"?t.toLocaleString():t&&typeof t=="object"?(t.total??(t.prompt??0)+(t.completion??0)).toLocaleString():"0"})(),icon:e.jsx(I,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(l,{title:"Traces",value:((u=i==null?void 0:i.totalTraces)==null?void 0:u.toString())??"0",icon:e.jsx(O,{className:"h-5 w-5"})}),e.jsx(l,{title:"Avg Rounds/Task",value:((h=i==null?void 0:i.avgRounds)==null?void 0:h.toFixed(1))??"—",icon:e.jsx(_,{className:"h-5 w-5"})}),e.jsx(l,{title:"Soul Tasks",value:((g=a==null?void 0:a.totalTasks)==null?void 0:g.toString())??"0",icon:e.jsx(x,{className:"h-5 w-5"})}),e.jsx(l,{title:"Confidence",value:a!=null&&a.avgConfidence?`${Math.round(a.avgConfidence*100)}%`:"—",icon:e.jsx(x,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(l,{title:"Alerts",value:R.toString(),icon:e.jsx(T,{className:"h-5 w-5"})}),e.jsx(l,{title:"Guardrail Violations",value:L.toString(),icon:e.jsx(T,{className:"h-5 w-5"})}),e.jsx(l,{title:"Total Errors",value:((j=s==null?void 0:s.totalErrors)==null?void 0:j.toString())??"0",icon:e.jsx(S,{className:"h-5 w-5"})}),e.jsx(l,{title:"Learned Patterns",value:((v=(p=a==null?void 0:a.patterns)==null?void 0:p.length)==null?void 0:v.toString())??"0",icon:e.jsx(x,{className:"h-5 w-5"})})]}),n&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-sm font-medium text-text-secondary mb-3 flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),"System Profile"]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"OS"})," ",e.jsxs("span",{className:"text-text-secondary ml-1",children:[n.os," ",n.arch]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"CPU"})," ",e.jsxs("span",{className:"text-text-secondary ml-1",children:[n.cpuCores,"c — ",n.cpuModel.split("@")[0].trim()]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"RAM"})," ",e.jsxs("span",{className:"text-text-secondary ml-1",children:[Math.round(n.ramTotalMB/1024),"GB"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"GPU"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.gpuName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Node"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.nodeVersion})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Install"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.installMethod})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Version"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.version})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"ID"})," ",e.jsx("span",{className:"text-text-secondary ml-1 font-mono",children:n.installId.slice(0,8)})]})]})]}),(s==null?void 0:s.topTools)&&s.topTools.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-3",children:"Top Tools"}),e.jsx("div",{className:"space-y-2",children:s.topTools.map((t,r)=>{const c=s.topTools[0].count,d=c>0?t.count/c*100:0;return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary w-24 truncate font-mono",children:t.tool}),e.jsx("div",{className:"flex-1 h-2 rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-accent/60",style:{width:`${d}%`}})}),e.jsx("span",{className:"text-xs text-text-muted w-10 text-right",children:t.count})]},r)})})]}),(a==null?void 0:a.patterns)&&a.patterns.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-3",children:"Learned Task Patterns"}),e.jsx("div",{className:"grid grid-cols-1 gap-2 lg:grid-cols-2",children:a.patterns.slice(0,8).map((t,r)=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-bg-secondary border border-border text-xs",children:[e.jsx("span",{className:"text-text-secondary",children:t.taskType}),e.jsxs("div",{className:"flex items-center gap-3 text-text-muted",children:[e.jsx("span",{className:"font-mono",children:t.bestStrategy}),e.jsxs("span",{children:[t.avgRounds.toFixed(1)," rounds"]}),e.jsxs("span",{className:t.successRate>=.7?"text-success":"text-warning",children:[Math.round(t.successRate*100),"%"]})]})]},r))})]})]})}export{Y as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SomaView-
|
|
2
|
-
var Xa=Object.defineProperty;var Za=(t,e,s)=>e in t?Xa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var We=(t,e,s)=>Za(t,typeof e!="symbol"?e+"":e,s);import{c as re,a as Xe,g as Qa,r as S,b as Pe,j as r,s as el,X as ws,S as hr,A as gt,C as fr,d as pr,G as Ii,R as te,_ as se,Z as tl,e as nn,f as sl,h as nl,W as rl,M as il,H as ol,u as al,i as ll,t as Sn}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SomaView-BG7YvBu2.js","assets/index-C6oarzis.js","assets/index-DsFoD9SP.css","assets/Input-DWnbv1Yh.js","assets/Tooltip-D4IeQDJL.js","assets/VoiceOverlay-BXPVdnJc.js","assets/SomaView-BtCkeWfZ.css","assets/CommandPostHub-PXKE62DN.js","assets/proxy-sXxWK7WF.js","assets/InlineEditableField-DyBCbIoN.js","assets/pause-B0XymOnS.js","assets/dollar-sign-Bu8fZOQl.js","assets/git-branch-CdmeqL8d.js","assets/chart-column-D39PCk17.js","assets/target-GxtNG2RW.js","assets/trash-2-B4jp_pAQ.js","assets/IntelligenceView-PIFGvIg_.js","assets/MemoryGraphPanel-DD7x4rrm.js","assets/InfraView-C5OYx_9s.js","assets/ToolsView-C8sWxLny.js","assets/SettingsView-DQB64bjy.js","assets/SettingsPanel-BdSGImIa.js","assets/PageHeader-CF75km05.js","assets/circle-check-big-CMz0QouP.js","assets/download-vvx6zJ-U.js","assets/play-Dwp2l5HG.js","assets/SecurityPanel-DjC4pXGM.js","assets/AuditPanel-DLy0WJQZ.js","assets/funnel-Bqns-i8I.js","assets/AutopilotPanel-nBluaHA4.js","assets/WorkflowsPanel-2z0TeXyR.js","assets/toggle-right-CYQd_Ux1.js","assets/LearningPanel-D_S4HFX5.js","assets/lightbulb-DOL6Q-iP.js","assets/trending-up-B26tNhFP.js","assets/SelfImprovePanel-CNpCp5N4.js","assets/trophy-Bf3ZeSeb.js","assets/PersonasPanel-ClC_TTGX.js","assets/HomelabPanel-B4bCsrBw.js","assets/StatCard-Cv2u-yqA.js","assets/SkeletonLoader-P8SFCyGi.js","assets/NvidiaPanel-DVntoRrH.js","assets/eye-off-BPXFIzlW.js","assets/FilesPanel-CNrDLmix.js","assets/arrow-left-BKOkzkae.js","assets/LogsPanel-BnWNREPX.js","assets/TelemetryPanel-DHNFyCwn.js","assets/SkillsPanel-lDMl_8da.js","assets/McpPanel-CIMxZ2Am.js","assets/plug-DRlTjWqQ.js","assets/IntegrationsPanel-DsB6hjvE.js","assets/ChannelsPanel-5EhhyXeg.js","assets/MeshPanel-CiuwR3oV.js","assets/DataTable-BHOu7fZP.js","assets/DaemonPanel-xt08Rs10.js","assets/MemoryWikiPanel-BPPVAH0b.js","assets/AutoresearchPanel-BDy8y_Cs.js","assets/SelfProposalsPanel-BJL6Fjxo.js","assets/OverviewPanel-gqYRhmpF.js","assets/SessionsPanel-EAGKDQp0.js","assets/WatchView-B7sDnMpl.js","assets/BackupPanel-B_Fv2pJA.js","assets/TrainingPanel-CLtiBq2h.js","assets/RecipesPanel-Di2l-eOe.js","assets/VramPanel-DjuwGUzA.js","assets/TeamsPanel-D-iCyyYd.js","assets/CronPanel-lAsoKavq.js","assets/CheckpointsPanel-BVt2oEUe.js","assets/OrganismPanel-pqIKtHrW.js","assets/FleetPanel-DP_ji0AE.js","assets/BrowserPanel-DOCT3-Rq.js","assets/PaperclipPanel-CwN5-cKg.js","assets/square-yh0jffQZ.js","assets/EvalPanel-D9rDf1bk.js","assets/legacy-DFIaZTiF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Xa=Object.defineProperty;var Za=(t,e,s)=>e in t?Xa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var We=(t,e,s)=>Za(t,typeof e!="symbol"?e+"":e,s);import{c as re,a as Xe,g as Qa,r as S,b as Pe,j as r,s as el,X as ws,S as hr,A as gt,C as fr,d as pr,G as Ii,R as te,_ as se,Z as tl,e as nn,f as sl,h as nl,W as rl,M as il,H as ol,u as al,i as ll,t as Sn}from"./index-C6oarzis.js";import{M as Di,V as cl,C as dl}from"./VoiceOverlay-BXPVdnJc.js";/**
|
|
3
3
|
* @license lucide-react v0.513.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -1014,7 +1014,7 @@ function Widget({ titan }) {
|
|
|
1014
1014
|
const btn = container.querySelector('button');
|
|
1015
1015
|
btn.addEventListener('click', () => btn.textContent = 'Clicked!');
|
|
1016
1016
|
}`,html:`<!-- Raw HTML. No scripts run. -->
|
|
1017
|
-
<div style="padding:16px;color:#e4e4e7">Hello, widget!</div>`,iframe:"",system:""},Cp={productivity:"#a78bfa",finance:"#34d399","health-fitness":"#f472b6","music-dj":"#c084fc",creative:"#fb923c",travel:"#60a5fa",gaming:"#f87171",social:"#38bdf8",cooking:"#fbbf24",vehicle:"#94a3b8",homelab:"#a3e635","ml-ai":"#818cf8",research:"#2dd4bf",document:"#f9a8d4",devops:"#fcd34d","e-commerce":"#fda4af",lifestyle:"#86efac",web:"#67e8f9",data:"#d8b4fe","multi-modal":"#fdba74",automation:"#facc15","smart-home":"#bef264",agents:"#e879f9","software-builder":"#7dd3fc",utilities:"#a5b4fc",media:"#fca5a5",communication:"#5eead4",education:"#c4b5fd",misc:"#9ca3af"};function Tp(t){return t.split(/[-_/]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Ap({open:t,onClose:e}){const[s,n]=S.useState([]),[i,a]=S.useState([]),[c,l]=S.useState("All"),[d,p]=S.useState(!1),[w,u]=S.useState(null);if(S.useEffect(()=>{t&&(p(!0),fetch("/api/widget-gallery").then(v=>v.json()).then(v=>{n(v.templates||[]),a(v.categories||[]),p(!1)}).catch(v=>{u(v.message),p(!1)}))},[t]),S.useEffect(()=>{if(!t)return;const v=A=>{A.key==="Escape"&&e()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[t,e]),!t)return null;const f=c==="All"?s:s.filter(v=>v.category===c),g=v=>{const A=`Create a "${v.name}" widget using the gallery template "${v.id}". Call gallery_search with "${v.name}" to find it, then gallery_get to fetch the source, and emit it onto the canvas.`;window.dispatchEvent(new CustomEvent("titan:chat:toggle",{detail:{open:!0}})),setTimeout(()=>{window.dispatchEvent(new CustomEvent("titan:chat:prompt",{detail:{text:A}}))},120),e()},y=["All",...i.map(v=>v.category)];return r.jsx("div",{className:"fixed inset-0 z-[2147483150] flex items-center justify-center p-4",style:{background:"rgba(0, 0, 0, 0.66)",backdropFilter:"blur(4px)"},onClick:e,children:r.jsxs("div",{className:"w-full max-w-4xl rounded-2xl border border-[#27272a] bg-[#0c0c10] shadow-2xl flex flex-col",style:{height:"min(720px, 90vh)"},onClick:v=>v.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hr,{className:"w-4 h-4 text-[#a78bfa]"}),r.jsx("h3",{className:"font-semibold text-white text-sm",children:"Widget gallery"}),r.jsx("span",{className:"text-[10px] text-[#71717a]",children:d?"Loading…":`${s.length} templates`})]}),r.jsx("button",{onClick:e,className:"p-1 rounded text-[#71717a] hover:bg-[#18181b] hover:text-white transition-colors",title:"Close (Esc)",children:r.jsx(ws,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"flex items-center gap-1.5 px-5 py-2 border-b border-[#27272a] text-[11px] overflow-x-auto",children:y.map(v=>{var A;return r.jsxs("button",{onClick:()=>l(v),className:`px-2.5 py-1 rounded-full border transition-colors whitespace-nowrap ${c===v?"border-[#6366f1] bg-[#6366f1]/15 text-white":"border-[#27272a] bg-transparent text-[#a1a1aa] hover:border-[#3f3f46] hover:text-white"}`,children:[Tp(v),v!=="All"&&r.jsx("span",{className:"ml-1.5 text-[9px] opacity-70",children:((A=i.find(C=>C.category===v))==null?void 0:A.count)??0})]},v)})}),r.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[d&&r.jsx("div",{className:"flex items-center justify-center h-full text-[#a1a1aa] text-sm",children:"Loading templates…"}),w&&r.jsxs("div",{className:"flex items-center justify-center h-full text-[#f87171] text-sm",children:["Error: ",w]}),!d&&!w&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:f.map(v=>r.jsxs("button",{onClick:()=>g(v),className:"text-left p-3 rounded-lg border border-[#27272a] bg-[#18181b]/60 hover:border-[#6366f1]/50 hover:bg-[#18181b] transition-colors group",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Cp[v.category]??"#9ca3af"}}),r.jsx("span",{className:"text-[12px] font-medium text-white truncate",children:v.name})]}),r.jsx(Gi,{className:"w-3 h-3 text-[#52525b] group-hover:text-[#a5b4fc] transition-colors shrink-0"})]}),r.jsx("div",{className:"text-[11px] text-[#a1a1aa] leading-relaxed line-clamp-2",children:v.description}),v.tags&&v.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:v.tags.slice(0,3).map(A=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-[#27272a] text-[#71717a]",children:A},A))})]},v.id))}),f.length===0&&r.jsx("div",{className:"flex items-center justify-center h-40 text-[#a1a1aa] text-sm",children:"No templates in this category."})]}),r.jsxs("div",{className:"mt-4 p-3 rounded-lg border border-dashed border-[#27272a] bg-[#0a0a0e] flex items-start gap-2",children:[r.jsx(Bi,{className:"w-3.5 h-3.5 text-[#71717a] mt-0.5 shrink-0"}),r.jsxs("div",{className:"text-[11px] text-[#a1a1aa] leading-relaxed",children:["Don’t see what you want? Open the chat (click the mascot) and describe your widget in plain English. TITAN can build anything that runs inside a sandboxed iframe with access to ",r.jsx("span",{className:"font-mono text-[#d4d4d8]",children:"titan.fetch"}),","," ",r.jsx("span",{className:"font-mono text-[#d4d4d8]",children:"titan.api.call"}),", and"," ",r.jsx("span",{className:"font-mono text-[#d4d4d8]",children:"titan.state"}),"."]})]})]})]})})}const Rp=[{type:"widget",source:"system:nav",name:"Nav Widget",w:3,h:4,icon:r.jsx(Bi,{className:"w-4 h-4"})},{type:"widget",source:"system:chat",name:"Chat Widget",w:4,h:5,icon:r.jsx($i,{className:"w-4 h-4"})},{type:"widget",source:"system:soma",name:"SOMA",w:6,h:6,icon:r.jsx(mt,{className:"w-4 h-4"})},{type:"widget",source:"system:command-post",name:"Command Post",w:8,h:6,icon:r.jsx(Yi,{className:"w-4 h-4"})},{type:"widget",source:"system:intelligence",name:"Intelligence",w:6,h:5,icon:r.jsx(zi,{className:"w-4 h-4"})},{type:"widget",source:"system:memory-graph",name:"Memory Graph",w:8,h:7,icon:r.jsx(kl,{className:"w-4 h-4"})},{type:"widget",source:"system:voice",name:"Voice",w:5,h:5,icon:r.jsx(Di,{className:"w-4 h-4"})},{type:"widget",source:"system:infra",name:"Infrastructure",w:6,h:4,icon:r.jsx(gr,{className:"w-4 h-4"})},{type:"widget",source:"system:tools",name:"Tools",w:5,h:4,icon:r.jsx(wr,{className:"w-4 h-4"})},{type:"widget",source:"system:settings",name:"Settings",w:5,h:5,icon:r.jsx(mr,{className:"w-4 h-4"})},{type:"widget",source:"system:files",name:"Files",w:4,h:6,icon:r.jsx(rn,{className:"w-4 h-4"})},{type:"widget",source:"system:daemon",name:"Daemon",w:6,h:6,icon:r.jsx(gt,{className:"w-4 h-4"})},{type:"widget",source:"system:memory-wiki",name:"Memory Wiki",w:6,h:6,icon:r.jsx(os,{className:"w-4 h-4"})},{type:"widget",source:"system:autoresearch",name:"Autoresearch",w:6,h:6,icon:r.jsx(Ui,{className:"w-4 h-4"})},{type:"widget",source:"system:self-proposals",name:"Self-Proposals",w:6,h:6,icon:r.jsx(Wi,{className:"w-4 h-4"})},{type:"widget",source:"system:overview",name:"Overview",w:6,h:5,icon:r.jsx(Pi,{className:"w-4 h-4"})},{type:"widget",source:"system:sessions",name:"Sessions",w:6,h:5,icon:r.jsx(as,{className:"w-4 h-4"})},{type:"widget",source:"system:watch",name:"Watch",w:8,h:7,icon:r.jsx(gt,{className:"w-4 h-4"})},{type:"widget",source:"system:backup",name:"Backup Manager",w:6,h:6,icon:r.jsx(Mi,{className:"w-4 h-4"})},{type:"widget",source:"system:training",name:"Training Dashboard",w:6,h:6,icon:r.jsx(mt,{className:"w-4 h-4"})},{type:"widget",source:"system:recipes",name:"Recipe Kitchen",w:6,h:6,icon:r.jsx(os,{className:"w-4 h-4"})},{type:"widget",source:"system:vram",name:"VRAM Monitor",w:6,h:6,icon:r.jsx(fr,{className:"w-4 h-4"})},{type:"widget",source:"system:teams",name:"Team Hub",w:6,h:6,icon:r.jsx(yr,{className:"w-4 h-4"})},{type:"widget",source:"system:cron",name:"Cron Scheduler",w:6,h:6,icon:r.jsx(as,{className:"w-4 h-4"})},{type:"widget",source:"system:checkpoints",name:"Checkpoints",w:6,h:5,icon:r.jsx(an,{className:"w-4 h-4"})},{type:"widget",source:"system:organism",name:"Organism Monitor",w:6,h:6,icon:r.jsx(pr,{className:"w-4 h-4"})},{type:"widget",source:"system:fleet",name:"Fleet Router",w:6,h:5,icon:r.jsx(Hi,{className:"w-4 h-4"})},{type:"widget",source:"system:browser",name:"Browser Tools",w:6,h:5,icon:r.jsx(Ii,{className:"w-4 h-4"})},{type:"widget",source:"system:paperclip",name:"Paperclip",w:6,h:5,icon:r.jsx(Vi,{className:"w-4 h-4"})},{type:"widget",source:"system:eval",name:"Test Lab",w:6,h:6,icon:r.jsx(Ki,{className:"w-4 h-4"})}];function Ya({currentSpaceId:t,onSpaceSelect:e,onAction:s,onClose:n}){const[i,a]=S.useState(""),[c,l]=S.useState(0),d=S.useRef(null),p=_e.list(),w=S.useMemo(()=>{const u=i.toLowerCase(),f=p.filter(y=>y.id!==t&&y.name.toLowerCase().includes(u)).map(y=>({type:"space",id:y.id,name:y.name,color:y.color})),g=Rp.filter(y=>y.name.toLowerCase().includes(u)).map(y=>({type:"action",action:y,name:y.name}));return[...f,...g]},[i,p,t]);return S.useEffect(()=>{var u;(u=d.current)==null||u.focus()},[]),S.useEffect(()=>{l(0)},[i]),S.useEffect(()=>{const u=f=>{if(f.key==="Escape"){n();return}if(f.key==="ArrowDown"){f.preventDefault(),l(g=>Math.min(g+1,w.length-1));return}if(f.key==="ArrowUp"){f.preventDefault(),l(g=>Math.max(g-1,0));return}if(f.key==="Enter"){f.preventDefault();const g=w[c];if(!g)return;g.type==="space"&&e(g.id),g.type==="action"&&s(g.action)}};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[w,c,e,s,n]),r.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[20vh]",onClick:n,children:r.jsxs("div",{className:"w-full max-w-lg bg-[#18181b]/98 backdrop-blur-xl border border-[#27272a]/60 rounded-2xl shadow-2xl shadow-black/60 overflow-hidden",onClick:u=>u.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-[#27272a]/40",children:[r.jsx(ec,{className:"w-4 h-4 text-[#3f3f46]"}),r.jsx("input",{ref:d,value:i,onChange:u=>a(u.target.value),placeholder:"Search spaces, widgets, actions...",className:"flex-1 bg-transparent text-sm text-[#e4e4e7] placeholder:text-[#3f3f46] outline-none"}),r.jsx("button",{onClick:n,className:"text-[#3f3f46] hover:text-[#71717a]",children:r.jsx(ws,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"max-h-[50vh] overflow-auto py-1",children:[w.length===0&&r.jsxs("div",{className:"px-4 py-6 text-center text-xs text-[#52525b]",children:['No results for "',i,'"']}),w.map((u,f)=>r.jsxs("button",{onClick:()=>{u.type==="space"&&e(u.id),u.type==="action"&&s(u.action)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors ${f===c?"bg-[#6366f1]/10 text-[#818cf8]":"text-[#a1a1aa] hover:bg-[#27272a]/30"}`,children:[u.type==="space"?r.jsx("div",{className:"w-4 h-4 rounded-full",style:{background:u.color||"#52525b"}}):r.jsx("span",{className:"text-[#6366f1]/60",children:u.action.icon}),r.jsx("span",{className:"text-sm",children:u.name}),r.jsx("span",{className:"ml-auto text-[10px] text-[#3f3f46] uppercase tracking-wider",children:u.type==="space"?"Space":"Widget"})]},u.type==="space"?u.id:u.action.source))]}),r.jsxs("div",{className:"px-4 py-2 border-t border-[#27272a]/40 flex items-center gap-3 text-[10px] text-[#3f3f46]",children:[r.jsx("span",{children:"↑↓ Navigate"}),r.jsx("span",{children:"↵ Select"}),r.jsx("span",{children:"ESC Close"})]})]})})}const Lp=te.lazy(()=>se(()=>import("./SomaView-CWnPKEQI.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function Ka(){const[t,e]=S.useState(null),[s,n]=S.useState(!1),[i,a]=S.useState(null),c=S.useCallback(async()=>{var p;try{const w=await Pe("/api/config");if(!w.ok)throw new Error(`HTTP ${w.status}`);const u=await w.json();e(!!((p=u==null?void 0:u.organism)!=null&&p.enabled)),a(null)}catch(w){a(w.message),e(!1)}},[]);S.useEffect(()=>{c()},[c]);const l=S.useRef(0),d=S.useCallback(async p=>{const w=++l.current;n(!0),a(null);try{const u=await Pe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organism:{enabled:p}})});if(w!==l.current)return;if(!u.ok)throw new Error(`HTTP ${u.status}`);e(p),window.dispatchEvent(new CustomEvent("titan:soma:changed",{detail:{enabled:p}}))}catch(u){if(w!==l.current)return;a(u.message)}finally{w===l.current&&n(!1)}},[]);return t===null?r.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[#52525b]",children:"Loading Soma…"}):t?r.jsxs("div",{className:"w-full h-full overflow-auto flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-[#27272a]/40 bg-[#18181b]/60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-[#34d399] animate-pulse"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-[#34d399]",children:"Soma active"})]}),r.jsxs("button",{onClick:()=>d(!1),disabled:s,className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-[#27272a] text-[10px] text-[#a1a1aa] hover:text-white hover:border-[#3f3f46] disabled:opacity-60 transition-colors",title:"Disable Soma",children:[r.jsx(Zr,{className:"w-3 h-3"}),s?"saving…":"disable"]})]}),r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Soma dashboard…"}),children:r.jsx(Lp,{})})})]}):r.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-4 p-6 text-center",children:[r.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-br from-[#6366f1]/20 to-[#a78bfa]/20 border border-[#6366f1]/30 flex items-center justify-center",children:r.jsx(gt,{className:"w-7 h-7 text-[#a78bfa]"})}),r.jsxs("div",{className:"space-y-1 max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-white",children:"Soma is off"}),r.jsx("p",{className:"text-xs text-[#a1a1aa] leading-relaxed",children:"TITAN’s homeostatic drive layer. When enabled, TITAN has a sense of its own state — purpose, curiosity, hunger, safety, social, rest — and will propose work when those drives drift. Every proposal still requires your approval."})]}),r.jsxs("button",{onClick:()=>d(!0),disabled:s,className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-[#6366f1] hover:bg-[#4f46e5] disabled:opacity-60 disabled:cursor-not-allowed text-white text-sm font-medium transition-colors",children:[r.jsx(Zr,{className:"w-4 h-4"}),s?"Enabling…":"Enable Soma"]}),i&&r.jsx("p",{className:"text-xs text-[#ef4444]",children:i}),r.jsx("p",{className:"text-[10px] text-[#52525b]",children:"You can turn this off anytime from the same button."})]})}const Ip={calm:{primary:"#6366f1",glow:"rgba(99,102,241,0.4)",pulse:"rgba(99,102,241,0.15)"},focused:{primary:"#10b981",glow:"rgba(16,185,129,0.4)",pulse:"rgba(16,185,129,0.15)"},excited:{primary:"#f59e0b",glow:"rgba(245,158,11,0.4)",pulse:"rgba(245,158,11,0.15)"},concerned:{primary:"#ef4444",glow:"rgba(239,68,68,0.4)",pulse:"rgba(239,68,68,0.15)"},dreaming:{primary:"#8b5cf6",glow:"rgba(139,92,246,0.4)",pulse:"rgba(139,92,246,0.15)"}};function Dp(t,e,s){if(!s)return{emotion:"dreaming",intensity:.25,activity:"Dormant"};const n=e[0],i=Math.min(1,t/2);switch(n){case"purpose":return{emotion:"focused",intensity:.4+i*.4,activity:"Pursuing purpose"};case"curiosity":return{emotion:"excited",intensity:.4+i*.5,activity:"Exploring"};case"hunger":return{emotion:"focused",intensity:.5+i*.3,activity:"Satiating"};case"safety":return{emotion:"concerned",intensity:.5+i*.4,activity:"Securing"};case"social":return{emotion:"calm",intensity:.3+i*.3,activity:"Connecting"};case"rest":return{emotion:"dreaming",intensity:.2+i*.2,activity:"Recuperating"};default:return t>.5?{emotion:"focused",intensity:i,activity:"Processing"}:{emotion:"calm",intensity:.3,activity:"Observing"}}}function Mp(){const[t,e]=S.useState(!1),[s,n]=S.useState({emotion:"calm",intensity:.3,activity:"Observing"}),[i,a]=S.useState(!1),[c,l]=S.useState({x:24,y:80}),[d,p]=S.useState(!1),w=S.useRef({x:0,y:0}),u=S.useRef(null);S.useEffect(()=>{let A=!1;const C=async()=>{try{const b=await Pe("/api/soma/state");if(!b.ok||A)return;const x=await b.json();if(A)return;n(Dp(Number((x==null?void 0:x.totalPressure)??0),Array.isArray(x==null?void 0:x.dominantDrives)?x.dominantDrives:[],!!(x!=null&&x.enabled)))}catch{}};C();const M=setInterval(C,15e3);return()=>{A=!0,clearInterval(M)}},[]),S.useEffect(()=>{const A=C=>{var M;(M=u.current)!=null&&M.contains(C.target)||a(!1)};return window.addEventListener("mousedown",A),()=>window.removeEventListener("mousedown",A)},[]);const f=A=>{A.button===0&&(w.current={x:A.clientX-c.x,y:A.clientY-c.y},p(!0))},g=A=>{d&&l({x:A.clientX-w.current.x,y:A.clientY-w.current.y})},y=()=>{p(!1)},v=Ip[s.emotion];return r.jsxs(r.Fragment,{children:[t&&r.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:()=>e(!1),children:r.jsxs("div",{className:"bg-[#18181b]/98 border border-[#27272a]/60 rounded-2xl shadow-2xl shadow-black/60 overflow-hidden",style:{width:"min(900px, 90vw)",height:"min(600px, 80vh)"},onClick:A=>A.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[#27272a]/40",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mt,{className:"w-4 h-4",style:{color:v.primary}}),r.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-[#a1a1aa]",children:"SOMA Consciousness"})]}),r.jsx("button",{onClick:()=>e(!1),className:"p-1 text-[#3f3f46] hover:text-[#71717a]",children:r.jsx(ws,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"h-[calc(100%-40px)]",children:r.jsx(Ka,{})})]})}),r.jsxs("div",{ref:u,className:"fixed z-50 select-none",style:{left:c.x,top:c.y},onMouseDown:f,onMouseMove:g,onMouseUp:y,onMouseLeave:y,children:[i&&r.jsxs("div",{className:"absolute bottom-full left-0 mb-2 bg-[#18181b]/98 backdrop-blur-xl border border-[#27272a]/60 rounded-xl shadow-2xl shadow-black/60 overflow-hidden min-w-[160px] py-1",children:[r.jsxs("button",{onClick:()=>{e(!0),a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-[11px] text-[#a1a1aa] hover:bg-[#27272a]/40 transition-colors",children:[r.jsx(mt,{className:"w-3.5 h-3.5",style:{color:v.primary}}),"Open SOMA"]}),r.jsxs("button",{onClick:()=>{a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-[11px] text-[#a1a1aa] hover:bg-[#27272a]/40 transition-colors",children:[r.jsx(hr,{className:"w-3.5 h-3.5 text-[#f59e0b]"}),"Summarize Canvas"]}),r.jsxs("button",{onClick:()=>{a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-[11px] text-[#a1a1aa] hover:bg-[#27272a]/40 transition-colors",children:[r.jsx(tl,{className:"w-3.5 h-3.5 text-[#6366f1]"}),"Run Self-Check"]})]}),r.jsxs("div",{className:"relative cursor-pointer group",onClick:()=>!d&&e(!0),onContextMenu:A=>{A.preventDefault(),a(!0)},children:[r.jsx("div",{className:"absolute inset-0 rounded-full animate-ping opacity-20",style:{background:v.pulse,animationDuration:`${3-s.intensity*2}s`}}),r.jsx("div",{className:"absolute -inset-2 rounded-full opacity-30 blur-md transition-all duration-1000",style:{background:v.glow}}),r.jsx("div",{className:"relative w-12 h-12 rounded-full flex items-center justify-center transition-all duration-500 hover:scale-110",style:{background:`radial-gradient(circle at 30% 30%, ${v.primary}, ${v.primary}88)`,boxShadow:`0 0 ${20+s.intensity*30}px ${v.glow}, inset 0 0 10px rgba(255,255,255,0.1)`},children:r.jsx(mt,{className:"w-5 h-5 text-white/90"})}),r.jsx("div",{className:"absolute -bottom-5 left-1/2 -translate-x-1/2 whitespace-nowrap",children:r.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-[#52525b] bg-[#0a0a0f]/80 px-1.5 py-0.5 rounded",children:s.activity})})]})]})]})}const Op=te.lazy(()=>se(()=>import("./CommandPostHub-BPPaUv1B.js").then(t=>t.C),__vite__mapDeps([7,1,2,3,8,9,4,5,10,11,12,13,14,15])));function Pp(){return r.jsx("div",{className:"w-full h-full overflow-auto p-2",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Command Post..."}),children:r.jsx(Op,{})})})}const Up=te.lazy(()=>se(()=>import("./IntelligenceView-smQ6aBwx.js"),__vite__mapDeps([16,1,2])));function Wp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Intelligence..."}),children:r.jsx(Up,{})})})}const Bp=te.lazy(()=>se(()=>import("./MemoryGraphPanel-BGOeSaET.js"),__vite__mapDeps([17,1,2,15,5])));function Fp(){return r.jsx("div",{className:"w-full h-full overflow-auto bg-[#09090b]",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-[#6366f1]/20 border-t-[#6366f1] animate-spin mx-auto mb-3"}),r.jsx("p",{className:"text-[11px] text-[#52525b]",children:"Loading memory graph..."})]})}),children:r.jsx("div",{className:"p-4",children:r.jsx(Bp,{})})})})}function $p(){const[t,e]=S.useState(!1);return t?r.jsx(cl,{onClose:()=>e(!1)}):r.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center bg-[#09090b]",children:r.jsxs("button",{onClick:()=>e(!0),className:"group relative flex flex-col items-center gap-4",children:[r.jsxs("div",{className:"relative w-20 h-20 rounded-full flex items-center justify-center transition-all duration-300 group-hover:scale-110",children:[r.jsx("div",{className:"absolute inset-0 rounded-full bg-[#6366f1]/20 animate-pulse"}),r.jsx("div",{className:"absolute inset-0 rounded-full bg-gradient-to-br from-[#6366f1]/30 to-[#4f46e5]/10 border border-[#6366f1]/30"}),r.jsx(Di,{className:"w-8 h-8 text-[#818cf8] relative z-10"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-sm font-medium text-[#a1a1aa]",children:"Tap to speak"}),r.jsx("p",{className:"text-[10px] text-[#52525b] mt-1",children:"F5-TTS · Voice Cloning"})]})]})})}const zp=te.lazy(()=>se(()=>import("./InfraView-eS7cpESw.js"),__vite__mapDeps([18,1,2])));function Vp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Infrastructure..."}),children:r.jsx(zp,{})})})}const Hp=te.lazy(()=>se(()=>import("./ToolsView-Cq7Fuq3i.js"),__vite__mapDeps([19,1,2])));function qp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Tools..."}),children:r.jsx(Hp,{})})})}const Gp=te.lazy(()=>se(()=>import("./SettingsView-C39dk_yr.js"),__vite__mapDeps([20,1,2])));function Yp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Settings..."}),children:r.jsx(Gp,{})})})}function Kp(){const[t,e]=S.useState([]),[s,n]=S.useState("/"),[i,a]=S.useState(!1),c=async()=>{a(!0);try{const l=await Pe(`/api/files?path=${encodeURIComponent(s)}`);if(l.ok){const d=await l.json();e(d.files||[])}else e([{name:"documents",path:"/documents",type:"directory"},{name:"readme.md",path:"/readme.md",type:"file"},{name:"config.yaml",path:"/config.yaml",type:"file"}])}catch{e([{name:"documents",path:"/documents",type:"directory"},{name:"readme.md",path:"/readme.md",type:"file"},{name:"config.yaml",path:"/config.yaml",type:"file"}])}finally{a(!1)}};return S.useEffect(()=>{c()},[s]),r.jsxs("div",{className:"w-full h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#27272a]/40",children:[r.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-[#71717a]",children:[r.jsx("span",{className:"text-[#6366f1]",children:"~"}),r.jsx(dl,{className:"w-3 h-3"}),r.jsx("span",{children:s})]}),r.jsx("button",{onClick:c,className:"p-1 text-[#3f3f46] hover:text-[#71717a]",children:r.jsx(on,{className:`w-3 h-3 ${i?"animate-spin":""}`})})]}),r.jsx("div",{className:"flex-1 overflow-auto",children:t.map(l=>r.jsxs("button",{onClick:()=>l.type==="directory"&&n(l.path),className:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-[#27272a]/20 transition-colors",children:[l.type==="directory"?r.jsx(Tl,{className:"w-3.5 h-3.5 text-[#f59e0b]"}):r.jsx(rn,{className:"w-3.5 h-3.5 text-[#6366f1]"}),r.jsx("span",{className:"text-[12px] text-[#a1a1aa]",children:l.name})]},l.path))})]})}const Jp=te.lazy(()=>se(()=>import("./SettingsPanel-DnEvJUFe.js"),__vite__mapDeps([21,1,2,3,22,5,4,23,24,25])));function Xp(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Jp,{})})})}const Zp=te.lazy(()=>se(()=>import("./SecurityPanel-i1QMctV0.js"),__vite__mapDeps([26,1,2,22,5])));function Qp(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Zp,{})})})}const eg=te.lazy(()=>se(()=>import("./AuditPanel-B84Mp16G.js"),__vite__mapDeps([27,1,2,28,5])));function tg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(eg,{})})})}const Li={researcher:"#60a5fa",engineer:"#f87171",manager:"#a78bfa",ceo:"#fbbf24",general:"#9ca3af"};function sg(){const[t,e]=S.useState(null),[s,n]=S.useState({}),[i,a]=S.useState(null),[c,l]=S.useState({}),[d,p]=S.useState(!0),w=S.useCallback(async()=>{a(null);try{const[g,y]=await Promise.all([Pe("/api/specialists"),Pe("/api/models")]);if(!g.ok)throw new Error(`Specialists request failed: ${g.status}`);if(!y.ok)throw new Error(`Models request failed: ${y.status}`);const v=await g.json(),A=await y.json();e(v),n(A)}catch(g){a(g.message)}finally{p(!1)}},[]);S.useEffect(()=>{w()},[w]);const u=S.useMemo(()=>{const g=new Set;if(s&&typeof s=="object")for(const y of Object.keys(s)){const v=s[y];if(Array.isArray(v))for(const A of v)typeof A=="string"?g.add(A):A&&typeof A=="object"&&"id"in A&&typeof A.id=="string"&&g.add(A.id)}if(Array.isArray(t))for(const y of t)y!=null&&y.activeModel&&g.add(y.activeModel),y!=null&&y.defaultModel&&g.add(y.defaultModel);return Array.from(g).sort((y,v)=>y.localeCompare(v))},[s,t]),f=S.useCallback(async(g,y)=>{l(v=>({...v,[g]:"saving"}));try{const v=await Pe(`/api/specialists/${encodeURIComponent(g)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:y})});if(!v.ok){const C=await v.text().catch(()=>"");throw new Error(`PATCH failed (${v.status}): ${C||v.statusText}`)}const A=await v.json();e(C=>(C==null?void 0:C.map(M=>M.id===g?{...M,activeModel:A.activeModel??M.defaultModel,overridden:(A.activeModel??M.defaultModel)!==M.defaultModel}:M))??null),l(C=>({...C,[g]:"saved"})),setTimeout(()=>{l(C=>{if(C[g]!=="saved")return C;const M={...C};return delete M[g],M})},1500)}catch(v){l(A=>({...A,[g]:"error"})),a(`${g}: ${v.message}`)}},[]);return d&&!t?r.jsx("div",{className:"h-full w-full flex items-center justify-center text-xs text-[#52525b]",children:"Loading specialists…"}):r.jsxs("div",{className:"w-full h-full flex flex-col bg-[#0a0a0f] text-[#e4e4e7] text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[#27272a]/60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yr,{className:"w-4 h-4 text-[#6366f1]"}),r.jsx("h3",{className:"font-semibold",children:"Specialist Models"}),r.jsxs("span",{className:"text-[10px] text-[#52525b]",children:[(t==null?void 0:t.length)??0," sub-agents · ",u.length," models"]})]}),r.jsxs("button",{onClick:()=>{p(!0),w()},className:"flex items-center gap-1 px-2 py-1 rounded text-[11px] text-[#71717a] hover:text-[#e4e4e7] hover:bg-[#27272a]/60 transition-colors",title:"Refresh from server",children:[r.jsx(on,{className:`w-3 h-3 ${d?"animate-spin":""}`}),"Refresh"]})]}),i&&r.jsxs("div",{className:"mx-4 mt-3 flex items-start gap-2 px-3 py-2 rounded bg-[#7f1d1d]/20 border border-[#7f1d1d]/40 text-[11px] text-[#fca5a5]",children:[r.jsx(nn,{className:"w-3 h-3 mt-0.5 shrink-0"}),r.jsx("span",{className:"font-mono",children:i})]}),r.jsxs("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-2",children:[(t==null?void 0:t.length)===0&&r.jsx("div",{className:"text-xs text-[#52525b] italic",children:"No specialists registered."}),t==null?void 0:t.map(g=>r.jsx(ng,{row:g,allModels:u,state:c[g.id]??"idle",onChange:y=>f(g.id,y),onReset:()=>f(g.id,null)},g.id))]}),r.jsxs("div",{className:"px-4 py-2 border-t border-[#27272a]/60 text-[10px] text-[#52525b]",children:["Overrides write to ",r.jsx("span",{className:"font-mono text-[#71717a]",children:"config.specialists.overrides"}),". Reset reverts a specialist to its code default."]})]})}function ng({row:t,allModels:e,state:s,onChange:n,onReset:i}){var c;const a=Li[t.role]??Li.general;return r.jsxs("div",{className:"rounded-lg border border-[#27272a]/60 bg-[#18181b]/70 hover:border-[#3f3f46]/80 transition-colors",children:[r.jsxs("div",{className:"px-3 py-2 flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-[180px]",children:[r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:a},title:t.role}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("div",{className:"text-sm font-medium truncate",children:t.name}),r.jsx("div",{className:"text-[10px] text-[#52525b] truncate",children:t.title})]})]}),r.jsxs("div",{className:"flex-1 flex items-center gap-2 min-w-0",children:[r.jsx("select",{value:t.activeModel,onChange:l=>n(l.target.value),disabled:s==="saving",className:"flex-1 min-w-0 px-2 py-1 rounded bg-[#0a0a0f] border border-[#27272a] text-xs font-mono focus:outline-none focus:border-[#6366f1] disabled:opacity-50",title:`default: ${t.defaultModel}`,children:e.map(l=>r.jsx("option",{value:l,children:l},l))}),t.overridden&&r.jsxs("button",{onClick:i,disabled:s==="saving",className:"flex items-center gap-1 px-2 py-1 rounded text-[10px] text-[#fbbf24] border border-[#fbbf24]/30 hover:bg-[#fbbf24]/10 transition-colors disabled:opacity-50",title:`Reset to default: ${t.defaultModel}`,children:[r.jsx(qi,{className:"w-3 h-3"}),"Reset"]}),r.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[s==="saving"&&r.jsx(on,{className:"w-3.5 h-3.5 animate-spin text-[#6366f1]"}),s==="saved"&&r.jsx(ml,{className:"w-3.5 h-3.5 text-[#10b981]"}),s==="error"&&r.jsx(nn,{className:"w-3.5 h-3.5 text-[#ef4444]"})]})]})]}),r.jsxs("div",{className:"px-3 pb-2 flex items-center gap-2 text-[10px] text-[#52525b]",children:[r.jsxs("span",{children:["id: ",r.jsx("span",{className:"font-mono text-[#71717a]",children:t.id})]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["role: ",r.jsx("span",{className:"font-mono",style:{color:a},children:t.role})]}),((c=t.templateMatches)==null?void 0:c.length)>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs("span",{className:"truncate",children:["templates: ",r.jsx("span",{className:"font-mono text-[#71717a]",children:t.templateMatches.join(", ")})]})]})]})]})}function rg(){const[t,e]=S.useState(null),[s,n]=S.useState(null),[i,a]=S.useState(null),[c,l]=S.useState(!1),[d,p]=S.useState(null),[w,u]=S.useState(null),f=S.useCallback(async()=>{p(null);try{const[A,C,M]=await Promise.all([Pe("/api/telemetry/consent").then(b=>b.ok?b.json():Promise.reject(new Error(`consent ${b.status}`))),Pe("/api/analytics/profile").then(b=>b.ok?b.json():null),Pe("/api/telemetry/status").then(b=>b.ok?b.json():null)]);e(A),n(C),M!=null&&M.remote&&a(M.remote)}catch(A){p(A.message)}},[]);S.useEffect(()=>{const A=setInterval(()=>{Pe("/api/telemetry/status").then(C=>C.ok?C.json():null).then(C=>{C!=null&&C.remote&&a(C.remote)}).catch(()=>{})},15e3);return()=>clearInterval(A)},[]),S.useEffect(()=>{f()},[f]);const g=S.useCallback(async A=>{l(!0),p(null);try{const C=await Pe("/api/telemetry/consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!C.ok)throw new Error(`save failed: ${C.status}`);const M=await C.json();e(b=>b?{...b,...M,consentedAt:M.enabled?new Date().toISOString():void 0}:null),u(Date.now()),setTimeout(()=>u(null),2e3)}catch(C){p(C.message)}finally{l(!1)}},[]),y=!!(t!=null&&t.enabled),v=!!(t!=null&&t.crashReports);return r.jsxs("div",{className:"w-full h-full overflow-auto bg-[#0a0a0f] text-[#e4e4e7] text-sm p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[y?r.jsx(ic,{className:"w-5 h-5 text-[#10b981]"}):r.jsx(pr,{className:"w-5 h-5 text-[#71717a]"}),r.jsx("h3",{className:"font-semibold text-base",children:"Privacy & Telemetry"}),r.jsx("span",{className:`ml-2 text-[10px] px-2 py-0.5 rounded-full border ${y?"border-[#10b981]/40 bg-[#10b981]/10 text-[#10b981]":"border-[#3f3f46] bg-[#18181b] text-[#71717a]"}`,children:y?"ENABLED":"OFF"}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[w&&r.jsxs("span",{className:"text-[11px] text-[#10b981] flex items-center gap-1",children:[r.jsx(sl,{className:"w-3 h-3"})," Saved"]}),d&&r.jsxs("span",{className:"text-[11px] text-[#ef4444] flex items-center gap-1",children:[r.jsx(nl,{className:"w-3 h-3"})," ",d]}),r.jsxs("button",{onClick:()=>{f()},className:"flex items-center gap-1 px-2 py-1 rounded text-[11px] text-[#71717a] hover:text-[#e4e4e7] hover:bg-[#27272a]/60 transition-colors",children:[r.jsx(on,{className:"w-3 h-3"})," Refresh"]})]})]}),r.jsx("div",{className:"mb-4 p-4 rounded-lg border border-[#27272a]/60 bg-[#18181b]/70",children:r.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:y,disabled:c,onChange:A=>g({enabled:A.target.checked,crashReports:v}),className:"mt-1 w-4 h-4 accent-[#6366f1] disabled:opacity-50"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium",children:"Send anonymous usage stats"}),r.jsx("div",{className:"text-xs text-[#a1a1aa] mt-1 leading-relaxed",children:"OS, Node version, CPU/GPU model + VRAM, RAM, TITAN version, and install method. A heartbeat every 5 minutes so we see uptime + concurrent-session counts. Never sends: prompts, file contents, credentials, IP address, or conversations."}),(t==null?void 0:t.consentedAt)&&r.jsxs("div",{className:"text-[10px] text-[#71717a] mt-2",children:["Consented ",r.jsx("span",{className:"font-mono",children:new Date(t.consentedAt).toLocaleString()}),t.consentedVersion&&r.jsxs(r.Fragment,{children:[" on TITAN v",r.jsx("span",{className:"font-mono",children:t.consentedVersion})]})]})]})]})}),r.jsx("div",{className:`mb-4 p-4 rounded-lg border transition-opacity ${y?"border-[#27272a]/60 bg-[#18181b]/70":"border-[#27272a]/30 bg-[#18181b]/30 opacity-60"}`,children:r.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:v,disabled:c||!y,onChange:A=>g({enabled:y,crashReports:A.target.checked}),className:"mt-1 w-4 h-4 accent-[#6366f1] disabled:opacity-50"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium",children:"Send crash reports"}),r.jsxs("div",{className:"text-xs text-[#a1a1aa] mt-1 leading-relaxed",children:["When TITAN throws an uncaught exception or unhandled promise rejection, send the error class, message, and stack trace. ",r.jsxs("span",{className:"text-[#fbbf24]",children:["Your $HOME path is replaced with the string ",r.jsx("span",{className:"font-mono",children:'"$HOME"'})," before sending."]})]})]})]})}),r.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-[#27272a]/60 bg-[#18181b]/40",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(nn,{className:"w-4 h-4 text-[#6366f1]"}),r.jsx("div",{className:"text-sm font-medium",children:"What would be sent right now"})]}),s?r.jsxs("dl",{className:"grid grid-cols-[160px_1fr] gap-y-1 text-xs",children:[r.jsx("dt",{className:"text-[#71717a]",children:"installId"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.installId.slice(0,32),"…"]}),r.jsx("dt",{className:"text-[#71717a]",children:"os / arch"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.os," / ",s.arch," (",s.osRelease,")"]}),r.jsx("dt",{className:"text-[#71717a]",children:"cpu"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.cpuModel," · ",s.cpuCores,"c"]}),r.jsx("dt",{className:"text-[#71717a]",children:"ram"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[(s.ramTotalMB/1024).toFixed(1)," GB"]}),r.jsx("dt",{className:"text-[#71717a]",children:"gpu"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.gpuVendor,"/",s.gpuName," · ",(s.gpuVramMB/1024).toFixed(1)," GB VRAM"]}),r.jsx("dt",{className:"text-[#71717a]",children:"disk"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.diskTotalGB," GB"]}),r.jsx("dt",{className:"text-[#71717a]",children:"version / node"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.version," · ",s.nodeVersion]}),r.jsx("dt",{className:"text-[#71717a]",children:"install method"}),r.jsx("dd",{className:"font-mono text-[#e4e4e7]",children:s.installMethod})]}):r.jsx("div",{className:"text-xs text-[#71717a]",children:"Loading profile preview…"})]}),r.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-[#27272a]/60 bg-[#18181b]/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Gi,{className:"w-4 h-4 text-[#6366f1]"}),r.jsx("div",{className:"text-sm font-medium",children:"Delivery status"}),(i==null?void 0:i.lastSuccessAt)&&!i.lastError&&r.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full border border-[#10b981]/40 bg-[#10b981]/10 text-[#10b981]",children:"FLOWING"}),(i==null?void 0:i.lastError)&&r.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full border border-[#ef4444]/40 bg-[#ef4444]/10 text-[#ef4444]",children:"ERROR"}),!(i!=null&&i.configured)&&r.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full border border-[#71717a]/40 bg-[#71717a]/10 text-[#71717a]",children:"NO REMOTE"})]}),i?r.jsxs("dl",{className:"grid grid-cols-[160px_1fr] gap-y-1 text-xs",children:[r.jsx("dt",{className:"text-[#71717a]",children:"remote URL"}),r.jsx("dd",{className:"font-mono text-[#e4e4e7] break-all",children:i.remoteUrl||"—"}),r.jsx("dt",{className:"text-[#71717a]",children:"sent / failed"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[r.jsx("span",{className:"text-[#10b981]",children:i.sentCount})," / ",r.jsx("span",{className:i.failedCount>0?"text-[#ef4444]":"text-[#71717a]",children:i.failedCount}),i.lastEventType&&r.jsxs("span",{className:"text-[#71717a]",children:[" · last event: ",r.jsx("span",{className:"text-[#a1a1aa]",children:i.lastEventType})]})]}),r.jsx("dt",{className:"text-[#71717a]",children:"last attempt"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7] flex items-center gap-1",children:[r.jsx(as,{className:"w-3 h-3 text-[#71717a]"}),i.lastAttemptAt?new Date(i.lastAttemptAt).toLocaleString():"—"]}),r.jsx("dt",{className:"text-[#71717a]",children:"last success"}),r.jsx("dd",{className:"font-mono text-[#e4e4e7]",children:i.lastSuccessAt?new Date(i.lastSuccessAt).toLocaleString():"—"}),i.lastError&&r.jsxs(r.Fragment,{children:[r.jsx("dt",{className:"text-[#ef4444]",children:"last error"}),r.jsx("dd",{className:"font-mono text-[#fca5a5] break-all",children:i.lastError})]})]}):r.jsx("div",{className:"text-xs text-[#71717a]",children:"Checking collector reachability…"})]}),r.jsxs("div",{className:"mb-4 p-3 rounded-lg border border-[#27272a]/60 bg-[#0a0a0f]",children:[r.jsx("div",{className:"text-[10px] text-[#71717a] uppercase tracking-wider mb-1",children:"Collector"}),r.jsx("div",{className:"font-mono text-[11px] text-[#a1a1aa] break-all",children:(t==null?void 0:t.remoteUrl)||"—"})]}),r.jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[r.jsxs("a",{href:"https://github.com/Djtony707/TITAN/blob/main/PRIVACY.md",target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 text-[#6366f1] hover:underline",children:[r.jsx(Xr,{className:"w-3 h-3"})," Read the full PRIVACY.md"]}),r.jsx("span",{className:"text-[#52525b]",children:"·"}),r.jsxs("a",{href:"https://github.com/Djtony707/TITAN/blob/main/src/analytics/collector.ts",target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 text-[#6366f1] hover:underline",children:[r.jsx(Xr,{className:"w-3 h-3"})," See the collector source"]})]})]})}const ig=te.lazy(()=>se(()=>import("./AutopilotPanel-nTb1Dnru.js"),__vite__mapDeps([29,1,2,22,5])));function og(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ig,{})})})}const ag=te.lazy(()=>se(()=>import("./WorkflowsPanel-qzNS0p0u.js"),__vite__mapDeps([30,1,2,22,5,3,9,14,25,10,15,31])));function lg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ag,{})})})}const cg=te.lazy(()=>se(()=>import("./LearningPanel-BEgF_iND.js"),__vite__mapDeps([32,1,2,22,5,33,34])));function dg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(cg,{})})})}const ug=te.lazy(()=>se(()=>import("./SelfImprovePanel-DbybAZWp.js"),__vite__mapDeps([35,1,2,23,36,34,5,25,15])));function hg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ug,{})})})}const fg=te.lazy(()=>se(()=>import("./PersonasPanel-DxrGW5C4.js"),__vite__mapDeps([37,1,2])));function pg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(fg,{})})})}const gg=te.lazy(()=>se(()=>import("./HomelabPanel-DhuXd3ZD.js"),__vite__mapDeps([38,1,2,22,5,39,40,13,23,11])));function mg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(gg,{})})})}const yg=te.lazy(()=>se(()=>import("./NvidiaPanel-NYt42w7L.js"),__vite__mapDeps([41,1,2,23,42,5])));function wg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(yg,{})})})}const bg=te.lazy(()=>se(()=>import("./FilesPanel-DATsiAqG.js"),__vite__mapDeps([43,1,2,5,44,15,24])));function xg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(bg,{})})})}const vg=te.lazy(()=>se(()=>import("./LogsPanel-Br1P8ST6.js"),__vite__mapDeps([45,1,2,5])));function _g(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(vg,{})})})}const kg=te.lazy(()=>se(()=>import("./TelemetryPanel-JZ90gJXC.js"),__vite__mapDeps([46,1,2,39,12,13,5])));function Eg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(kg,{})})})}const Sg=te.lazy(()=>se(()=>import("./SkillsPanel-DM4qBFDS.js"),__vite__mapDeps([47,1,2,22,5,15,24])));function jg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Sg,{})})})}const Ng=te.lazy(()=>se(()=>import("./McpPanel-ByvQ12J_.js"),__vite__mapDeps([48,1,2,49,15,5])));function Cg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Ng,{})})})}const Tg=te.lazy(()=>se(()=>import("./IntegrationsPanel-C_FswSRN.js"),__vite__mapDeps([50,1,2,49,23,42,5])));function Ag(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Tg,{})})})}const Rg=te.lazy(()=>se(()=>import("./ChannelsPanel-CD2kHhA5.js"),__vite__mapDeps([51,1,2,22,5,23,42])));function Lg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Rg,{})})})}const Ig=te.lazy(()=>se(()=>import("./MeshPanel-BjkcSOMz.js"),__vite__mapDeps([52,1,2,53,5])));function Dg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Ig,{})})})}const Mg=te.lazy(()=>se(()=>import("./DaemonPanel-CNUggBbL.js"),__vite__mapDeps([54,1,2,10,25,5])));function Og(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Mg,{})})})}const Pg=te.lazy(()=>se(()=>import("./MemoryWikiPanel-CR8btd66.js"),__vite__mapDeps([55,1,2,22,5,44])));function Ug(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Pg,{})})})}const Wg=te.lazy(()=>se(()=>import("./AutoresearchPanel-D46mX8VF.js"),__vite__mapDeps([56,1,2,25,10,36,34,5])));function Bg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Wg,{})})})}const Fg=te.lazy(()=>se(()=>import("./SelfProposalsPanel-DtcTUDDd.js"),__vite__mapDeps([57,1,2,22,5])));function $g(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Fg,{})})})}const zg=te.lazy(()=>se(()=>import("./OverviewPanel-q35zdMr6.js"),__vite__mapDeps([58,1,2,39,22,5,40])));function Vg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(zg,{})})})}const Hg=te.lazy(()=>se(()=>import("./SessionsPanel-B7QmOizR.js"),__vite__mapDeps([59,1,2,22,5,3,53,9,15])));function qg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Hg,{})})})}const Gg=te.lazy(()=>se(()=>import("./WatchView-CQBemwsm.js"),__vite__mapDeps([60,1,2,8])));function Yg(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Gg,{})})})}const Kg=te.lazy(()=>se(()=>import("./BackupPanel-DGM1XXbG.js"),__vite__mapDeps([61,1,2,22,5,23])));function Jg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Kg,{})})})}const Xg=te.lazy(()=>se(()=>import("./TrainingPanel-CWnP4H2l.js"),__vite__mapDeps([62,1,2,22,5,24])));function Zg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Xg,{})})})}const Qg=te.lazy(()=>se(()=>import("./RecipesPanel-CYRdBx5u.js"),__vite__mapDeps([63,1,2,22,5,25,15])));function em(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Qg,{})})})}const tm=te.lazy(()=>se(()=>import("./VramPanel-CLd9Ggck.js"),__vite__mapDeps([64,1,2,22,5])));function sm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(tm,{})})})}const nm=te.lazy(()=>se(()=>import("./TeamsPanel-Bf6GaUni.js"),__vite__mapDeps([65,1,2,22,5,15])));function rm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(nm,{})})})}const im=te.lazy(()=>se(()=>import("./CronPanel-CsfQctFp.js"),__vite__mapDeps([66,1,2,22,5,31,15])));function om(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(im,{})})})}const am=te.lazy(()=>se(()=>import("./CheckpointsPanel-BrUTFPu_.js"),__vite__mapDeps([67,1,2,22,5,15])));function lm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(am,{})})})}const cm=te.lazy(()=>se(()=>import("./OrganismPanel-PHvISvVn.js"),__vite__mapDeps([68,1,2,22,5,23])));function dm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(cm,{})})})}const um=te.lazy(()=>se(()=>import("./FleetPanel-QYQKqx4W.js"),__vite__mapDeps([69,1,2,22,5])));function hm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(um,{})})})}const fm=te.lazy(()=>se(()=>import("./BrowserPanel-Cn1tTN3y.js"),__vite__mapDeps([70,1,2,22,5])));function pm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(fm,{})})})}const gm=te.lazy(()=>se(()=>import("./PaperclipPanel-BDpQki0d.js"),__vite__mapDeps([71,1,2,22,5,25,72])));function mm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(gm,{})})})}const ym=te.lazy(()=>se(()=>import("./EvalPanel-DEX0a5-b.js"),__vite__mapDeps([73,1,2,22,5,25])));function wm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ym,{})})})}function bm(){const[t,e]=S.useState([]),[s,n]=S.useState(!0),[i,a]=S.useState(null),c=async()=>{try{const l=await fetch("/api/agents");if(!l.ok)throw new Error(`HTTP ${l.status}`);const d=await l.json();e(Array.isArray(d)?d:d.agents||[]),a(null)}catch(l){a(l.message)}finally{n(!1)}};return S.useEffect(()=>{c();const l=setInterval(c,1e4);return()=>clearInterval(l)},[]),s?r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"w-4 h-4 text-[#6366f1] animate-spin"})}):i?r.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",children:r.jsxs("div",{className:"text-center",children:[r.jsx(nn,{className:"w-4 h-4 text-red-400 mx-auto mb-1"}),r.jsx("span",{className:"text-[10px] text-red-400",children:i})]})}):t.length===0?r.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",children:r.jsx("span",{className:"text-[10px] text-[#52525b]",children:"No active agents"})}):r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsx("div",{className:"space-y-2",children:t.map(l=>r.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsx(Oi,{className:`w-3.5 h-3.5 ${l.status==="busy"?"text-[#f59e0b]":l.status==="error"?"text-red-400":"text-[#6366f1]"}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-[11px] text-[#a1a1aa] truncate",children:l.name}),r.jsxs("div",{className:"text-[10px] text-[#52525b] truncate",children:[l.role,l.model?` · ${l.model}`:""]})]}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full uppercase ${l.status==="busy"?"bg-[#f59e0b]/10 text-[#f59e0b]":l.status==="error"?"bg-red-400/10 text-red-400":"bg-[#6366f1]/10 text-[#818cf8]"}`,children:l.status})]},l.id))})})}function xm(){const[t,e]=S.useState(null),[s,n]=S.useState(!0),i=async()=>{try{const[c,l]=await Promise.allSettled([fetch("/api/health").then(w=>w.ok?w.json():null),fetch("/ollama/api/tags").then(w=>w.ok)]),d=c.status==="fulfilled"&&c.value,p=l.status==="fulfilled"&&l.value;e({gateway:d,ollama:p,version:(d==null?void 0:d.version)||"unknown",uptime:(d==null?void 0:d.uptime)||0})}catch{e({gateway:!1,ollama:!1,version:"unknown",uptime:0})}finally{n(!1)}};if(S.useEffect(()=>{i();const c=setInterval(i,3e4);return()=>clearInterval(c)},[]),s)return r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"w-4 h-4 text-[#6366f1] animate-spin"})});const a=c=>{const l=Math.floor(c/3600),d=Math.floor(c%3600/60);return`${l}h ${d}m`};return r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[t!=null&&t.gateway?r.jsx(rl,{className:"w-3.5 h-3.5 text-emerald-400"}):r.jsx(dc,{className:"w-3.5 h-3.5 text-red-400"}),r.jsx("span",{className:"text-[11px] text-[#a1a1aa]",children:"TITAN Gateway"})]}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full uppercase ${t!=null&&t.gateway?"bg-emerald-400/10 text-emerald-400":"bg-red-400/10 text-red-400"}`,children:t!=null&&t.gateway?"Online":"Offline"})]}),r.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(gt,{className:`w-3.5 h-3.5 ${t!=null&&t.ollama?"text-emerald-400":"text-red-400"}`}),r.jsx("span",{className:"text-[11px] text-[#a1a1aa]",children:"Ollama"})]}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full uppercase ${t!=null&&t.ollama?"bg-emerald-400/10 text-emerald-400":"bg-red-400/10 text-red-400"}`,children:t!=null&&t.ollama?"Online":"Offline"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsx("div",{className:"text-[9px] text-[#52525b] uppercase tracking-wider",children:"Version"}),r.jsx("div",{className:"text-[11px] text-[#a1a1aa] font-mono mt-0.5",children:t==null?void 0:t.version})]}),r.jsxs("div",{className:"px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsx("div",{className:"text-[9px] text-[#52525b] uppercase tracking-wider",children:"Uptime"}),r.jsx("div",{className:"text-[11px] text-[#a1a1aa] font-mono mt-0.5",children:a((t==null?void 0:t.uptime)||0)})]})]})]})})}function Rs({label:t,value:e,icon:s,color:n}){const i=Math.max(0,Math.min(100,Math.round(e)));return r.jsxs("div",{className:"px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[s,r.jsx("span",{className:"text-[10px] text-[#52525b] uppercase tracking-wider",children:t})]}),r.jsxs("span",{className:"text-[11px] text-[#a1a1aa] font-mono",children:[i,"%"]})]}),r.jsx("div",{className:"h-1.5 rounded-full bg-[#27272a] overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,backgroundColor:n}})})]})}function vm(){const[t,e]=S.useState({cpu:0,memory:0,disk:0,load:0});return S.useEffect(()=>{const s=setInterval(()=>{e({cpu:Math.random()*60+10,memory:Math.random()*50+30,disk:Math.random()*40+20,load:Math.random()*30+5})},3e3);return e({cpu:Math.random()*60+10,memory:Math.random()*50+30,disk:Math.random()*40+20,load:Math.random()*30+5}),()=>clearInterval(s)},[]),r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Rs,{label:"CPU",value:t.cpu,icon:r.jsx(fr,{className:"w-3 h-3 text-[#6366f1]"}),color:"#6366f1"}),r.jsx(Rs,{label:"Memory",value:t.memory,icon:r.jsx(il,{className:"w-3 h-3 text-[#a78bfa]"}),color:"#a78bfa"}),r.jsx(Rs,{label:"Disk",value:t.disk,icon:r.jsx(ol,{className:"w-3 h-3 text-[#10b981]"}),color:"#10b981"}),r.jsx(Rs,{label:"Load",value:t.load,icon:r.jsx(gt,{className:"w-3 h-3 text-[#f59e0b]"}),color:"#f59e0b"})]})})}const _m=[{label:"Nav",source:"system:nav",w:3,h:4,icon:r.jsx(vl,{className:"w-3.5 h-3.5"})},{label:"Agents",source:"system:agents",w:3,h:4,icon:r.jsx(Oi,{className:"w-3.5 h-3.5"})},{label:"Health",source:"system:health",w:3,h:3,icon:r.jsx(gt,{className:"w-3.5 h-3.5"})},{label:"Stats",source:"system:stats",w:3,h:4,icon:r.jsx(Rl,{className:"w-3.5 h-3.5"})},{label:"Chat",source:"system:chat",w:4,h:5,icon:r.jsx($i,{className:"w-3.5 h-3.5"})},{label:"Files",source:"system:files",w:4,h:6,icon:r.jsx(rn,{className:"w-3.5 h-3.5"})},{label:"Skills",source:"system:tools",w:5,h:4,icon:r.jsx(hr,{className:"w-3.5 h-3.5"})},{label:"Soma",source:"system:soma",w:6,h:6,icon:r.jsx(Dl,{className:"w-3.5 h-3.5"})},{label:"Intel",source:"system:intelligence",w:6,h:5,icon:r.jsx(mt,{className:"w-3.5 h-3.5"})},{label:"Infra",source:"system:infra",w:6,h:4,icon:r.jsx(gr,{className:"w-3.5 h-3.5"})},{label:"Tools",source:"system:tools",w:5,h:4,icon:r.jsx(wr,{className:"w-3.5 h-3.5"})},{label:"Settings",source:"system:settings",w:4,h:6,icon:r.jsx(mr,{className:"w-3.5 h-3.5"})},{label:"Daemon",source:"system:daemon",w:5,h:5,icon:r.jsx(gt,{className:"w-3.5 h-3.5"})},{label:"Wiki",source:"system:memory-wiki",w:5,h:5,icon:r.jsx(os,{className:"w-3.5 h-3.5"})},{label:"Research",source:"system:autoresearch",w:5,h:5,icon:r.jsx(Ui,{className:"w-3.5 h-3.5"})},{label:"Proposals",source:"system:self-proposals",w:5,h:5,icon:r.jsx(Wi,{className:"w-3.5 h-3.5"})},{label:"Overview",source:"system:overview",w:5,h:4,icon:r.jsx(Pi,{className:"w-3.5 h-3.5"})},{label:"Sessions",source:"system:sessions",w:5,h:4,icon:r.jsx(as,{className:"w-3.5 h-3.5"})},{label:"Watch",source:"system:watch",w:6,h:5,icon:r.jsx(gt,{className:"w-3.5 h-3.5"})},{label:"Backup",source:"system:backup",w:5,h:5,icon:r.jsx(Mi,{className:"w-3.5 h-3.5"})},{label:"Training",source:"system:training",w:5,h:5,icon:r.jsx(mt,{className:"w-3.5 h-3.5"})},{label:"Recipes",source:"system:recipes",w:5,h:5,icon:r.jsx(os,{className:"w-3.5 h-3.5"})},{label:"VRAM",source:"system:vram",w:5,h:5,icon:r.jsx(fr,{className:"w-3.5 h-3.5"})},{label:"Teams",source:"system:teams",w:5,h:5,icon:r.jsx(yr,{className:"w-3.5 h-3.5"})},{label:"Cron",source:"system:cron",w:5,h:5,icon:r.jsx(as,{className:"w-3.5 h-3.5"})},{label:"Checkpoints",source:"system:checkpoints",w:5,h:5,icon:r.jsx(an,{className:"w-3.5 h-3.5"})},{label:"Organism",source:"system:organism",w:5,h:5,icon:r.jsx(pr,{className:"w-3.5 h-3.5"})},{label:"Fleet",source:"system:fleet",w:5,h:5,icon:r.jsx(Hi,{className:"w-3.5 h-3.5"})},{label:"Browser",source:"system:browser",w:5,h:5,icon:r.jsx(Ii,{className:"w-3.5 h-3.5"})},{label:"Paperclip",source:"system:paperclip",w:5,h:5,icon:r.jsx(Vi,{className:"w-3.5 h-3.5"})},{label:"Eval",source:"system:eval",w:5,h:5,icon:r.jsx(Ki,{className:"w-3.5 h-3.5"})}];function km(){const t=(e,s,n)=>{window.dispatchEvent(new CustomEvent("titan:widget:add",{detail:{source:e,w:s,h:n}}))};return r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:_m.map(e=>r.jsxs("button",{onClick:()=>t(e.source,e.w,e.h),className:"flex items-center gap-2 px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a] text-[#71717a] hover:text-[#a1a1aa] hover:border-[#3f3f46] hover:bg-[#27272a]/30 transition-all text-left",children:[r.jsx("span",{className:"text-[#6366f1]",children:e.icon}),r.jsx("span",{className:"text-[10px] font-medium",children:e.label})]},e.source))})})}class Em extends te.Component{componentDidCatch(e){this.props.onError(e.message)}render(){return this.props.children}}function Sm({name:t,children:e}){const[s,n]=te.useState(null);return s?r.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",children:r.jsxs("span",{className:"text-xs text-red-400",children:[t,": ",s]})}):r.jsx(Em,{onError:n,children:e})}const jm=te.lazy(()=>se(()=>import("./legacy-DOO7F5cq.js"),__vite__mapDeps([74,1,2])).then(t=>({default:t.Responsive}))),Nm={"system:nav":Ba,"system:chat":za,"system:cmd":Ya,"system:soma":Ka,"system:command-post":Pp,"system:intelligence":Wp,"system:memory-graph":Fp,"system:voice":$p,"system:infra":Vp,"system:tools":qp,"system:settings":Yp,"system:files":Kp,"system:settings-general":Xp,"system:settings-security":Qp,"system:settings-audit":tg,"system:settings-specialists":sg,"system:settings-privacy":rg,"system:intelligence-autopilot":og,"system:intelligence-workflows":lg,"system:intelligence-learning":dg,"system:intelligence-self-improve":hg,"system:intelligence-personas":pg,"system:infra-homelab":mg,"system:infra-gpu":wg,"system:infra-files":xg,"system:infra-logs":_g,"system:infra-telemetry":Eg,"system:tools-skills":jg,"system:tools-mcp":Cg,"system:tools-integrations":Ag,"system:tools-channels":Lg,"system:tools-mesh":Dg,"system:agents":bm,"system:health":xm,"system:stats":vm,"system:quick-links":km,"system:daemon":Og,"system:memory-wiki":Ug,"system:autoresearch":Bg,"system:self-proposals":$g,"system:overview":Vg,"system:sessions":qg,"system:watch":Yg,"system:backup":Jg,"system:training":Zg,"system:recipes":em,"system:vram":sm,"system:teams":rm,"system:cron":om,"system:checkpoints":lm,"system:organism":dm,"system:fleet":hm,"system:browser":pm,"system:paperclip":mm,"system:eval":wm},Cm={lg:12,md:10,sm:6,xs:4,xxs:2},Tm=60,Am={lg:1200,md:996,sm:768,xs:480,xxs:0},Rm=[12,12],Lm=["se","sw","ne","nw","e","w","n","s"],Ja=te.forwardRef(({widget:t,space:e,onRemove:s,style:n,className:i,onMouseDown:a,onMouseUp:c,onTouchStart:l,onTouchEnd:d,children:p},w)=>{const u=S.useCallback(()=>s(t.id),[t.id,s]);return r.jsxs("div",{ref:w,style:n,className:i,onMouseDown:a,onMouseUp:c,onTouchStart:l,onTouchEnd:d,children:[r.jsx(Mm,{widget:t,space:e,onRemove:u}),p]})});Ja.displayName="MemoWidgetItem";const Im=te.memo(Ja);function Dm({widget:t,space:e,onRemove:s}){const n=S.useRef(null),i=S.useRef(null),a=S.useRef(e),[c,l]=S.useState(null),[d,p]=S.useState(!0);if(S.useEffect(()=>{a.current=e},[e]),S.useEffect(()=>{if(t.format==="system"||!n.current)return;if(!t.source||t.source.trim()===""){l("Empty widget — no source code"),p(!1);return}p(!0),l(null),i.current=new Wa(n.current,{onLog:u=>console.log(`[Widget ${t.id}]`,u)}),i.current.setMessageHandler(u=>{var g,y,v,A;const f=a.current;if(u.type==="canvas"&&((g=u.payload)==null?void 0:g.action)==="createWidget"){const C=u.payload.def;if(!C)return{ok:!1,error:"createWidget requires a `def` object"};const M=Number.isFinite(C.w)?C.w:4,b=Number.isFinite(C.h)?C.h:4,x=Number.isFinite(C.x)&&Number.isFinite(C.y)?{x:C.x,y:C.y}:Ps(f.widgets||[],M,b);try{const E=_e.addWidget(f.id,{name:C.name||"Agent Widget",format:C.format||"react",source:C.source||"",x:x.x,y:x.y,w:M,h:b});return window.dispatchEvent(new CustomEvent("titan:space:refresh",{detail:{spaceId:f.id}})),{ok:!0,widgetId:E.id}}catch(E){return{ok:!1,error:E.message}}}if(u.type==="canvas"&&((y=u.payload)==null?void 0:y.action)==="updateWidget"){const{id:C,patch:M}=u.payload;return C?(_e.updateWidget(f.id,C,M||{}),window.dispatchEvent(new CustomEvent("titan:space:refresh",{detail:{spaceId:f.id}})),{ok:!0,id:C}):{ok:!1,error:"updateWidget requires an `id`"}}if(u.type==="canvas"&&((v=u.payload)==null?void 0:v.action)==="listWidgets")return{ok:!0,widgets:f.widgets||[]};if(u.type==="canvas"&&((A=u.payload)==null?void 0:A.action)==="removeWidget"){const C=u.payload.id;return C?(_e.removeWidget(f.id,C),window.dispatchEvent(new CustomEvent("titan:space:refresh",{detail:{spaceId:f.id}})),{ok:!0}):{ok:!1,error:"removeWidget requires an `id`"}}return{ok:!1,error:"Unknown message type"}});const w=setTimeout(()=>{p(!1),l("Sandbox timeout: widget took longer than 30s to render. Babel (~2MB) or React may be slow to load from unpkg.com. Check network tab in DevTools (F12).")},3e4);return i.current.render(t.format,t.source).then(()=>{clearTimeout(w),p(!1)}).catch(u=>{clearTimeout(w),p(!1),l(String(u))}),()=>{var u;clearTimeout(w),(u=i.current)==null||u.destroy()}},[t.format,t.source,t.id]),t.format==="system"){const w=Nm[t.source];return w?r.jsxs("div",{className:"w-full h-full rounded-xl bg-[#18181b]/90 border border-[#27272a]/60 overflow-hidden flex flex-col group hover:border-[#6366f1]/30 transition-colors shadow-lg shadow-black/20",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-[#27272a]/40 panel-drag-handle cursor-move",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-[#6366f1]/70",children:t.name}),r.jsx("button",{onClick:s,className:"opacity-0 group-hover:opacity-100 text-[#3f3f46] hover:text-red-400 text-xs px-1 transition-opacity",children:"×"})]}),r.jsx("div",{className:"flex-1 overflow-auto relative",children:r.jsx(Sm,{name:t.name,children:r.jsx(w,{space:e,widget:t,onRemove:s})})})]}):r.jsxs("div",{className:"w-full h-full flex items-center justify-center text-xs text-red-400",children:["Unknown system widget: ",t.source]})}return r.jsxs("div",{className:"w-full h-full rounded-xl bg-[#18181b]/90 border border-[#27272a]/60 overflow-hidden flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-[#27272a]/40 panel-drag-handle cursor-move",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-[#6366f1]/70",children:t.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:w=>{w.stopPropagation(),window.dispatchEvent(new CustomEvent("titan:widget:edit",{detail:{spaceId:e.id,widgetId:t.id}}))},onMouseDown:w=>w.stopPropagation(),className:"text-[#52525b] hover:text-[#a5b4fc] px-1",title:"Edit widget",children:r.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m18 2 4 4-14 14H4v-4L18 2z"})})}),r.jsx("button",{onClick:s,className:"text-[#3f3f46] hover:text-red-400 text-xs px-1",children:"×"})]})]}),r.jsx("div",{className:"flex-1 relative",children:c?r.jsx("div",{className:"p-3 text-xs text-red-400 font-mono whitespace-pre-wrap",children:c}):r.jsxs(r.Fragment,{children:[r.jsx("iframe",{ref:n,className:"w-full h-full border-0",sandbox:"allow-scripts",title:t.name}),d&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#0a0a0f]/80 text-xs text-[#52525b]",children:r.jsx("span",{className:"animate-pulse",children:"Loading widget…"})})]})})]})}const Mm=te.memo(Dm);function Om({children:t,position:e}){const s={"bottom-left":"left-4 bottom-4","bottom-right":"right-4 bottom-4","top-left":"left-4 top-4","top-right":"right-4 top-4"}[e];return r.jsx("div",{className:`fixed ${s} z-50`,children:t})}function Pm(){const{spaceId:t}=al(),e=ll(),[s,n]=S.useState(null),[i]=S.useState(!0),[a,c]=S.useState(!1),[l,d]=S.useState(null),[p,w]=S.useState(!1),[u,f]=S.useState(!1),[g,y]=S.useState(!1),[v,A]=S.useState(1200),C=S.useRef(null),M=S.useRef(null),{info:b,triggerUpdate:x}=Rf(),[E,j]=S.useState(!1);S.useEffect(()=>{const B=t||"home",H=_e.get(B);H?n(H):e("/space/home",{replace:!0})},[t,e]),S.useEffect(()=>{const B=()=>{const ge=M.current;if(!ge)return null;const fe=new ResizeObserver(be=>{for(const ce of be)A(ce.contentRect.width)});return fe.observe(ge),A(ge.getBoundingClientRect().width||1200),fe};let H=B();const $=setInterval(()=>{H||(H=B()),H&&clearInterval($)},200);return()=>{H==null||H.disconnect(),clearInterval($)}},[s==null?void 0:s.id]),S.useEffect(()=>{const B=H=>{(H.metaKey||H.ctrlKey)&&H.key==="k"&&(H.preventDefault(),f($=>!$)),(H.metaKey||H.ctrlKey)&&H.key==="j"&&(H.preventDefault(),window.dispatchEvent(new CustomEvent("titan:chat:toggle")))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]),Lf([{key:"?",action:()=>y(!0),description:"Show keyboard shortcuts help"},{key:"g",shift:!0,action:()=>e("/space/command"),description:"Go to Command Post space"},{key:"h",shift:!0,action:()=>e("/space/home"),description:"Go to Home space"},{key:"s",shift:!0,action:()=>e("/space/settings"),description:"Go to Settings space"},{key:"i",shift:!0,action:()=>e("/space/intelligence"),description:"Go to Intelligence space"}]);const k=S.useCallback(()=>{},[]),R=S.useRef(null),O=S.useRef(null),N=S.useCallback(B=>{s&&(O.current=B,R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{const H=O.current;!H||!s||(_e.updateLayout(s.id,H.map($=>({i:$.i,x:$.x,y:$.y,w:$.w,h:$.h}))),O.current=null,R.current=null)},50))},[s]),L=S.useCallback(B=>{var ge;if(!s)return;const H=(ge=s.widgets)==null?void 0:ge.find(fe=>fe.id===B);Sn("canvas_panel_removed",{widgetId:B,format:H==null?void 0:H.format,source:H==null?void 0:H.source}),_e.removeWidget(s.id,B);const $=Array.isArray(s.widgets)?s.widgets:[];n({...s,widgets:$.filter(fe=>fe.id!==B)})},[s]),W=S.useCallback(B=>{if(!s)return;const H=_e.addWidget(s.id,B),$=Array.isArray(s.widgets)?s.widgets:[];return n({...s,widgets:[...$,H]}),Sn(B.format==="system"?"canvas_system_panel_created":"canvas_panel_created",{source:B.source,name:B.name,format:B.format}),H},[s]),F=S.useCallback((B,H)=>{if(!s||!Array.isArray(s.widgets)||s.widgets.length===0)return{x:0,y:0};const $=12,ge=new Set;for(const fe of s.widgets)for(let be=0;be<fe.w;be++)for(let ce=0;ce<fe.h;ce++)ge.add(`${fe.x+be},${fe.y+ce}`);for(let fe=0;fe<200;fe++)for(let be=0;be<=$-B;be++){let ce=!0;for(let ee=0;ee<B;ee++){for(let Ee=0;Ee<H;Ee++)if(ge.has(`${be+ee},${fe+Ee}`)){ce=!1;break}if(!ce)break}if(ce)return{x:be,y:fe}}return{x:0,y:0}},[s]),V=S.useCallback((B,H,$=4,ge=4)=>{const fe=F($,ge);W({name:H,format:"system",source:B,x:fe.x,y:fe.y,w:$,h:ge})},[W,F]);S.useEffect(()=>{const B=H=>{const $=H.detail;if(console.log("[TitanCanvas] titan:space:refresh received:",$),!!s&&($==null?void 0:$.spaceId)===s.id){const ge=_e.get(s.id);ge&&(console.log("[TitanCanvas] Refreshing space, widget count:",ge.widgets.length),n(ge))}};return window.addEventListener("titan:space:refresh",B),()=>window.removeEventListener("titan:space:refresh",B)},[s]),S.useEffect(()=>{const B=H=>{const $=H.detail;if(s&&$!=null&&$.source){const ge=$.source.replace("system:","").replace(/-/g," ");V($.source,ge,$.w||4,$.h||4)}};return window.addEventListener("titan:widget:add",B),()=>window.removeEventListener("titan:widget:add",B)},[s,V]),S.useEffect(()=>{const B=H=>{const $=H.detail;s&&($==null?void 0:$.spaceId)===s.id&&typeof($==null?void 0:$.widgetId)=="string"&&d($.widgetId)};return window.addEventListener("titan:widget:edit",B),()=>window.removeEventListener("titan:widget:edit",B)},[s]),S.useEffect(()=>s?_e.observe(s.id,H=>{console.log("[TitanCanvas] CRDT observer fired, widgets:",H.length),n($=>$&&{...$,widgets:H})}):void 0,[s==null?void 0:s.id]);const G=S.useMemo(()=>{const B=s==null?void 0:s.widgets;return Array.isArray(B)?B.filter(Boolean):[]},[s]),Z=S.useMemo(()=>G.map((B,H)=>({i:B.id,x:Number.isFinite(B.x)?B.x:H%3*4,y:Number.isFinite(B.y)?B.y:Math.floor(H/3)*4,w:Number.isFinite(B.w)?B.w:4,h:Number.isFinite(B.h)?B.h:4,minW:2,minH:2,maxW:12,maxH:40})),[G]);return s?r.jsxs("div",{ref:C,className:"h-screen w-screen bg-[#0a0a0f] relative overflow-auto",children:[r.jsx("style",{children:`
|
|
1017
|
+
<div style="padding:16px;color:#e4e4e7">Hello, widget!</div>`,iframe:"",system:""},Cp={productivity:"#a78bfa",finance:"#34d399","health-fitness":"#f472b6","music-dj":"#c084fc",creative:"#fb923c",travel:"#60a5fa",gaming:"#f87171",social:"#38bdf8",cooking:"#fbbf24",vehicle:"#94a3b8",homelab:"#a3e635","ml-ai":"#818cf8",research:"#2dd4bf",document:"#f9a8d4",devops:"#fcd34d","e-commerce":"#fda4af",lifestyle:"#86efac",web:"#67e8f9",data:"#d8b4fe","multi-modal":"#fdba74",automation:"#facc15","smart-home":"#bef264",agents:"#e879f9","software-builder":"#7dd3fc",utilities:"#a5b4fc",media:"#fca5a5",communication:"#5eead4",education:"#c4b5fd",misc:"#9ca3af"};function Tp(t){return t.split(/[-_/]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Ap({open:t,onClose:e}){const[s,n]=S.useState([]),[i,a]=S.useState([]),[c,l]=S.useState("All"),[d,p]=S.useState(!1),[w,u]=S.useState(null);if(S.useEffect(()=>{t&&(p(!0),fetch("/api/widget-gallery").then(v=>v.json()).then(v=>{n(v.templates||[]),a(v.categories||[]),p(!1)}).catch(v=>{u(v.message),p(!1)}))},[t]),S.useEffect(()=>{if(!t)return;const v=A=>{A.key==="Escape"&&e()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[t,e]),!t)return null;const f=c==="All"?s:s.filter(v=>v.category===c),g=v=>{const A=`Create a "${v.name}" widget using the gallery template "${v.id}". Call gallery_search with "${v.name}" to find it, then gallery_get to fetch the source, and emit it onto the canvas.`;window.dispatchEvent(new CustomEvent("titan:chat:toggle",{detail:{open:!0}})),setTimeout(()=>{window.dispatchEvent(new CustomEvent("titan:chat:prompt",{detail:{text:A}}))},120),e()},y=["All",...i.map(v=>v.category)];return r.jsx("div",{className:"fixed inset-0 z-[2147483150] flex items-center justify-center p-4",style:{background:"rgba(0, 0, 0, 0.66)",backdropFilter:"blur(4px)"},onClick:e,children:r.jsxs("div",{className:"w-full max-w-4xl rounded-2xl border border-[#27272a] bg-[#0c0c10] shadow-2xl flex flex-col",style:{height:"min(720px, 90vh)"},onClick:v=>v.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hr,{className:"w-4 h-4 text-[#a78bfa]"}),r.jsx("h3",{className:"font-semibold text-white text-sm",children:"Widget gallery"}),r.jsx("span",{className:"text-[10px] text-[#71717a]",children:d?"Loading…":`${s.length} templates`})]}),r.jsx("button",{onClick:e,className:"p-1 rounded text-[#71717a] hover:bg-[#18181b] hover:text-white transition-colors",title:"Close (Esc)",children:r.jsx(ws,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"flex items-center gap-1.5 px-5 py-2 border-b border-[#27272a] text-[11px] overflow-x-auto",children:y.map(v=>{var A;return r.jsxs("button",{onClick:()=>l(v),className:`px-2.5 py-1 rounded-full border transition-colors whitespace-nowrap ${c===v?"border-[#6366f1] bg-[#6366f1]/15 text-white":"border-[#27272a] bg-transparent text-[#a1a1aa] hover:border-[#3f3f46] hover:text-white"}`,children:[Tp(v),v!=="All"&&r.jsx("span",{className:"ml-1.5 text-[9px] opacity-70",children:((A=i.find(C=>C.category===v))==null?void 0:A.count)??0})]},v)})}),r.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[d&&r.jsx("div",{className:"flex items-center justify-center h-full text-[#a1a1aa] text-sm",children:"Loading templates…"}),w&&r.jsxs("div",{className:"flex items-center justify-center h-full text-[#f87171] text-sm",children:["Error: ",w]}),!d&&!w&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:f.map(v=>r.jsxs("button",{onClick:()=>g(v),className:"text-left p-3 rounded-lg border border-[#27272a] bg-[#18181b]/60 hover:border-[#6366f1]/50 hover:bg-[#18181b] transition-colors group",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Cp[v.category]??"#9ca3af"}}),r.jsx("span",{className:"text-[12px] font-medium text-white truncate",children:v.name})]}),r.jsx(Gi,{className:"w-3 h-3 text-[#52525b] group-hover:text-[#a5b4fc] transition-colors shrink-0"})]}),r.jsx("div",{className:"text-[11px] text-[#a1a1aa] leading-relaxed line-clamp-2",children:v.description}),v.tags&&v.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:v.tags.slice(0,3).map(A=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-[#27272a] text-[#71717a]",children:A},A))})]},v.id))}),f.length===0&&r.jsx("div",{className:"flex items-center justify-center h-40 text-[#a1a1aa] text-sm",children:"No templates in this category."})]}),r.jsxs("div",{className:"mt-4 p-3 rounded-lg border border-dashed border-[#27272a] bg-[#0a0a0e] flex items-start gap-2",children:[r.jsx(Bi,{className:"w-3.5 h-3.5 text-[#71717a] mt-0.5 shrink-0"}),r.jsxs("div",{className:"text-[11px] text-[#a1a1aa] leading-relaxed",children:["Don’t see what you want? Open the chat (click the mascot) and describe your widget in plain English. TITAN can build anything that runs inside a sandboxed iframe with access to ",r.jsx("span",{className:"font-mono text-[#d4d4d8]",children:"titan.fetch"}),","," ",r.jsx("span",{className:"font-mono text-[#d4d4d8]",children:"titan.api.call"}),", and"," ",r.jsx("span",{className:"font-mono text-[#d4d4d8]",children:"titan.state"}),"."]})]})]})]})})}const Rp=[{type:"widget",source:"system:nav",name:"Nav Widget",w:3,h:4,icon:r.jsx(Bi,{className:"w-4 h-4"})},{type:"widget",source:"system:chat",name:"Chat Widget",w:4,h:5,icon:r.jsx($i,{className:"w-4 h-4"})},{type:"widget",source:"system:soma",name:"SOMA",w:6,h:6,icon:r.jsx(mt,{className:"w-4 h-4"})},{type:"widget",source:"system:command-post",name:"Command Post",w:8,h:6,icon:r.jsx(Yi,{className:"w-4 h-4"})},{type:"widget",source:"system:intelligence",name:"Intelligence",w:6,h:5,icon:r.jsx(zi,{className:"w-4 h-4"})},{type:"widget",source:"system:memory-graph",name:"Memory Graph",w:8,h:7,icon:r.jsx(kl,{className:"w-4 h-4"})},{type:"widget",source:"system:voice",name:"Voice",w:5,h:5,icon:r.jsx(Di,{className:"w-4 h-4"})},{type:"widget",source:"system:infra",name:"Infrastructure",w:6,h:4,icon:r.jsx(gr,{className:"w-4 h-4"})},{type:"widget",source:"system:tools",name:"Tools",w:5,h:4,icon:r.jsx(wr,{className:"w-4 h-4"})},{type:"widget",source:"system:settings",name:"Settings",w:5,h:5,icon:r.jsx(mr,{className:"w-4 h-4"})},{type:"widget",source:"system:files",name:"Files",w:4,h:6,icon:r.jsx(rn,{className:"w-4 h-4"})},{type:"widget",source:"system:daemon",name:"Daemon",w:6,h:6,icon:r.jsx(gt,{className:"w-4 h-4"})},{type:"widget",source:"system:memory-wiki",name:"Memory Wiki",w:6,h:6,icon:r.jsx(os,{className:"w-4 h-4"})},{type:"widget",source:"system:autoresearch",name:"Autoresearch",w:6,h:6,icon:r.jsx(Ui,{className:"w-4 h-4"})},{type:"widget",source:"system:self-proposals",name:"Self-Proposals",w:6,h:6,icon:r.jsx(Wi,{className:"w-4 h-4"})},{type:"widget",source:"system:overview",name:"Overview",w:6,h:5,icon:r.jsx(Pi,{className:"w-4 h-4"})},{type:"widget",source:"system:sessions",name:"Sessions",w:6,h:5,icon:r.jsx(as,{className:"w-4 h-4"})},{type:"widget",source:"system:watch",name:"Watch",w:8,h:7,icon:r.jsx(gt,{className:"w-4 h-4"})},{type:"widget",source:"system:backup",name:"Backup Manager",w:6,h:6,icon:r.jsx(Mi,{className:"w-4 h-4"})},{type:"widget",source:"system:training",name:"Training Dashboard",w:6,h:6,icon:r.jsx(mt,{className:"w-4 h-4"})},{type:"widget",source:"system:recipes",name:"Recipe Kitchen",w:6,h:6,icon:r.jsx(os,{className:"w-4 h-4"})},{type:"widget",source:"system:vram",name:"VRAM Monitor",w:6,h:6,icon:r.jsx(fr,{className:"w-4 h-4"})},{type:"widget",source:"system:teams",name:"Team Hub",w:6,h:6,icon:r.jsx(yr,{className:"w-4 h-4"})},{type:"widget",source:"system:cron",name:"Cron Scheduler",w:6,h:6,icon:r.jsx(as,{className:"w-4 h-4"})},{type:"widget",source:"system:checkpoints",name:"Checkpoints",w:6,h:5,icon:r.jsx(an,{className:"w-4 h-4"})},{type:"widget",source:"system:organism",name:"Organism Monitor",w:6,h:6,icon:r.jsx(pr,{className:"w-4 h-4"})},{type:"widget",source:"system:fleet",name:"Fleet Router",w:6,h:5,icon:r.jsx(Hi,{className:"w-4 h-4"})},{type:"widget",source:"system:browser",name:"Browser Tools",w:6,h:5,icon:r.jsx(Ii,{className:"w-4 h-4"})},{type:"widget",source:"system:paperclip",name:"Paperclip",w:6,h:5,icon:r.jsx(Vi,{className:"w-4 h-4"})},{type:"widget",source:"system:eval",name:"Test Lab",w:6,h:6,icon:r.jsx(Ki,{className:"w-4 h-4"})}];function Ya({currentSpaceId:t,onSpaceSelect:e,onAction:s,onClose:n}){const[i,a]=S.useState(""),[c,l]=S.useState(0),d=S.useRef(null),p=_e.list(),w=S.useMemo(()=>{const u=i.toLowerCase(),f=p.filter(y=>y.id!==t&&y.name.toLowerCase().includes(u)).map(y=>({type:"space",id:y.id,name:y.name,color:y.color})),g=Rp.filter(y=>y.name.toLowerCase().includes(u)).map(y=>({type:"action",action:y,name:y.name}));return[...f,...g]},[i,p,t]);return S.useEffect(()=>{var u;(u=d.current)==null||u.focus()},[]),S.useEffect(()=>{l(0)},[i]),S.useEffect(()=>{const u=f=>{if(f.key==="Escape"){n();return}if(f.key==="ArrowDown"){f.preventDefault(),l(g=>Math.min(g+1,w.length-1));return}if(f.key==="ArrowUp"){f.preventDefault(),l(g=>Math.max(g-1,0));return}if(f.key==="Enter"){f.preventDefault();const g=w[c];if(!g)return;g.type==="space"&&e(g.id),g.type==="action"&&s(g.action)}};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[w,c,e,s,n]),r.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[20vh]",onClick:n,children:r.jsxs("div",{className:"w-full max-w-lg bg-[#18181b]/98 backdrop-blur-xl border border-[#27272a]/60 rounded-2xl shadow-2xl shadow-black/60 overflow-hidden",onClick:u=>u.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-[#27272a]/40",children:[r.jsx(ec,{className:"w-4 h-4 text-[#3f3f46]"}),r.jsx("input",{ref:d,value:i,onChange:u=>a(u.target.value),placeholder:"Search spaces, widgets, actions...",className:"flex-1 bg-transparent text-sm text-[#e4e4e7] placeholder:text-[#3f3f46] outline-none"}),r.jsx("button",{onClick:n,className:"text-[#3f3f46] hover:text-[#71717a]",children:r.jsx(ws,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"max-h-[50vh] overflow-auto py-1",children:[w.length===0&&r.jsxs("div",{className:"px-4 py-6 text-center text-xs text-[#52525b]",children:['No results for "',i,'"']}),w.map((u,f)=>r.jsxs("button",{onClick:()=>{u.type==="space"&&e(u.id),u.type==="action"&&s(u.action)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors ${f===c?"bg-[#6366f1]/10 text-[#818cf8]":"text-[#a1a1aa] hover:bg-[#27272a]/30"}`,children:[u.type==="space"?r.jsx("div",{className:"w-4 h-4 rounded-full",style:{background:u.color||"#52525b"}}):r.jsx("span",{className:"text-[#6366f1]/60",children:u.action.icon}),r.jsx("span",{className:"text-sm",children:u.name}),r.jsx("span",{className:"ml-auto text-[10px] text-[#3f3f46] uppercase tracking-wider",children:u.type==="space"?"Space":"Widget"})]},u.type==="space"?u.id:u.action.source))]}),r.jsxs("div",{className:"px-4 py-2 border-t border-[#27272a]/40 flex items-center gap-3 text-[10px] text-[#3f3f46]",children:[r.jsx("span",{children:"↑↓ Navigate"}),r.jsx("span",{children:"↵ Select"}),r.jsx("span",{children:"ESC Close"})]})]})})}const Lp=te.lazy(()=>se(()=>import("./SomaView-BG7YvBu2.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function Ka(){const[t,e]=S.useState(null),[s,n]=S.useState(!1),[i,a]=S.useState(null),c=S.useCallback(async()=>{var p;try{const w=await Pe("/api/config");if(!w.ok)throw new Error(`HTTP ${w.status}`);const u=await w.json();e(!!((p=u==null?void 0:u.organism)!=null&&p.enabled)),a(null)}catch(w){a(w.message),e(!1)}},[]);S.useEffect(()=>{c()},[c]);const l=S.useRef(0),d=S.useCallback(async p=>{const w=++l.current;n(!0),a(null);try{const u=await Pe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organism:{enabled:p}})});if(w!==l.current)return;if(!u.ok)throw new Error(`HTTP ${u.status}`);e(p),window.dispatchEvent(new CustomEvent("titan:soma:changed",{detail:{enabled:p}}))}catch(u){if(w!==l.current)return;a(u.message)}finally{w===l.current&&n(!1)}},[]);return t===null?r.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[#52525b]",children:"Loading Soma…"}):t?r.jsxs("div",{className:"w-full h-full overflow-auto flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-[#27272a]/40 bg-[#18181b]/60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-[#34d399] animate-pulse"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-[#34d399]",children:"Soma active"})]}),r.jsxs("button",{onClick:()=>d(!1),disabled:s,className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-[#27272a] text-[10px] text-[#a1a1aa] hover:text-white hover:border-[#3f3f46] disabled:opacity-60 transition-colors",title:"Disable Soma",children:[r.jsx(Zr,{className:"w-3 h-3"}),s?"saving…":"disable"]})]}),r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Soma dashboard…"}),children:r.jsx(Lp,{})})})]}):r.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-4 p-6 text-center",children:[r.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-br from-[#6366f1]/20 to-[#a78bfa]/20 border border-[#6366f1]/30 flex items-center justify-center",children:r.jsx(gt,{className:"w-7 h-7 text-[#a78bfa]"})}),r.jsxs("div",{className:"space-y-1 max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-white",children:"Soma is off"}),r.jsx("p",{className:"text-xs text-[#a1a1aa] leading-relaxed",children:"TITAN’s homeostatic drive layer. When enabled, TITAN has a sense of its own state — purpose, curiosity, hunger, safety, social, rest — and will propose work when those drives drift. Every proposal still requires your approval."})]}),r.jsxs("button",{onClick:()=>d(!0),disabled:s,className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-[#6366f1] hover:bg-[#4f46e5] disabled:opacity-60 disabled:cursor-not-allowed text-white text-sm font-medium transition-colors",children:[r.jsx(Zr,{className:"w-4 h-4"}),s?"Enabling…":"Enable Soma"]}),i&&r.jsx("p",{className:"text-xs text-[#ef4444]",children:i}),r.jsx("p",{className:"text-[10px] text-[#52525b]",children:"You can turn this off anytime from the same button."})]})}const Ip={calm:{primary:"#6366f1",glow:"rgba(99,102,241,0.4)",pulse:"rgba(99,102,241,0.15)"},focused:{primary:"#10b981",glow:"rgba(16,185,129,0.4)",pulse:"rgba(16,185,129,0.15)"},excited:{primary:"#f59e0b",glow:"rgba(245,158,11,0.4)",pulse:"rgba(245,158,11,0.15)"},concerned:{primary:"#ef4444",glow:"rgba(239,68,68,0.4)",pulse:"rgba(239,68,68,0.15)"},dreaming:{primary:"#8b5cf6",glow:"rgba(139,92,246,0.4)",pulse:"rgba(139,92,246,0.15)"}};function Dp(t,e,s){if(!s)return{emotion:"dreaming",intensity:.25,activity:"Dormant"};const n=e[0],i=Math.min(1,t/2);switch(n){case"purpose":return{emotion:"focused",intensity:.4+i*.4,activity:"Pursuing purpose"};case"curiosity":return{emotion:"excited",intensity:.4+i*.5,activity:"Exploring"};case"hunger":return{emotion:"focused",intensity:.5+i*.3,activity:"Satiating"};case"safety":return{emotion:"concerned",intensity:.5+i*.4,activity:"Securing"};case"social":return{emotion:"calm",intensity:.3+i*.3,activity:"Connecting"};case"rest":return{emotion:"dreaming",intensity:.2+i*.2,activity:"Recuperating"};default:return t>.5?{emotion:"focused",intensity:i,activity:"Processing"}:{emotion:"calm",intensity:.3,activity:"Observing"}}}function Mp(){const[t,e]=S.useState(!1),[s,n]=S.useState({emotion:"calm",intensity:.3,activity:"Observing"}),[i,a]=S.useState(!1),[c,l]=S.useState({x:24,y:80}),[d,p]=S.useState(!1),w=S.useRef({x:0,y:0}),u=S.useRef(null);S.useEffect(()=>{let A=!1;const C=async()=>{try{const b=await Pe("/api/soma/state");if(!b.ok||A)return;const x=await b.json();if(A)return;n(Dp(Number((x==null?void 0:x.totalPressure)??0),Array.isArray(x==null?void 0:x.dominantDrives)?x.dominantDrives:[],!!(x!=null&&x.enabled)))}catch{}};C();const M=setInterval(C,15e3);return()=>{A=!0,clearInterval(M)}},[]),S.useEffect(()=>{const A=C=>{var M;(M=u.current)!=null&&M.contains(C.target)||a(!1)};return window.addEventListener("mousedown",A),()=>window.removeEventListener("mousedown",A)},[]);const f=A=>{A.button===0&&(w.current={x:A.clientX-c.x,y:A.clientY-c.y},p(!0))},g=A=>{d&&l({x:A.clientX-w.current.x,y:A.clientY-w.current.y})},y=()=>{p(!1)},v=Ip[s.emotion];return r.jsxs(r.Fragment,{children:[t&&r.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:()=>e(!1),children:r.jsxs("div",{className:"bg-[#18181b]/98 border border-[#27272a]/60 rounded-2xl shadow-2xl shadow-black/60 overflow-hidden",style:{width:"min(900px, 90vw)",height:"min(600px, 80vh)"},onClick:A=>A.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[#27272a]/40",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mt,{className:"w-4 h-4",style:{color:v.primary}}),r.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-[#a1a1aa]",children:"SOMA Consciousness"})]}),r.jsx("button",{onClick:()=>e(!1),className:"p-1 text-[#3f3f46] hover:text-[#71717a]",children:r.jsx(ws,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"h-[calc(100%-40px)]",children:r.jsx(Ka,{})})]})}),r.jsxs("div",{ref:u,className:"fixed z-50 select-none",style:{left:c.x,top:c.y},onMouseDown:f,onMouseMove:g,onMouseUp:y,onMouseLeave:y,children:[i&&r.jsxs("div",{className:"absolute bottom-full left-0 mb-2 bg-[#18181b]/98 backdrop-blur-xl border border-[#27272a]/60 rounded-xl shadow-2xl shadow-black/60 overflow-hidden min-w-[160px] py-1",children:[r.jsxs("button",{onClick:()=>{e(!0),a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-[11px] text-[#a1a1aa] hover:bg-[#27272a]/40 transition-colors",children:[r.jsx(mt,{className:"w-3.5 h-3.5",style:{color:v.primary}}),"Open SOMA"]}),r.jsxs("button",{onClick:()=>{a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-[11px] text-[#a1a1aa] hover:bg-[#27272a]/40 transition-colors",children:[r.jsx(hr,{className:"w-3.5 h-3.5 text-[#f59e0b]"}),"Summarize Canvas"]}),r.jsxs("button",{onClick:()=>{a(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-[11px] text-[#a1a1aa] hover:bg-[#27272a]/40 transition-colors",children:[r.jsx(tl,{className:"w-3.5 h-3.5 text-[#6366f1]"}),"Run Self-Check"]})]}),r.jsxs("div",{className:"relative cursor-pointer group",onClick:()=>!d&&e(!0),onContextMenu:A=>{A.preventDefault(),a(!0)},children:[r.jsx("div",{className:"absolute inset-0 rounded-full animate-ping opacity-20",style:{background:v.pulse,animationDuration:`${3-s.intensity*2}s`}}),r.jsx("div",{className:"absolute -inset-2 rounded-full opacity-30 blur-md transition-all duration-1000",style:{background:v.glow}}),r.jsx("div",{className:"relative w-12 h-12 rounded-full flex items-center justify-center transition-all duration-500 hover:scale-110",style:{background:`radial-gradient(circle at 30% 30%, ${v.primary}, ${v.primary}88)`,boxShadow:`0 0 ${20+s.intensity*30}px ${v.glow}, inset 0 0 10px rgba(255,255,255,0.1)`},children:r.jsx(mt,{className:"w-5 h-5 text-white/90"})}),r.jsx("div",{className:"absolute -bottom-5 left-1/2 -translate-x-1/2 whitespace-nowrap",children:r.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-[#52525b] bg-[#0a0a0f]/80 px-1.5 py-0.5 rounded",children:s.activity})})]})]})]})}const Op=te.lazy(()=>se(()=>import("./CommandPostHub-PXKE62DN.js").then(t=>t.C),__vite__mapDeps([7,1,2,3,8,9,4,5,10,11,12,13,14,15])));function Pp(){return r.jsx("div",{className:"w-full h-full overflow-auto p-2",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Command Post..."}),children:r.jsx(Op,{})})})}const Up=te.lazy(()=>se(()=>import("./IntelligenceView-PIFGvIg_.js"),__vite__mapDeps([16,1,2])));function Wp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Intelligence..."}),children:r.jsx(Up,{})})})}const Bp=te.lazy(()=>se(()=>import("./MemoryGraphPanel-DD7x4rrm.js"),__vite__mapDeps([17,1,2,15,5])));function Fp(){return r.jsx("div",{className:"w-full h-full overflow-auto bg-[#09090b]",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-[#6366f1]/20 border-t-[#6366f1] animate-spin mx-auto mb-3"}),r.jsx("p",{className:"text-[11px] text-[#52525b]",children:"Loading memory graph..."})]})}),children:r.jsx("div",{className:"p-4",children:r.jsx(Bp,{})})})})}function $p(){const[t,e]=S.useState(!1);return t?r.jsx(cl,{onClose:()=>e(!1)}):r.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center bg-[#09090b]",children:r.jsxs("button",{onClick:()=>e(!0),className:"group relative flex flex-col items-center gap-4",children:[r.jsxs("div",{className:"relative w-20 h-20 rounded-full flex items-center justify-center transition-all duration-300 group-hover:scale-110",children:[r.jsx("div",{className:"absolute inset-0 rounded-full bg-[#6366f1]/20 animate-pulse"}),r.jsx("div",{className:"absolute inset-0 rounded-full bg-gradient-to-br from-[#6366f1]/30 to-[#4f46e5]/10 border border-[#6366f1]/30"}),r.jsx(Di,{className:"w-8 h-8 text-[#818cf8] relative z-10"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-sm font-medium text-[#a1a1aa]",children:"Tap to speak"}),r.jsx("p",{className:"text-[10px] text-[#52525b] mt-1",children:"F5-TTS · Voice Cloning"})]})]})})}const zp=te.lazy(()=>se(()=>import("./InfraView-C5OYx_9s.js"),__vite__mapDeps([18,1,2])));function Vp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Infrastructure..."}),children:r.jsx(zp,{})})})}const Hp=te.lazy(()=>se(()=>import("./ToolsView-C8sWxLny.js"),__vite__mapDeps([19,1,2])));function qp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Tools..."}),children:r.jsx(Hp,{})})})}const Gp=te.lazy(()=>se(()=>import("./SettingsView-DQB64bjy.js"),__vite__mapDeps([20,1,2])));function Yp(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"p-4 text-xs text-[#52525b]",children:"Loading Settings..."}),children:r.jsx(Gp,{})})})}function Kp(){const[t,e]=S.useState([]),[s,n]=S.useState("/"),[i,a]=S.useState(!1),c=async()=>{a(!0);try{const l=await Pe(`/api/files?path=${encodeURIComponent(s)}`);if(l.ok){const d=await l.json();e(d.files||[])}else e([{name:"documents",path:"/documents",type:"directory"},{name:"readme.md",path:"/readme.md",type:"file"},{name:"config.yaml",path:"/config.yaml",type:"file"}])}catch{e([{name:"documents",path:"/documents",type:"directory"},{name:"readme.md",path:"/readme.md",type:"file"},{name:"config.yaml",path:"/config.yaml",type:"file"}])}finally{a(!1)}};return S.useEffect(()=>{c()},[s]),r.jsxs("div",{className:"w-full h-full flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#27272a]/40",children:[r.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-[#71717a]",children:[r.jsx("span",{className:"text-[#6366f1]",children:"~"}),r.jsx(dl,{className:"w-3 h-3"}),r.jsx("span",{children:s})]}),r.jsx("button",{onClick:c,className:"p-1 text-[#3f3f46] hover:text-[#71717a]",children:r.jsx(on,{className:`w-3 h-3 ${i?"animate-spin":""}`})})]}),r.jsx("div",{className:"flex-1 overflow-auto",children:t.map(l=>r.jsxs("button",{onClick:()=>l.type==="directory"&&n(l.path),className:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-[#27272a]/20 transition-colors",children:[l.type==="directory"?r.jsx(Tl,{className:"w-3.5 h-3.5 text-[#f59e0b]"}):r.jsx(rn,{className:"w-3.5 h-3.5 text-[#6366f1]"}),r.jsx("span",{className:"text-[12px] text-[#a1a1aa]",children:l.name})]},l.path))})]})}const Jp=te.lazy(()=>se(()=>import("./SettingsPanel-BdSGImIa.js"),__vite__mapDeps([21,1,2,3,22,5,4,23,24,25])));function Xp(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Jp,{})})})}const Zp=te.lazy(()=>se(()=>import("./SecurityPanel-DjC4pXGM.js"),__vite__mapDeps([26,1,2,22,5])));function Qp(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Zp,{})})})}const eg=te.lazy(()=>se(()=>import("./AuditPanel-DLy0WJQZ.js"),__vite__mapDeps([27,1,2,28,5])));function tg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(eg,{})})})}const Li={researcher:"#60a5fa",engineer:"#f87171",manager:"#a78bfa",ceo:"#fbbf24",general:"#9ca3af"};function sg(){const[t,e]=S.useState(null),[s,n]=S.useState({}),[i,a]=S.useState(null),[c,l]=S.useState({}),[d,p]=S.useState(!0),w=S.useCallback(async()=>{a(null);try{const[g,y]=await Promise.all([Pe("/api/specialists"),Pe("/api/models")]);if(!g.ok)throw new Error(`Specialists request failed: ${g.status}`);if(!y.ok)throw new Error(`Models request failed: ${y.status}`);const v=await g.json(),A=await y.json();e(v),n(A)}catch(g){a(g.message)}finally{p(!1)}},[]);S.useEffect(()=>{w()},[w]);const u=S.useMemo(()=>{const g=new Set;if(s&&typeof s=="object")for(const y of Object.keys(s)){const v=s[y];if(Array.isArray(v))for(const A of v)typeof A=="string"?g.add(A):A&&typeof A=="object"&&"id"in A&&typeof A.id=="string"&&g.add(A.id)}if(Array.isArray(t))for(const y of t)y!=null&&y.activeModel&&g.add(y.activeModel),y!=null&&y.defaultModel&&g.add(y.defaultModel);return Array.from(g).sort((y,v)=>y.localeCompare(v))},[s,t]),f=S.useCallback(async(g,y)=>{l(v=>({...v,[g]:"saving"}));try{const v=await Pe(`/api/specialists/${encodeURIComponent(g)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:y})});if(!v.ok){const C=await v.text().catch(()=>"");throw new Error(`PATCH failed (${v.status}): ${C||v.statusText}`)}const A=await v.json();e(C=>(C==null?void 0:C.map(M=>M.id===g?{...M,activeModel:A.activeModel??M.defaultModel,overridden:(A.activeModel??M.defaultModel)!==M.defaultModel}:M))??null),l(C=>({...C,[g]:"saved"})),setTimeout(()=>{l(C=>{if(C[g]!=="saved")return C;const M={...C};return delete M[g],M})},1500)}catch(v){l(A=>({...A,[g]:"error"})),a(`${g}: ${v.message}`)}},[]);return d&&!t?r.jsx("div",{className:"h-full w-full flex items-center justify-center text-xs text-[#52525b]",children:"Loading specialists…"}):r.jsxs("div",{className:"w-full h-full flex flex-col bg-[#0a0a0f] text-[#e4e4e7] text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[#27272a]/60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yr,{className:"w-4 h-4 text-[#6366f1]"}),r.jsx("h3",{className:"font-semibold",children:"Specialist Models"}),r.jsxs("span",{className:"text-[10px] text-[#52525b]",children:[(t==null?void 0:t.length)??0," sub-agents · ",u.length," models"]})]}),r.jsxs("button",{onClick:()=>{p(!0),w()},className:"flex items-center gap-1 px-2 py-1 rounded text-[11px] text-[#71717a] hover:text-[#e4e4e7] hover:bg-[#27272a]/60 transition-colors",title:"Refresh from server",children:[r.jsx(on,{className:`w-3 h-3 ${d?"animate-spin":""}`}),"Refresh"]})]}),i&&r.jsxs("div",{className:"mx-4 mt-3 flex items-start gap-2 px-3 py-2 rounded bg-[#7f1d1d]/20 border border-[#7f1d1d]/40 text-[11px] text-[#fca5a5]",children:[r.jsx(nn,{className:"w-3 h-3 mt-0.5 shrink-0"}),r.jsx("span",{className:"font-mono",children:i})]}),r.jsxs("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-2",children:[(t==null?void 0:t.length)===0&&r.jsx("div",{className:"text-xs text-[#52525b] italic",children:"No specialists registered."}),t==null?void 0:t.map(g=>r.jsx(ng,{row:g,allModels:u,state:c[g.id]??"idle",onChange:y=>f(g.id,y),onReset:()=>f(g.id,null)},g.id))]}),r.jsxs("div",{className:"px-4 py-2 border-t border-[#27272a]/60 text-[10px] text-[#52525b]",children:["Overrides write to ",r.jsx("span",{className:"font-mono text-[#71717a]",children:"config.specialists.overrides"}),". Reset reverts a specialist to its code default."]})]})}function ng({row:t,allModels:e,state:s,onChange:n,onReset:i}){var c;const a=Li[t.role]??Li.general;return r.jsxs("div",{className:"rounded-lg border border-[#27272a]/60 bg-[#18181b]/70 hover:border-[#3f3f46]/80 transition-colors",children:[r.jsxs("div",{className:"px-3 py-2 flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-[180px]",children:[r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:a},title:t.role}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("div",{className:"text-sm font-medium truncate",children:t.name}),r.jsx("div",{className:"text-[10px] text-[#52525b] truncate",children:t.title})]})]}),r.jsxs("div",{className:"flex-1 flex items-center gap-2 min-w-0",children:[r.jsx("select",{value:t.activeModel,onChange:l=>n(l.target.value),disabled:s==="saving",className:"flex-1 min-w-0 px-2 py-1 rounded bg-[#0a0a0f] border border-[#27272a] text-xs font-mono focus:outline-none focus:border-[#6366f1] disabled:opacity-50",title:`default: ${t.defaultModel}`,children:e.map(l=>r.jsx("option",{value:l,children:l},l))}),t.overridden&&r.jsxs("button",{onClick:i,disabled:s==="saving",className:"flex items-center gap-1 px-2 py-1 rounded text-[10px] text-[#fbbf24] border border-[#fbbf24]/30 hover:bg-[#fbbf24]/10 transition-colors disabled:opacity-50",title:`Reset to default: ${t.defaultModel}`,children:[r.jsx(qi,{className:"w-3 h-3"}),"Reset"]}),r.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[s==="saving"&&r.jsx(on,{className:"w-3.5 h-3.5 animate-spin text-[#6366f1]"}),s==="saved"&&r.jsx(ml,{className:"w-3.5 h-3.5 text-[#10b981]"}),s==="error"&&r.jsx(nn,{className:"w-3.5 h-3.5 text-[#ef4444]"})]})]})]}),r.jsxs("div",{className:"px-3 pb-2 flex items-center gap-2 text-[10px] text-[#52525b]",children:[r.jsxs("span",{children:["id: ",r.jsx("span",{className:"font-mono text-[#71717a]",children:t.id})]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["role: ",r.jsx("span",{className:"font-mono",style:{color:a},children:t.role})]}),((c=t.templateMatches)==null?void 0:c.length)>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs("span",{className:"truncate",children:["templates: ",r.jsx("span",{className:"font-mono text-[#71717a]",children:t.templateMatches.join(", ")})]})]})]})]})}function rg(){const[t,e]=S.useState(null),[s,n]=S.useState(null),[i,a]=S.useState(null),[c,l]=S.useState(!1),[d,p]=S.useState(null),[w,u]=S.useState(null),f=S.useCallback(async()=>{p(null);try{const[A,C,M]=await Promise.all([Pe("/api/telemetry/consent").then(b=>b.ok?b.json():Promise.reject(new Error(`consent ${b.status}`))),Pe("/api/analytics/profile").then(b=>b.ok?b.json():null),Pe("/api/telemetry/status").then(b=>b.ok?b.json():null)]);e(A),n(C),M!=null&&M.remote&&a(M.remote)}catch(A){p(A.message)}},[]);S.useEffect(()=>{const A=setInterval(()=>{Pe("/api/telemetry/status").then(C=>C.ok?C.json():null).then(C=>{C!=null&&C.remote&&a(C.remote)}).catch(()=>{})},15e3);return()=>clearInterval(A)},[]),S.useEffect(()=>{f()},[f]);const g=S.useCallback(async A=>{l(!0),p(null);try{const C=await Pe("/api/telemetry/consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!C.ok)throw new Error(`save failed: ${C.status}`);const M=await C.json();e(b=>b?{...b,...M,consentedAt:M.enabled?new Date().toISOString():void 0}:null),u(Date.now()),setTimeout(()=>u(null),2e3)}catch(C){p(C.message)}finally{l(!1)}},[]),y=!!(t!=null&&t.enabled),v=!!(t!=null&&t.crashReports);return r.jsxs("div",{className:"w-full h-full overflow-auto bg-[#0a0a0f] text-[#e4e4e7] text-sm p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[y?r.jsx(ic,{className:"w-5 h-5 text-[#10b981]"}):r.jsx(pr,{className:"w-5 h-5 text-[#71717a]"}),r.jsx("h3",{className:"font-semibold text-base",children:"Privacy & Telemetry"}),r.jsx("span",{className:`ml-2 text-[10px] px-2 py-0.5 rounded-full border ${y?"border-[#10b981]/40 bg-[#10b981]/10 text-[#10b981]":"border-[#3f3f46] bg-[#18181b] text-[#71717a]"}`,children:y?"ENABLED":"OFF"}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[w&&r.jsxs("span",{className:"text-[11px] text-[#10b981] flex items-center gap-1",children:[r.jsx(sl,{className:"w-3 h-3"})," Saved"]}),d&&r.jsxs("span",{className:"text-[11px] text-[#ef4444] flex items-center gap-1",children:[r.jsx(nl,{className:"w-3 h-3"})," ",d]}),r.jsxs("button",{onClick:()=>{f()},className:"flex items-center gap-1 px-2 py-1 rounded text-[11px] text-[#71717a] hover:text-[#e4e4e7] hover:bg-[#27272a]/60 transition-colors",children:[r.jsx(on,{className:"w-3 h-3"})," Refresh"]})]})]}),r.jsx("div",{className:"mb-4 p-4 rounded-lg border border-[#27272a]/60 bg-[#18181b]/70",children:r.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:y,disabled:c,onChange:A=>g({enabled:A.target.checked,crashReports:v}),className:"mt-1 w-4 h-4 accent-[#6366f1] disabled:opacity-50"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium",children:"Send anonymous usage stats"}),r.jsx("div",{className:"text-xs text-[#a1a1aa] mt-1 leading-relaxed",children:"OS, Node version, CPU/GPU model + VRAM, RAM, TITAN version, and install method. A heartbeat every 5 minutes so we see uptime + concurrent-session counts. Never sends: prompts, file contents, credentials, IP address, or conversations."}),(t==null?void 0:t.consentedAt)&&r.jsxs("div",{className:"text-[10px] text-[#71717a] mt-2",children:["Consented ",r.jsx("span",{className:"font-mono",children:new Date(t.consentedAt).toLocaleString()}),t.consentedVersion&&r.jsxs(r.Fragment,{children:[" on TITAN v",r.jsx("span",{className:"font-mono",children:t.consentedVersion})]})]})]})]})}),r.jsx("div",{className:`mb-4 p-4 rounded-lg border transition-opacity ${y?"border-[#27272a]/60 bg-[#18181b]/70":"border-[#27272a]/30 bg-[#18181b]/30 opacity-60"}`,children:r.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:v,disabled:c||!y,onChange:A=>g({enabled:y,crashReports:A.target.checked}),className:"mt-1 w-4 h-4 accent-[#6366f1] disabled:opacity-50"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium",children:"Send crash reports"}),r.jsxs("div",{className:"text-xs text-[#a1a1aa] mt-1 leading-relaxed",children:["When TITAN throws an uncaught exception or unhandled promise rejection, send the error class, message, and stack trace. ",r.jsxs("span",{className:"text-[#fbbf24]",children:["Your $HOME path is replaced with the string ",r.jsx("span",{className:"font-mono",children:'"$HOME"'})," before sending."]})]})]})]})}),r.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-[#27272a]/60 bg-[#18181b]/40",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(nn,{className:"w-4 h-4 text-[#6366f1]"}),r.jsx("div",{className:"text-sm font-medium",children:"What would be sent right now"})]}),s?r.jsxs("dl",{className:"grid grid-cols-[160px_1fr] gap-y-1 text-xs",children:[r.jsx("dt",{className:"text-[#71717a]",children:"installId"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.installId.slice(0,32),"…"]}),r.jsx("dt",{className:"text-[#71717a]",children:"os / arch"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.os," / ",s.arch," (",s.osRelease,")"]}),r.jsx("dt",{className:"text-[#71717a]",children:"cpu"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.cpuModel," · ",s.cpuCores,"c"]}),r.jsx("dt",{className:"text-[#71717a]",children:"ram"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[(s.ramTotalMB/1024).toFixed(1)," GB"]}),r.jsx("dt",{className:"text-[#71717a]",children:"gpu"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.gpuVendor,"/",s.gpuName," · ",(s.gpuVramMB/1024).toFixed(1)," GB VRAM"]}),r.jsx("dt",{className:"text-[#71717a]",children:"disk"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.diskTotalGB," GB"]}),r.jsx("dt",{className:"text-[#71717a]",children:"version / node"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[s.version," · ",s.nodeVersion]}),r.jsx("dt",{className:"text-[#71717a]",children:"install method"}),r.jsx("dd",{className:"font-mono text-[#e4e4e7]",children:s.installMethod})]}):r.jsx("div",{className:"text-xs text-[#71717a]",children:"Loading profile preview…"})]}),r.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-[#27272a]/60 bg-[#18181b]/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Gi,{className:"w-4 h-4 text-[#6366f1]"}),r.jsx("div",{className:"text-sm font-medium",children:"Delivery status"}),(i==null?void 0:i.lastSuccessAt)&&!i.lastError&&r.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full border border-[#10b981]/40 bg-[#10b981]/10 text-[#10b981]",children:"FLOWING"}),(i==null?void 0:i.lastError)&&r.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full border border-[#ef4444]/40 bg-[#ef4444]/10 text-[#ef4444]",children:"ERROR"}),!(i!=null&&i.configured)&&r.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full border border-[#71717a]/40 bg-[#71717a]/10 text-[#71717a]",children:"NO REMOTE"})]}),i?r.jsxs("dl",{className:"grid grid-cols-[160px_1fr] gap-y-1 text-xs",children:[r.jsx("dt",{className:"text-[#71717a]",children:"remote URL"}),r.jsx("dd",{className:"font-mono text-[#e4e4e7] break-all",children:i.remoteUrl||"—"}),r.jsx("dt",{className:"text-[#71717a]",children:"sent / failed"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7]",children:[r.jsx("span",{className:"text-[#10b981]",children:i.sentCount})," / ",r.jsx("span",{className:i.failedCount>0?"text-[#ef4444]":"text-[#71717a]",children:i.failedCount}),i.lastEventType&&r.jsxs("span",{className:"text-[#71717a]",children:[" · last event: ",r.jsx("span",{className:"text-[#a1a1aa]",children:i.lastEventType})]})]}),r.jsx("dt",{className:"text-[#71717a]",children:"last attempt"}),r.jsxs("dd",{className:"font-mono text-[#e4e4e7] flex items-center gap-1",children:[r.jsx(as,{className:"w-3 h-3 text-[#71717a]"}),i.lastAttemptAt?new Date(i.lastAttemptAt).toLocaleString():"—"]}),r.jsx("dt",{className:"text-[#71717a]",children:"last success"}),r.jsx("dd",{className:"font-mono text-[#e4e4e7]",children:i.lastSuccessAt?new Date(i.lastSuccessAt).toLocaleString():"—"}),i.lastError&&r.jsxs(r.Fragment,{children:[r.jsx("dt",{className:"text-[#ef4444]",children:"last error"}),r.jsx("dd",{className:"font-mono text-[#fca5a5] break-all",children:i.lastError})]})]}):r.jsx("div",{className:"text-xs text-[#71717a]",children:"Checking collector reachability…"})]}),r.jsxs("div",{className:"mb-4 p-3 rounded-lg border border-[#27272a]/60 bg-[#0a0a0f]",children:[r.jsx("div",{className:"text-[10px] text-[#71717a] uppercase tracking-wider mb-1",children:"Collector"}),r.jsx("div",{className:"font-mono text-[11px] text-[#a1a1aa] break-all",children:(t==null?void 0:t.remoteUrl)||"—"})]}),r.jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[r.jsxs("a",{href:"https://github.com/Djtony707/TITAN/blob/main/PRIVACY.md",target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 text-[#6366f1] hover:underline",children:[r.jsx(Xr,{className:"w-3 h-3"})," Read the full PRIVACY.md"]}),r.jsx("span",{className:"text-[#52525b]",children:"·"}),r.jsxs("a",{href:"https://github.com/Djtony707/TITAN/blob/main/src/analytics/collector.ts",target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 text-[#6366f1] hover:underline",children:[r.jsx(Xr,{className:"w-3 h-3"})," See the collector source"]})]})]})}const ig=te.lazy(()=>se(()=>import("./AutopilotPanel-nBluaHA4.js"),__vite__mapDeps([29,1,2,22,5])));function og(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ig,{})})})}const ag=te.lazy(()=>se(()=>import("./WorkflowsPanel-2z0TeXyR.js"),__vite__mapDeps([30,1,2,22,5,3,9,14,25,10,15,31])));function lg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ag,{})})})}const cg=te.lazy(()=>se(()=>import("./LearningPanel-D_S4HFX5.js"),__vite__mapDeps([32,1,2,22,5,33,34])));function dg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(cg,{})})})}const ug=te.lazy(()=>se(()=>import("./SelfImprovePanel-CNpCp5N4.js"),__vite__mapDeps([35,1,2,23,36,34,5,25,15])));function hg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ug,{})})})}const fg=te.lazy(()=>se(()=>import("./PersonasPanel-ClC_TTGX.js"),__vite__mapDeps([37,1,2])));function pg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(fg,{})})})}const gg=te.lazy(()=>se(()=>import("./HomelabPanel-B4bCsrBw.js"),__vite__mapDeps([38,1,2,22,5,39,40,13,23,11])));function mg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(gg,{})})})}const yg=te.lazy(()=>se(()=>import("./NvidiaPanel-DVntoRrH.js"),__vite__mapDeps([41,1,2,23,42,5])));function wg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(yg,{})})})}const bg=te.lazy(()=>se(()=>import("./FilesPanel-CNrDLmix.js"),__vite__mapDeps([43,1,2,5,44,15,24])));function xg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(bg,{})})})}const vg=te.lazy(()=>se(()=>import("./LogsPanel-BnWNREPX.js"),__vite__mapDeps([45,1,2,5])));function _g(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(vg,{})})})}const kg=te.lazy(()=>se(()=>import("./TelemetryPanel-DHNFyCwn.js"),__vite__mapDeps([46,1,2,39,12,13,5])));function Eg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(kg,{})})})}const Sg=te.lazy(()=>se(()=>import("./SkillsPanel-lDMl_8da.js"),__vite__mapDeps([47,1,2,22,5,15,24])));function jg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Sg,{})})})}const Ng=te.lazy(()=>se(()=>import("./McpPanel-CIMxZ2Am.js"),__vite__mapDeps([48,1,2,49,15,5])));function Cg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Ng,{})})})}const Tg=te.lazy(()=>se(()=>import("./IntegrationsPanel-DsB6hjvE.js"),__vite__mapDeps([50,1,2,49,23,42,5])));function Ag(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Tg,{})})})}const Rg=te.lazy(()=>se(()=>import("./ChannelsPanel-5EhhyXeg.js"),__vite__mapDeps([51,1,2,22,5,23,42])));function Lg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Rg,{})})})}const Ig=te.lazy(()=>se(()=>import("./MeshPanel-CiuwR3oV.js"),__vite__mapDeps([52,1,2,53,5])));function Dg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Ig,{})})})}const Mg=te.lazy(()=>se(()=>import("./DaemonPanel-xt08Rs10.js"),__vite__mapDeps([54,1,2,10,25,5])));function Og(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Mg,{})})})}const Pg=te.lazy(()=>se(()=>import("./MemoryWikiPanel-BPPVAH0b.js"),__vite__mapDeps([55,1,2,22,5,44])));function Ug(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Pg,{})})})}const Wg=te.lazy(()=>se(()=>import("./AutoresearchPanel-BDy8y_Cs.js"),__vite__mapDeps([56,1,2,25,10,36,34,5])));function Bg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Wg,{})})})}const Fg=te.lazy(()=>se(()=>import("./SelfProposalsPanel-BJL6Fjxo.js"),__vite__mapDeps([57,1,2,22,5])));function $g(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Fg,{})})})}const zg=te.lazy(()=>se(()=>import("./OverviewPanel-gqYRhmpF.js"),__vite__mapDeps([58,1,2,39,22,5,40])));function Vg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(zg,{})})})}const Hg=te.lazy(()=>se(()=>import("./SessionsPanel-EAGKDQp0.js"),__vite__mapDeps([59,1,2,22,5,3,53,9,15])));function qg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Hg,{})})})}const Gg=te.lazy(()=>se(()=>import("./WatchView-B7sDnMpl.js"),__vite__mapDeps([60,1,2,8])));function Yg(){return r.jsx("div",{className:"w-full h-full overflow-auto",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Gg,{})})})}const Kg=te.lazy(()=>se(()=>import("./BackupPanel-B_Fv2pJA.js"),__vite__mapDeps([61,1,2,22,5,23])));function Jg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Kg,{})})})}const Xg=te.lazy(()=>se(()=>import("./TrainingPanel-CLtiBq2h.js"),__vite__mapDeps([62,1,2,22,5,24])));function Zg(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Xg,{})})})}const Qg=te.lazy(()=>se(()=>import("./RecipesPanel-Di2l-eOe.js"),__vite__mapDeps([63,1,2,22,5,25,15])));function em(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(Qg,{})})})}const tm=te.lazy(()=>se(()=>import("./VramPanel-DjuwGUzA.js"),__vite__mapDeps([64,1,2,22,5])));function sm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(tm,{})})})}const nm=te.lazy(()=>se(()=>import("./TeamsPanel-D-iCyyYd.js"),__vite__mapDeps([65,1,2,22,5,15])));function rm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(nm,{})})})}const im=te.lazy(()=>se(()=>import("./CronPanel-lAsoKavq.js"),__vite__mapDeps([66,1,2,22,5,31,15])));function om(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(im,{})})})}const am=te.lazy(()=>se(()=>import("./CheckpointsPanel-BVt2oEUe.js"),__vite__mapDeps([67,1,2,22,5,15])));function lm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(am,{})})})}const cm=te.lazy(()=>se(()=>import("./OrganismPanel-pqIKtHrW.js"),__vite__mapDeps([68,1,2,22,5,23])));function dm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(cm,{})})})}const um=te.lazy(()=>se(()=>import("./FleetPanel-DP_ji0AE.js"),__vite__mapDeps([69,1,2,22,5])));function hm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(um,{})})})}const fm=te.lazy(()=>se(()=>import("./BrowserPanel-DOCT3-Rq.js"),__vite__mapDeps([70,1,2,22,5])));function pm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(fm,{})})})}const gm=te.lazy(()=>se(()=>import("./PaperclipPanel-CwN5-cKg.js"),__vite__mapDeps([71,1,2,22,5,25,72])));function mm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(gm,{})})})}const ym=te.lazy(()=>se(()=>import("./EvalPanel-D9rDf1bk.js"),__vite__mapDeps([73,1,2,22,5,25])));function wm(){return r.jsx("div",{className:"w-full h-full overflow-auto p-4",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"text-xs text-[#52525b]",children:"Loading..."}),children:r.jsx(ym,{})})})}function bm(){const[t,e]=S.useState([]),[s,n]=S.useState(!0),[i,a]=S.useState(null),c=async()=>{try{const l=await fetch("/api/agents");if(!l.ok)throw new Error(`HTTP ${l.status}`);const d=await l.json();e(Array.isArray(d)?d:d.agents||[]),a(null)}catch(l){a(l.message)}finally{n(!1)}};return S.useEffect(()=>{c();const l=setInterval(c,1e4);return()=>clearInterval(l)},[]),s?r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"w-4 h-4 text-[#6366f1] animate-spin"})}):i?r.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",children:r.jsxs("div",{className:"text-center",children:[r.jsx(nn,{className:"w-4 h-4 text-red-400 mx-auto mb-1"}),r.jsx("span",{className:"text-[10px] text-red-400",children:i})]})}):t.length===0?r.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",children:r.jsx("span",{className:"text-[10px] text-[#52525b]",children:"No active agents"})}):r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsx("div",{className:"space-y-2",children:t.map(l=>r.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsx(Oi,{className:`w-3.5 h-3.5 ${l.status==="busy"?"text-[#f59e0b]":l.status==="error"?"text-red-400":"text-[#6366f1]"}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-[11px] text-[#a1a1aa] truncate",children:l.name}),r.jsxs("div",{className:"text-[10px] text-[#52525b] truncate",children:[l.role,l.model?` · ${l.model}`:""]})]}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full uppercase ${l.status==="busy"?"bg-[#f59e0b]/10 text-[#f59e0b]":l.status==="error"?"bg-red-400/10 text-red-400":"bg-[#6366f1]/10 text-[#818cf8]"}`,children:l.status})]},l.id))})})}function xm(){const[t,e]=S.useState(null),[s,n]=S.useState(!0),i=async()=>{try{const[c,l]=await Promise.allSettled([fetch("/api/health").then(w=>w.ok?w.json():null),fetch("/ollama/api/tags").then(w=>w.ok)]),d=c.status==="fulfilled"&&c.value,p=l.status==="fulfilled"&&l.value;e({gateway:d,ollama:p,version:(d==null?void 0:d.version)||"unknown",uptime:(d==null?void 0:d.uptime)||0})}catch{e({gateway:!1,ollama:!1,version:"unknown",uptime:0})}finally{n(!1)}};if(S.useEffect(()=>{i();const c=setInterval(i,3e4);return()=>clearInterval(c)},[]),s)return r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"w-4 h-4 text-[#6366f1] animate-spin"})});const a=c=>{const l=Math.floor(c/3600),d=Math.floor(c%3600/60);return`${l}h ${d}m`};return r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[t!=null&&t.gateway?r.jsx(rl,{className:"w-3.5 h-3.5 text-emerald-400"}):r.jsx(dc,{className:"w-3.5 h-3.5 text-red-400"}),r.jsx("span",{className:"text-[11px] text-[#a1a1aa]",children:"TITAN Gateway"})]}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full uppercase ${t!=null&&t.gateway?"bg-emerald-400/10 text-emerald-400":"bg-red-400/10 text-red-400"}`,children:t!=null&&t.gateway?"Online":"Offline"})]}),r.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(gt,{className:`w-3.5 h-3.5 ${t!=null&&t.ollama?"text-emerald-400":"text-red-400"}`}),r.jsx("span",{className:"text-[11px] text-[#a1a1aa]",children:"Ollama"})]}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full uppercase ${t!=null&&t.ollama?"bg-emerald-400/10 text-emerald-400":"bg-red-400/10 text-red-400"}`,children:t!=null&&t.ollama?"Online":"Offline"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsx("div",{className:"text-[9px] text-[#52525b] uppercase tracking-wider",children:"Version"}),r.jsx("div",{className:"text-[11px] text-[#a1a1aa] font-mono mt-0.5",children:t==null?void 0:t.version})]}),r.jsxs("div",{className:"px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsx("div",{className:"text-[9px] text-[#52525b] uppercase tracking-wider",children:"Uptime"}),r.jsx("div",{className:"text-[11px] text-[#a1a1aa] font-mono mt-0.5",children:a((t==null?void 0:t.uptime)||0)})]})]})]})})}function Rs({label:t,value:e,icon:s,color:n}){const i=Math.max(0,Math.min(100,Math.round(e)));return r.jsxs("div",{className:"px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[s,r.jsx("span",{className:"text-[10px] text-[#52525b] uppercase tracking-wider",children:t})]}),r.jsxs("span",{className:"text-[11px] text-[#a1a1aa] font-mono",children:[i,"%"]})]}),r.jsx("div",{className:"h-1.5 rounded-full bg-[#27272a] overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,backgroundColor:n}})})]})}function vm(){const[t,e]=S.useState({cpu:0,memory:0,disk:0,load:0});return S.useEffect(()=>{const s=setInterval(()=>{e({cpu:Math.random()*60+10,memory:Math.random()*50+30,disk:Math.random()*40+20,load:Math.random()*30+5})},3e3);return e({cpu:Math.random()*60+10,memory:Math.random()*50+30,disk:Math.random()*40+20,load:Math.random()*30+5}),()=>clearInterval(s)},[]),r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Rs,{label:"CPU",value:t.cpu,icon:r.jsx(fr,{className:"w-3 h-3 text-[#6366f1]"}),color:"#6366f1"}),r.jsx(Rs,{label:"Memory",value:t.memory,icon:r.jsx(il,{className:"w-3 h-3 text-[#a78bfa]"}),color:"#a78bfa"}),r.jsx(Rs,{label:"Disk",value:t.disk,icon:r.jsx(ol,{className:"w-3 h-3 text-[#10b981]"}),color:"#10b981"}),r.jsx(Rs,{label:"Load",value:t.load,icon:r.jsx(gt,{className:"w-3 h-3 text-[#f59e0b]"}),color:"#f59e0b"})]})})}const _m=[{label:"Nav",source:"system:nav",w:3,h:4,icon:r.jsx(vl,{className:"w-3.5 h-3.5"})},{label:"Agents",source:"system:agents",w:3,h:4,icon:r.jsx(Oi,{className:"w-3.5 h-3.5"})},{label:"Health",source:"system:health",w:3,h:3,icon:r.jsx(gt,{className:"w-3.5 h-3.5"})},{label:"Stats",source:"system:stats",w:3,h:4,icon:r.jsx(Rl,{className:"w-3.5 h-3.5"})},{label:"Chat",source:"system:chat",w:4,h:5,icon:r.jsx($i,{className:"w-3.5 h-3.5"})},{label:"Files",source:"system:files",w:4,h:6,icon:r.jsx(rn,{className:"w-3.5 h-3.5"})},{label:"Skills",source:"system:tools",w:5,h:4,icon:r.jsx(hr,{className:"w-3.5 h-3.5"})},{label:"Soma",source:"system:soma",w:6,h:6,icon:r.jsx(Dl,{className:"w-3.5 h-3.5"})},{label:"Intel",source:"system:intelligence",w:6,h:5,icon:r.jsx(mt,{className:"w-3.5 h-3.5"})},{label:"Infra",source:"system:infra",w:6,h:4,icon:r.jsx(gr,{className:"w-3.5 h-3.5"})},{label:"Tools",source:"system:tools",w:5,h:4,icon:r.jsx(wr,{className:"w-3.5 h-3.5"})},{label:"Settings",source:"system:settings",w:4,h:6,icon:r.jsx(mr,{className:"w-3.5 h-3.5"})},{label:"Daemon",source:"system:daemon",w:5,h:5,icon:r.jsx(gt,{className:"w-3.5 h-3.5"})},{label:"Wiki",source:"system:memory-wiki",w:5,h:5,icon:r.jsx(os,{className:"w-3.5 h-3.5"})},{label:"Research",source:"system:autoresearch",w:5,h:5,icon:r.jsx(Ui,{className:"w-3.5 h-3.5"})},{label:"Proposals",source:"system:self-proposals",w:5,h:5,icon:r.jsx(Wi,{className:"w-3.5 h-3.5"})},{label:"Overview",source:"system:overview",w:5,h:4,icon:r.jsx(Pi,{className:"w-3.5 h-3.5"})},{label:"Sessions",source:"system:sessions",w:5,h:4,icon:r.jsx(as,{className:"w-3.5 h-3.5"})},{label:"Watch",source:"system:watch",w:6,h:5,icon:r.jsx(gt,{className:"w-3.5 h-3.5"})},{label:"Backup",source:"system:backup",w:5,h:5,icon:r.jsx(Mi,{className:"w-3.5 h-3.5"})},{label:"Training",source:"system:training",w:5,h:5,icon:r.jsx(mt,{className:"w-3.5 h-3.5"})},{label:"Recipes",source:"system:recipes",w:5,h:5,icon:r.jsx(os,{className:"w-3.5 h-3.5"})},{label:"VRAM",source:"system:vram",w:5,h:5,icon:r.jsx(fr,{className:"w-3.5 h-3.5"})},{label:"Teams",source:"system:teams",w:5,h:5,icon:r.jsx(yr,{className:"w-3.5 h-3.5"})},{label:"Cron",source:"system:cron",w:5,h:5,icon:r.jsx(as,{className:"w-3.5 h-3.5"})},{label:"Checkpoints",source:"system:checkpoints",w:5,h:5,icon:r.jsx(an,{className:"w-3.5 h-3.5"})},{label:"Organism",source:"system:organism",w:5,h:5,icon:r.jsx(pr,{className:"w-3.5 h-3.5"})},{label:"Fleet",source:"system:fleet",w:5,h:5,icon:r.jsx(Hi,{className:"w-3.5 h-3.5"})},{label:"Browser",source:"system:browser",w:5,h:5,icon:r.jsx(Ii,{className:"w-3.5 h-3.5"})},{label:"Paperclip",source:"system:paperclip",w:5,h:5,icon:r.jsx(Vi,{className:"w-3.5 h-3.5"})},{label:"Eval",source:"system:eval",w:5,h:5,icon:r.jsx(Ki,{className:"w-3.5 h-3.5"})}];function km(){const t=(e,s,n)=>{window.dispatchEvent(new CustomEvent("titan:widget:add",{detail:{source:e,w:s,h:n}}))};return r.jsx("div",{className:"w-full h-full p-3 overflow-auto",children:r.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:_m.map(e=>r.jsxs("button",{onClick:()=>t(e.source,e.w,e.h),className:"flex items-center gap-2 px-2.5 py-2 rounded-lg bg-[#0a0a0f] border border-[#27272a] text-[#71717a] hover:text-[#a1a1aa] hover:border-[#3f3f46] hover:bg-[#27272a]/30 transition-all text-left",children:[r.jsx("span",{className:"text-[#6366f1]",children:e.icon}),r.jsx("span",{className:"text-[10px] font-medium",children:e.label})]},e.source))})})}class Em extends te.Component{componentDidCatch(e){this.props.onError(e.message)}render(){return this.props.children}}function Sm({name:t,children:e}){const[s,n]=te.useState(null);return s?r.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",children:r.jsxs("span",{className:"text-xs text-red-400",children:[t,": ",s]})}):r.jsx(Em,{onError:n,children:e})}const jm=te.lazy(()=>se(()=>import("./legacy-DFIaZTiF.js"),__vite__mapDeps([74,1,2])).then(t=>({default:t.Responsive}))),Nm={"system:nav":Ba,"system:chat":za,"system:cmd":Ya,"system:soma":Ka,"system:command-post":Pp,"system:intelligence":Wp,"system:memory-graph":Fp,"system:voice":$p,"system:infra":Vp,"system:tools":qp,"system:settings":Yp,"system:files":Kp,"system:settings-general":Xp,"system:settings-security":Qp,"system:settings-audit":tg,"system:settings-specialists":sg,"system:settings-privacy":rg,"system:intelligence-autopilot":og,"system:intelligence-workflows":lg,"system:intelligence-learning":dg,"system:intelligence-self-improve":hg,"system:intelligence-personas":pg,"system:infra-homelab":mg,"system:infra-gpu":wg,"system:infra-files":xg,"system:infra-logs":_g,"system:infra-telemetry":Eg,"system:tools-skills":jg,"system:tools-mcp":Cg,"system:tools-integrations":Ag,"system:tools-channels":Lg,"system:tools-mesh":Dg,"system:agents":bm,"system:health":xm,"system:stats":vm,"system:quick-links":km,"system:daemon":Og,"system:memory-wiki":Ug,"system:autoresearch":Bg,"system:self-proposals":$g,"system:overview":Vg,"system:sessions":qg,"system:watch":Yg,"system:backup":Jg,"system:training":Zg,"system:recipes":em,"system:vram":sm,"system:teams":rm,"system:cron":om,"system:checkpoints":lm,"system:organism":dm,"system:fleet":hm,"system:browser":pm,"system:paperclip":mm,"system:eval":wm},Cm={lg:12,md:10,sm:6,xs:4,xxs:2},Tm=60,Am={lg:1200,md:996,sm:768,xs:480,xxs:0},Rm=[12,12],Lm=["se","sw","ne","nw","e","w","n","s"],Ja=te.forwardRef(({widget:t,space:e,onRemove:s,style:n,className:i,onMouseDown:a,onMouseUp:c,onTouchStart:l,onTouchEnd:d,children:p},w)=>{const u=S.useCallback(()=>s(t.id),[t.id,s]);return r.jsxs("div",{ref:w,style:n,className:i,onMouseDown:a,onMouseUp:c,onTouchStart:l,onTouchEnd:d,children:[r.jsx(Mm,{widget:t,space:e,onRemove:u}),p]})});Ja.displayName="MemoWidgetItem";const Im=te.memo(Ja);function Dm({widget:t,space:e,onRemove:s}){const n=S.useRef(null),i=S.useRef(null),a=S.useRef(e),[c,l]=S.useState(null),[d,p]=S.useState(!0);if(S.useEffect(()=>{a.current=e},[e]),S.useEffect(()=>{if(t.format==="system"||!n.current)return;if(!t.source||t.source.trim()===""){l("Empty widget — no source code"),p(!1);return}p(!0),l(null),i.current=new Wa(n.current,{onLog:u=>console.log(`[Widget ${t.id}]`,u)}),i.current.setMessageHandler(u=>{var g,y,v,A;const f=a.current;if(u.type==="canvas"&&((g=u.payload)==null?void 0:g.action)==="createWidget"){const C=u.payload.def;if(!C)return{ok:!1,error:"createWidget requires a `def` object"};const M=Number.isFinite(C.w)?C.w:4,b=Number.isFinite(C.h)?C.h:4,x=Number.isFinite(C.x)&&Number.isFinite(C.y)?{x:C.x,y:C.y}:Ps(f.widgets||[],M,b);try{const E=_e.addWidget(f.id,{name:C.name||"Agent Widget",format:C.format||"react",source:C.source||"",x:x.x,y:x.y,w:M,h:b});return window.dispatchEvent(new CustomEvent("titan:space:refresh",{detail:{spaceId:f.id}})),{ok:!0,widgetId:E.id}}catch(E){return{ok:!1,error:E.message}}}if(u.type==="canvas"&&((y=u.payload)==null?void 0:y.action)==="updateWidget"){const{id:C,patch:M}=u.payload;return C?(_e.updateWidget(f.id,C,M||{}),window.dispatchEvent(new CustomEvent("titan:space:refresh",{detail:{spaceId:f.id}})),{ok:!0,id:C}):{ok:!1,error:"updateWidget requires an `id`"}}if(u.type==="canvas"&&((v=u.payload)==null?void 0:v.action)==="listWidgets")return{ok:!0,widgets:f.widgets||[]};if(u.type==="canvas"&&((A=u.payload)==null?void 0:A.action)==="removeWidget"){const C=u.payload.id;return C?(_e.removeWidget(f.id,C),window.dispatchEvent(new CustomEvent("titan:space:refresh",{detail:{spaceId:f.id}})),{ok:!0}):{ok:!1,error:"removeWidget requires an `id`"}}return{ok:!1,error:"Unknown message type"}});const w=setTimeout(()=>{p(!1),l("Sandbox timeout: widget took longer than 30s to render. Babel (~2MB) or React may be slow to load from unpkg.com. Check network tab in DevTools (F12).")},3e4);return i.current.render(t.format,t.source).then(()=>{clearTimeout(w),p(!1)}).catch(u=>{clearTimeout(w),p(!1),l(String(u))}),()=>{var u;clearTimeout(w),(u=i.current)==null||u.destroy()}},[t.format,t.source,t.id]),t.format==="system"){const w=Nm[t.source];return w?r.jsxs("div",{className:"w-full h-full rounded-xl bg-[#18181b]/90 border border-[#27272a]/60 overflow-hidden flex flex-col group hover:border-[#6366f1]/30 transition-colors shadow-lg shadow-black/20",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-[#27272a]/40 panel-drag-handle cursor-move",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-[#6366f1]/70",children:t.name}),r.jsx("button",{onClick:s,className:"opacity-0 group-hover:opacity-100 text-[#3f3f46] hover:text-red-400 text-xs px-1 transition-opacity",children:"×"})]}),r.jsx("div",{className:"flex-1 overflow-auto relative",children:r.jsx(Sm,{name:t.name,children:r.jsx(w,{space:e,widget:t,onRemove:s})})})]}):r.jsxs("div",{className:"w-full h-full flex items-center justify-center text-xs text-red-400",children:["Unknown system widget: ",t.source]})}return r.jsxs("div",{className:"w-full h-full rounded-xl bg-[#18181b]/90 border border-[#27272a]/60 overflow-hidden flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-[#27272a]/40 panel-drag-handle cursor-move",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-[#6366f1]/70",children:t.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:w=>{w.stopPropagation(),window.dispatchEvent(new CustomEvent("titan:widget:edit",{detail:{spaceId:e.id,widgetId:t.id}}))},onMouseDown:w=>w.stopPropagation(),className:"text-[#52525b] hover:text-[#a5b4fc] px-1",title:"Edit widget",children:r.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m18 2 4 4-14 14H4v-4L18 2z"})})}),r.jsx("button",{onClick:s,className:"text-[#3f3f46] hover:text-red-400 text-xs px-1",children:"×"})]})]}),r.jsx("div",{className:"flex-1 relative",children:c?r.jsx("div",{className:"p-3 text-xs text-red-400 font-mono whitespace-pre-wrap",children:c}):r.jsxs(r.Fragment,{children:[r.jsx("iframe",{ref:n,className:"w-full h-full border-0",sandbox:"allow-scripts",title:t.name}),d&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#0a0a0f]/80 text-xs text-[#52525b]",children:r.jsx("span",{className:"animate-pulse",children:"Loading widget…"})})]})})]})}const Mm=te.memo(Dm);function Om({children:t,position:e}){const s={"bottom-left":"left-4 bottom-4","bottom-right":"right-4 bottom-4","top-left":"left-4 top-4","top-right":"right-4 top-4"}[e];return r.jsx("div",{className:`fixed ${s} z-50`,children:t})}function Pm(){const{spaceId:t}=al(),e=ll(),[s,n]=S.useState(null),[i]=S.useState(!0),[a,c]=S.useState(!1),[l,d]=S.useState(null),[p,w]=S.useState(!1),[u,f]=S.useState(!1),[g,y]=S.useState(!1),[v,A]=S.useState(1200),C=S.useRef(null),M=S.useRef(null),{info:b,triggerUpdate:x}=Rf(),[E,j]=S.useState(!1);S.useEffect(()=>{const B=t||"home",H=_e.get(B);H?n(H):e("/space/home",{replace:!0})},[t,e]),S.useEffect(()=>{const B=()=>{const ge=M.current;if(!ge)return null;const fe=new ResizeObserver(be=>{for(const ce of be)A(ce.contentRect.width)});return fe.observe(ge),A(ge.getBoundingClientRect().width||1200),fe};let H=B();const $=setInterval(()=>{H||(H=B()),H&&clearInterval($)},200);return()=>{H==null||H.disconnect(),clearInterval($)}},[s==null?void 0:s.id]),S.useEffect(()=>{const B=H=>{(H.metaKey||H.ctrlKey)&&H.key==="k"&&(H.preventDefault(),f($=>!$)),(H.metaKey||H.ctrlKey)&&H.key==="j"&&(H.preventDefault(),window.dispatchEvent(new CustomEvent("titan:chat:toggle")))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]),Lf([{key:"?",action:()=>y(!0),description:"Show keyboard shortcuts help"},{key:"g",shift:!0,action:()=>e("/space/command"),description:"Go to Command Post space"},{key:"h",shift:!0,action:()=>e("/space/home"),description:"Go to Home space"},{key:"s",shift:!0,action:()=>e("/space/settings"),description:"Go to Settings space"},{key:"i",shift:!0,action:()=>e("/space/intelligence"),description:"Go to Intelligence space"}]);const k=S.useCallback(()=>{},[]),R=S.useRef(null),O=S.useRef(null),N=S.useCallback(B=>{s&&(O.current=B,R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{const H=O.current;!H||!s||(_e.updateLayout(s.id,H.map($=>({i:$.i,x:$.x,y:$.y,w:$.w,h:$.h}))),O.current=null,R.current=null)},50))},[s]),L=S.useCallback(B=>{var ge;if(!s)return;const H=(ge=s.widgets)==null?void 0:ge.find(fe=>fe.id===B);Sn("canvas_panel_removed",{widgetId:B,format:H==null?void 0:H.format,source:H==null?void 0:H.source}),_e.removeWidget(s.id,B);const $=Array.isArray(s.widgets)?s.widgets:[];n({...s,widgets:$.filter(fe=>fe.id!==B)})},[s]),W=S.useCallback(B=>{if(!s)return;const H=_e.addWidget(s.id,B),$=Array.isArray(s.widgets)?s.widgets:[];return n({...s,widgets:[...$,H]}),Sn(B.format==="system"?"canvas_system_panel_created":"canvas_panel_created",{source:B.source,name:B.name,format:B.format}),H},[s]),F=S.useCallback((B,H)=>{if(!s||!Array.isArray(s.widgets)||s.widgets.length===0)return{x:0,y:0};const $=12,ge=new Set;for(const fe of s.widgets)for(let be=0;be<fe.w;be++)for(let ce=0;ce<fe.h;ce++)ge.add(`${fe.x+be},${fe.y+ce}`);for(let fe=0;fe<200;fe++)for(let be=0;be<=$-B;be++){let ce=!0;for(let ee=0;ee<B;ee++){for(let Ee=0;Ee<H;Ee++)if(ge.has(`${be+ee},${fe+Ee}`)){ce=!1;break}if(!ce)break}if(ce)return{x:be,y:fe}}return{x:0,y:0}},[s]),V=S.useCallback((B,H,$=4,ge=4)=>{const fe=F($,ge);W({name:H,format:"system",source:B,x:fe.x,y:fe.y,w:$,h:ge})},[W,F]);S.useEffect(()=>{const B=H=>{const $=H.detail;if(console.log("[TitanCanvas] titan:space:refresh received:",$),!!s&&($==null?void 0:$.spaceId)===s.id){const ge=_e.get(s.id);ge&&(console.log("[TitanCanvas] Refreshing space, widget count:",ge.widgets.length),n(ge))}};return window.addEventListener("titan:space:refresh",B),()=>window.removeEventListener("titan:space:refresh",B)},[s]),S.useEffect(()=>{const B=H=>{const $=H.detail;if(s&&$!=null&&$.source){const ge=$.source.replace("system:","").replace(/-/g," ");V($.source,ge,$.w||4,$.h||4)}};return window.addEventListener("titan:widget:add",B),()=>window.removeEventListener("titan:widget:add",B)},[s,V]),S.useEffect(()=>{const B=H=>{const $=H.detail;s&&($==null?void 0:$.spaceId)===s.id&&typeof($==null?void 0:$.widgetId)=="string"&&d($.widgetId)};return window.addEventListener("titan:widget:edit",B),()=>window.removeEventListener("titan:widget:edit",B)},[s]),S.useEffect(()=>s?_e.observe(s.id,H=>{console.log("[TitanCanvas] CRDT observer fired, widgets:",H.length),n($=>$&&{...$,widgets:H})}):void 0,[s==null?void 0:s.id]);const G=S.useMemo(()=>{const B=s==null?void 0:s.widgets;return Array.isArray(B)?B.filter(Boolean):[]},[s]),Z=S.useMemo(()=>G.map((B,H)=>({i:B.id,x:Number.isFinite(B.x)?B.x:H%3*4,y:Number.isFinite(B.y)?B.y:Math.floor(H/3)*4,w:Number.isFinite(B.w)?B.w:4,h:Number.isFinite(B.h)?B.h:4,minW:2,minH:2,maxW:12,maxH:40})),[G]);return s?r.jsxs("div",{ref:C,className:"h-screen w-screen bg-[#0a0a0f] relative overflow-auto",children:[r.jsx("style",{children:`
|
|
1018
1018
|
.titan-canvas-grid .react-grid-item > .react-resizable-handle {
|
|
1019
1019
|
background: none;
|
|
1020
1020
|
padding: 0;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkillsPanel-lDMl_8da.js","assets/index-C6oarzis.js","assets/index-DsFoD9SP.css","assets/PageHeader-CF75km05.js","assets/VoiceOverlay-BXPVdnJc.js","assets/TitanCanvas-BhurNMK3.js","assets/TitanCanvas-BfitWg9R.css","assets/trash-2-B4jp_pAQ.js","assets/download-vvx6zJ-U.js","assets/McpPanel-CIMxZ2Am.js","assets/plug-DRlTjWqQ.js","assets/IntegrationsPanel-DsB6hjvE.js","assets/circle-check-big-CMz0QouP.js","assets/eye-off-BPXFIzlW.js","assets/ChannelsPanel-5EhhyXeg.js","assets/MeshPanel-CiuwR3oV.js","assets/DataTable-BHOu7fZP.js","assets/EvalHarnessPanel-CJv8CUDy.js","assets/play-Dwp2l5HG.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as l,j as e,n,_ as t}from"./index-C6oarzis.js";const o=l.lazy(()=>t(()=>import("./SkillsPanel-lDMl_8da.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),r=l.lazy(()=>t(()=>import("./McpPanel-CIMxZ2Am.js"),__vite__mapDeps([9,1,2,10,5,4,6,7]))),c=l.lazy(()=>t(()=>import("./IntegrationsPanel-DsB6hjvE.js"),__vite__mapDeps([11,1,2,10,12,13,5,4,6]))),d=l.lazy(()=>t(()=>import("./ChannelsPanel-5EhhyXeg.js"),__vite__mapDeps([14,1,2,3,4,5,6,12,13]))),x=l.lazy(()=>t(()=>import("./MeshPanel-CiuwR3oV.js"),__vite__mapDeps([15,1,2,16,5,4,6]))),m=l.lazy(()=>t(()=>import("./EvalHarnessPanel-CJv8CUDy.js"),__vite__mapDeps([17,1,2,5,4,6,18,12]))),_=[{id:"skills",label:"Skills"},{id:"mcp",label:"MCP Servers"},{id:"integrations",label:"Integrations"},{id:"channels",label:"Channels"},{id:"mesh",label:"Mesh Network"},{id:"evals",label:"Eval Harness"}];function p(){const[s,i]=l.useState("skills");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:"Tools & Connections"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:_.map(a=>e.jsxs("button",{onClick:()=>i(a.id),className:n("px-3 py-2 text-xs font-medium transition-colors relative",s===a.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[a.label,s===a.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},a.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(l.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[s==="skills"&&e.jsx(o,{}),s==="mcp"&&e.jsx(r,{}),s==="integrations"&&e.jsx(c,{}),s==="channels"&&e.jsx(d,{}),s==="mesh"&&e.jsx(x,{}),s==="evals"&&e.jsx(m,{})]})})]})}export{p as default};
|