titan-agent 5.2.1 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -3
- package/dist/eval/harness.js +49 -0
- package/dist/eval/harness.js.map +1 -1
- package/dist/eval/parity.js +148 -0
- package/dist/eval/parity.js.map +1 -0
- package/dist/eval/record.js +96 -0
- package/dist/eval/record.js.map +1 -0
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/safety.js +31 -1
- package/dist/utils/safety.js.map +1 -1
- package/package.json +5 -1
- package/scripts/eval-gate.sh +189 -0
- package/scripts/eval-record.ts +133 -0
- package/ui/dist/assets/{AuditPanel-DLy0WJQZ.js → AuditPanel-C31LRHZX.js} +1 -1
- package/ui/dist/assets/{AutonomyPanel-DjFAQGns.js → AutonomyPanel-CxQU72ZY.js} +1 -1
- package/ui/dist/assets/{AutopilotPanel-nBluaHA4.js → AutopilotPanel-D4FnBwJm.js} +1 -1
- package/ui/dist/assets/{AutoresearchPanel-BDy8y_Cs.js → AutoresearchPanel-BYHXZ9AO.js} +1 -1
- package/ui/dist/assets/{BackupPanel-B_Fv2pJA.js → BackupPanel-C4CQKf2P.js} +1 -1
- package/ui/dist/assets/{BrowserPanel-DOCT3-Rq.js → BrowserPanel-C-OFYyLm.js} +1 -1
- package/ui/dist/assets/{CPAgents-CpkHf0b8.js → CPAgents-CvkZDm_3.js} +1 -1
- package/ui/dist/assets/{CPDashboard-CnMd6qNK.js → CPDashboard-JmBLBbj7.js} +1 -1
- package/ui/dist/assets/{CPFiles-BDRjJpYl.js → CPFiles-BDToRw0a.js} +1 -1
- package/ui/dist/assets/{CPGoals-2DrwHk62.js → CPGoals-Dh9qJNWa.js} +1 -1
- package/ui/dist/assets/{CPInbox-C6l2o4FD.js → CPInbox-B6iaIbNG.js} +1 -1
- package/ui/dist/assets/{CPSocial-Cea6NptR.js → CPSocial-CsFrwZRC.js} +1 -1
- package/ui/dist/assets/{ChannelsPanel-5EhhyXeg.js → ChannelsPanel-D-S4ktFn.js} +1 -1
- package/ui/dist/assets/{CheckpointsPanel-BVt2oEUe.js → CheckpointsPanel-D-sP9ZuS.js} +1 -1
- package/ui/dist/assets/{CommandPostHub-PXKE62DN.js → CommandPostHub-BhlNyeDH.js} +3 -3
- package/ui/dist/assets/{CronPanel-lAsoKavq.js → CronPanel-Bf3rV7N2.js} +1 -1
- package/ui/dist/assets/{DaemonPanel-xt08Rs10.js → DaemonPanel-GGBWjTG2.js} +1 -1
- package/ui/dist/assets/{DataTable-BHOu7fZP.js → DataTable-D2Px4o6f.js} +1 -1
- package/ui/dist/assets/{EmptyState-Dk7BBthD.js → EmptyState-DH6-Jy6A.js} +1 -1
- package/ui/dist/assets/EvalHarnessPanel-Cz9dRg61.js +2 -0
- package/ui/dist/assets/{EvalPanel-D9rDf1bk.js → EvalPanel-CdjxzHlJ.js} +1 -1
- package/ui/dist/assets/{FilesPanel-CNrDLmix.js → FilesPanel-Dz8TFydL.js} +1 -1
- package/ui/dist/assets/{FleetPanel-DP_ji0AE.js → FleetPanel-CWwWWTD4.js} +1 -1
- package/ui/dist/assets/{HomelabPanel-B4bCsrBw.js → HomelabPanel-C7VBV7AC.js} +1 -1
- package/ui/dist/assets/{InfraView-C5OYx_9s.js → InfraView-B1TgXARJ.js} +2 -2
- package/ui/dist/assets/{InlineEditableField-DyBCbIoN.js → InlineEditableField-DOJNOL8m.js} +1 -1
- package/ui/dist/assets/{Input-DWnbv1Yh.js → Input-BgyHgQ3D.js} +1 -1
- package/ui/dist/assets/{IntegrationsPanel-DsB6hjvE.js → IntegrationsPanel-O26b4nhv.js} +1 -1
- package/ui/dist/assets/{IntelligenceView-PIFGvIg_.js → IntelligenceView-DUhTQ8f_.js} +2 -2
- package/ui/dist/assets/{LearningPanel-D_S4HFX5.js → LearningPanel-DX5S9ovg.js} +1 -1
- package/ui/dist/assets/{LogsPanel-BnWNREPX.js → LogsPanel-DdeTnATQ.js} +1 -1
- package/ui/dist/assets/{McpPanel-CIMxZ2Am.js → McpPanel-BpXWrP1a.js} +1 -1
- package/ui/dist/assets/{MemoryGraphPanel-DD7x4rrm.js → MemoryGraphPanel-CNkZmTUy.js} +1 -1
- package/ui/dist/assets/{MemoryWikiPanel-BPPVAH0b.js → MemoryWikiPanel-o4L8Df-n.js} +1 -1
- package/ui/dist/assets/{MeshPanel-CiuwR3oV.js → MeshPanel-DMBQJFCC.js} +1 -1
- package/ui/dist/assets/{NvidiaPanel-DVntoRrH.js → NvidiaPanel-C8P-tJFG.js} +1 -1
- package/ui/dist/assets/{OrganismPanel-pqIKtHrW.js → OrganismPanel-CcfHDWDk.js} +1 -1
- package/ui/dist/assets/OverviewPanel-BSotI1Zv.js +1 -0
- package/ui/dist/assets/{PageHeader-CF75km05.js → PageHeader-DPJuAgJk.js} +1 -1
- package/ui/dist/assets/{PaperclipPanel-CwN5-cKg.js → PaperclipPanel-aXoXUjo6.js} +1 -1
- package/ui/dist/assets/{PersonasPanel-ClC_TTGX.js → PersonasPanel-DdPZxz2C.js} +1 -1
- package/ui/dist/assets/{RecipesPanel-Di2l-eOe.js → RecipesPanel-D7qffXQN.js} +1 -1
- package/ui/dist/assets/{SecurityPanel-DjC4pXGM.js → SecurityPanel-BDRK5el7.js} +1 -1
- package/ui/dist/assets/{SelfImprovePanel-CNpCp5N4.js → SelfImprovePanel-oYiMwFnA.js} +1 -1
- package/ui/dist/assets/{SelfProposalsPanel-BJL6Fjxo.js → SelfProposalsPanel-DOpNU_rr.js} +1 -1
- package/ui/dist/assets/{SessionsPanel-EAGKDQp0.js → SessionsPanel-eRbM3D9P.js} +1 -1
- package/ui/dist/assets/{SessionsTab-tc0njI15.js → SessionsTab-Jq3UKQCI.js} +1 -1
- package/ui/dist/assets/{SettingsPanel-BdSGImIa.js → SettingsPanel-DBIvKUYY.js} +1 -1
- package/ui/dist/assets/{SettingsView-DQB64bjy.js → SettingsView-yfSY4OLt.js} +2 -2
- package/ui/dist/assets/{SkeletonLoader-P8SFCyGi.js → SkeletonLoader-D1d-Gyyg.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-lDMl_8da.js → SkillsPanel-bubl9nag.js} +1 -1
- package/ui/dist/assets/{SomaView-BG7YvBu2.js → SomaView-D3aFL8Tw.js} +1 -1
- package/ui/dist/assets/{StatCard-Cv2u-yqA.js → StatCard-CEVFsz7t.js} +1 -1
- package/ui/dist/assets/{StatusBadge-JJeoEdCm.js → StatusBadge-DxeA9LNd.js} +1 -1
- package/ui/dist/assets/{TeamsPanel-D-iCyyYd.js → TeamsPanel-D6IJJIR_.js} +1 -1
- package/ui/dist/assets/{TelemetryPanel-DHNFyCwn.js → TelemetryPanel-SMPebdjQ.js} +1 -1
- package/ui/dist/assets/{TitanCanvas-BhurNMK3.js → TitanCanvas-BQU1yxqf.js} +3 -3
- package/ui/dist/assets/ToolsView-DgP4uRPr.js +2 -0
- package/ui/dist/assets/{Tooltip-D4IeQDJL.js → Tooltip-CNPQr7IO.js} +1 -1
- package/ui/dist/assets/{TraceViewer-CMd-Wi0z.js → TraceViewer-BbISy_ET.js} +1 -1
- package/ui/dist/assets/{TrainingPanel-CLtiBq2h.js → TrainingPanel-BdCHcv6t.js} +1 -1
- package/ui/dist/assets/{VoiceOverlay-BXPVdnJc.js → VoiceOverlay-l6yoasVz.js} +1 -1
- package/ui/dist/assets/{VramPanel-DjuwGUzA.js → VramPanel-XLhmen92.js} +1 -1
- package/ui/dist/assets/{WatchView-B7sDnMpl.js → WatchView-Bt-lNNWJ.js} +1 -1
- package/ui/dist/assets/{WorkTab-B5nQ4Y7A.js → WorkTab-IG-F6Qll.js} +1 -1
- package/ui/dist/assets/{WorkflowsPanel-2z0TeXyR.js → WorkflowsPanel-DsMpnwLK.js} +1 -1
- package/ui/dist/assets/{arrow-left-BKOkzkae.js → arrow-left-C_H9Z2Tm.js} +1 -1
- package/ui/dist/assets/{chart-column-D39PCk17.js → chart-column-rR6tb72l.js} +1 -1
- package/ui/dist/assets/{circle-check-big-CMz0QouP.js → circle-check-big-B1hMwau0.js} +1 -1
- package/ui/dist/assets/{dollar-sign-Bu8fZOQl.js → dollar-sign-DhYwsTnR.js} +1 -1
- package/ui/dist/assets/{download-vvx6zJ-U.js → download-UDDcAlZC.js} +1 -1
- package/ui/dist/assets/{eye-off-BPXFIzlW.js → eye-off-Cx0M_VQb.js} +1 -1
- package/ui/dist/assets/{funnel-Bqns-i8I.js → funnel-B7YvM1ei.js} +1 -1
- package/ui/dist/assets/{git-branch-CdmeqL8d.js → git-branch-BhTBN3J6.js} +1 -1
- package/ui/dist/assets/index-D0RJ8701.css +1 -0
- package/ui/dist/assets/{index-C6oarzis.js → index-D7Clon2u.js} +2 -2
- package/ui/dist/assets/layers-B6jDzitD.js +6 -0
- package/ui/dist/assets/{legacy-DFIaZTiF.js → legacy-av079XKu.js} +1 -1
- package/ui/dist/assets/{lightbulb-DOL6Q-iP.js → lightbulb-DRuQ3Chf.js} +1 -1
- package/ui/dist/assets/{pause-B0XymOnS.js → pause-DqkRWPB_.js} +1 -1
- package/ui/dist/assets/{play-Dwp2l5HG.js → play-hUyR3CVS.js} +1 -1
- package/ui/dist/assets/{plug-DRlTjWqQ.js → plug-CvpyjJt_.js} +1 -1
- package/ui/dist/assets/{proxy-sXxWK7WF.js → proxy-Cc5bR828.js} +1 -1
- package/ui/dist/assets/{square-yh0jffQZ.js → square-CdiC0J8Z.js} +1 -1
- package/ui/dist/assets/{target-GxtNG2RW.js → target-DemL8_0v.js} +1 -1
- package/ui/dist/assets/{toggle-right-CYQd_Ux1.js → toggle-right-Dsk892k5.js} +1 -1
- package/ui/dist/assets/{trash-2-B4jp_pAQ.js → trash-2-Byj4OvKB.js} +1 -1
- package/ui/dist/assets/{trending-up-B26tNhFP.js → trending-up-Dh_CffGX.js} +1 -1
- package/ui/dist/assets/{trophy-Bf3ZeSeb.js → trophy-DDr2AePx.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/EvalHarnessPanel-CJv8CUDy.js +0 -1
- package/ui/dist/assets/OverviewPanel-gqYRhmpF.js +0 -6
- package/ui/dist/assets/ToolsView-C8sWxLny.js +0 -2
- package/ui/dist/assets/index-DsFoD9SP.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AutopilotPanel-
|
|
2
|
-
import{r as s,j as e,n as a,_ as t}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AutopilotPanel-D4FnBwJm.js","assets/index-D7Clon2u.js","assets/index-D0RJ8701.css","assets/PageHeader-DPJuAgJk.js","assets/VoiceOverlay-l6yoasVz.js","assets/WorkflowsPanel-DsMpnwLK.js","assets/Input-BgyHgQ3D.js","assets/TitanCanvas-BQU1yxqf.js","assets/TitanCanvas-BfitWg9R.css","assets/InlineEditableField-DOJNOL8m.js","assets/target-DemL8_0v.js","assets/play-hUyR3CVS.js","assets/pause-DqkRWPB_.js","assets/trash-2-Byj4OvKB.js","assets/toggle-right-Dsk892k5.js","assets/LearningPanel-DX5S9ovg.js","assets/lightbulb-DRuQ3Chf.js","assets/trending-up-Dh_CffGX.js","assets/MemoryGraphPanel-CNkZmTUy.js","assets/SelfImprovePanel-oYiMwFnA.js","assets/circle-check-big-B1hMwau0.js","assets/trophy-DDr2AePx.js","assets/PersonasPanel-DdPZxz2C.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,j as e,n as a,_ as t}from"./index-D7Clon2u.js";const i=s.lazy(()=>t(()=>import("./AutopilotPanel-D4FnBwJm.js"),__vite__mapDeps([0,1,2,3,4]))),n=s.lazy(()=>t(()=>import("./WorkflowsPanel-DsMpnwLK.js"),__vite__mapDeps([5,1,2,3,4,6,7,8,9,10,11,12,13,14]))),d=s.lazy(()=>t(()=>import("./LearningPanel-DX5S9ovg.js"),__vite__mapDeps([15,1,2,3,4,7,8,16,17]))),c=s.lazy(()=>t(()=>import("./MemoryGraphPanel-CNkZmTUy.js"),__vite__mapDeps([18,1,2,7,4,8,13]))),m=s.lazy(()=>t(()=>import("./SelfImprovePanel-oYiMwFnA.js"),__vite__mapDeps([19,1,2,7,4,8,20,21,17,11,13]))),x=s.lazy(()=>t(()=>import("./PersonasPanel-DdPZxz2C.js"),__vite__mapDeps([22,1,2]))),p=[{id:"autopilot",label:"Autopilot"},{id:"workflows",label:"Workflows"},{id:"learning",label:"Learning"},{id:"memory",label:"Memory & Graph"},{id:"self-improve",label:"Self-Improve"},{id:"personas",label:"Personas"}];function u(){const[l,r]=s.useState("autopilot");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Intelligence"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:p.map(o=>e.jsxs("button",{onClick:()=>r(o.id),className:a("px-3 py-2 text-xs font-medium transition-colors relative",l===o.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[o.label,l===o.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},o.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(s.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[l==="autopilot"&&e.jsx(i,{}),l==="workflows"&&e.jsx(n,{}),l==="learning"&&e.jsx(d,{}),l==="memory"&&e.jsx(c,{}),l==="self-improve"&&e.jsx(m,{}),l==="personas"&&e.jsx(x,{})]})})]})}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e,T as g,b as x}from"./index-
|
|
1
|
+
import{r as o,j as e,T as g,b as x}from"./index-D7Clon2u.js";import{P as j}from"./PageHeader-DPJuAgJk.js";import{R as f,d as p,W as N,D as v}from"./TitanCanvas-BQU1yxqf.js";import{L as y}from"./lightbulb-DRuQ3Chf.js";import{T as C}from"./trending-up-Dh_CffGX.js";import"./VoiceOverlay-l6yoasVz.js";function w(t){return t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}function k(t){return t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}K`:`${(t/1e6).toFixed(2)}M`}function l({icon:t,label:i,value:r,color:n,sub:a}){return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md",style:{backgroundColor:n+"15"},children:e.jsx(t,{className:"h-3.5 w-3.5",style:{color:n}})}),e.jsx("p",{className:"text-xs text-text-muted",children:i})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:r}),a&&e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:a})]})}function R(){const[t,i]=o.useState(null),[r,n]=o.useState(null),[a,b]=o.useState(null),[h,m]=o.useState(!0),u=()=>{m(!0),Promise.all([x("/api/learning").then(s=>s.ok?s.json():null).catch(()=>null),x("/api/stats").then(s=>s.ok?s.json():null).catch(()=>null),x("/api/graphiti").then(s=>s.ok?s.json():null).catch(()=>null)]).then(([s,c,d])=>{i(s),n(c),b(d?{nodeCount:d.nodeCount||0,edgeCount:d.edgeCount||0,episodeCount:d.episodeCount||0}:null)}).finally(()=>m(!1))};return o.useEffect(()=>{u()},[]),h?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 animate-pulse rounded-xl bg-bg-secondary"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:8}).map((s,c)=>e.jsx("div",{className:"h-24 animate-pulse rounded-xl bg-bg-secondary"},c))})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(j,{title:"Learning",subtitle:"Knowledge base, tool mastery, and memory systems",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Memory"},{label:"Learning"}],actions:e.jsxs("button",{onClick:u,className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-xs text-text-secondary hover:bg-border hover:text-text transition-colors",children:[e.jsx(f,{className:"h-3.5 w-3.5"})," Refresh"]})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Knowledge Base"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(l,{icon:p,label:"Knowledge Entries",value:(t==null?void 0:t.knowledgeEntries)??0,color:"#6366f1",sub:"Facts, patterns, corrections"}),e.jsx(l,{icon:N,label:"Tools Tracked",value:(t==null?void 0:t.toolsTracked)??0,color:"#22d3ee",sub:"Success rates learned"}),e.jsx(l,{icon:g,label:"Error Patterns",value:(t==null?void 0:t.errorPatterns)??0,color:"#f59e0b",sub:"Known failure modes"}),e.jsx(l,{icon:y,label:"Corrections",value:(t==null?void 0:t.corrections)??0,color:"#34d399",sub:"User-taught improvements"})]})]}),a&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Memory Graph"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(l,{icon:v,label:"Entities",value:a.nodeCount,color:"#818cf8",sub:"People, topics, projects"}),e.jsx(l,{icon:C,label:"Relationships",value:a.edgeCount,color:"#22d3ee",sub:"Connections between entities"}),e.jsx(l,{icon:p,label:"Episodes",value:a.episodeCount,color:"#34d399",sub:"Conversation memories"})]})]}),r&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"System"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Tokens Used"}),e.jsx("p",{className:"text-xl font-bold text-text",children:k(r.totalTokens)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Requests"}),e.jsx("p",{className:"text-xl font-bold text-text",children:r.totalRequests})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Uptime"}),e.jsx("p",{className:"text-xl font-bold text-text",children:w(r.uptime)})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Memory"}),e.jsxs("p",{className:"text-xl font-bold text-text",children:[r.memoryMB,"MB"]})]})]})]})]})}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,ab as v,j as e}from"./index-
|
|
1
|
+
import{r,ab as v,j as e}from"./index-D7Clon2u.js";import{R as j}from"./TitanCanvas-BQU1yxqf.js";import"./VoiceOverlay-l6yoasVz.js";const x={debug:"bg-text-muted/20 text-text-secondary",info:"bg-info/20 text-info",warn:"bg-warning/20 text-warning",warning:"bg-warning/20 text-warning",error:"bg-error/20 text-error"};function L(){const[c,u]=r.useState([]),[g,m]=r.useState(!0),[i,d]=r.useState(null),[a,b]=r.useState(""),[o,h]=r.useState(100),[l,p]=r.useState(!1),s=r.useRef(null),n=r.useCallback(async()=>{try{const t=await v(a||void 0,o);u(t),d(null)}catch(t){d(t instanceof Error?t.message:"Failed to fetch logs")}finally{m(!1)}},[a,o]);return r.useEffect(()=>{n()},[n]),r.useEffect(()=>(l?s.current=setInterval(n,5e3):s.current&&(clearInterval(s.current),s.current=null),()=>{s.current&&clearInterval(s.current)}),[l,n]),g?e.jsx("div",{className:"h-96 animate-pulse rounded-xl border border-border bg-bg-secondary"}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-text",children:"Logs"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:a,onChange:t=>b(t.target.value),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:"",children:"All levels"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]}),e.jsxs("select",{value:o,onChange:t=>h(Number(t.target.value)),className:"rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent",children:[e.jsx("option",{value:50,children:"50 entries"}),e.jsx("option",{value:100,children:"100 entries"}),e.jsx("option",{value:200,children:"200 entries"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:t=>p(t.target.checked),className:"h-4 w-4 rounded border-border accent-accent"}),"Auto-refresh (5s)"]}),e.jsx("button",{onClick:n,className:"ml-auto rounded-lg p-2 text-text-secondary transition-colors hover:bg-bg-tertiary hover:text-text",title:"Refresh",children:e.jsx(j,{className:"h-4 w-4"})})]}),i&&e.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:i}),e.jsx("div",{className:"max-h-[600px] overflow-y-auto rounded-xl border border-border bg-bg-secondary",children:c.length===0?e.jsx("p",{className:"px-4 py-12 text-center text-text-muted",children:"No logs found"}):e.jsx("div",{className:"divide-y divide-border",children:c.map((t,f)=>e.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5",children:[e.jsx("span",{className:"shrink-0 font-mono text-xs text-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium uppercase ${x[t.level]??x.debug}`,children:t.level}),e.jsx("span",{className:"min-w-0 break-all text-sm text-text",children:t.message})]},f))})})]})}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as e,G as k,ai as z,aj as $,ak as b,al as R,am as I,an as E}from"./index-C6oarzis.js";import{P as h}from"./plug-DRlTjWqQ.js";import{R as D,P as L,h as g,l as G,m as B}from"./TitanCanvas-BhurNMK3.js";import{T as F}from"./trash-2-B4jp_pAQ.js";import"./VoiceOverlay-BXPVdnJc.js";function J(){const[n,j]=d.useState([]),[N,y]=d.useState([]),[f,x]=d.useState(!0),[m,c]=d.useState(!1),[v,p]=d.useState(null),[l,i]=d.useState(null),[s,a]=d.useState({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),o=async()=>{x(!0);try{const[t,r]=await Promise.all([z(),$()]);j(t),y(r)}catch{}x(!1)};d.useEffect(()=>{o()},[]);const C=async()=>{try{await b({id:s.id,name:s.name,description:s.description,type:s.type,...s.type==="stdio"?{command:s.command,args:s.args.split(/\s+/).filter(Boolean)}:{url:s.url}}),c(!1),a({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),o()}catch(t){alert(t.message)}},P=async t=>{try{await b({presetId:t}),o()}catch(r){alert(r.message)}},w=async t=>{confirm(`Remove MCP server "${t}"?`)&&(await E(t),o())},M=async(t,r)=>{await I(t,r),o()},T=async t=>{p(t),i(null);try{const r=await R(t);i({id:t,...r})}catch(r){i({id:t,ok:!1,tools:0,error:r.message})}p(null)},S=t=>t==="connected"?"text-[var(--success)]":t==="error"?"text-[var(--error)]":"text-[var(--text-muted)]",A=t=>t==="connected"?"bg-[var(--success)]":t==="error"?"bg-[var(--error)]":"bg-[var(--text-muted)]",u=N.filter(t=>!n.some(r=>r.id===t.id));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"MCP Connections"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connect to external tools via Model Context Protocol"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:o,className:"px-3 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(D,{size:14})}),e.jsxs("button",{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] transition-colors",children:[e.jsx(L,{size:14})," Add Server"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Configured Servers"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--text)]",children:n.length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connected"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--success)]",children:n.filter(t=>t.status==="connected").length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"External Tools"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--accent)]",children:n.reduce((t,r)=>t+r.toolCount,0)})]})]}),m&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Add MCP Server"}),u.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)] mb-2",children:"Quick Add Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(t=>e.jsxs("button",{onClick:()=>P(t.id),className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:[e.jsx(g,{size:12})," ",t.name]},t.id))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"ID"}),e.jsx("input",{id:"mcp-server-id",name:"mcp-server-id",value:s.id,onChange:t=>a({...s,id:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"my-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Name"}),e.jsx("input",{id:"mcp-server-name",name:"mcp-server-name",value:s.name,onChange:t=>a({...s,name:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"My MCP Server"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Description"}),e.jsx("input",{id:"mcp-server-description",name:"mcp-server-description",value:s.description,onChange:t=>a({...s,description:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"What does this server do?"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Type"}),e.jsxs("select",{id:"mcp-server-type",name:"mcp-server-type",value:s.type,onChange:t=>a({...s,type:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",children:[e.jsx("option",{value:"stdio",children:"stdio (local process)"}),e.jsx("option",{value:"http",children:"HTTP (remote server)"})]})]}),s.type==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Command"}),e.jsx("input",{id:"mcp-server-command",name:"mcp-server-command",value:s.command,onChange:t=>a({...s,command:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"npx @modelcontextprotocol/server-xxx"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Arguments (space-separated)"}),e.jsx("input",{id:"mcp-server-args",name:"mcp-server-args",value:s.args,onChange:t=>a({...s,args:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"--port 3000"})]})]}):e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Server URL"}),e.jsx("input",{id:"mcp-server-url",name:"mcp-server-url",value:s.url,onChange:t=>a({...s,url:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"http://localhost:3000/mcp"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:C,disabled:!s.id||!s.name,className:"px-4 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] disabled:opacity-40 transition-colors",children:"Add Server"}),e.jsx("button",{onClick:()=>c(!1),className:"px-4 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:"Cancel"})]})]}),f?e.jsx("div",{className:"text-[var(--text-muted)] text-sm",children:"Loading MCP servers..."}):n.length===0?e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center",children:[e.jsx(h,{className:"w-10 h-10 text-[var(--text-muted)] mx-auto mb-3"}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:"No MCP servers configured"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Add an MCP server to connect TITAN to external tools like databases, APIs, and services."})]}):e.jsx("div",{className:"space-y-3",children:n.map(t=>e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:t.type==="stdio"?e.jsx(g,{size:18,className:"text-[var(--text-muted)]"}):e.jsx(k,{size:18,className:"text-[var(--text-muted)]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-[var(--text)]",children:t.name}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${A(t.status)}`}),e.jsx("span",{className:S(t.status),children:t.status})]}),t.toolCount>0&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--accent)]/10 text-[var(--accent)]",children:[t.toolCount," tools"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:t.description}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-1 font-mono",children:t.type==="stdio"?`${t.command} ${(t.args||[]).join(" ")}`:t.url})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>T(t.id),disabled:v===t.id,title:"Test connection",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-tertiary)] transition-colors disabled:opacity-40",children:e.jsx(G,{size:14,className:v===t.id?"animate-pulse":""})}),e.jsx("button",{onClick:()=>M(t.id,!t.enabled),title:t.enabled?"Disable":"Enable",className:`p-1.5 rounded-md transition-colors hover:bg-[var(--bg-tertiary)] ${t.enabled?"text-[var(--success)]":"text-[var(--text-muted)]"}`,children:e.jsx(B,{size:14})}),e.jsx("button",{onClick:()=>w(t.id),title:"Remove",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--error)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(F,{size:14})})]})]}),(l==null?void 0:l.id)===t.id&&e.jsx("div",{className:`mt-3 px-3 py-2 rounded-md text-xs ${l.ok?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:l.ok?`Connected successfully — ${l.tools} tools discovered`:`Connection failed: ${l.error}`})]},t.id))}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"About MCP"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)] leading-relaxed",children:["Model Context Protocol (MCP) is the universal standard for connecting AI agents to external tools. TITAN acts as both an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"server"})," (exposing its tools to other agents) and an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"client"})," (connecting to external MCP servers). Add any MCP-compatible server and its tools automatically become available in TITAN."]})]})]})}export{J as default};
|
|
1
|
+
import{r as d,j as e,G as k,ai as z,aj as $,ak as b,al as R,am as I,an as E}from"./index-D7Clon2u.js";import{P as h}from"./plug-CvpyjJt_.js";import{R as D,P as L,h as g,l as G,m as B}from"./TitanCanvas-BQU1yxqf.js";import{T as F}from"./trash-2-Byj4OvKB.js";import"./VoiceOverlay-l6yoasVz.js";function J(){const[n,j]=d.useState([]),[N,y]=d.useState([]),[f,x]=d.useState(!0),[m,c]=d.useState(!1),[v,p]=d.useState(null),[l,i]=d.useState(null),[s,a]=d.useState({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),o=async()=>{x(!0);try{const[t,r]=await Promise.all([z(),$()]);j(t),y(r)}catch{}x(!1)};d.useEffect(()=>{o()},[]);const C=async()=>{try{await b({id:s.id,name:s.name,description:s.description,type:s.type,...s.type==="stdio"?{command:s.command,args:s.args.split(/\s+/).filter(Boolean)}:{url:s.url}}),c(!1),a({id:"",name:"",description:"",type:"stdio",command:"",args:"",url:""}),o()}catch(t){alert(t.message)}},P=async t=>{try{await b({presetId:t}),o()}catch(r){alert(r.message)}},w=async t=>{confirm(`Remove MCP server "${t}"?`)&&(await E(t),o())},M=async(t,r)=>{await I(t,r),o()},T=async t=>{p(t),i(null);try{const r=await R(t);i({id:t,...r})}catch(r){i({id:t,ok:!1,tools:0,error:r.message})}p(null)},S=t=>t==="connected"?"text-[var(--success)]":t==="error"?"text-[var(--error)]":"text-[var(--text-muted)]",A=t=>t==="connected"?"bg-[var(--success)]":t==="error"?"bg-[var(--error)]":"bg-[var(--text-muted)]",u=N.filter(t=>!n.some(r=>r.id===t.id));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"MCP Connections"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connect to external tools via Model Context Protocol"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:o,className:"px-3 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(D,{size:14})}),e.jsxs("button",{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] transition-colors",children:[e.jsx(L,{size:14})," Add Server"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Configured Servers"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--text)]",children:n.length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Connected"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--success)]",children:n.filter(t=>t.status==="connected").length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"External Tools"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--accent)]",children:n.reduce((t,r)=>t+r.toolCount,0)})]})]}),m&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Add MCP Server"}),u.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)] mb-2",children:"Quick Add Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(t=>e.jsxs("button",{onClick:()=>P(t.id),className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:[e.jsx(g,{size:12})," ",t.name]},t.id))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"ID"}),e.jsx("input",{id:"mcp-server-id",name:"mcp-server-id",value:s.id,onChange:t=>a({...s,id:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"my-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Name"}),e.jsx("input",{id:"mcp-server-name",name:"mcp-server-name",value:s.name,onChange:t=>a({...s,name:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"My MCP Server"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Description"}),e.jsx("input",{id:"mcp-server-description",name:"mcp-server-description",value:s.description,onChange:t=>a({...s,description:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"What does this server do?"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Type"}),e.jsxs("select",{id:"mcp-server-type",name:"mcp-server-type",value:s.type,onChange:t=>a({...s,type:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",children:[e.jsx("option",{value:"stdio",children:"stdio (local process)"}),e.jsx("option",{value:"http",children:"HTTP (remote server)"})]})]}),s.type==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Command"}),e.jsx("input",{id:"mcp-server-command",name:"mcp-server-command",value:s.command,onChange:t=>a({...s,command:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"npx @modelcontextprotocol/server-xxx"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Arguments (space-separated)"}),e.jsx("input",{id:"mcp-server-args",name:"mcp-server-args",value:s.args,onChange:t=>a({...s,args:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"--port 3000"})]})]}):e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Server URL"}),e.jsx("input",{id:"mcp-server-url",name:"mcp-server-url",value:s.url,onChange:t=>a({...s,url:t.target.value}),className:"w-full mt-1 px-3 py-1.5 text-sm bg-[var(--bg)] border border-[var(--border)] rounded-md text-[var(--text)]",placeholder:"http://localhost:3000/mcp"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:C,disabled:!s.id||!s.name,className:"px-4 py-1.5 text-sm rounded-md bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] disabled:opacity-40 transition-colors",children:"Add Server"}),e.jsx("button",{onClick:()=>c(!1),className:"px-4 py-1.5 text-sm rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:"Cancel"})]})]}),f?e.jsx("div",{className:"text-[var(--text-muted)] text-sm",children:"Loading MCP servers..."}):n.length===0?e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center",children:[e.jsx(h,{className:"w-10 h-10 text-[var(--text-muted)] mx-auto mb-3"}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:"No MCP servers configured"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Add an MCP server to connect TITAN to external tools like databases, APIs, and services."})]}):e.jsx("div",{className:"space-y-3",children:n.map(t=>e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:t.type==="stdio"?e.jsx(g,{size:18,className:"text-[var(--text-muted)]"}):e.jsx(k,{size:18,className:"text-[var(--text-muted)]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-[var(--text)]",children:t.name}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${A(t.status)}`}),e.jsx("span",{className:S(t.status),children:t.status})]}),t.toolCount>0&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--accent)]/10 text-[var(--accent)]",children:[t.toolCount," tools"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:t.description}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-1 font-mono",children:t.type==="stdio"?`${t.command} ${(t.args||[]).join(" ")}`:t.url})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>T(t.id),disabled:v===t.id,title:"Test connection",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--bg-tertiary)] transition-colors disabled:opacity-40",children:e.jsx(G,{size:14,className:v===t.id?"animate-pulse":""})}),e.jsx("button",{onClick:()=>M(t.id,!t.enabled),title:t.enabled?"Disable":"Enable",className:`p-1.5 rounded-md transition-colors hover:bg-[var(--bg-tertiary)] ${t.enabled?"text-[var(--success)]":"text-[var(--text-muted)]"}`,children:e.jsx(B,{size:14})}),e.jsx("button",{onClick:()=>w(t.id),title:"Remove",className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--error)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(F,{size:14})})]})]}),(l==null?void 0:l.id)===t.id&&e.jsx("div",{className:`mt-3 px-3 py-2 rounded-md text-xs ${l.ok?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:l.ok?`Connected successfully — ${l.tools} tools discovered`:`Connection failed: ${l.error}`})]},t.id))}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"About MCP"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)] leading-relaxed",children:["Model Context Protocol (MCP) is the universal standard for connecting AI agents to external tools. TITAN acts as both an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"server"})," (exposing its tools to other agents) and an MCP ",e.jsx("strong",{className:"text-[var(--text-secondary)]",children:"client"})," (connecting to external MCP servers). Add any MCP-compatible server and its tools automatically become available in TITAN."]})]})]})}export{J as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ye,r as j,b as be,j as o,X as Se}from"./index-
|
|
1
|
+
import{c as ye,r as j,b as be,j as o,X as Se}from"./index-D7Clon2u.js";import{N as ve,R as Ce,a as ke}from"./TitanCanvas-BQU1yxqf.js";import{T as $e}from"./trash-2-Byj4OvKB.js";import"./VoiceOverlay-l6yoasVz.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as g,r as n,b as h,j as e}from"./index-
|
|
1
|
+
import{c as g,r as n,b as h,j as e}from"./index-D7Clon2u.js";import{P as u}from"./PageHeader-DPJuAgJk.js";import{A as v}from"./arrow-left-C_H9Z2Tm.js";import{C as w,a as k,d as S}from"./TitanCanvas-BQU1yxqf.js";import"./VoiceOverlay-l6yoasVz.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as l,r as n,j as e,ar as y,as as j,at as N,au as f,av as k}from"./index-
|
|
1
|
+
import{c as l,r as n,j as e,ar as y,as as j,at as N,au as f,av as k}from"./index-D7Clon2u.js";import{D as v}from"./DataTable-D2Px4o6f.js";import{R as w,n as P}from"./TitanCanvas-BQU1yxqf.js";import"./VoiceOverlay-l6yoasVz.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,b as y,j as e,C as K,e as U,Z as O,A as B,d as E,K as G,$ as T}from"./index-C6oarzis.js";import{R as D,c as L,E as V,a as $,i as M}from"./TitanCanvas-BhurNMK3.js";import{C as F}from"./circle-check-big-CMz0QouP.js";import{E as H}from"./eye-off-BPXFIzlW.js";import"./VoiceOverlay-BXPVdnJc.js";const _={enabled:!1,apiKey:"",cuopt:{enabled:!1,url:"http://localhost:5000"},asr:{enabled:!1,grpcUrl:"localhost:50051",healthUrl:"http://localhost:9000"},openshell:{enabled:!1,binaryPath:"openshell",policyPath:""}};function v({status:s}){const l={unknown:"bg-border-light",checking:"bg-[#eab308] animate-pulse",healthy:"bg-success",unhealthy:"bg-error"},d={unknown:"Not checked",checking:"Checking...",healthy:"Healthy",unhealthy:"Unreachable"};return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-text-muted",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${l[s]}`}),d[s]]})}function f({title:s,description:l,icon:d,enabled:r,onToggle:h,children:p}){return e.jsxs("div",{className:`rounded-xl border bg-bg-secondary transition-colors ${r?"border-[#76b900]/30":"border-bg-tertiary"}`,children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-9 w-9 items-center justify-center rounded-lg ${r?"bg-nvidia/15":"bg-bg-tertiary"}`,children:e.jsx(d,{className:`h-4.5 w-4.5 ${r?"text-nvidia":"text-text-muted"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:l})]})]}),e.jsx("button",{onClick:h,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${r?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${r?"translate-x-6":"translate-x-1"}`})})]}),r&&e.jsx("div",{className:"border-t border-bg-tertiary px-5 py-4 space-y-3",children:p})]})}function u({id:s,label:l,value:d,onChange:r,placeholder:h,type:p="text",secret:x=!1}){const[m,b]=o.useState(!1);return e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:l}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:s,name:s,type:x&&!m?"password":p,value:d,onChange:n=>r(n.target.value),placeholder:h,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-[#76b900] transition-colors"}),x&&e.jsx("button",{type:"button",onClick:()=>b(!m),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:m?e.jsx(H,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})})]})]})}function X(){const[s,l]=o.useState(_),[d,r]=o.useState(!0),[h,p]=o.useState(!1),[x,m]=o.useState(null),[b,n]=o.useState({cuopt:"unknown",asr:"unknown",nim:"unknown"}),[g,j]=o.useState(!1),N=o.useCallback((t,a)=>{m({type:t,message:a}),setTimeout(()=>m(null),3e3)},[]);o.useEffect(()=>{(async()=>{var a,c,w,k,S,A,I,C;try{const i=await G();i.nvidia&&(l({enabled:i.nvidia.enabled??!1,apiKey:"",cuopt:{enabled:((a=i.nvidia.cuopt)==null?void 0:a.enabled)??!1,url:((c=i.nvidia.cuopt)==null?void 0:c.url)??"http://localhost:5000"},asr:{enabled:((w=i.nvidia.asr)==null?void 0:w.enabled)??!1,grpcUrl:((k=i.nvidia.asr)==null?void 0:k.grpcUrl)??"localhost:50051",healthUrl:((S=i.nvidia.asr)==null?void 0:S.healthUrl)??"http://localhost:9000"},openshell:{enabled:((A=i.nvidia.openshell)==null?void 0:A.enabled)??!1,binaryPath:((I=i.nvidia.openshell)==null?void 0:I.binaryPath)??"openshell",policyPath:((C=i.nvidia.openshell)==null?void 0:C.policyPath)??""}}),j(i.nvidia.apiKeySet??!1))}catch{}finally{r(!1)}})()},[]);const P=o.useCallback(async()=>{if(s.cuopt.enabled){n(t=>({...t,cuopt:"checking"}));try{const a=await(await y("/api/nvidia/health/cuopt")).json();n(c=>({...c,cuopt:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,cuopt:"unhealthy"}))}}if(s.asr.enabled){n(t=>({...t,asr:"checking"}));try{const a=await(await y("/api/nvidia/health/asr")).json();n(c=>({...c,asr:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,asr:"unhealthy"}))}}if(g||s.apiKey){n(t=>({...t,nim:"checking"}));try{const a=await(await y("/api/nvidia/health/nim")).json();n(c=>({...c,nim:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,nim:"unhealthy"}))}}},[s.cuopt.enabled,s.asr.enabled,g,s.apiKey]),R=async()=>{p(!0);try{const t={nvidia:{enabled:s.enabled,cuopt:s.cuopt,asr:s.asr,openshell:s.openshell}};s.apiKey&&(t.nvidia.apiKey=s.apiKey),await T(t),N("success","NVIDIA configuration saved"),s.apiKey&&(j(!0),l(a=>({...a,apiKey:""})))}catch(t){N("error",t instanceof Error?t.message:"Failed to save")}finally{p(!1)}};return d?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((t,a)=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},a))}):e.jsxs("div",{className:"space-y-6 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-nvidia/15",children:e.jsx(K,{className:"h-5 w-5 text-nvidia"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"NVIDIA"}),e.jsx("p",{className:"text-xs text-text-muted",children:"GPU-accelerated AI services — NIM, cuOpt, Nemotron-ASR, OpenShell"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:P,className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary transition-colors",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Check Health"]}),e.jsxs("button",{onClick:R,disabled:h,className:"flex items-center gap-2 rounded-lg bg-nvidia px-4 py-1.5 text-xs font-medium text-black transition-colors hover:bg-nvidia/80 disabled:opacity-50",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save"]})]})]}),x&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${x.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[x.type==="success"?e.jsx(F,{className:"h-4 w-4"}):e.jsx(U,{className:"h-4 w-4"}),x.message]}),e.jsx("div",{className:`rounded-xl border p-5 transition-colors ${s.enabled?"border-[#76b900]/30 bg-nvidia/5":"border-bg-tertiary bg-bg-secondary"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-medium text-text",children:"Enable NVIDIA Skills"}),e.jsxs("p",{className:"text-xs text-text-muted mt-0.5",children:["Load NVIDIA GPU-accelerated skills (cuOpt, AI-Q Research, etc.) when TITAN starts. Equivalent to setting ",e.jsx("code",{className:"text-nvidia/70 bg-nvidia/10 px-1 rounded",children:"TITAN_NVIDIA=1"})]})]}),e.jsx("button",{onClick:()=>l(t=>({...t,enabled:!t.enabled})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s.enabled?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${s.enabled?"translate-x-6":"translate-x-1"}`})})]})}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{className:"h-4 w-4 text-nvidia"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"NVIDIA NIM API"}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:"Cloud inference for Nemotron 3 Super and other NIM models"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(v,{status:b.nim}),g&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Key configured"]})]})]}),e.jsx(u,{id:"nvidia-api-key",label:"API Key",value:s.apiKey,onChange:t=>l(a=>({...a,apiKey:t})),placeholder:g?"(configured — enter new key to replace)":"nvapi-...",secret:!0}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Get your key at"," ",e.jsxs("a",{href:"https://build.nvidia.com",target:"_blank",rel:"noopener noreferrer",className:"text-nvidia hover:underline inline-flex items-center gap-0.5",children:["build.nvidia.com ",e.jsx(V,{className:"h-2.5 w-2.5"})]})]})]}),e.jsxs(f,{title:"cuOpt Optimization",description:"GPU-accelerated routing, scheduling, and mathematical programming (MILP/LP/QP)",icon:B,enabled:s.cuopt.enabled,onToggle:()=>l(t=>({...t,cuopt:{...t.cuopt,enabled:!t.cuopt.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(v,{status:b.cuopt})]}),e.jsx(u,{id:"nvidia-cuopt-url",label:"cuOpt Server URL",value:s.cuopt.url,onChange:t=>l(a=>({...a,cuopt:{...a.cuopt,url:t}})),placeholder:"http://localhost:5000"}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start cuOpt: ",e.jsx("code",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary",children:"docker compose -f docker-compose.nvidia.yml --profile cuopt up -d"})]})]}),e.jsxs(f,{title:"Nemotron-ASR Streaming",description:"NVIDIA speech recognition with 24ms median finalization — replaces faster-whisper for voice chat",icon:$,enabled:s.asr.enabled,onToggle:()=>l(t=>({...t,asr:{...t.asr,enabled:!t.asr.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(v,{status:b.asr})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-asr-grpc-url",label:"gRPC Address",value:s.asr.grpcUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,grpcUrl:t}})),placeholder:"localhost:50051"}),e.jsx(u,{id:"nvidia-asr-health-url",label:"Health Check URL",value:s.asr.healthUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,healthUrl:t}})),placeholder:"http://localhost:9000"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start ASR: ",e.jsx("code",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary",children:"docker compose -f docker-compose.nvidia.yml --profile asr up -d"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["VRAM: ~3-4 GB. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:"STT_ENGINE=nemotron-asr"})," in voice agent env."]})]}),e.jsxs(f,{title:"OpenShell Sandbox",description:"NVIDIA secure sandbox runtime for code execution with declarative policy enforcement",icon:E,enabled:s.openshell.enabled,onToggle:()=>l(t=>({...t,openshell:{...t.openshell,enabled:!t.openshell.enabled}})),children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-openshell-binary-path",label:"Binary Path",value:s.openshell.binaryPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,binaryPath:t}})),placeholder:"openshell"}),e.jsx(u,{id:"nvidia-openshell-policy-path",label:"Policy File Path (optional)",value:s.openshell.policyPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,policyPath:t}})),placeholder:"Auto-detected"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["When enabled, code execution uses OpenShell instead of Docker. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:'sandbox.engine: "openshell"'})," in config."]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:"VRAM Budget (RTX 5090, 32 GB)"}),e.jsxs("div",{className:"space-y-2",children:[[{label:"Nemotron 3 Nano 30B",vram:"~24 GB",note:"Full local inference"},{label:"Nemotron 3 Nano 4B",vram:"~3 GB",note:"Lightweight variant"},{label:"Nemotron-ASR",vram:"~3-4 GB",note:"Speech recognition"},{label:"cuOpt",vram:"~2-4 GB",note:"Optimization solver"}].map(({label:t,vram:a,note:c})=>e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-text",children:t}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2",children:c})]}),e.jsx("span",{className:"text-xs font-mono text-nvidia",children:a})]},t)),e.jsx("div",{className:"border-t border-bg-tertiary pt-2 mt-2",children:e.jsx("p",{className:"text-[10px] text-text-muted",children:"Recommended: Nano 4B + ASR + cuOpt = ~10 GB, leaving room for other models. Or use NIM cloud API for LLM inference (0 GB local)."})})]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-2",children:"Quick Start"}),e.jsxs("div",{className:"space-y-2 text-xs text-text-muted",children:[e.jsx("p",{children:"Start all NVIDIA services:"}),e.jsx("code",{className:"block bg-bg border border-bg-tertiary rounded-lg px-3 py-2 text-text-secondary font-mono text-xs",children:"docker compose -f docker-compose.nvidia.yml --profile all up -d"}),e.jsx("p",{className:"mt-2",children:"Or start individual services:"}),e.jsxs("div",{className:"space-y-1 font-mono text-[10px] text-text-muted",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"cuopt:"})," --profile cuopt"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"asr:"})," --profile asr (includes Riva bridge)"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"voice:"})," --profile voice (ASR + bridge)"]})]})]})]})]})}export{X as default};
|
|
1
|
+
import{r as o,b as y,j as e,C as K,e as U,Z as O,A as B,d as E,K as G,$ as T}from"./index-D7Clon2u.js";import{R as D,c as L,E as V,a as $,i as M}from"./TitanCanvas-BQU1yxqf.js";import{C as F}from"./circle-check-big-B1hMwau0.js";import{E as H}from"./eye-off-Cx0M_VQb.js";import"./VoiceOverlay-l6yoasVz.js";const _={enabled:!1,apiKey:"",cuopt:{enabled:!1,url:"http://localhost:5000"},asr:{enabled:!1,grpcUrl:"localhost:50051",healthUrl:"http://localhost:9000"},openshell:{enabled:!1,binaryPath:"openshell",policyPath:""}};function v({status:s}){const l={unknown:"bg-border-light",checking:"bg-[#eab308] animate-pulse",healthy:"bg-success",unhealthy:"bg-error"},d={unknown:"Not checked",checking:"Checking...",healthy:"Healthy",unhealthy:"Unreachable"};return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-text-muted",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${l[s]}`}),d[s]]})}function f({title:s,description:l,icon:d,enabled:r,onToggle:h,children:p}){return e.jsxs("div",{className:`rounded-xl border bg-bg-secondary transition-colors ${r?"border-[#76b900]/30":"border-bg-tertiary"}`,children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-9 w-9 items-center justify-center rounded-lg ${r?"bg-nvidia/15":"bg-bg-tertiary"}`,children:e.jsx(d,{className:`h-4.5 w-4.5 ${r?"text-nvidia":"text-text-muted"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:l})]})]}),e.jsx("button",{onClick:h,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${r?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${r?"translate-x-6":"translate-x-1"}`})})]}),r&&e.jsx("div",{className:"border-t border-bg-tertiary px-5 py-4 space-y-3",children:p})]})}function u({id:s,label:l,value:d,onChange:r,placeholder:h,type:p="text",secret:x=!1}){const[m,b]=o.useState(!1);return e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:l}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:s,name:s,type:x&&!m?"password":p,value:d,onChange:n=>r(n.target.value),placeholder:h,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-[#76b900] transition-colors"}),x&&e.jsx("button",{type:"button",onClick:()=>b(!m),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:m?e.jsx(H,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})})]})]})}function X(){const[s,l]=o.useState(_),[d,r]=o.useState(!0),[h,p]=o.useState(!1),[x,m]=o.useState(null),[b,n]=o.useState({cuopt:"unknown",asr:"unknown",nim:"unknown"}),[g,j]=o.useState(!1),N=o.useCallback((t,a)=>{m({type:t,message:a}),setTimeout(()=>m(null),3e3)},[]);o.useEffect(()=>{(async()=>{var a,c,w,k,S,A,I,C;try{const i=await G();i.nvidia&&(l({enabled:i.nvidia.enabled??!1,apiKey:"",cuopt:{enabled:((a=i.nvidia.cuopt)==null?void 0:a.enabled)??!1,url:((c=i.nvidia.cuopt)==null?void 0:c.url)??"http://localhost:5000"},asr:{enabled:((w=i.nvidia.asr)==null?void 0:w.enabled)??!1,grpcUrl:((k=i.nvidia.asr)==null?void 0:k.grpcUrl)??"localhost:50051",healthUrl:((S=i.nvidia.asr)==null?void 0:S.healthUrl)??"http://localhost:9000"},openshell:{enabled:((A=i.nvidia.openshell)==null?void 0:A.enabled)??!1,binaryPath:((I=i.nvidia.openshell)==null?void 0:I.binaryPath)??"openshell",policyPath:((C=i.nvidia.openshell)==null?void 0:C.policyPath)??""}}),j(i.nvidia.apiKeySet??!1))}catch{}finally{r(!1)}})()},[]);const P=o.useCallback(async()=>{if(s.cuopt.enabled){n(t=>({...t,cuopt:"checking"}));try{const a=await(await y("/api/nvidia/health/cuopt")).json();n(c=>({...c,cuopt:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,cuopt:"unhealthy"}))}}if(s.asr.enabled){n(t=>({...t,asr:"checking"}));try{const a=await(await y("/api/nvidia/health/asr")).json();n(c=>({...c,asr:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,asr:"unhealthy"}))}}if(g||s.apiKey){n(t=>({...t,nim:"checking"}));try{const a=await(await y("/api/nvidia/health/nim")).json();n(c=>({...c,nim:a.healthy?"healthy":"unhealthy"}))}catch{n(t=>({...t,nim:"unhealthy"}))}}},[s.cuopt.enabled,s.asr.enabled,g,s.apiKey]),R=async()=>{p(!0);try{const t={nvidia:{enabled:s.enabled,cuopt:s.cuopt,asr:s.asr,openshell:s.openshell}};s.apiKey&&(t.nvidia.apiKey=s.apiKey),await T(t),N("success","NVIDIA configuration saved"),s.apiKey&&(j(!0),l(a=>({...a,apiKey:""})))}catch(t){N("error",t instanceof Error?t.message:"Failed to save")}finally{p(!1)}};return d?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((t,a)=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},a))}):e.jsxs("div",{className:"space-y-6 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-nvidia/15",children:e.jsx(K,{className:"h-5 w-5 text-nvidia"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"NVIDIA"}),e.jsx("p",{className:"text-xs text-text-muted",children:"GPU-accelerated AI services — NIM, cuOpt, Nemotron-ASR, OpenShell"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:P,className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary transition-colors",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Check Health"]}),e.jsxs("button",{onClick:R,disabled:h,className:"flex items-center gap-2 rounded-lg bg-nvidia px-4 py-1.5 text-xs font-medium text-black transition-colors hover:bg-nvidia/80 disabled:opacity-50",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save"]})]})]}),x&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${x.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[x.type==="success"?e.jsx(F,{className:"h-4 w-4"}):e.jsx(U,{className:"h-4 w-4"}),x.message]}),e.jsx("div",{className:`rounded-xl border p-5 transition-colors ${s.enabled?"border-[#76b900]/30 bg-nvidia/5":"border-bg-tertiary bg-bg-secondary"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-medium text-text",children:"Enable NVIDIA Skills"}),e.jsxs("p",{className:"text-xs text-text-muted mt-0.5",children:["Load NVIDIA GPU-accelerated skills (cuOpt, AI-Q Research, etc.) when TITAN starts. Equivalent to setting ",e.jsx("code",{className:"text-nvidia/70 bg-nvidia/10 px-1 rounded",children:"TITAN_NVIDIA=1"})]})]}),e.jsx("button",{onClick:()=>l(t=>({...t,enabled:!t.enabled})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s.enabled?"bg-nvidia":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${s.enabled?"translate-x-6":"translate-x-1"}`})})]})}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{className:"h-4 w-4 text-nvidia"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"NVIDIA NIM API"}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:"Cloud inference for Nemotron 3 Super and other NIM models"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(v,{status:b.nim}),g&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-success"}),"Key configured"]})]})]}),e.jsx(u,{id:"nvidia-api-key",label:"API Key",value:s.apiKey,onChange:t=>l(a=>({...a,apiKey:t})),placeholder:g?"(configured — enter new key to replace)":"nvapi-...",secret:!0}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Get your key at"," ",e.jsxs("a",{href:"https://build.nvidia.com",target:"_blank",rel:"noopener noreferrer",className:"text-nvidia hover:underline inline-flex items-center gap-0.5",children:["build.nvidia.com ",e.jsx(V,{className:"h-2.5 w-2.5"})]})]})]}),e.jsxs(f,{title:"cuOpt Optimization",description:"GPU-accelerated routing, scheduling, and mathematical programming (MILP/LP/QP)",icon:B,enabled:s.cuopt.enabled,onToggle:()=>l(t=>({...t,cuopt:{...t.cuopt,enabled:!t.cuopt.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(v,{status:b.cuopt})]}),e.jsx(u,{id:"nvidia-cuopt-url",label:"cuOpt Server URL",value:s.cuopt.url,onChange:t=>l(a=>({...a,cuopt:{...a.cuopt,url:t}})),placeholder:"http://localhost:5000"}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start cuOpt: ",e.jsx("code",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary",children:"docker compose -f docker-compose.nvidia.yml --profile cuopt up -d"})]})]}),e.jsxs(f,{title:"Nemotron-ASR Streaming",description:"NVIDIA speech recognition with 24ms median finalization — replaces faster-whisper for voice chat",icon:$,enabled:s.asr.enabled,onToggle:()=>l(t=>({...t,asr:{...t.asr,enabled:!t.asr.enabled}})),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Service Status"}),e.jsx(v,{status:b.asr})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-asr-grpc-url",label:"gRPC Address",value:s.asr.grpcUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,grpcUrl:t}})),placeholder:"localhost:50051"}),e.jsx(u,{id:"nvidia-asr-health-url",label:"Health Check URL",value:s.asr.healthUrl,onChange:t=>l(a=>({...a,asr:{...a.asr,healthUrl:t}})),placeholder:"http://localhost:9000"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["Start ASR: ",e.jsx("code",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-secondary",children:"docker compose -f docker-compose.nvidia.yml --profile asr up -d"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["VRAM: ~3-4 GB. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:"STT_ENGINE=nemotron-asr"})," in voice agent env."]})]}),e.jsxs(f,{title:"OpenShell Sandbox",description:"NVIDIA secure sandbox runtime for code execution with declarative policy enforcement",icon:E,enabled:s.openshell.enabled,onToggle:()=>l(t=>({...t,openshell:{...t.openshell,enabled:!t.openshell.enabled}})),children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{id:"nvidia-openshell-binary-path",label:"Binary Path",value:s.openshell.binaryPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,binaryPath:t}})),placeholder:"openshell"}),e.jsx(u,{id:"nvidia-openshell-policy-path",label:"Policy File Path (optional)",value:s.openshell.policyPath,onChange:t=>l(a=>({...a,openshell:{...a.openshell,policyPath:t}})),placeholder:"Auto-detected"})]}),e.jsxs("p",{className:"text-[10px] text-text-muted",children:["When enabled, code execution uses OpenShell instead of Docker. Set ",e.jsx("code",{className:"bg-bg-tertiary px-1 rounded text-text-secondary",children:'sandbox.engine: "openshell"'})," in config."]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:"VRAM Budget (RTX 5090, 32 GB)"}),e.jsxs("div",{className:"space-y-2",children:[[{label:"Nemotron 3 Nano 30B",vram:"~24 GB",note:"Full local inference"},{label:"Nemotron 3 Nano 4B",vram:"~3 GB",note:"Lightweight variant"},{label:"Nemotron-ASR",vram:"~3-4 GB",note:"Speech recognition"},{label:"cuOpt",vram:"~2-4 GB",note:"Optimization solver"}].map(({label:t,vram:a,note:c})=>e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-text",children:t}),e.jsx("span",{className:"text-[10px] text-text-muted ml-2",children:c})]}),e.jsx("span",{className:"text-xs font-mono text-nvidia",children:a})]},t)),e.jsx("div",{className:"border-t border-bg-tertiary pt-2 mt-2",children:e.jsx("p",{className:"text-[10px] text-text-muted",children:"Recommended: Nano 4B + ASR + cuOpt = ~10 GB, leaving room for other models. Or use NIM cloud API for LLM inference (0 GB local)."})})]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-2",children:"Quick Start"}),e.jsxs("div",{className:"space-y-2 text-xs text-text-muted",children:[e.jsx("p",{children:"Start all NVIDIA services:"}),e.jsx("code",{className:"block bg-bg border border-bg-tertiary rounded-lg px-3 py-2 text-text-secondary font-mono text-xs",children:"docker compose -f docker-compose.nvidia.yml --profile all up -d"}),e.jsx("p",{className:"mt-2",children:"Or start individual services:"}),e.jsxs("div",{className:"space-y-1 font-mono text-[10px] text-text-muted",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"cuopt:"})," --profile cuopt"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"asr:"})," --profile asr (includes Riva bridge)"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-nvidia",children:"voice:"})," --profile voice (ASR + bridge)"]})]})]})]})]})}export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,aX as g,aY as b,j as e,T as d,d as f,aZ as h}from"./index-
|
|
1
|
+
import{r as t,aX as g,aY as b,j as e,T as d,d as f,aZ as h}from"./index-D7Clon2u.js";import{P as p}from"./PageHeader-DPJuAgJk.js";import{R as j}from"./TitanCanvas-BQU1yxqf.js";import{C as u}from"./circle-check-big-B1hMwau0.js";import"./VoiceOverlay-l6yoasVz.js";function A(){const[n,m]=t.useState([]),[i,o]=t.useState({}),[l,c]=t.useState(!0),r=t.useCallback(async()=>{c(!0);try{const[s,a]=await Promise.all([g(),b()]);m(s.alerts||[]),o(a)}catch{}c(!1)},[]);t.useEffect(()=>{r()},[r]);const x=async s=>{try{await h(s),await r()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(p,{title:"Organism Monitor",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Safety"},{label:"Organism"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:r,disabled:l,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(j,{className:`w-4 h-4 ${l?"animate-spin":""}`})," Refresh"]})}),Object.keys(i).length>0&&e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Object.entries(i).map(([s,a])=>e.jsxs("div",{className:"p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsx("div",{className:"text-xs text-[#52525b] capitalize",children:s}),e.jsx("div",{className:"text-sm font-semibold text-[#e4e4e7]",children:typeof a=="number"?a.toFixed(2):a})]},s))}),e.jsx("div",{className:"space-y-2",children:n.map(s=>e.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border ${s.severity==="critical"?"bg-red-950/20 border-red-900/50":s.severity==="warning"?"bg-amber-950/20 border-amber-900/50":"bg-[#0a0a0f] border-[#27272a]"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[s.severity==="critical"?e.jsx(d,{className:"w-4 h-4 text-red-400"}):s.severity==="warning"?e.jsx(d,{className:"w-4 h-4 text-amber-400"}):e.jsx(f,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:s.message}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.source," • ",new Date(s.timestamp).toLocaleString()]})]})]}),!s.acknowledged&&e.jsxs("button",{onClick:()=>x(s.id),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] text-xs hover:bg-[#3f3f46]",children:[e.jsx(u,{className:"w-3.5 h-3.5"})," Ack"]})]},s.id))})]})}export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as e,Z as v,A as x,H as f,C as h,aB as g}from"./index-D7Clon2u.js";import{S as a}from"./StatCard-CEVFsz7t.js";import{P as c}from"./PageHeader-DPJuAgJk.js";import{S as j}from"./SkeletonLoader-D1d-Gyyg.js";import{C as p,M as b,h as y}from"./TitanCanvas-BQU1yxqf.js";import{L as S}from"./layers-B6jDzitD.js";import"./VoiceOverlay-l6yoasVz.js";function w(t){const s=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return s>0?`${s}d ${r}h ${i}m`:r>0?`${r}h ${i}m`:`${i}m`}function m(t){const s=t/1024/1024;return s>1024?`${(s/1024).toFixed(1)} GB`:`${s.toFixed(0)} MB`}function L(){const[t,s]=o.useState(null),[r,i]=o.useState(null),[d,u]=o.useState(!0),n=async()=>{try{const l=await g();s(l),i(null)}catch(l){i(l instanceof Error?l.message:"Failed to fetch stats")}finally{u(!1)}};return o.useEffect(()=>{n();const l=setInterval(n,1e4);return()=>clearInterval(l)},[]),d?e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx(c,{title:"System Overview",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Monitoring"},{label:"Overview"}]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:e.jsx(j,{variant:"metric",count:8})})]}):r?e.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:r}):t?e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx(c,{title:"System Overview",subtitle:"Real-time system health and metrics",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Monitoring"},{label:"Overview"}]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(a,{title:"Uptime",value:w(t.uptime),icon:e.jsx(p,{className:"h-5 w-5"})}),e.jsx(a,{title:"Total Requests",value:t.totalRequests.toLocaleString(),icon:e.jsx(v,{className:"h-5 w-5"})}),e.jsx(a,{title:"Active Agents",value:t.activeAgents,icon:e.jsx(x,{className:"h-5 w-5"})}),e.jsx(a,{title:"Active Sessions",value:t.activeSessions,icon:e.jsx(b,{className:"h-5 w-5"})}),e.jsx(a,{title:"Memory Usage",value:m(t.memoryUsage.heapUsed),icon:e.jsx(f,{className:"h-5 w-5"}),subtitle:`${m(t.memoryUsage.heapTotal)} total`}),e.jsx(a,{title:"Model",value:t.model,icon:e.jsx(h,{className:"h-5 w-5"})}),e.jsx(a,{title:"Provider",value:t.provider,icon:e.jsx(y,{className:"h-5 w-5"})}),e.jsx(a,{title:"Version",value:t.version,icon:e.jsx(S,{className:"h-5 w-5"})})]})]}):null}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,aA as i}from"./index-
|
|
1
|
+
import{j as e,aA as i}from"./index-D7Clon2u.js";import{C as r}from"./VoiceOverlay-l6yoasVz.js";function h({title:n,subtitle:a,breadcrumbs:t,actions:l}){return e.jsxs("div",{className:"mb-4 md:mb-6",children:[t&&t.length>0&&e.jsx("nav",{className:"mb-2 flex items-center gap-1 text-[10px] md:text-xs text-text-muted overflow-x-auto scrollbar-thin pb-1",children:t.map((s,x)=>e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[x>0&&e.jsx(r,{size:12,className:"opacity-50 flex-shrink-0"}),s.href?e.jsx(i,{to:s.href,className:"hover:text-text transition-colors whitespace-nowrap",children:s.label}):e.jsx("span",{className:x===t.length-1?"text-text-secondary whitespace-nowrap":"",children:s.label})]},x))}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg md:text-xl font-semibold text-text",children:n}),a&&e.jsx("p",{className:"mt-0.5 text-[11px] md:text-sm text-text-muted",children:a})]}),l&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:l})]})]})}export{h as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,b0 as m,j as e,b1 as d,b2 as p}from"./index-
|
|
1
|
+
import{r as t,b0 as m,j as e,b1 as d,b2 as p}from"./index-D7Clon2u.js";import{P as x}from"./PageHeader-DPJuAgJk.js";import{R as u,p as f,q as h}from"./TitanCanvas-BQU1yxqf.js";import{P as b}from"./play-hUyR3CVS.js";import{S as g}from"./square-CdiC0J8Z.js";import"./VoiceOverlay-l6yoasVz.js";function S(){const[a,n]=t.useState(null),[r,l]=t.useState(!0),s=t.useCallback(async()=>{l(!0);try{const o=await m();n(o)}catch{}l(!1)},[]);t.useEffect(()=>{s()},[s]);const i=async()=>{try{await d(),await s()}catch{}},c=async()=>{try{await p(),await s()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{title:"Paperclip",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Paperclip"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:s,disabled:r,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(u,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),a&&e.jsxs("div",{className:"p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(f,{className:`w-4 h-4 ${a.running?"text-emerald-400":"text-[#52525b]"}`}),e.jsx("span",{className:"text-sm font-medium text-[#e4e4e7]",children:a.running?"Running":"Stopped"}),a.pid&&e.jsxs("span",{className:"text-xs text-[#52525b]",children:["PID ",a.pid]})]}),a.url&&e.jsx("div",{className:"text-xs text-[#52525b] mb-3",children:a.url}),e.jsxs("div",{className:"flex gap-2",children:[!a.running&&e.jsxs("button",{onClick:i,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5]",children:[e.jsx(b,{className:"w-4 h-4"})," Start"]}),a.running&&e.jsxs("button",{onClick:c,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-red-600 text-white text-sm font-medium hover:bg-red-700",children:[e.jsx(g,{className:"w-4 h-4"})," Stop"]}),e.jsxs("button",{onClick:s,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46]",children:[e.jsx(h,{className:"w-4 h-4"})," Reset"]})]})]})]})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as s,a2 as y,a3 as j}from"./index-
|
|
1
|
+
import{r as a,j as s,a2 as y,a3 as j}from"./index-D7Clon2u.js";function w(){const[r,g]=a.useState([]),[c,l]=a.useState("default"),[h,f]=a.useState(!0),[o,d]=a.useState(null),[n,x]=a.useState(null),[i,b]=a.useState("all");a.useEffect(()=>{(async()=>{try{const t=await y();g(t.personas),l(t.active)}catch(t){d(t instanceof Error?t.message:"Failed to fetch personas")}finally{f(!1)}})()},[]);const p=a.useMemo(()=>{const e=new Set(r.map(t=>t.division));return["all",...Array.from(e).sort()]},[r]),m=a.useMemo(()=>i==="all"?r:r.filter(e=>e.division===i),[r,i]),v=async e=>{if(!(e===c||n)){x(e);try{const t=await j(e);l(t.active)}catch(t){d(t instanceof Error?t.message:"Failed to switch persona")}finally{x(null)}}};return h?s.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-3",children:Array.from({length:6}).map((e,t)=>s.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):o?s.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:o}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-lg font-semibold text-text",children:"Personas"}),s.jsxs("span",{className:"text-sm text-text-muted",children:[r.length," available"]})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(e=>s.jsx("button",{onClick:()=>b(e),className:`rounded-lg px-3 py-1.5 text-sm font-medium capitalize transition-colors ${i===e?"bg-accent text-white":"bg-bg-tertiary text-text-secondary hover:text-text"}`,children:e},e))}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[m.map(e=>{const t=e.id===c,u=e.id===n;return s.jsxs("button",{onClick:()=>v(e.id),disabled:t||!!n,className:`rounded-xl border p-4 text-left transition-all ${t?"border-accent bg-accent/10 ring-1 ring-accent/30":"border-border bg-bg-secondary hover:border-border-light hover:bg-bg-secondary"} ${u?"opacity-60":""} disabled:cursor-default`,children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("h3",{className:"font-medium text-text",children:e.name}),t&&s.jsx("span",{className:"rounded-full bg-accent/20 px-2 py-0.5 text-xs font-medium text-accent-hover",children:"Active"}),u&&s.jsx("span",{className:"text-xs text-text-secondary",children:"Switching..."})]}),s.jsx("p",{className:"text-sm text-text-secondary line-clamp-2",children:e.description}),s.jsx("p",{className:"mt-2 text-xs capitalize text-text-muted",children:e.division})]},e.id)}),m.length===0&&s.jsx("p",{className:"col-span-full py-12 text-center text-text-muted",children:"No personas in this division"})]})]})}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,aM as p,j as e,aN as h,aO as f}from"./index-
|
|
1
|
+
import{r as a,aM as p,j as e,aN as h,aO as f}from"./index-D7Clon2u.js";import{P as u}from"./PageHeader-DPJuAgJk.js";import{R as b,d as g}from"./TitanCanvas-BQU1yxqf.js";import{P as j}from"./play-hUyR3CVS.js";import{T as N}from"./trash-2-Byj4OvKB.js";import"./VoiceOverlay-l6yoasVz.js";function P(){const[d,o]=a.useState([]),[i,n]=a.useState(!0),[c,l]=a.useState(null),t=a.useCallback(async()=>{n(!0);try{const s=await p();o(s.recipes||[])}catch{}n(!1)},[]);a.useEffect(()=>{t()},[t]);const m=async s=>{l(s);try{await h(s)}catch{}l(null)},x=async s=>{if(confirm("Delete this recipe?"))try{await f(s),await t()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{title:"Recipe Kitchen",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Recipes"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:t,disabled:i,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(b,{className:`w-4 h-4 ${i?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:d.map(s=>{var r;return e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(g,{className:"w-4 h-4 text-[#6366f1] shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-[#e4e4e7] truncate",children:s.name}),e.jsx("div",{className:"text-xs text-[#52525b] truncate",children:s.description}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[s.steps.length," steps • ",(r=s.tags)==null?void 0:r.join(", ")]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("button",{onClick:()=>m(s.id),disabled:c===s.id,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#6366f1] text-white text-xs hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(j,{className:"w-3.5 h-3.5"})," ",c===s.id?"Running...":"Run"]}),e.jsx("button",{onClick:()=>x(s.id),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(N,{className:"w-3.5 h-3.5"})})]})]},s.id)})})]})}export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,b as n,j as e}from"./index-
|
|
1
|
+
import{r as t,b as n,j as e}from"./index-D7Clon2u.js";import{P as i}from"./PageHeader-DPJuAgJk.js";import"./VoiceOverlay-l6yoasVz.js";function b(){const[a,d]=t.useState(null),[o,l]=t.useState(!0);if(t.useEffect(()=>{n("/api/config",{headers:{"Content-Type":"application/json"}}).then(s=>s.json()).then(s=>d(s.security||{})).catch(()=>d({})).finally(()=>l(!1))},[]),o)return e.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading security config..."});const r=a||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(i,{title:"Security",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Settings"},{label:"Security"}]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Sandbox Mode"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:String(r.sandboxMode||"none")})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Shield"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:r.shield?"Enabled":"Disabled"})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Denied Tools"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:Array.isArray(r.deniedTools)?r.deniedTools.length:0})]})]}),Array.isArray(r.deniedTools)&&r.deniedTools.length>0&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-medium text-[var(--text-secondary)] mb-2",children:"Denied Tools"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.deniedTools.map(s=>e.jsx("span",{className:"px-2 py-1 text-xs rounded bg-red-500/10 text-red-400 border border-red-500/20",children:s},s))})]})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,K as Je,b as p,j as e,A as he,e as We,C as Ge,Z as be,h as Ve,$ as He}from"./index-C6oarzis.js";import{e as Ke,R as k,C as Pe,W as Ue,B as Ze,f as ge,T as ze,g as Xe}from"./TitanCanvas-BhurNMK3.js";import{C as je}from"./circle-check-big-CMz0QouP.js";import{T as Ye}from"./trophy-Bf3ZeSeb.js";import{T as fe}from"./trending-up-B26tNhFP.js";import{a as I,C as Q}from"./VoiceOverlay-BXPVdnJc.js";import{P as ye}from"./play-Dwp2l5HG.js";import{T as et}from"./trash-2-B4jp_pAQ.js";const D={prompts:"System Prompts","tool-selection":"Tool Selection","response-quality":"Response Quality","error-recovery":"Error Recovery"},J=[{label:"Once daily (2am)",value:["0 2 * * *"]},{label:"Twice daily (2am + 2pm)",value:["0 2 * * *","0 14 * * *"]},{label:"Three times (2am + 10am + 6pm)",value:["0 2 * * *","0 10 * * *","0 18 * * *"]}];function Ne({status:j}){const B={running:"bg-info/10 text-info",completed:"bg-success/10 text-success",failed:"bg-error/10 text-error",training:"bg-warning/10 text-warning",deployed:"bg-purple/10 text-purple"},f={running:"bg-info",completed:"bg-success",failed:"bg-error",training:"bg-warning",deployed:"bg-purple"};return e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${B[j]||"bg-border-light/20 text-text-muted"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${f[j]||"bg-border-light"}`}),j]})}function ct(){var me,ue;const[j,B]=a.useState(null),[f,ve]=a.useState([]),[W,we]=a.useState([]),[h,Se]=a.useState([]),[r,ke]=a.useState(null),[Ce,Re]=a.useState(!0),[C,G]=a.useState(null),[R,V]=a.useState(null),[A,_e]=a.useState(!1),[N,Te]=a.useState(!0),[i,H]=a.useState("tool_router"),[E,Me]=a.useState(!1),[u,v]=a.useState({baseModel:"unsloth/Qwen2.5-32B-bnb-4bit",loraRank:32,learningRate:1e-4,epochs:2,timeBudgetMin:60,maxSeqLength:2048}),[b,$e]=a.useState([]),[x,De]=a.useState(null),[K,P]=a.useState(!1),[U,Z]=a.useState(!1),[z,X]=a.useState(!1),[g,Y]=a.useState([]),[S,Be]=a.useState(!0),[Ae,_]=a.useState(!1),L=a.useRef(null),O=a.useRef(null),ee=a.useRef(null),[F,te]=a.useState(1),[T,se]=a.useState(30),[q,ae]=a.useState(120),[M,re]=a.useState(!1),[$,ne]=a.useState(!1),[le,ie]=a.useState([]),[xe,ce]=a.useState(0),m=a.useCallback((t,s)=>{V({type:t,message:s}),setTimeout(()=>V(null),3e3)},[]),y=a.useCallback(async()=>{try{const s=(await Je()).selfImprove||{};B(s),te(s.runsPerDay||1),se(s.budgetMinutes||30),ae(s.maxDailyBudgetMinutes||120),re(s.autoApply||!1),ne(s.pauseOnWeekends||!1),ie(s.areas||["prompts","tool-selection","response-quality","error-recovery"]);const c=s.schedule||["0 2 * * *"],o=J.findIndex(n=>JSON.stringify(n.value)===JSON.stringify(c));ce(o>=0?o:0);try{const n=await p("/api/self-improve/history");if(n.ok){const d=await n.json();ve(d.sessions||[])}}catch{}try{const n=await p("/api/training/runs");if(n.ok){const d=await n.json();we(d.runs||[])}}catch{}try{const[n,d]=await Promise.all([p("/api/autoresearch/results"),p("/api/autoresearch/performance")]);if(n.ok){const l=await n.json();Se(l.runs||[])}if(d.ok){const l=await d.json();ke(l)}}catch{}try{const[n,d]=await Promise.all([p("/api/autoresearch/results?type=agent"),p("/api/autoresearch/performance?type=agent")]);if(n.ok){const l=await n.json();$e(l.runs||[])}if(d.ok){const l=await d.json();De(l)}}catch{}}catch{}finally{Re(!1)}},[]);a.useEffect(()=>{y()},[y]),a.useEffect(()=>(N&&(L.current=setInterval(y,1e4)),()=>{L.current&&clearInterval(L.current)}),[N,y]),a.useEffect(()=>{const t=new EventSource("/api/training/stream");return ee.current=t,t.onopen=()=>_(!0),t.onerror=()=>_(!1),t.onmessage=s=>{try{const c=JSON.parse(s.data);if(c.type==="connected"){_(!0);return}Y(o=>{const n=[...o,c];return n.length>200?n.slice(-200):n})}catch{}},()=>{t.close(),ee.current=null,_(!1)}},[]),a.useEffect(()=>{O.current&&S&&O.current.scrollIntoView({behavior:"smooth"})},[g,S]);const Ee=a.useCallback(async()=>{try{await p("/api/training/progress",{method:"DELETE"}),Y([])}catch{}},[]),Le=async()=>{var t;try{await He({selfImprove:{runsPerDay:F,budgetMinutes:T,maxDailyBudgetMinutes:q,autoApply:M,pauseOnWeekends:$,areas:le,schedule:((t=J[xe])==null?void 0:t.value)||["0 2 * * *"]}}),m("success","Self-improvement settings saved"),await y()}catch(s){m("error",s instanceof Error?s.message:"Failed to save")}},de=async t=>{G(t);try{(await p("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:`Run a self-improvement experiment on ${t} using self_improve_start with area="${t}" and budgetMinutes=${T}`,sessionId:"self-improve"})})).ok?(m("success",`Self-improvement started for ${D[t]||t}`),setTimeout(y,2e3)):m("error","Failed to start self-improvement")}catch(s){m("error",s instanceof Error?s.message:"Failed to start")}finally{G(null)}},Oe=t=>{ie(s=>s.includes(t)?s.filter(c=>c!==t):[...s,t])},Fe=async()=>{P(!0);try{(await p("/api/autoresearch/generate-data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i})})).ok?m("success",`Training data generation started for ${i==="main_agent"?"Main Agent":"Tool Router"}`):m("error","Failed to start data generation")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{P(!1)}},qe=async()=>{Z(!0);try{(await p("/api/autoresearch/trigger",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i,config:u})})).ok?m("success",`Training started for ${i==="main_agent"?"Main Agent":"Tool Router"}`):m("error","Failed to start training")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{Z(!1)}},Ie=async()=>{X(!0);try{(await p("/api/autoresearch/deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i})})).ok?m("success",`Model deployed as ${i==="main_agent"?"titan-agent":"titan-qwen"}`):m("error","Failed to deploy model")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{X(!1)}};if(Ce)return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((t,s)=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))});const w=f.length,oe=w>0?(f.reduce((t,s)=>t+(s.bestScore-s.baselineScore),0)/w).toFixed(1):"0",Qe=w>0?(f.filter(t=>t.bestScore>t.baselineScore).length/w*100).toFixed(0):"0";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple/10",children:e.jsx(Ke,{className:"h-4 w-4 text-purple-light"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"Self-Improvement"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Autonomous optimization of prompts, tool selection, and response quality"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Te(!N),className:`flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs transition-colors ${N?"border-success/30 text-success bg-success/5":"border-border text-text-muted hover:bg-bg-tertiary"}`,children:[e.jsx(he,{className:`h-3.5 w-3.5 ${N?"animate-pulse":""}`}),N?"Live":"Paused"]}),e.jsxs("button",{onClick:y,className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary transition-colors hover:bg-bg-tertiary",children:[e.jsx(k,{className:"h-3.5 w-3.5"}),"Refresh"]})]})]}),R&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${R.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[R.type==="success"?e.jsx(je,{className:"h-4 w-4"}):e.jsx(We,{className:"h-4 w-4"}),R.message]}),e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Pe,{className:"h-3.5 w-3.5 text-text-muted"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Total Sessions"})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:w+((r==null?void 0:r.totalRuns)||0)}),r&&r.totalRuns>0&&e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:[w," self-improve + ",r.totalRuns," autoresearch"]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ye,{className:"h-3.5 w-3.5 text-warning"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Best Val Score"})]}),e.jsx("p",{className:"text-2xl font-bold text-warning",children:(r==null?void 0:r.bestScore)||"—"}),r&&r.baseline>0&&(()=>{const t=r.bestScore-r.baseline,s=t>=0?"+":"",c=t>=0?"text-success":"text-error";return e.jsxs("p",{className:`text-[10px] mt-0.5 ${c}`,children:[s,t.toFixed(1)," from ",r.baseline," baseline"]})})()]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-success"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Success Rate"})]}),e.jsxs("p",{className:"text-2xl font-bold text-info",children:[Qe,"%"]}),e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["avg improvement: ",Number(oe)>=0?"+":"",oe]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ge,{className:"h-3.5 w-3.5 text-purple"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Deployed Model"})]}),e.jsx("p",{className:"text-lg font-bold text-purple",children:"titan-qwen"}),e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["Q4_K_M • 19GB • ",(j==null?void 0:j.enabled)!==!1?"🟢 Active":"⚫ Off"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Model Training"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("button",{onClick:()=>H("tool_router"),className:`rounded-xl border p-4 text-left transition-all ${i==="tool_router"?"border-purple bg-purple/5 ring-1 ring-purple/20":"border-bg-tertiary bg-bg-secondary hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${i==="tool_router"?"bg-purple/20":"bg-bg-tertiary"}`,children:e.jsx(Ue,{className:`h-3.5 w-3.5 ${i==="tool_router"?"text-purple-light":"text-text-muted"}`})}),e.jsx("span",{className:`text-sm font-medium ${i==="tool_router"?"text-text":"text-text-secondary"}`,children:"Tool Router"})]}),e.jsx("p",{className:"text-xs text-text-muted mb-1",children:"titan-qwen"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-success font-medium",children:["Score: ",(r==null?void 0:r.bestScore)||"—"]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"•"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:h.length>0?`${((me=h[h.length-1])==null?void 0:me.num_examples)||0} examples`:"No data"})]}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:"Brain / Tool Selection"})]}),e.jsxs("button",{onClick:()=>H("main_agent"),className:`rounded-xl border p-4 text-left transition-all ${i==="main_agent"?"border-purple bg-purple/5 ring-1 ring-purple/20":"border-bg-tertiary bg-bg-secondary hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${i==="main_agent"?"bg-purple/20":"bg-bg-tertiary"}`,children:e.jsx(Ze,{className:`h-3.5 w-3.5 ${i==="main_agent"?"text-purple-light":"text-text-muted"}`})}),e.jsx("span",{className:`text-sm font-medium ${i==="main_agent"?"text-text":"text-text-secondary"}`,children:"Main Agent"})]}),e.jsx("p",{className:"text-xs text-text-muted mb-1",children:"titan-agent"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-warning font-medium",children:["Score: ",(x==null?void 0:x.bestScore)||"—"]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"•"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:b.length>0?`${((ue=b[b.length-1])==null?void 0:ue.num_examples)||0} examples`:"No data"})]}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:"Primary LLM / Full Agent"})]})]}),e.jsxs("button",{onClick:()=>Me(!E),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[E?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ge,{className:"h-3.5 w-3.5"}),"Training Configuration"]}),E&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Base Model"}),e.jsxs("select",{id:"train-base-model",name:"train-base-model",value:u.baseModel,onChange:t=>v(s=>({...s,baseModel:t.target.value})),className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none",children:[e.jsx("option",{value:"unsloth/Qwen2.5-32B-bnb-4bit",children:"Qwen 2.5 32B (4-bit)"}),e.jsx("option",{value:"unsloth/Qwen2.5-14B-bnb-4bit",children:"Qwen 2.5 14B (4-bit)"}),e.jsx("option",{value:"unsloth/Qwen2.5-7B-bnb-4bit",children:"Qwen 2.5 7B (4-bit)"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"LoRA Rank"}),e.jsx("span",{className:"text-sm font-medium text-text",children:u.loraRank})]}),e.jsx("input",{id:"train-lora-rank",name:"train-lora-rank",type:"range",min:4,max:64,step:4,value:u.loraRank,onChange:t=>v(s=>({...s,loraRank:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"4"}),e.jsx("span",{children:"32"}),e.jsx("span",{children:"64"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Learning Rate"}),e.jsx("span",{className:"text-sm font-medium text-text font-mono",children:u.learningRate.toExponential(0)})]}),e.jsx("input",{id:"train-learning-rate",name:"train-learning-rate",type:"range",min:-5,max:-3,step:.5,value:Math.log10(u.learningRate),onChange:t=>v(s=>({...s,learningRate:Math.pow(10,Number(t.target.value))})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1e-5"}),e.jsx("span",{children:"1e-4"}),e.jsx("span",{children:"1e-3"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Epochs"}),e.jsx("span",{className:"text-sm font-medium text-text",children:u.epochs})]}),e.jsx("input",{id:"train-epochs",name:"train-epochs",type:"range",min:1,max:10,value:u.epochs,onChange:t=>v(s=>({...s,epochs:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"5"}),e.jsx("span",{children:"10"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Time Budget"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[u.timeBudgetMin," min"]})]}),e.jsx("input",{id:"train-time-budget",name:"train-time-budget",type:"range",min:5,max:120,step:5,value:u.timeBudgetMin,onChange:t=>v(s=>({...s,timeBudgetMin:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"5 min"}),e.jsx("span",{children:"60 min"}),e.jsx("span",{children:"120 min"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max Sequence Length"}),e.jsx("span",{className:"text-sm font-medium text-text",children:u.maxSeqLength})]}),e.jsx("input",{id:"train-max-seq-length",name:"train-max-seq-length",type:"range",min:512,max:4096,step:256,value:u.maxSeqLength,onChange:t=>v(s=>({...s,maxSeqLength:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"512"}),e.jsx("span",{children:"2048"}),e.jsx("span",{children:"4096"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:Fe,disabled:K,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-purple/50 hover:bg-bg-secondary disabled:opacity-50",children:[K?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(be,{className:"h-3.5 w-3.5 text-warning"}),"Generate Training Data"]}),e.jsxs("button",{onClick:qe,disabled:U,className:"flex items-center justify-center gap-2 rounded-xl bg-purple px-4 py-3 text-xs font-medium text-white transition-colors hover:bg-purple/80 disabled:opacity-50",children:[U?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ye,{className:"h-3.5 w-3.5"}),"Start Training"]}),e.jsxs("button",{onClick:Ie,disabled:z,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-success/50 hover:bg-bg-secondary disabled:opacity-50",children:[z?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(je,{className:"h-3.5 w-3.5 text-success"}),"Deploy Best Model"]}),e.jsxs("button",{onClick:()=>de(i==="main_agent"?"agent-benchmark":"tool-benchmark"),disabled:C!==null,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-[#3b82f6]/50 hover:bg-bg-secondary disabled:opacity-50",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-info"}),"Run Benchmark"]})]})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>Be(!S),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[S?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ze,{className:"h-3.5 w-3.5"}),"Live Training Activity",e.jsxs("span",{className:"ml-auto flex items-center gap-1.5",children:[Ae?e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-success",children:[e.jsx(Xe,{className:"h-3 w-3 animate-pulse"})," Connected"]}):e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-error",children:[e.jsx(Ve,{className:"h-3 w-3"})," Disconnected"]}),g.length>0&&e.jsx("span",{className:"rounded-full bg-purple/20 px-1.5 py-0.5 text-[10px] text-purple-light",children:g.length})]})]}),S&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg overflow-hidden",children:[g.length>0&&(()=>{var c,o,n;const t=[...g].reverse().find(d=>{var l;return((l=d.detail)==null?void 0:l.pct)!==void 0});if(!t||t.type==="complete")return null;const s=((c=t.detail)==null?void 0:c.pct)||0;return e.jsxs("div",{className:"border-b border-bg-tertiary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:t.message}),e.jsxs("span",{className:"text-xs font-medium text-purple",children:[s,"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-purple to-accent transition-all duration-500",style:{width:`${s}%`}})}),((o=t.detail)==null?void 0:o.current)!==void 0&&((n=t.detail)==null?void 0:n.total)!==void 0&&e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsxs("span",{className:"text-[10px] text-text-muted",children:[t.detail.current," / ",t.detail.total," examples"]}),t.detail.category&&e.jsxs("span",{className:"text-[10px] text-text-muted",children:["Category: ",t.detail.category]})]})]})})(),e.jsxs("div",{className:"max-h-64 overflow-y-auto p-3 font-mono text-[11px] leading-5 scrollbar-thin",children:[g.length===0?e.jsxs("div",{className:"flex items-center justify-center py-8 text-text-muted",children:[e.jsx(he,{className:"h-4 w-4 mr-2"}),e.jsx("span",{children:"No training activity yet. Start training to see live progress."})]}):g.map((t,s)=>{var pe;const c={info:"text-info",progress:"text-purple",success:"text-success",error:"text-error",complete:"text-warning",connected:"text-success"},o={info:"●",progress:"◆",success:"✓",error:"✗",complete:"★",connected:"◉"},n=c[t.type]||"text-text-muted",d=o[t.type]||"·",l=t.timestamp?new Date(t.timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"";return e.jsxs("div",{className:"flex items-start gap-2 hover:bg-bg-secondary/50 rounded px-1",children:[e.jsx("span",{className:"text-border shrink-0 select-none",children:l}),e.jsx("span",{className:`shrink-0 ${n}`,children:d}),e.jsxs("span",{className:`${t.type==="error"?"text-error":"text-text-secondary"}`,children:[t.message,((pe=t.detail)==null?void 0:pe.category)&&t.type==="progress"&&e.jsxs("span",{className:"text-text-muted",children:[" [",t.detail.category,"]"]})]})]},s)}),e.jsx("div",{ref:O})]}),g.length>0&&e.jsxs("div",{className:"border-t border-bg-tertiary px-3 py-2 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-text-muted",children:[g.filter(t=>t.type==="success"||t.type==="progress").length," successes"," · ",g.filter(t=>t.type==="error").length," errors"]}),e.jsxs("button",{onClick:Ee,className:"flex items-center gap-1 text-[10px] text-text-muted hover:text-text-secondary transition-colors",children:[e.jsx(et,{className:"h-3 w-3"}),"Clear"]})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Run Now"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(D).map(([t,s])=>e.jsxs("button",{onClick:()=>de(t),disabled:C!==null,className:"flex items-center gap-3 rounded-xl border border-bg-tertiary bg-bg-secondary p-4 text-left transition-colors hover:border-purple/50 hover:bg-bg-secondary disabled:opacity-50",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple/10",children:C===t?e.jsx(k,{className:"h-4 w-4 text-purple-light animate-spin"}):e.jsx(ye,{className:"h-4 w-4 text-purple-light"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:s}),e.jsx("p",{className:"text-xs text-text-muted",children:C===t?"Running...":"Start experiment"})]})]},t))})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>_e(!A),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[A?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ge,{className:"h-3.5 w-3.5"}),"Schedule Settings"]}),A&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-6 space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Runs per day"}),e.jsx("span",{className:"text-sm font-medium text-text",children:F})]}),e.jsx("input",{id:"schedule-runs-per-day",name:"schedule-runs-per-day",type:"range",min:1,max:12,value:F,onChange:t=>te(Number(t.target.value)),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"6"}),e.jsx("span",{children:"12"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Schedule"}),e.jsx("select",{id:"schedule-preset",name:"schedule-preset",value:xe,onChange:t=>ce(Number(t.target.value)),className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none",children:J.map((t,s)=>e.jsx("option",{value:s,children:t.label},s))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Budget per run (minutes)"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[T," min"]})]}),e.jsx("input",{id:"schedule-budget-minutes",name:"schedule-budget-minutes",type:"range",min:5,max:120,step:5,value:T,onChange:t=>se(Number(t.target.value)),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"5 min"}),e.jsx("span",{children:"60 min"}),e.jsx("span",{children:"120 min"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max daily budget (minutes)"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[q," min"]})]}),e.jsx("input",{id:"schedule-max-daily-budget",name:"schedule-max-daily-budget",type:"range",min:30,max:480,step:30,value:q,onChange:t=>ae(Number(t.target.value)),className:"w-full accent-purple"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs text-text-muted",children:"Improvement areas"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(D).map(([t,s])=>e.jsx("button",{onClick:()=>Oe(t),className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${le.includes(t)?"bg-purple text-white":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:s},t))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Auto-apply improvements"}),e.jsx("button",{onClick:()=>re(!M),className:`relative h-5 w-9 rounded-full transition-colors ${M?"bg-purple":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-transform ${M?"translate-x-4":""}`})})]}),e.jsxs("label",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Pause on weekends"}),e.jsx("button",{onClick:()=>ne(!$),className:`relative h-5 w-9 rounded-full transition-colors ${$?"bg-purple":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-transform ${$?"translate-x-4":""}`})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:Le,className:"flex items-center gap-2 rounded-lg bg-purple px-4 py-2 text-xs font-medium text-white transition-colors hover:bg-purple/80",children:"Save Settings"})})]})]}),f.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Session History"}),e.jsx("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Area"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Baseline"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Best"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"+Δ"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"K/D/C"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Status"})]})}),e.jsx("tbody",{children:f.slice().reverse().slice(0,10).map(t=>{const s=t.bestScore-t.baselineScore;return e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:t.startedAt.slice(0,10)}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text",children:D[t.area]||t.area}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.baselineScore}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text font-medium",children:t.bestScore}),e.jsxs("td",{className:`px-4 py-2.5 text-xs font-medium ${s>0?"text-success":"text-text-muted"}`,children:[s>0?"+":"",s]}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[t.keeps,"/",t.discards,"/",t.crashes]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(Ne,{status:t.applied?"deployed":t.status})})]},t.id)})})]})})]}),W.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Model Training"}),e.jsx("div",{className:"space-y-2",children:W.slice().reverse().slice(0,5).map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(be,{className:"h-4 w-4 text-warning"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:t.id}),e.jsxs("p",{className:"text-xs text-text-muted",children:[t.baseModel," • ",t.dataPoints," samples • ",t.method]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.finalLoss!==void 0&&e.jsxs("span",{className:"text-xs text-text-muted",children:["loss: ",t.finalLoss.toFixed(4)]}),e.jsx(Ne,{status:t.status})]})]},t.id))})]}),h.length>0&&i==="tool_router"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Autoresearch Experiments — Tool Router"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-bg-tertiary",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Val Score Over Time"}),e.jsxs("span",{className:"text-xs text-success font-medium",children:["Best: ",(r==null?void 0:r.bestScore)||Math.max(...h.map(t=>t.val_score))]})]}),e.jsx("div",{className:"h-16 flex items-end gap-1",children:h.map((t,s)=>{const c=Math.max(...h.map(l=>l.val_score),100),o=Math.min(...h.map(l=>l.val_score),0),n=c-o||1,d=(t.val_score-o)/n*100;return e.jsx("div",{className:"flex-1 rounded-t transition-all hover:opacity-80",style:{height:`${Math.max(d,4)}%`,backgroundColor:(r==null?void 0:r.baseline)!=null?t.val_score>=r.baseline?"var(--color-success)":"var(--color-error)":"var(--color-purple)"},title:`Run ${s+1}: ${t.val_score} (${new Date(t.timestamp).toLocaleDateString()})`},s)})}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"border-t border-dashed border-border-light/50 absolute w-full"}),e.jsx("span",{className:"text-[9px] text-text-muted relative -top-2",children:(r==null?void 0:r.baseline)!=null?`baseline: ${r.baseline}`:"baseline: —"})]})]}),e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Score"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"LR"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Rank"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Epochs"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Examples"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Duration"})]})}),e.jsx("tbody",{children:h.slice().reverse().slice(0,20).map((t,s)=>e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:h.length-s}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:new Date(t.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:`px-4 py-2.5 text-xs font-bold ${t.val_score>=((r==null?void 0:r.baseline)||78)?"text-success":"text-error"}`,children:t.val_score}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted font-mono",children:t.hyperparams.lr}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.rank}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.epochs}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.num_examples}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[Math.round(t.training_time_s/60),"m ",Math.round(t.training_time_s%60),"s"]})]},s))})]})]})]}),b.length>0&&i==="main_agent"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Autoresearch Experiments — Main Agent"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-bg-tertiary",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Val Score Over Time"}),e.jsxs("span",{className:"text-xs text-warning font-medium",children:["Best: ",(x==null?void 0:x.bestScore)||Math.max(...b.map(t=>t.val_score))]})]}),e.jsx("div",{className:"h-16 flex items-end gap-1",children:b.map((t,s)=>{const c=Math.max(...b.map(l=>l.val_score),100),o=Math.min(...b.map(l=>l.val_score),0),n=c-o||1,d=(t.val_score-o)/n*100;return e.jsx("div",{className:"flex-1 rounded-t transition-all hover:opacity-80",style:{height:`${Math.max(d,4)}%`,backgroundColor:(x==null?void 0:x.baseline)!=null?t.val_score>=x.baseline?"var(--color-warning)":"var(--color-error)":"var(--color-purple)"},title:`Run ${s+1}: ${t.val_score} (${new Date(t.timestamp).toLocaleDateString()})`},s)})}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"border-t border-dashed border-border-light/50 absolute w-full"}),e.jsx("span",{className:"text-[9px] text-text-muted relative -top-2",children:(x==null?void 0:x.baseline)!=null?`baseline: ${x.baseline}`:"baseline: —"})]})]}),e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Score"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"LR"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Rank"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Epochs"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Examples"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Duration"})]})}),e.jsx("tbody",{children:b.slice().reverse().slice(0,20).map((t,s)=>e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:b.length-s}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:new Date(t.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:`px-4 py-2.5 text-xs font-bold ${t.val_score>=((x==null?void 0:x.baseline)||70)?"text-warning":"text-error"}`,children:t.val_score}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted font-mono",children:t.hyperparams.lr}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.rank}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.epochs}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.num_examples}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[Math.round(t.training_time_s/60),"m ",Math.round(t.training_time_s%60),"s"]})]},s))})]})]})]})]})}export{ct as default};
|
|
1
|
+
import{r as a,K as Je,b as p,j as e,A as he,e as We,C as Ge,Z as be,h as Ve,$ as He}from"./index-D7Clon2u.js";import{e as Ke,R as k,C as Pe,W as Ue,B as Ze,f as ge,T as ze,g as Xe}from"./TitanCanvas-BQU1yxqf.js";import{C as je}from"./circle-check-big-B1hMwau0.js";import{T as Ye}from"./trophy-DDr2AePx.js";import{T as fe}from"./trending-up-Dh_CffGX.js";import{a as I,C as Q}from"./VoiceOverlay-l6yoasVz.js";import{P as ye}from"./play-hUyR3CVS.js";import{T as et}from"./trash-2-Byj4OvKB.js";const D={prompts:"System Prompts","tool-selection":"Tool Selection","response-quality":"Response Quality","error-recovery":"Error Recovery"},J=[{label:"Once daily (2am)",value:["0 2 * * *"]},{label:"Twice daily (2am + 2pm)",value:["0 2 * * *","0 14 * * *"]},{label:"Three times (2am + 10am + 6pm)",value:["0 2 * * *","0 10 * * *","0 18 * * *"]}];function Ne({status:j}){const B={running:"bg-info/10 text-info",completed:"bg-success/10 text-success",failed:"bg-error/10 text-error",training:"bg-warning/10 text-warning",deployed:"bg-purple/10 text-purple"},f={running:"bg-info",completed:"bg-success",failed:"bg-error",training:"bg-warning",deployed:"bg-purple"};return e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${B[j]||"bg-border-light/20 text-text-muted"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${f[j]||"bg-border-light"}`}),j]})}function ct(){var me,ue;const[j,B]=a.useState(null),[f,ve]=a.useState([]),[W,we]=a.useState([]),[h,Se]=a.useState([]),[r,ke]=a.useState(null),[Ce,Re]=a.useState(!0),[C,G]=a.useState(null),[R,V]=a.useState(null),[A,_e]=a.useState(!1),[N,Te]=a.useState(!0),[i,H]=a.useState("tool_router"),[E,Me]=a.useState(!1),[u,v]=a.useState({baseModel:"unsloth/Qwen2.5-32B-bnb-4bit",loraRank:32,learningRate:1e-4,epochs:2,timeBudgetMin:60,maxSeqLength:2048}),[b,$e]=a.useState([]),[x,De]=a.useState(null),[K,P]=a.useState(!1),[U,Z]=a.useState(!1),[z,X]=a.useState(!1),[g,Y]=a.useState([]),[S,Be]=a.useState(!0),[Ae,_]=a.useState(!1),L=a.useRef(null),O=a.useRef(null),ee=a.useRef(null),[F,te]=a.useState(1),[T,se]=a.useState(30),[q,ae]=a.useState(120),[M,re]=a.useState(!1),[$,ne]=a.useState(!1),[le,ie]=a.useState([]),[xe,ce]=a.useState(0),m=a.useCallback((t,s)=>{V({type:t,message:s}),setTimeout(()=>V(null),3e3)},[]),y=a.useCallback(async()=>{try{const s=(await Je()).selfImprove||{};B(s),te(s.runsPerDay||1),se(s.budgetMinutes||30),ae(s.maxDailyBudgetMinutes||120),re(s.autoApply||!1),ne(s.pauseOnWeekends||!1),ie(s.areas||["prompts","tool-selection","response-quality","error-recovery"]);const c=s.schedule||["0 2 * * *"],o=J.findIndex(n=>JSON.stringify(n.value)===JSON.stringify(c));ce(o>=0?o:0);try{const n=await p("/api/self-improve/history");if(n.ok){const d=await n.json();ve(d.sessions||[])}}catch{}try{const n=await p("/api/training/runs");if(n.ok){const d=await n.json();we(d.runs||[])}}catch{}try{const[n,d]=await Promise.all([p("/api/autoresearch/results"),p("/api/autoresearch/performance")]);if(n.ok){const l=await n.json();Se(l.runs||[])}if(d.ok){const l=await d.json();ke(l)}}catch{}try{const[n,d]=await Promise.all([p("/api/autoresearch/results?type=agent"),p("/api/autoresearch/performance?type=agent")]);if(n.ok){const l=await n.json();$e(l.runs||[])}if(d.ok){const l=await d.json();De(l)}}catch{}}catch{}finally{Re(!1)}},[]);a.useEffect(()=>{y()},[y]),a.useEffect(()=>(N&&(L.current=setInterval(y,1e4)),()=>{L.current&&clearInterval(L.current)}),[N,y]),a.useEffect(()=>{const t=new EventSource("/api/training/stream");return ee.current=t,t.onopen=()=>_(!0),t.onerror=()=>_(!1),t.onmessage=s=>{try{const c=JSON.parse(s.data);if(c.type==="connected"){_(!0);return}Y(o=>{const n=[...o,c];return n.length>200?n.slice(-200):n})}catch{}},()=>{t.close(),ee.current=null,_(!1)}},[]),a.useEffect(()=>{O.current&&S&&O.current.scrollIntoView({behavior:"smooth"})},[g,S]);const Ee=a.useCallback(async()=>{try{await p("/api/training/progress",{method:"DELETE"}),Y([])}catch{}},[]),Le=async()=>{var t;try{await He({selfImprove:{runsPerDay:F,budgetMinutes:T,maxDailyBudgetMinutes:q,autoApply:M,pauseOnWeekends:$,areas:le,schedule:((t=J[xe])==null?void 0:t.value)||["0 2 * * *"]}}),m("success","Self-improvement settings saved"),await y()}catch(s){m("error",s instanceof Error?s.message:"Failed to save")}},de=async t=>{G(t);try{(await p("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:`Run a self-improvement experiment on ${t} using self_improve_start with area="${t}" and budgetMinutes=${T}`,sessionId:"self-improve"})})).ok?(m("success",`Self-improvement started for ${D[t]||t}`),setTimeout(y,2e3)):m("error","Failed to start self-improvement")}catch(s){m("error",s instanceof Error?s.message:"Failed to start")}finally{G(null)}},Oe=t=>{ie(s=>s.includes(t)?s.filter(c=>c!==t):[...s,t])},Fe=async()=>{P(!0);try{(await p("/api/autoresearch/generate-data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i})})).ok?m("success",`Training data generation started for ${i==="main_agent"?"Main Agent":"Tool Router"}`):m("error","Failed to start data generation")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{P(!1)}},qe=async()=>{Z(!0);try{(await p("/api/autoresearch/trigger",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i,config:u})})).ok?m("success",`Training started for ${i==="main_agent"?"Main Agent":"Tool Router"}`):m("error","Failed to start training")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{Z(!1)}},Ie=async()=>{X(!0);try{(await p("/api/autoresearch/deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i})})).ok?m("success",`Model deployed as ${i==="main_agent"?"titan-agent":"titan-qwen"}`):m("error","Failed to deploy model")}catch(t){m("error",t instanceof Error?t.message:"Failed")}finally{X(!1)}};if(Ce)return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((t,s)=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))});const w=f.length,oe=w>0?(f.reduce((t,s)=>t+(s.bestScore-s.baselineScore),0)/w).toFixed(1):"0",Qe=w>0?(f.filter(t=>t.bestScore>t.baselineScore).length/w*100).toFixed(0):"0";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple/10",children:e.jsx(Ke,{className:"h-4 w-4 text-purple-light"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-text",children:"Self-Improvement"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Autonomous optimization of prompts, tool selection, and response quality"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Te(!N),className:`flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs transition-colors ${N?"border-success/30 text-success bg-success/5":"border-border text-text-muted hover:bg-bg-tertiary"}`,children:[e.jsx(he,{className:`h-3.5 w-3.5 ${N?"animate-pulse":""}`}),N?"Live":"Paused"]}),e.jsxs("button",{onClick:y,className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary transition-colors hover:bg-bg-tertiary",children:[e.jsx(k,{className:"h-3.5 w-3.5"}),"Refresh"]})]})]}),R&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${R.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[R.type==="success"?e.jsx(je,{className:"h-4 w-4"}):e.jsx(We,{className:"h-4 w-4"}),R.message]}),e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Pe,{className:"h-3.5 w-3.5 text-text-muted"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Total Sessions"})]}),e.jsx("p",{className:"text-2xl font-bold text-text",children:w+((r==null?void 0:r.totalRuns)||0)}),r&&r.totalRuns>0&&e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:[w," self-improve + ",r.totalRuns," autoresearch"]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ye,{className:"h-3.5 w-3.5 text-warning"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Best Val Score"})]}),e.jsx("p",{className:"text-2xl font-bold text-warning",children:(r==null?void 0:r.bestScore)||"—"}),r&&r.baseline>0&&(()=>{const t=r.bestScore-r.baseline,s=t>=0?"+":"",c=t>=0?"text-success":"text-error";return e.jsxs("p",{className:`text-[10px] mt-0.5 ${c}`,children:[s,t.toFixed(1)," from ",r.baseline," baseline"]})})()]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-success"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Success Rate"})]}),e.jsxs("p",{className:"text-2xl font-bold text-info",children:[Qe,"%"]}),e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["avg improvement: ",Number(oe)>=0?"+":"",oe]})]}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ge,{className:"h-3.5 w-3.5 text-purple"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Deployed Model"})]}),e.jsx("p",{className:"text-lg font-bold text-purple",children:"titan-qwen"}),e.jsxs("p",{className:"text-[10px] text-text-muted mt-0.5",children:["Q4_K_M • 19GB • ",(j==null?void 0:j.enabled)!==!1?"🟢 Active":"⚫ Off"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Model Training"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("button",{onClick:()=>H("tool_router"),className:`rounded-xl border p-4 text-left transition-all ${i==="tool_router"?"border-purple bg-purple/5 ring-1 ring-purple/20":"border-bg-tertiary bg-bg-secondary hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${i==="tool_router"?"bg-purple/20":"bg-bg-tertiary"}`,children:e.jsx(Ue,{className:`h-3.5 w-3.5 ${i==="tool_router"?"text-purple-light":"text-text-muted"}`})}),e.jsx("span",{className:`text-sm font-medium ${i==="tool_router"?"text-text":"text-text-secondary"}`,children:"Tool Router"})]}),e.jsx("p",{className:"text-xs text-text-muted mb-1",children:"titan-qwen"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-success font-medium",children:["Score: ",(r==null?void 0:r.bestScore)||"—"]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"•"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:h.length>0?`${((me=h[h.length-1])==null?void 0:me.num_examples)||0} examples`:"No data"})]}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:"Brain / Tool Selection"})]}),e.jsxs("button",{onClick:()=>H("main_agent"),className:`rounded-xl border p-4 text-left transition-all ${i==="main_agent"?"border-purple bg-purple/5 ring-1 ring-purple/20":"border-bg-tertiary bg-bg-secondary hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${i==="main_agent"?"bg-purple/20":"bg-bg-tertiary"}`,children:e.jsx(Ze,{className:`h-3.5 w-3.5 ${i==="main_agent"?"text-purple-light":"text-text-muted"}`})}),e.jsx("span",{className:`text-sm font-medium ${i==="main_agent"?"text-text":"text-text-secondary"}`,children:"Main Agent"})]}),e.jsx("p",{className:"text-xs text-text-muted mb-1",children:"titan-agent"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-warning font-medium",children:["Score: ",(x==null?void 0:x.bestScore)||"—"]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"•"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:b.length>0?`${((ue=b[b.length-1])==null?void 0:ue.num_examples)||0} examples`:"No data"})]}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:"Primary LLM / Full Agent"})]})]}),e.jsxs("button",{onClick:()=>Me(!E),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[E?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ge,{className:"h-3.5 w-3.5"}),"Training Configuration"]}),E&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-5 space-y-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Base Model"}),e.jsxs("select",{id:"train-base-model",name:"train-base-model",value:u.baseModel,onChange:t=>v(s=>({...s,baseModel:t.target.value})),className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none",children:[e.jsx("option",{value:"unsloth/Qwen2.5-32B-bnb-4bit",children:"Qwen 2.5 32B (4-bit)"}),e.jsx("option",{value:"unsloth/Qwen2.5-14B-bnb-4bit",children:"Qwen 2.5 14B (4-bit)"}),e.jsx("option",{value:"unsloth/Qwen2.5-7B-bnb-4bit",children:"Qwen 2.5 7B (4-bit)"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"LoRA Rank"}),e.jsx("span",{className:"text-sm font-medium text-text",children:u.loraRank})]}),e.jsx("input",{id:"train-lora-rank",name:"train-lora-rank",type:"range",min:4,max:64,step:4,value:u.loraRank,onChange:t=>v(s=>({...s,loraRank:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"4"}),e.jsx("span",{children:"32"}),e.jsx("span",{children:"64"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Learning Rate"}),e.jsx("span",{className:"text-sm font-medium text-text font-mono",children:u.learningRate.toExponential(0)})]}),e.jsx("input",{id:"train-learning-rate",name:"train-learning-rate",type:"range",min:-5,max:-3,step:.5,value:Math.log10(u.learningRate),onChange:t=>v(s=>({...s,learningRate:Math.pow(10,Number(t.target.value))})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1e-5"}),e.jsx("span",{children:"1e-4"}),e.jsx("span",{children:"1e-3"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Epochs"}),e.jsx("span",{className:"text-sm font-medium text-text",children:u.epochs})]}),e.jsx("input",{id:"train-epochs",name:"train-epochs",type:"range",min:1,max:10,value:u.epochs,onChange:t=>v(s=>({...s,epochs:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"5"}),e.jsx("span",{children:"10"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Time Budget"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[u.timeBudgetMin," min"]})]}),e.jsx("input",{id:"train-time-budget",name:"train-time-budget",type:"range",min:5,max:120,step:5,value:u.timeBudgetMin,onChange:t=>v(s=>({...s,timeBudgetMin:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"5 min"}),e.jsx("span",{children:"60 min"}),e.jsx("span",{children:"120 min"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max Sequence Length"}),e.jsx("span",{className:"text-sm font-medium text-text",children:u.maxSeqLength})]}),e.jsx("input",{id:"train-max-seq-length",name:"train-max-seq-length",type:"range",min:512,max:4096,step:256,value:u.maxSeqLength,onChange:t=>v(s=>({...s,maxSeqLength:Number(t.target.value)})),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"512"}),e.jsx("span",{children:"2048"}),e.jsx("span",{children:"4096"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:Fe,disabled:K,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-purple/50 hover:bg-bg-secondary disabled:opacity-50",children:[K?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(be,{className:"h-3.5 w-3.5 text-warning"}),"Generate Training Data"]}),e.jsxs("button",{onClick:qe,disabled:U,className:"flex items-center justify-center gap-2 rounded-xl bg-purple px-4 py-3 text-xs font-medium text-white transition-colors hover:bg-purple/80 disabled:opacity-50",children:[U?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ye,{className:"h-3.5 w-3.5"}),"Start Training"]}),e.jsxs("button",{onClick:Ie,disabled:z,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-success/50 hover:bg-bg-secondary disabled:opacity-50",children:[z?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(je,{className:"h-3.5 w-3.5 text-success"}),"Deploy Best Model"]}),e.jsxs("button",{onClick:()=>de(i==="main_agent"?"agent-benchmark":"tool-benchmark"),disabled:C!==null,className:"flex items-center justify-center gap-2 rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs font-medium text-text transition-colors hover:border-[#3b82f6]/50 hover:bg-bg-secondary disabled:opacity-50",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-info"}),"Run Benchmark"]})]})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>Be(!S),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[S?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ze,{className:"h-3.5 w-3.5"}),"Live Training Activity",e.jsxs("span",{className:"ml-auto flex items-center gap-1.5",children:[Ae?e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-success",children:[e.jsx(Xe,{className:"h-3 w-3 animate-pulse"})," Connected"]}):e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-error",children:[e.jsx(Ve,{className:"h-3 w-3"})," Disconnected"]}),g.length>0&&e.jsx("span",{className:"rounded-full bg-purple/20 px-1.5 py-0.5 text-[10px] text-purple-light",children:g.length})]})]}),S&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg overflow-hidden",children:[g.length>0&&(()=>{var c,o,n;const t=[...g].reverse().find(d=>{var l;return((l=d.detail)==null?void 0:l.pct)!==void 0});if(!t||t.type==="complete")return null;const s=((c=t.detail)==null?void 0:c.pct)||0;return e.jsxs("div",{className:"border-b border-bg-tertiary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:t.message}),e.jsxs("span",{className:"text-xs font-medium text-purple",children:[s,"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-purple to-accent transition-all duration-500",style:{width:`${s}%`}})}),((o=t.detail)==null?void 0:o.current)!==void 0&&((n=t.detail)==null?void 0:n.total)!==void 0&&e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsxs("span",{className:"text-[10px] text-text-muted",children:[t.detail.current," / ",t.detail.total," examples"]}),t.detail.category&&e.jsxs("span",{className:"text-[10px] text-text-muted",children:["Category: ",t.detail.category]})]})]})})(),e.jsxs("div",{className:"max-h-64 overflow-y-auto p-3 font-mono text-[11px] leading-5 scrollbar-thin",children:[g.length===0?e.jsxs("div",{className:"flex items-center justify-center py-8 text-text-muted",children:[e.jsx(he,{className:"h-4 w-4 mr-2"}),e.jsx("span",{children:"No training activity yet. Start training to see live progress."})]}):g.map((t,s)=>{var pe;const c={info:"text-info",progress:"text-purple",success:"text-success",error:"text-error",complete:"text-warning",connected:"text-success"},o={info:"●",progress:"◆",success:"✓",error:"✗",complete:"★",connected:"◉"},n=c[t.type]||"text-text-muted",d=o[t.type]||"·",l=t.timestamp?new Date(t.timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"";return e.jsxs("div",{className:"flex items-start gap-2 hover:bg-bg-secondary/50 rounded px-1",children:[e.jsx("span",{className:"text-border shrink-0 select-none",children:l}),e.jsx("span",{className:`shrink-0 ${n}`,children:d}),e.jsxs("span",{className:`${t.type==="error"?"text-error":"text-text-secondary"}`,children:[t.message,((pe=t.detail)==null?void 0:pe.category)&&t.type==="progress"&&e.jsxs("span",{className:"text-text-muted",children:[" [",t.detail.category,"]"]})]})]},s)}),e.jsx("div",{ref:O})]}),g.length>0&&e.jsxs("div",{className:"border-t border-bg-tertiary px-3 py-2 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-text-muted",children:[g.filter(t=>t.type==="success"||t.type==="progress").length," successes"," · ",g.filter(t=>t.type==="error").length," errors"]}),e.jsxs("button",{onClick:Ee,className:"flex items-center gap-1 text-[10px] text-text-muted hover:text-text-secondary transition-colors",children:[e.jsx(et,{className:"h-3 w-3"}),"Clear"]})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Run Now"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(D).map(([t,s])=>e.jsxs("button",{onClick:()=>de(t),disabled:C!==null,className:"flex items-center gap-3 rounded-xl border border-bg-tertiary bg-bg-secondary p-4 text-left transition-colors hover:border-purple/50 hover:bg-bg-secondary disabled:opacity-50",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple/10",children:C===t?e.jsx(k,{className:"h-4 w-4 text-purple-light animate-spin"}):e.jsx(ye,{className:"h-4 w-4 text-purple-light"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:s}),e.jsx("p",{className:"text-xs text-text-muted",children:C===t?"Running...":"Start experiment"})]})]},t))})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>_e(!A),className:"flex w-full items-center gap-2 text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:[A?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(Q,{className:"h-3.5 w-3.5"}),e.jsx(ge,{className:"h-3.5 w-3.5"}),"Schedule Settings"]}),A&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-6 space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Runs per day"}),e.jsx("span",{className:"text-sm font-medium text-text",children:F})]}),e.jsx("input",{id:"schedule-runs-per-day",name:"schedule-runs-per-day",type:"range",min:1,max:12,value:F,onChange:t=>te(Number(t.target.value)),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"6"}),e.jsx("span",{children:"12"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"Schedule"}),e.jsx("select",{id:"schedule-preset",name:"schedule-preset",value:xe,onChange:t=>ce(Number(t.target.value)),className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none",children:J.map((t,s)=>e.jsx("option",{value:s,children:t.label},s))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Budget per run (minutes)"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[T," min"]})]}),e.jsx("input",{id:"schedule-budget-minutes",name:"schedule-budget-minutes",type:"range",min:5,max:120,step:5,value:T,onChange:t=>se(Number(t.target.value)),className:"w-full accent-purple"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted mt-1",children:[e.jsx("span",{children:"5 min"}),e.jsx("span",{children:"60 min"}),e.jsx("span",{children:"120 min"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max daily budget (minutes)"}),e.jsxs("span",{className:"text-sm font-medium text-text",children:[q," min"]})]}),e.jsx("input",{id:"schedule-max-daily-budget",name:"schedule-max-daily-budget",type:"range",min:30,max:480,step:30,value:q,onChange:t=>ae(Number(t.target.value)),className:"w-full accent-purple"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs text-text-muted",children:"Improvement areas"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(D).map(([t,s])=>e.jsx("button",{onClick:()=>Oe(t),className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${le.includes(t)?"bg-purple text-white":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:s},t))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Auto-apply improvements"}),e.jsx("button",{onClick:()=>re(!M),className:`relative h-5 w-9 rounded-full transition-colors ${M?"bg-purple":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-transform ${M?"translate-x-4":""}`})})]}),e.jsxs("label",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Pause on weekends"}),e.jsx("button",{onClick:()=>ne(!$),className:`relative h-5 w-9 rounded-full transition-colors ${$?"bg-purple":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-transform ${$?"translate-x-4":""}`})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:Le,className:"flex items-center gap-2 rounded-lg bg-purple px-4 py-2 text-xs font-medium text-white transition-colors hover:bg-purple/80",children:"Save Settings"})})]})]}),f.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Session History"}),e.jsx("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Area"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Baseline"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Best"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"+Δ"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"K/D/C"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Status"})]})}),e.jsx("tbody",{children:f.slice().reverse().slice(0,10).map(t=>{const s=t.bestScore-t.baselineScore;return e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:t.startedAt.slice(0,10)}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text",children:D[t.area]||t.area}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.baselineScore}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text font-medium",children:t.bestScore}),e.jsxs("td",{className:`px-4 py-2.5 text-xs font-medium ${s>0?"text-success":"text-text-muted"}`,children:[s>0?"+":"",s]}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[t.keeps,"/",t.discards,"/",t.crashes]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(Ne,{status:t.applied?"deployed":t.status})})]},t.id)})})]})})]}),W.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Model Training"}),e.jsx("div",{className:"space-y-2",children:W.slice().reverse().slice(0,5).map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(be,{className:"h-4 w-4 text-warning"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text",children:t.id}),e.jsxs("p",{className:"text-xs text-text-muted",children:[t.baseModel," • ",t.dataPoints," samples • ",t.method]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.finalLoss!==void 0&&e.jsxs("span",{className:"text-xs text-text-muted",children:["loss: ",t.finalLoss.toFixed(4)]}),e.jsx(Ne,{status:t.status})]})]},t.id))})]}),h.length>0&&i==="tool_router"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Autoresearch Experiments — Tool Router"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-bg-tertiary",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Val Score Over Time"}),e.jsxs("span",{className:"text-xs text-success font-medium",children:["Best: ",(r==null?void 0:r.bestScore)||Math.max(...h.map(t=>t.val_score))]})]}),e.jsx("div",{className:"h-16 flex items-end gap-1",children:h.map((t,s)=>{const c=Math.max(...h.map(l=>l.val_score),100),o=Math.min(...h.map(l=>l.val_score),0),n=c-o||1,d=(t.val_score-o)/n*100;return e.jsx("div",{className:"flex-1 rounded-t transition-all hover:opacity-80",style:{height:`${Math.max(d,4)}%`,backgroundColor:(r==null?void 0:r.baseline)!=null?t.val_score>=r.baseline?"var(--color-success)":"var(--color-error)":"var(--color-purple)"},title:`Run ${s+1}: ${t.val_score} (${new Date(t.timestamp).toLocaleDateString()})`},s)})}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"border-t border-dashed border-border-light/50 absolute w-full"}),e.jsx("span",{className:"text-[9px] text-text-muted relative -top-2",children:(r==null?void 0:r.baseline)!=null?`baseline: ${r.baseline}`:"baseline: —"})]})]}),e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Score"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"LR"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Rank"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Epochs"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Examples"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Duration"})]})}),e.jsx("tbody",{children:h.slice().reverse().slice(0,20).map((t,s)=>e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:h.length-s}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:new Date(t.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:`px-4 py-2.5 text-xs font-bold ${t.val_score>=((r==null?void 0:r.baseline)||78)?"text-success":"text-error"}`,children:t.val_score}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted font-mono",children:t.hyperparams.lr}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.rank}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.epochs}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.num_examples}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[Math.round(t.training_time_s/60),"m ",Math.round(t.training_time_s%60),"s"]})]},s))})]})]})]}),b.length>0&&i==="main_agent"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Autoresearch Experiments — Main Agent"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-bg-tertiary",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Val Score Over Time"}),e.jsxs("span",{className:"text-xs text-warning font-medium",children:["Best: ",(x==null?void 0:x.bestScore)||Math.max(...b.map(t=>t.val_score))]})]}),e.jsx("div",{className:"h-16 flex items-end gap-1",children:b.map((t,s)=>{const c=Math.max(...b.map(l=>l.val_score),100),o=Math.min(...b.map(l=>l.val_score),0),n=c-o||1,d=(t.val_score-o)/n*100;return e.jsx("div",{className:"flex-1 rounded-t transition-all hover:opacity-80",style:{height:`${Math.max(d,4)}%`,backgroundColor:(x==null?void 0:x.baseline)!=null?t.val_score>=x.baseline?"var(--color-warning)":"var(--color-error)":"var(--color-purple)"},title:`Run ${s+1}: ${t.val_score} (${new Date(t.timestamp).toLocaleDateString()})`},s)})}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"border-t border-dashed border-border-light/50 absolute w-full"}),e.jsx("span",{className:"text-[9px] text-text-muted relative -top-2",children:(x==null?void 0:x.baseline)!=null?`baseline: ${x.baseline}`:"baseline: —"})]})]}),e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Score"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"LR"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Rank"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Epochs"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Examples"}),e.jsx("th",{className:"px-4 py-2.5 text-xs font-medium text-text-muted",children:"Duration"})]})}),e.jsx("tbody",{children:b.slice().reverse().slice(0,20).map((t,s)=>e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:b.length-s}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-secondary",children:new Date(t.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:`px-4 py-2.5 text-xs font-bold ${t.val_score>=((x==null?void 0:x.baseline)||70)?"text-warning":"text-error"}`,children:t.val_score}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted font-mono",children:t.hyperparams.lr}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.rank}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.hyperparams.epochs}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:t.num_examples}),e.jsxs("td",{className:"px-4 py-2.5 text-xs text-text-muted",children:[Math.round(t.training_time_s/60),"m ",Math.round(t.training_time_s%60),"s"]})]},s))})]})]})]})]})}export{ct as default};
|