titan-agent 5.0.2 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/agent.js +48 -3
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/agentLoop.js +83 -5
- package/dist/agent/agentLoop.js.map +1 -1
- package/dist/agent/commandPost.js +1 -1
- package/dist/agent/commandPost.js.map +1 -1
- package/dist/agent/goalProposer.js +2 -2
- package/dist/agent/goalProposer.js.map +1 -1
- package/dist/agent/missionDriver.js +1 -1
- package/dist/agent/missionDriver.js.map +1 -1
- package/dist/agent/promptBudget.js +85 -0
- package/dist/agent/promptBudget.js.map +1 -0
- package/dist/agent/structuredSpawn.js +1 -1
- package/dist/agent/structuredSpawn.js.map +1 -1
- package/dist/agent/subtaskTaxonomy.js +1 -1
- package/dist/agent/subtaskTaxonomy.js.map +1 -1
- package/dist/agent/systemPromptParts.js +10 -1
- package/dist/agent/systemPromptParts.js.map +1 -1
- package/dist/agent/toolRunner.js +16 -0
- package/dist/agent/toolRunner.js.map +1 -1
- package/dist/agent/toolSearch.js +4 -1
- package/dist/agent/toolSearch.js.map +1 -1
- package/dist/analytics/bugReports.js +1 -1
- package/dist/analytics/bugReports.js.map +1 -1
- package/dist/channels/messenger.js +1 -1
- package/dist/channels/messenger.js.map +1 -1
- package/dist/eval/harness.js +141 -0
- package/dist/eval/harness.js.map +1 -0
- package/dist/gateway/server.js +374 -74
- package/dist/gateway/server.js.map +1 -1
- package/dist/hooks/shellHooks.js +1 -1
- package/dist/hooks/shellHooks.js.map +1 -1
- package/dist/lib/auto-heal/repair-strategies.js.map +1 -1
- package/dist/memory/promptIncludes.js +58 -0
- package/dist/memory/promptIncludes.js.map +1 -0
- package/dist/organism/alertsStore.js +70 -0
- package/dist/organism/alertsStore.js.map +1 -0
- package/dist/plugins/memoryRetrieval.js.map +1 -1
- package/dist/providers/ollama.js +7 -7
- package/dist/providers/ollama.js.map +1 -1
- package/dist/safety/invariants.js +60 -0
- package/dist/safety/invariants.js.map +1 -0
- package/dist/safety/opusReview.js +1 -1
- package/dist/safety/opusReview.js.map +1 -1
- package/dist/security/commandScanner.js +2 -2
- package/dist/security/commandScanner.js.map +1 -1
- package/dist/security/secretGuard.js +4 -4
- package/dist/security/secretGuard.js.map +1 -1
- package/dist/skills/builtin/widget_gallery.js +28 -1
- package/dist/skills/builtin/widget_gallery.js.map +1 -1
- package/dist/skills/frontmatterLoader.js +119 -0
- package/dist/skills/frontmatterLoader.js.map +1 -0
- package/dist/skills/registry.js +20 -0
- package/dist/skills/registry.js.map +1 -1
- package/dist/testing/testHealthMonitor.js +1 -2
- package/dist/testing/testHealthMonitor.js.map +1 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/replyQuality.js +1 -1
- package/dist/utils/replyQuality.js.map +1 -1
- package/dist/utils/tokens.js +1 -1
- package/dist/utils/tokens.js.map +1 -1
- package/docs/bleeding-edge-agents-2026.md +450 -0
- package/docs/langchain-analysis.md +598 -0
- package/docs/langchain-code-analysis.md +363 -0
- package/docs/space-agent-analysis.md +300 -0
- package/package.json +1 -1
- package/ui/dist/assets/{AuditPanel-G7YA1HzV.js → AuditPanel-B84Mp16G.js} +2 -2
- package/ui/dist/assets/AutonomyPanel-DOtiTFxV.js +11 -0
- package/ui/dist/assets/{AutopilotPanel-CHRjxdh0.js → AutopilotPanel-nTb1Dnru.js} +1 -1
- package/ui/dist/assets/AutoresearchPanel-D46mX8VF.js +6 -0
- package/ui/dist/assets/BackupPanel-DGM1XXbG.js +1 -0
- package/ui/dist/assets/BrowserPanel-Cn1tTN3y.js +6 -0
- package/ui/dist/assets/{CPAgents-D5533PhK.js → CPAgents-CEraUkME.js} +1 -1
- package/ui/dist/assets/{CPDashboard-C-GgqDsI.js → CPDashboard-B_yidGAe.js} +2 -2
- package/ui/dist/assets/CPFiles-BBS8jtYH.js +1 -0
- package/ui/dist/assets/CPGoals-DL5v21TZ.js +1 -0
- package/ui/dist/assets/CPInbox-CyLQJBYF.js +11 -0
- package/ui/dist/assets/{CPSocial-mUQsrSh5.js → CPSocial-BkEtQ1Um.js} +3 -3
- package/ui/dist/assets/ChannelsPanel-CD2kHhA5.js +1 -0
- package/ui/dist/assets/CheckpointsPanel-BrUTFPu_.js +1 -0
- package/ui/dist/assets/CommandPostHub-BPPaUv1B.js +29 -0
- package/ui/dist/assets/CronPanel-CsfQctFp.js +1 -0
- package/ui/dist/assets/DaemonPanel-CNUggBbL.js +1 -0
- package/ui/dist/assets/DataTable-DuAEp_QJ.js +1 -0
- package/ui/dist/assets/{EmptyState-D60-wQrz.js → EmptyState-DFrAEZDm.js} +1 -1
- package/ui/dist/assets/EvalPanel-DEX0a5-b.js +1 -0
- package/ui/dist/assets/{FilesPanel-BNN3h_HW.js → FilesPanel-DATsiAqG.js} +1 -1
- package/ui/dist/assets/FleetPanel-QYQKqx4W.js +1 -0
- package/ui/dist/assets/{HomelabPanel-1mfhRBh6.js → HomelabPanel-DhuXd3ZD.js} +2 -2
- package/ui/dist/assets/{InfraView-Df6SFI7b.js → InfraView-eS7cpESw.js} +2 -2
- package/ui/dist/assets/InlineEditableField-zIAnW4AR.js +1 -0
- package/ui/dist/assets/{Input-DYukme8A.js → Input-bFsLI0fq.js} +1 -1
- package/ui/dist/assets/IntegrationsPanel-C_FswSRN.js +1 -0
- package/ui/dist/assets/IntelligenceView-smQ6aBwx.js +2 -0
- package/ui/dist/assets/{LearningPanel-BPx05bBu.js → LearningPanel-BEgF_iND.js} +1 -1
- package/ui/dist/assets/{LogsPanel-D3Qfp2SE.js → LogsPanel-Br1P8ST6.js} +1 -1
- package/ui/dist/assets/McpPanel-ByvQ12J_.js +1 -0
- package/ui/dist/assets/{MemoryGraphPanel-BFovwaSG.js → MemoryGraphPanel-BGOeSaET.js} +1 -1
- package/ui/dist/assets/MemoryWikiPanel-CR8btd66.js +11 -0
- package/ui/dist/assets/MeshPanel-BjkcSOMz.js +11 -0
- package/ui/dist/assets/NvidiaPanel-NYt42w7L.js +1 -0
- package/ui/dist/assets/OrganismPanel-PHvISvVn.js +1 -0
- package/ui/dist/assets/OverviewPanel-q35zdMr6.js +6 -0
- package/ui/dist/assets/{PageHeader-BdvxKoad.js → PageHeader-Cwn3OALc.js} +1 -1
- package/ui/dist/assets/PaperclipPanel-BDpQki0d.js +1 -0
- package/ui/dist/assets/{PersonasPanel-BpI6Npxv.js → PersonasPanel-DxrGW5C4.js} +1 -1
- package/ui/dist/assets/RecipesPanel-CYRdBx5u.js +1 -0
- package/ui/dist/assets/{SecurityPanel-CBDsEAFz.js → SecurityPanel-i1QMctV0.js} +1 -1
- package/ui/dist/assets/SelfImprovePanel-DbybAZWp.js +1 -0
- package/ui/dist/assets/SelfProposalsPanel-DtcTUDDd.js +2 -0
- package/ui/dist/assets/SessionsPanel-B7QmOizR.js +1 -0
- package/ui/dist/assets/SessionsTab-BdJj_vsI.js +1 -0
- package/ui/dist/assets/{SettingsPanel-BiWHsOAJ.js → SettingsPanel-DnEvJUFe.js} +1 -1
- package/ui/dist/assets/SettingsView-C39dk_yr.js +2 -0
- package/ui/dist/assets/{SkeletonLoader-CGtpZJ-7.js → SkeletonLoader-CsiR8ED9.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-Z_9jA6dU.js → SkillsPanel-DM4qBFDS.js} +1 -1
- package/ui/dist/assets/{SomaView-AP3BXqf-.js → SomaView-CWnPKEQI.js} +1 -1
- package/ui/dist/assets/{StatCard-CrnvXPg5.js → StatCard-CY8lgeWm.js} +1 -1
- package/ui/dist/assets/{StatusBadge-B6r5EWBA.js → StatusBadge-CGvKbP7R.js} +1 -1
- package/ui/dist/assets/TeamsPanel-Bf6GaUni.js +1 -0
- package/ui/dist/assets/{TelemetryPanel-D6o14H-i.js → TelemetryPanel-JZ90gJXC.js} +1 -1
- package/ui/dist/assets/TitanCanvas-Hk49NFcA.js +1092 -0
- package/ui/dist/assets/ToolsView-Cq7Fuq3i.js +2 -0
- package/ui/dist/assets/{Tooltip-DNsYGHC9.js → Tooltip-CcoZrKsl.js} +1 -1
- package/ui/dist/assets/{TraceViewer-TOpdmqLF.js → TraceViewer-ojGf0drx.js} +1 -1
- package/ui/dist/assets/TrainingPanel-CWnP4H2l.js +1 -0
- package/ui/dist/assets/{VoiceOverlay-XIyCbAP7.js → VoiceOverlay-Dn6iaYgd.js} +1 -1
- package/ui/dist/assets/VramPanel-CLd9Ggck.js +1 -0
- package/ui/dist/assets/WatchView-CQBemwsm.js +13 -0
- package/ui/dist/assets/WorkTab-BOfTN-Bd.js +1 -0
- package/ui/dist/assets/WorkflowsPanel-qzNS0p0u.js +11 -0
- package/ui/dist/assets/{arrow-left-CQF-yBIU.js → arrow-left-c-8OFZUV.js} +1 -1
- package/ui/dist/assets/{chart-column-1smg0GbX.js → chart-column-x6L66Qw7.js} +1 -1
- package/ui/dist/assets/{circle-check-big-BiMDFx6C.js → circle-check-big-WaW3U3Xl.js} +1 -1
- package/ui/dist/assets/{dollar-sign-DMYH4Q_a.js → dollar-sign-D2Oce4Ru.js} +1 -1
- package/ui/dist/assets/{download-BYFd-yl6.js → download-YvPDLlFJ.js} +1 -1
- package/ui/dist/assets/eye-off-DIMcxsdQ.js +6 -0
- package/ui/dist/assets/{funnel-pWBglhfw.js → funnel-DqD9srZu.js} +1 -1
- package/ui/dist/assets/{git-branch-Cgqic2Us.js → git-branch-0FamUEbU.js} +1 -1
- package/ui/dist/assets/index-D932CbpQ.css +1 -0
- package/ui/dist/assets/index-NatBSFxj.js +227 -0
- package/ui/dist/assets/{legacy-BHbi-Nm_.js → legacy-DOO7F5cq.js} +1 -1
- package/ui/dist/assets/{lightbulb-D_y0Mtyq.js → lightbulb-Bk6KlR6q.js} +1 -1
- package/ui/dist/assets/pause-DDC_zUiJ.js +6 -0
- package/ui/dist/assets/{play-2xR4_zUG.js → play-BPXbHToG.js} +1 -1
- package/ui/dist/assets/{plug-DhvhYYy_.js → plug-Dxp-sWVF.js} +1 -1
- package/ui/dist/assets/proxy-vU7v4NVM.js +9 -0
- package/ui/dist/assets/square-Bn_0tYME.js +6 -0
- package/ui/dist/assets/target-BrtxUtzl.js +6 -0
- package/ui/dist/assets/toggle-right-CYphlpN5.js +11 -0
- package/ui/dist/assets/{trash-2-DmRaMz9e.js → trash-2-C_Jsp23A.js} +1 -1
- package/ui/dist/assets/{trending-up-DsDcs3Jo.js → trending-up-DrtLViSm.js} +1 -1
- package/ui/dist/assets/trophy-DdRzAOfo.js +6 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/CPFiles-G7veSjMg.js +0 -6
- package/ui/dist/assets/CPGoals-C3DlKJrJ.js +0 -1
- package/ui/dist/assets/CPInbox-D10curQs.js +0 -16
- package/ui/dist/assets/ChannelsPanel-M3pO2htW.js +0 -1
- package/ui/dist/assets/CommandPostHub-CW9OY1A4.js +0 -37
- package/ui/dist/assets/InlineEditableField-CH-jR3LC.js +0 -11
- package/ui/dist/assets/IntegrationsPanel-EaN999Te.js +0 -1
- package/ui/dist/assets/IntelligenceView-Q4DBmJpJ.js +0 -2
- package/ui/dist/assets/McpPanel-zC7jTaSx.js +0 -6
- package/ui/dist/assets/MeshPanel-CqtYZ74K.js +0 -11
- package/ui/dist/assets/NvidiaPanel-BVIZFHet.js +0 -1
- package/ui/dist/assets/SelfImprovePanel-PSCYO6sx.js +0 -11
- package/ui/dist/assets/SessionsTab-Cn3dGgjX.js +0 -1
- package/ui/dist/assets/SettingsView-3BSIzAfW.js +0 -2
- package/ui/dist/assets/TitanCanvas-cnb7R1gS.js +0 -1056
- package/ui/dist/assets/ToolsView-Dp-xUWJG.js +0 -2
- package/ui/dist/assets/WorkTab-Pgq-iLz9.js +0 -1
- package/ui/dist/assets/WorkflowsPanel-B91LeW7r.js +0 -21
- package/ui/dist/assets/eye-BfW7UcEC.js +0 -11
- package/ui/dist/assets/index-BWSnB6Kr.js +0 -227
- package/ui/dist/assets/index-Dtw1pbjc.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
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-NatBSFxj.js";import{R as D,c as L,E as V,a as $,i as M}from"./TitanCanvas-Hk49NFcA.js";import{C as F}from"./circle-check-big-WaW3U3Xl.js";import{E as H}from"./eye-off-DIMcxsdQ.js";import"./VoiceOverlay-Dn6iaYgd.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};
|
|
@@ -0,0 +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-NatBSFxj.js";import{P as p}from"./PageHeader-Cwn3OALc.js";import{R as j}from"./TitanCanvas-Hk49NFcA.js";import{C as u}from"./circle-check-big-WaW3U3Xl.js";import"./VoiceOverlay-Dn6iaYgd.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,6 @@
|
|
|
1
|
+
import{c as v,r as o,j as e,Z as x,A as h,H as f,C as j,aB as p}from"./index-NatBSFxj.js";import{S as a}from"./StatCard-CY8lgeWm.js";import{P as n}from"./PageHeader-Cwn3OALc.js";import{S as g}from"./SkeletonLoader-CsiR8ED9.js";import{C as y,M as b,h as w}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
|
+
* @license lucide-react v0.513.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const S=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],N=v("layers",S);function M(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 C(){const[t,s]=o.useState(null),[r,i]=o.useState(null),[d,u]=o.useState(!0),c=async()=>{try{const l=await p();s(l),i(null)}catch(l){i(l instanceof Error?l.message:"Failed to fetch stats")}finally{u(!1)}};return o.useEffect(()=>{c();const l=setInterval(c,1e4);return()=>clearInterval(l)},[]),d?e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx(n,{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(g,{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(n,{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:M(t.uptime),icon:e.jsx(y,{className:"h-5 w-5"})}),e.jsx(a,{title:"Total Requests",value:t.totalRequests.toLocaleString(),icon:e.jsx(x,{className:"h-5 w-5"})}),e.jsx(a,{title:"Active Agents",value:t.activeAgents,icon:e.jsx(h,{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(j,{className:"h-5 w-5"})}),e.jsx(a,{title:"Provider",value:t.provider,icon:e.jsx(w,{className:"h-5 w-5"})}),e.jsx(a,{title:"Version",value:t.version,icon:e.jsx(N,{className:"h-5 w-5"})})]})]}):null}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,
|
|
1
|
+
import{j as e,aA as i}from"./index-NatBSFxj.js";import{C as r}from"./VoiceOverlay-Dn6iaYgd.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,b0 as m,j as e,b1 as d,b2 as p}from"./index-NatBSFxj.js";import{P as x}from"./PageHeader-Cwn3OALc.js";import{R as u,p as f,q as h}from"./TitanCanvas-Hk49NFcA.js";import{P as b}from"./play-BPXbHToG.js";import{S as g}from"./square-Bn_0tYME.js";import"./VoiceOverlay-Dn6iaYgd.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,
|
|
1
|
+
import{r as a,j as s,a2 as y,a3 as j}from"./index-NatBSFxj.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,aM as p,j as e,aN as h,aO as f}from"./index-NatBSFxj.js";import{P as u}from"./PageHeader-Cwn3OALc.js";import{R as b,d as g}from"./TitanCanvas-Hk49NFcA.js";import{P as j}from"./play-BPXbHToG.js";import{T as N}from"./trash-2-C_Jsp23A.js";import"./VoiceOverlay-Dn6iaYgd.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-NatBSFxj.js";import{P as i}from"./PageHeader-Cwn3OALc.js";import"./VoiceOverlay-Dn6iaYgd.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};
|
|
@@ -0,0 +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-NatBSFxj.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-Hk49NFcA.js";import{C as je}from"./circle-check-big-WaW3U3Xl.js";import{T as Ye}from"./trophy-DdRzAOfo.js";import{T as fe}from"./trending-up-DrtLViSm.js";import{a as I,C as Q}from"./VoiceOverlay-Dn6iaYgd.js";import{P as ye}from"./play-BPXbHToG.js";import{T as et}from"./trash-2-C_Jsp23A.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as l,b as x,j as t,T as E,h,f as v}from"./index-NatBSFxj.js";import{P as g}from"./PageHeader-Cwn3OALc.js";import{G as I,C as f}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.js";const M={captured:{label:"Captured",color:"text-blue-400",icon:f},review_pending:{label:"Reviewing",color:"text-amber-400",icon:f},approved:{label:"Approved — ready for PR",color:"text-emerald-400",icon:v},rejected:{label:"Rejected",color:"text-rose-400",icon:h},pr_open:{label:"PR open — awaiting merge",color:"text-purple-400",icon:I},merged:{label:"Merged ✓",color:"text-emerald-500",icon:v},closed_unmerged:{label:"Closed unmerged",color:"text-slate-400",icon:h},error:{label:"Error",color:"text-rose-500",icon:E}};function U(){const[m,u]=l.useState([]),[j,b]=l.useState(!0),[y,N]=l.useState(!1),[w,P]=l.useState(null),[n,i]=l.useState(null),[p,S]=l.useState({}),o=l.useCallback(async()=>{try{const e=await x("/api/self-proposals");if(e.status===404){N(!0),b(!1);return}const r=await e.json();u(r.proposals||[])}catch{u([])}finally{b(!1)}},[]);l.useEffect(()=>{o();const e=setInterval(o,15e3);return()=>clearInterval(e)},[o]);const R=async(e,r)=>{var a;if(!((a=p[e])!=null&&a[r]))try{const d=await x(`/api/self-proposals/${e}/files/${r}`);if(!d.ok)return;const s=await d.text();S(c=>({...c,[e]:{...c[e]||{},[r]:s}}))}catch{}},C=async e=>{i(e);try{await x(`/api/self-proposals/${e}/review`,{method:"POST"}),await o()}finally{i(null)}},T=async e=>{i(e);try{const a=await(await x(`/api/self-proposals/${e}/open-pr`,{method:"POST"})).json();a.prUrl?window.open(a.prUrl,"_blank"):a.errorMessage?alert("PR creation failed: "+a.errorMessage):a.bundlePath&&alert(`No git checkout — bundle exported to:
|
|
2
|
+
`+a.bundlePath),await o()}finally{i(null)}},k=async e=>{if(window.confirm("Dismiss this self-proposal? This marks it rejected and prevents PR creation.")){i(e);try{await x(`/api/self-proposals/${e}/dismiss`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"dismissed by user from UI"})}),await o()}finally{i(null)}}};return y?t.jsxs("div",{className:"space-y-6",children:[t.jsx(g,{title:"Self-Proposals",subtitle:"Autonomous outputs captured for human-gated merge",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"}]}),t.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-6",children:[t.jsx("p",{className:"text-[var(--text)] font-medium mb-2",children:"Self-Modification is off."}),t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["Enable by setting ",t.jsx("code",{className:"bg-[var(--bg-tertiary)] px-1 rounded",children:"selfMod.enabled: true"})," in ",t.jsx("code",{className:"bg-[var(--bg-tertiary)] px-1 rounded",children:"titan.json"}),". When on, autonomous writes from Soma-driven goals are captured, reviewed by the specialist panel, and proposed as GitHub PRs for your merge."]})]})]}):j?t.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading self-proposals..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(g,{title:"Self-Proposals",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"},{label:"Self-Proposals"}]}),t.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"TITAN autonomously wrote these outputs while working on Soma-driven goals. Its specialist panel (Analyst, Builder, Writer) reviews each for safety + utility. You are the final merge gate — no PR is ever merged without your click on GitHub."})}),m.length===0?t.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-6 text-center",children:t.jsx("p",{className:"text-[var(--text-muted)]",children:"No self-proposals yet. They appear here when TITAN writes code under an autonomous Soma-driven session."})}):t.jsx("div",{className:"space-y-3",children:m.map(e=>{const r=M[e.status],a=r.icon,d=w===e.id;return t.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg overflow-hidden",children:[t.jsx("button",{className:"w-full p-4 text-left hover:bg-[var(--bg-tertiary)]",onClick:()=>P(d?null:e.id),children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(a,{className:`w-4 h-4 ${r.color}`}),t.jsx("span",{className:`text-xs font-medium ${r.color}`,children:r.label}),e.drive&&t.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--bg-tertiary)] text-[var(--text-muted)]",children:["drive: ",e.drive]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:[e.files.length," file",e.files.length===1?"":"s"]})]}),t.jsx("p",{className:"text-sm font-medium text-[var(--text)] truncate",children:e.title}),e.goalTitle&&t.jsxs("p",{className:"text-xs text-[var(--text-muted)] mt-1 truncate",children:["Goal: ",e.goalTitle]})]}),t.jsx("div",{className:"text-xs text-[var(--text-muted)] whitespace-nowrap",children:new Date(e.createdAt).toLocaleString()})]})}),d&&t.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-[var(--border)]",children:[e.rejectionReason&&t.jsxs("div",{className:"mt-3 p-3 bg-rose-500/10 border border-rose-500/30 rounded text-sm",children:[t.jsx("p",{className:"font-medium text-rose-400 mb-1",children:"Rejection"}),t.jsx("p",{className:"text-[var(--text)]",children:e.rejectionReason})]}),e.errorMessage&&t.jsxs("div",{className:"mt-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded text-sm",children:[t.jsx("p",{className:"font-medium text-amber-400 mb-1",children:"Error"}),t.jsx("p",{className:"text-[var(--text)]",children:e.errorMessage})]}),e.verdicts.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"text-xs font-medium text-[var(--text-muted)] mb-2",children:"Specialist verdicts"}),t.jsx("div",{className:"space-y-2",children:e.verdicts.map(s=>t.jsxs("div",{className:"p-2 bg-[var(--bg-tertiary)] rounded text-xs",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"font-semibold text-[var(--text)] capitalize",children:s.specialistId}),t.jsx("span",{className:s.vote==="approve"?"text-emerald-400":s.vote==="reject"?"text-rose-400":"text-amber-400",children:s.vote})]}),t.jsx("p",{className:"text-[var(--text-muted)]",children:s.rationale})]},s.specialistId))})]}),e.files.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"text-xs font-medium text-[var(--text-muted)] mb-2",children:"Captured files"}),t.jsx("div",{className:"space-y-2",children:e.files.map(s=>{var c;return t.jsxs("details",{className:"bg-[var(--bg-tertiary)] rounded",onToggle:A=>{A.target.open&&R(e.id,s.capturedPath)},children:[t.jsxs("summary",{className:"p-2 cursor-pointer text-xs text-[var(--text)]",children:[t.jsx("code",{children:s.capturedPath}),t.jsxs("span",{className:"text-[var(--text-muted)] ml-2",children:["(",s.lineCount," lines, ",s.size," bytes)"]})]}),t.jsx("pre",{className:"p-3 text-xs overflow-x-auto max-h-96 bg-[var(--bg-primary)] text-[var(--text)]",children:((c=p[e.id])==null?void 0:c[s.capturedPath])??"Loading..."})]},s.capturedPath)})})]}),t.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.status==="captured"&&t.jsx("button",{onClick:()=>C(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-blue-600 hover:bg-blue-500 disabled:opacity-50 text-white rounded",children:n===e.id?"Reviewing...":"Run specialist review"}),e.status==="approved"&&t.jsx("button",{onClick:()=>T(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white rounded",children:n===e.id?"Opening PR...":"Open GitHub PR"}),e.prUrl&&t.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs bg-[var(--bg-tertiary)] hover:bg-[var(--bg-primary)] text-[var(--text)] rounded border border-[var(--border)]",children:["View PR #",e.prNumber??""]}),(e.status==="captured"||e.status==="review_pending"||e.status==="approved")&&t.jsx("button",{onClick:()=>k(e.id),disabled:n===e.id,className:"px-3 py-1.5 text-xs bg-[var(--bg-tertiary)] hover:bg-rose-600 hover:text-white disabled:opacity-50 text-[var(--text-muted)] rounded border border-[var(--border)]",children:"Dismiss"})]})]})]},e.id)})})]})}export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as s,X as k,aC as C,aD as M,aE as L,aF as E}from"./index-NatBSFxj.js";import{P as D}from"./PageHeader-Cwn3OALc.js";import"./Input-bFsLI0fq.js";import{D as F}from"./DataTable-DuAEp_QJ.js";import{I as P}from"./InlineEditableField-zIAnW4AR.js";import{a as A}from"./TitanCanvas-Hk49NFcA.js";import{T as I}from"./trash-2-C_Jsp23A.js";import"./VoiceOverlay-Dn6iaYgd.js";function z(){const[p,g]=a.useState([]),[b,f]=a.useState(!0),[c,n]=a.useState(null),[o,y]=a.useState(""),[l,i]=a.useState(null),[m,r]=a.useState([]),[j,x]=a.useState(!1),d=async()=>{try{const e=await C();g(e),n(null)}catch(e){n(e instanceof Error?e.message:"Failed to fetch sessions")}finally{f(!1)}};a.useEffect(()=>{d()},[]);const N=async e=>{i(e.id),x(!0);try{const t=await M(e.id);r(t)}catch{r([])}finally{x(!1)}},w=async e=>{try{await E(e),l===e&&(i(null),r([])),await d()}catch(t){n(t instanceof Error?t.message:"Failed to delete session")}},S=p.filter(e=>{var u,h;if(!o)return!0;const t=o.toLowerCase();return e.id.toLowerCase().includes(t)||((u=e.name)==null?void 0:u.toLowerCase().includes(t))||((h=e.lastMessage)==null?void 0:h.toLowerCase().includes(t))}),v=[{key:"id",header:"ID",render:e=>s.jsxs("span",{className:"font-mono text-xs",children:[e.id.slice(0,12),"..."]})},{key:"name",header:"Name",render:e=>s.jsx("span",{className:"text-sm text-text",children:s.jsx(P,{value:e.name??"",onSave:async t=>{await L(e.id,t),await d()},placeholder:"Session name",emptyLabel:"Untitled",hidePencil:!0})})},{key:"messageCount",header:"Messages"},{key:"lastMessage",header:"Last Message",render:e=>s.jsx("span",{className:"block max-w-xs truncate text-text-secondary",children:e.lastMessage??"-"})},{key:"createdAt",header:"Created",render:e=>s.jsx("span",{children:new Date(e.createdAt).toLocaleString()})},{key:"_actions",header:"",className:"w-16",render:e=>s.jsx("button",{onClick:t=>{t.stopPropagation(),w(e.id)},className:"rounded-md p-1.5 text-error transition-colors hover:bg-bg-tertiary",title:"Delete session",children:s.jsx(I,{className:"h-4 w-4"})})}];return b?s.jsx("div",{className:"h-64 animate-pulse rounded-xl border border-border bg-bg-secondary"}):s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:`space-y-4 ${l?"flex-1":"w-full"}`,children:[s.jsx(D,{title:"Sessions",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Monitoring"},{label:"Sessions"}]}),s.jsxs("div",{className:"relative",children:[s.jsx(A,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-muted"}),s.jsx("input",{value:o,onChange:e=>y(e.target.value),placeholder:"Search sessions...",className:"w-full rounded-lg border border-border bg-bg py-2 pl-10 pr-3 text-sm text-text outline-none focus:border-accent"})]}),c&&s.jsx("div",{className:"rounded-lg border border-error/50 bg-bg-secondary px-4 py-2 text-sm text-error",children:c}),s.jsx(F,{columns:v,data:S,onRowClick:N,emptyMessage:"No sessions found"})]}),l&&s.jsxs("div",{className:"w-96 shrink-0 rounded-xl border border-border bg-bg-secondary",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[s.jsx("h3",{className:"text-sm font-medium text-text",children:"Messages"}),s.jsx("button",{onClick:()=>{i(null),r([])},className:"rounded-md p-1 text-text-muted hover:text-text",children:s.jsx(k,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"max-h-[600px] overflow-y-auto p-4",children:j?s.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-bg-tertiary"},t))}):m.length===0?s.jsx("p",{className:"text-center text-sm text-text-muted",children:"No messages"}):s.jsx("div",{className:"space-y-3",children:m.map((e,t)=>s.jsxs("div",{className:`rounded-lg p-3 text-sm ${e.role==="user"?"bg-accent/10 text-text":e.role==="assistant"?"bg-bg-tertiary text-text":"bg-bg text-text-secondary"}`,children:[s.jsx("span",{className:"mb-1 block text-xs font-medium uppercase text-text-muted",children:e.role}),s.jsx("p",{className:"whitespace-pre-wrap",children:e.content})]},t))})})]})]})}export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as c,j as e,b as j,X as A}from"./index-NatBSFxj.js";import{A as E,m as v}from"./proxy-vU7v4NVM.js";const C=["initiative","deliberation","autopilot","agent-","company-","swarm","subagent","plan-"],S=["webchat","messenger-admin","messenger","twilio-admin","twilio","livekit","api"];function p(s){return C.some(a=>s===a||s.startsWith(a))}function g(s){return S.some(a=>s===a||s.startsWith(a))}function F(){const[s,a]=c.useState([]),[o,x]=c.useState(!0),[l,m]=c.useState("internal"),[u,n]=c.useState(null);c.useEffect(()=>{let t=!0;const i=async()=>{try{const h=await j("/api/sessions");if(!h.ok)return;const b=await h.json();if(!t)return;a(Array.isArray(b)?b:[]),x(!1)}catch{}};i();const r=setInterval(i,15e3);return()=>{t=!1,clearInterval(r)}},[]);const d=c.useMemo(()=>{let t=s;return l==="internal"?t=t.filter(i=>p(i.channel)):l==="user"?t=t.filter(i=>g(i.channel)):l!=="all"&&(t=t.filter(i=>i.channel===l)),t.sort((i,r)=>(r.lastActive||"").localeCompare(i.lastActive||""))},[s,l]),w=c.useMemo(()=>{const t=new Map;for(const i of d){const r=t.get(i.channel)||[];r.push(i),t.set(i.channel,r)}return[...t.entries()].sort((i,r)=>i[0].localeCompare(r[0]))},[d]),y=s.filter(t=>p(t.channel)).length,k=s.filter(t=>g(t.channel)).length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] text-text-muted mb-2",children:"Internal sessions are TITAN's background thought-trains: autopilot runs, deliberation plans, sub-agent delegations. You wouldn't normally see these in chat."}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsxs(f,{active:l==="internal",onClick:()=>m("internal"),children:["Internal ",e.jsxs("span",{className:"text-text-muted ml-1",children:["(",y,")"]})]}),e.jsxs(f,{active:l==="user",onClick:()=>m("user"),children:["User chats ",e.jsxs("span",{className:"text-text-muted ml-1",children:["(",k,")"]})]}),e.jsxs(f,{active:l==="all",onClick:()=>m("all"),children:["All ",e.jsxs("span",{className:"text-text-muted ml-1",children:["(",s.length,")"]})]})]})]}),o?e.jsx("div",{className:"p-6 text-center text-[12px] text-text-muted",children:"Loading sessions…"}):d.length===0?e.jsx("div",{className:"p-8 text-center text-[12px] text-text-muted bg-bg-secondary/50 border border-border rounded-xl",children:"No sessions in this filter."}):e.jsx("div",{className:"space-y-4",children:w.map(([t,i])=>e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2.5 flex items-center justify-between border-b border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[12px] text-text-secondary font-medium",children:t}),e.jsx("span",{className:"text-[10px] text-text-muted",children:i.length})]}),e.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:p(t)?"internal":g(t)?"user":"other"})]}),e.jsxs("div",{className:"divide-y divide-border/30",children:[i.slice(0,8).map(r=>{var h;return e.jsxs("div",{onClick:()=>n(r),className:"px-4 py-2.5 flex items-start gap-3 hover:bg-bg-tertiary/30 cursor-pointer",children:[e.jsx("div",{className:`w-1.5 h-1.5 rounded-full mt-1.5 flex-shrink-0 ${r.status==="active"?"bg-emerald-400":"bg-white/20"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[12px] text-text truncate",children:r.name||((h=r.lastMessage)==null?void 0:h.slice(0,80))||"(untitled)"}),e.jsxs("div",{className:"text-[10px] text-white/35 mt-0.5",children:[r.messageCount," msg · ",N(r.lastActive)," · ",r.userId]})]})]},r.id)}),i.length>8&&e.jsxs("div",{className:"px-4 py-2 text-[10px] text-text-muted italic",children:["+ ",i.length-8," more ",t," session",i.length-8===1?"":"s"]})]})]},t))}),e.jsx(I,{open:u!==null,session:u,onClose:()=>n(null)})]})}function f({active:s,onClick:a,children:o}){return e.jsx("button",{onClick:a,className:`px-3 py-1 text-[11px] rounded-lg transition-colors ${s?"bg-indigo-600 text-white":"bg-bg-tertiary text-text-muted hover:text-text"}`,children:o})}function I({open:s,session:a,onClose:o}){const[x,l]=c.useState([]),[m,u]=c.useState(!1);return c.useEffect(()=>{if(!s||!a){l([]);return}u(!0),j(`/api/sessions/${a.id}`).then(n=>n.ok?n.json():null).then(n=>{const d=Array.isArray(n)?n:(n==null?void 0:n.messages)||[];l(d)}).catch(()=>{}).finally(()=>u(!1))},[s,a]),c.useEffect(()=>{if(!s)return;const n=d=>{d.key==="Escape"&&o()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[s,o]),e.jsx(E,{children:s&&a&&e.jsxs(e.Fragment,{children:[e.jsx(v.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},onClick:o,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",zIndex:99}},"backdrop"),e.jsxs(v.aside,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{duration:.28,ease:[.32,.72,0,1]},style:{position:"fixed",top:0,right:0,bottom:0,width:"min(600px, 100vw)",background:"rgba(10, 12, 20, 0.96)",backdropFilter:"blur(24px)",borderLeft:"1px solid rgba(167, 139, 250, 0.15)",zIndex:100,display:"flex",flexDirection:"column",boxShadow:"-20px 0 60px rgba(0,0,0,0.5)"},children:[e.jsxs("div",{className:"px-6 py-4 border-b border-border flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted font-semibold mb-1",children:a.channel}),e.jsx("div",{className:"text-[16px] font-semibold text-white/95 truncate",children:a.name||"(untitled session)"}),e.jsxs("div",{className:"text-[11px] text-white/35 mt-1",children:[a.messageCount," messages · ",N(a.lastActive)]})]}),e.jsx("button",{onClick:o,className:"text-white/55 hover:text-text p-1.5 rounded","aria-label":"Close",children:e.jsx(A,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-3",children:[m&&e.jsx("div",{className:"text-[12px] text-white/35",children:"Loading transcript…"}),!m&&x.length===0&&e.jsx("div",{className:"text-[12px] text-white/35 italic",children:"No messages."}),x.map((n,d)=>e.jsxs("div",{className:`p-3 rounded-lg border-l-2 ${n.role==="assistant"?"bg-purple-500/[0.03] border-purple-400/50":n.role==="user"?"bg-bg-tertiary/30 border-white/20":"bg-bg-secondary/50 border-white/10"}`,children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold mb-1",children:n.role}),e.jsxs("div",{className:"text-[12px] text-white/85 whitespace-pre-wrap leading-relaxed",style:{wordBreak:"break-word"},children:[(n.content||"").slice(0,2e3),(n.content||"").length>2e3&&e.jsx("span",{className:"text-text-muted",children:"… (truncated)"})]})]},d))]})]},"panel")]})})}function N(s){if(!s)return"";const a=Date.parse(s);if(isNaN(a))return"";const o=Math.max(0,Math.floor((Date.now()-a)/1e3));if(o<60)return`${o}s ago`;const x=Math.floor(o/60);if(x<60)return`${x}m ago`;const l=Math.floor(x/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}export{C as INTERNAL_CHANNEL_PREFIXES,S as USER_CHANNEL_PREFIXES,F as default,p as isInternalChannel,g as isUserChannel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,b as B,I as fe,j as e,C as Z,W as je,J as ee,K as Ne,L as ye,N as we,O as Se,t as Ce,P as ke,Q as te,U as Ve,V as Te,Y as Le}from"./index-BWSnB6Kr.js";import"./Input-DYukme8A.js";import{P as Ue}from"./PageHeader-BdvxKoad.js";import{H as se}from"./Tooltip-DNsYGHC9.js";import{C as Ee}from"./circle-check-big-BiMDFx6C.js";import{M as D}from"./VoiceOverlay-XIyCbAP7.js";import{R as Pe,b as Ae,L as ae,c as Ie}from"./TitanCanvas-cnb7R1gS.js";import{D as Me}from"./download-BYFd-yl6.js";import{P as Fe}from"./play-2xR4_zUG.js";const M=["ollama","lmstudio","localai"];function Re({ok:o}){return o?e.jsx("div",{className:"h-2 w-2 rounded-full bg-success shadow-[0_0_6px_rgba(34,197,94,0.4)]"}):e.jsx("div",{className:"h-2 w-2 rounded-full bg-border-light"})}function $e({models:o,selectedModel:j,onSelect:N,onSwitch:F,currentModel:m}){const S=m.includes("/")?m.split("/")[0]:"",[h,C]=a.useState(S);a.useEffect(()=>{C(S)},[S]);const u=a.useMemo(()=>[...new Set(o.map(i=>i.provider))].sort((i,d)=>{const n=M.includes(i.toLowerCase()),w=M.includes(d.toLowerCase());return n&&!w?-1:!n&&w?1:i.localeCompare(d)}),[o]),y=a.useMemo(()=>o.filter(c=>c.provider===h),[o,h]),U=c=>{C(c);const i=o.filter(n=>n.provider===c),d=i.find(n=>n.id===m);d?N(d.id):i.length>0&&N(i[0].id)},R=j!==m,g=M.includes(h.toLowerCase());return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx("label",{className:"text-xs text-text-muted",children:"Provider"}),e.jsx(se,{title:"AI Provider",description:"The company or service that hosts the AI model. Local providers (Ollama, LM Studio) run on your machine. Cloud providers (Anthropic, OpenAI) run remotely and require an API key."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("select",{value:h,onChange:c=>U(c.target.value),className:"w-full rounded-lg border border-border bg-bg px-3 py-2.5 text-sm text-text outline-none transition-colors focus:border-accent min-h-[44px]",children:u.map(c=>{const i=M.includes(c.toLowerCase()),d=o.filter(n=>n.provider===c).length;return e.jsxs("option",{value:c,children:[i?`💻 ${c} (local)`:c," — ",d," model",d!==1?"s":""]},c)})}),g&&e.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap rounded bg-success/15 px-2 py-1 text-xs font-medium text-success self-start mt-0.5 sm:self-auto sm:mt-0",children:[e.jsx(ye,{className:"h-3 w-3"})," Local"]}),!g&&h&&e.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap rounded bg-accent/15 px-2 py-1 text-xs font-medium text-accent-hover self-start mt-0.5 sm:self-auto sm:mt-0",children:[e.jsx(we,{className:"h-3 w-3"})," Cloud"]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx("label",{className:"text-xs text-text-muted",children:"Model"}),e.jsx(se,{title:"Model Selection",description:"The specific AI model TITAN uses to think and respond. Larger models are smarter but slower and cost more. You can switch anytime without losing conversation history."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end gap-2 md:gap-3",children:[e.jsxs("select",{value:j,onChange:c=>N(c.target.value),className:"w-full rounded-lg border border-border bg-bg px-3 py-2.5 text-sm text-text outline-none transition-colors focus:border-accent min-h-[44px]",children:[y.map(c=>e.jsxs("option",{value:c.id,disabled:!c.available,children:[c.name,c.id===m?" (active)":"",c.available?"":" — unavailable"]},c.id)),y.length===0&&e.jsx("option",{disabled:!0,children:"No models for this provider"})]}),e.jsx("button",{onClick:F,disabled:!R,className:"rounded-lg bg-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50 min-h-[44px] w-full sm:w-auto active:scale-[0.98]",children:"Switch"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-bg px-3 py-2.5",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-success animate-pulse flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:"Active:"}),e.jsx("span",{className:"text-xs text-text-secondary font-mono overflow-x-auto scrollbar-thin",children:m||"None"})]})]})}function at(){var G,X,Y;const[o,j]=a.useState(null),[N,F]=a.useState([]),[m,S]=a.useState(!0),[h,C]=a.useState(!1),[u,y]=a.useState(""),[U,R]=a.useState(null),[g,c]=a.useState(null),[i,d]=a.useState(!1),[n,w]=a.useState(""),[k,V]=a.useState("andrew"),[v,q]=a.useState("f5-tts"),[re,K]=a.useState("http://localhost:5006"),[ce,T]=a.useState(["andrew"]),[Oe,_e]=a.useState(null),[Be,De]=a.useState(!1),[qe,Ke]=a.useState(""),E=[{id:"f5-tts",name:"F5-TTS",desc:"Voice cloning with MLX (Apple Silicon)",defaultUrl:"http://localhost:5006",defaultVoices:["andrew"]}],[ze,oe]=a.useState(null),[ie,He]=a.useState(!1),[ne,We]=a.useState(""),[z,$]=a.useState([]),[H,W]=a.useState(!1),[b,le]=a.useState(null),[L,de]=a.useState(null),[O,Q]=a.useState(!1),P=t=>{var s;return((s=t==null?void 0:t.agent)==null?void 0:s.model)??(t==null?void 0:t.model)??""};a.useEffect(()=>{(async()=>{try{const[s,r]=await Promise.all([ee(),Ne()]);j(s),F(r),y(P(s));const l=(s==null?void 0:s.voice)??{};d(l.enabled??!1),w(l.livekitUrl??""),V(l.ttsVoice??"andrew"),q(l.ttsEngine??"f5-tts"),K(l.ttsUrl??"http://localhost:5006")}catch(s){const r=s instanceof Error?s.message:"Failed to load config";R(r),x("error",r)}finally{S(!1)}})()},[]),a.useEffect(()=>{(async()=>{var t;try{const s=await B("/api/voice/voices");if(s.ok){const r=await s.json();(t=r.voices)!=null&&t.length&&T(r.voices)}}catch{}})()},[]);const _=async()=>{Q(!0);try{const[t,s]=await Promise.allSettled([B("/api/voice/health").then(r=>r.json()),B("/api/voice/status").then(r=>r.json())]);t.status==="fulfilled"&&le(t.value),s.status==="fulfilled"&&(de(s.value),s.value.livekitUrl&&!n&&w(s.value.livekitUrl))}catch{}Q(!1)};a.useEffect(()=>{m||_()},[m]),a.useEffect(()=>{i&&fe().then(t=>{var s;oe({installed:t.installed,running:t.running,voices:t.voices}),$(t.voices.map(r=>({name:r,hasTranscript:!1,sizeBytes:0}))),(s=t.voices)!=null&&s.length&&T(["andrew",...t.voices])}).catch(()=>{})},[i]);const xe=async()=>{const t=document.createElement("input");t.type="file",t.accept="audio/wav,audio/mp3,audio/mpeg,audio/flac,.wav,.mp3,.flac",t.onchange=async()=>{var p;const s=(p=t.files)==null?void 0:p[0];if(!s)return;const r=prompt('Name this voice (e.g., "robin", "jarvis"):',s.name.replace(/\.[^.]+$/,""));if(!r)return;const l=prompt("(Optional) Transcript of the audio — improves cloning quality:","")||"";W(!0);try{const f=await s.arrayBuffer(),A=btoa(String.fromCharCode(...new Uint8Array(f))),I=await ke(r,A,l),ge=I!=null&&I.duration?` Duration: ${I.duration}s,`:"";x("success",`Voice "${r}" uploaded!${ge} preprocessed and normalized.`);const J=await te();$(J.voices||[]),T(["default",...J.voices.map(ve=>ve.name)]),V(r)}catch(f){x("error",f instanceof Error?f.message:"Failed to upload voice")}finally{W(!1)}},t.click()},me=async t=>{try{x("success",`Generating preview for "${t}"...`);const s=["Hello, how can I help you today?","I am ready to assist you with anything you need.","Good morning. It is a pleasure to be of service."],r=s[Math.floor(Math.random()*s.length)],l=await Ve(t,r),p=new Blob([l],{type:"audio/wav"}),f=URL.createObjectURL(p),A=new Audio(f);A.onended=()=>URL.revokeObjectURL(f),A.play()}catch(s){x("error",s instanceof Error?s.message:"Failed to preview voice")}},ue=async t=>{if(confirm(`Delete voice "${t}"?`))try{await Te(t);const s=await te();$(s.voices||[]),T(["andrew",...s.voices.map(r=>r.name)]),k===t&&V("default"),x("success",`Voice "${t}" deleted`)}catch(s){x("error",s instanceof Error?s.message:"Failed to delete voice")}},x=(t,s)=>{c({type:t,message:s}),setTimeout(()=>c(null),3e3)},pe=async()=>{if(!(!u||u===P(o??{})))try{const t=N.find(r=>r.id===u);await Se(u,t==null?void 0:t.provider),Ce("model_switched",{model:u,provider:t==null?void 0:t.provider});const s=await ee();j(s),y(P(s)),x("success",`Switched to ${u}`)}catch(t){x("error",t instanceof Error?t.message:"Failed to switch model")}},he=async()=>{var t,s,r,l;C(!0);try{const p=await Le({voice:{enabled:i,livekitUrl:n,ttsVoice:k,ttsEngine:v,ttsUrl:re||"http://localhost:5005",sttUrl:((t=o==null?void 0:o.voice)==null?void 0:t.sttUrl)??"http://localhost:48421",livekitApiKey:((s=o==null?void 0:o.voice)==null?void 0:s.livekitApiKey)??"",livekitApiSecret:((r=o==null?void 0:o.voice)==null?void 0:r.livekitApiSecret)??"",agentUrl:((l=o==null?void 0:o.voice)==null?void 0:l.agentUrl)??""}});j(p),x("success","Settings saved"),i&&_()}catch(p){x("error",p instanceof Error?p.message:"Failed to save settings")}finally{C(!1)}};if(m)return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((t,s)=>e.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))});if(U)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ue,{title:"Settings",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Settings"},{label:"Settings"}]}),e.jsxs("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-error",children:[e.jsx(Z,{className:"h-5 w-5"}),e.jsx("p",{className:"text-sm font-medium",children:"Failed to load settings"})]}),e.jsx("p",{className:"mt-2 text-sm text-text-secondary",children:U}),e.jsx("button",{onClick:()=>window.location.reload(),className:"mt-4 rounded-lg bg-bg-tertiary px-4 py-2 text-sm text-text hover:bg-border transition-colors",children:"Retry"})]})]});const be=o?P(o):"";return e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx("h2",{className:"text-base md:text-lg font-semibold text-text",children:"Settings"}),g&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-3 md:px-4 py-2.5 md:py-2 text-[11px] md:text-sm ${g.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[g.type==="success"?e.jsx(Ee,{className:"h-4 w-4"}):e.jsx(Z,{className:"h-4 w-4"}),g.message]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-3 md:p-6",children:[e.jsx("h3",{className:"mb-3 md:mb-4 text-[11px] md:text-sm font-medium text-text-secondary",children:"Model"}),e.jsx($e,{models:N,selectedModel:u,onSelect:y,onSwitch:pe,currentModel:be})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-3 md:p-6",children:[e.jsxs("div",{className:"mb-3 md:mb-4 flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-4 w-4 text-accent-hover"}),e.jsx("h3",{className:"text-sm font-medium text-text-secondary",children:"Voice"}),e.jsx("span",{className:"rounded-full bg-accent/20 px-2 py-0.5 text-[9px] font-medium text-purple-light",children:((G=E.find(t=>t.id===v))==null?void 0:G.name)||v})]}),e.jsxs("button",{onClick:_,disabled:O,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-[10px] text-text-muted hover:bg-bg-tertiary hover:text-text-secondary transition-colors",children:[e.jsx(Pe,{className:`h-3 w-3 ${O?"animate-spin":""}`}),O?"Scanning...":"Scan Services"]})]}),e.jsxs("div",{className:"space-y-4",children:[b&&e.jsxs("div",{className:"rounded-lg border border-bg-tertiary bg-bg p-3",children:[e.jsx("p",{className:"mb-2 text-[10px] font-medium uppercase tracking-wider text-text-muted",children:"Service Discovery"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{label:"LiveKit Server",ok:b.livekit},{label:"Voice Agent",ok:b.agent},{label:"STT",ok:b.stt},{label:`TTS (${((X=E.find(t=>t.id===v))==null?void 0:X.name)||"TTS"})`,ok:b.tts}].map(({label:t,ok:s})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{ok:s}),e.jsx("span",{className:`text-xs ${s?"text-text-secondary":"text-text-muted"}`,children:t}),s&&e.jsx("span",{className:"text-[9px] text-success",children:"Online"})]},t))}),(L==null?void 0:L.available)!==void 0&&e.jsx("div",{className:"mt-2 flex items-center gap-2 border-t border-bg-tertiary pt-2",children:L.available?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"h-3.5 w-3.5 text-success"}),e.jsx("span",{className:"text-xs text-success",children:"Voice system ready"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"h-3.5 w-3.5 text-text-muted"}),e.jsx("span",{className:"text-xs text-text-muted",children:L.reason||"Voice not available"})]})})]}),e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:t=>d(t.target.checked),className:"h-4 w-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-sm text-text",children:"Enable Voice Chat"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs text-text-muted",children:"TTS Engine"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:E.map(t=>e.jsxs("button",{type:"button",onClick:()=>{q(t.id),K(t.defaultUrl),V(t.defaultVoices[0]||"default"),T(t.defaultVoices)},className:`rounded-lg border p-3 text-left transition-all min-h-[64px] active:scale-[0.98] sm:min-h-[56px] ${v===t.id?"border-accent bg-accent/10":"border-border hover:border-border-light"}`,children:[e.jsx("div",{className:"text-xs font-medium text-text",children:t.name}),e.jsx("div",{className:"mt-0.5 text-[10px] text-text-muted",children:t.desc})]},t.id))}),e.jsx("div",{className:"mt-3 rounded-xl border border-border bg-bg-secondary p-4 space-y-4",children:ie?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-accent2 animate-spin"}),e.jsx("span",{className:"text-sm font-medium text-text",children:"Installing F5-TTS..."})]}),e.jsx("div",{className:"rounded-lg bg-bg border border-bg-tertiary p-3",children:e.jsx("p",{className:"text-xs text-text-secondary font-mono break-all",children:ne})})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-success shadow-[0_0_6px_rgba(34,197,94,0.4)]"}),e.jsx("span",{className:"text-sm text-text",children:"F5-TTS Running"})]})}),e.jsxs("div",{className:"rounded-lg border border-bg-tertiary bg-bg p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-medium text-text-secondary",children:"Cloned Voices"}),e.jsxs("button",{onClick:xe,disabled:H,className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-accent2 border border-border hover:border-accent2/50 hover:bg-accent2/10 transition-colors disabled:opacity-50",children:[H?e.jsx(ae,{className:"h-3 w-3 animate-spin"}):e.jsx(Me,{className:"h-3 w-3 rotate-180"}),"Upload Voice"]})]}),e.jsx("p",{className:"text-[10px] text-text-muted leading-relaxed",children:"Upload 5-10 seconds of clear speech. No background noise or music. Adding a transcript significantly improves quality."}),z.length>0?e.jsx("div",{className:"space-y-1.5",children:z.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-bg-tertiary px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-3.5 w-3.5 text-accent2"}),e.jsx("span",{className:"text-sm text-text capitalize",children:t.name}),e.jsxs("span",{className:"text-[9px] text-text-muted",children:[(t.sizeBytes/1024).toFixed(0),"KB"]}),t.hasTranscript&&e.jsx("span",{className:"rounded bg-success/15 px-1 py-0.5 text-[8px] text-success",children:"transcript"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>me(t.name),className:"text-text-muted hover:text-accent2 transition-colors",title:"Preview voice",children:e.jsx(Fe,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>ue(t.name),className:"text-text-muted hover:text-error transition-colors",title:"Delete voice",children:e.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})})})]})]},t.name))}):e.jsx("p",{className:"text-xs text-text-muted",children:"No cloned voices yet. Upload a 5-10 second WAV reference to clone any voice."})]})]})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:["LiveKit URL",(b==null?void 0:b.livekit)&&e.jsx("span",{className:"rounded bg-success/15 px-1.5 py-0.5 text-[9px] font-medium text-success",children:"Connected"})]}),e.jsx("input",{value:n,onChange:t=>w(t.target.value),placeholder:"ws://localhost:7880",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs text-text-muted",children:"Voice"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:ce.map(t=>e.jsx("button",{type:"button",onClick:()=>V(t),className:`rounded-lg border px-3 py-2 text-sm transition-all capitalize ${k===t?"border-accent bg-accent/10 text-text":"border-border text-text-secondary hover:border-border-light hover:text-text"}`,children:t},t))}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:"F5-TTS voice cloning via MLX. Upload a 5-10 second reference audio to clone any voice."})]}),k&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-bg px-3 py-2",children:[e.jsx(D,{className:"h-3.5 w-3.5 text-accent-hover"}),e.jsx("span",{className:"text-xs text-text-muted",children:"Selected:"}),e.jsx("span",{className:"text-xs font-mono text-text-secondary",children:k}),e.jsx("span",{className:"ml-auto rounded bg-accent/15 px-1.5 py-0.5 text-[9px] font-medium text-purple-light",children:((Y=E.find(t=>t.id===v))==null?void 0:Y.name)||v})]})]})]}),e.jsxs("button",{onClick:he,disabled:h,className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(Ie,{className:"h-4 w-4"}),h?"Saving...":"Save Settings"]})]})}export{at as default};
|
|
1
|
+
import{r as a,b as B,J as fe,j as e,e as Z,W as je,K as ee,L as Ne,N as ye,O as we,P as Se,t as ke,Q as Ce,U as te,V as Ve,Y as Te,$ as Le}from"./index-NatBSFxj.js";import"./Input-bFsLI0fq.js";import{P as Ue}from"./PageHeader-Cwn3OALc.js";import{H as se}from"./Tooltip-CcoZrKsl.js";import{C as Ee}from"./circle-check-big-WaW3U3Xl.js";import{M as D}from"./VoiceOverlay-Dn6iaYgd.js";import{R as Pe,b as Ae,L as ae,c as Me}from"./TitanCanvas-Hk49NFcA.js";import{D as Ie}from"./download-YvPDLlFJ.js";import{P as Fe}from"./play-BPXbHToG.js";const I=["ollama","lmstudio","localai"];function $e({ok:o}){return o?e.jsx("div",{className:"h-2 w-2 rounded-full bg-success shadow-[0_0_6px_rgba(34,197,94,0.4)]"}):e.jsx("div",{className:"h-2 w-2 rounded-full bg-border-light"})}function Re({models:o,selectedModel:j,onSelect:N,onSwitch:F,currentModel:m}){const S=m.includes("/")?m.split("/")[0]:"",[h,k]=a.useState(S);a.useEffect(()=>{k(S)},[S]);const u=a.useMemo(()=>[...new Set(o.map(i=>i.provider))].sort((i,d)=>{const n=I.includes(i.toLowerCase()),w=I.includes(d.toLowerCase());return n&&!w?-1:!n&&w?1:i.localeCompare(d)}),[o]),y=a.useMemo(()=>o.filter(c=>c.provider===h),[o,h]),U=c=>{k(c);const i=o.filter(n=>n.provider===c),d=i.find(n=>n.id===m);d?N(d.id):i.length>0&&N(i[0].id)},$=j!==m,g=I.includes(h.toLowerCase());return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx("label",{className:"text-xs text-text-muted",children:"Provider"}),e.jsx(se,{title:"AI Provider",description:"The company or service that hosts the AI model. Local providers (Ollama, LM Studio) run on your machine. Cloud providers (Anthropic, OpenAI) run remotely and require an API key."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsx("select",{value:h,onChange:c=>U(c.target.value),className:"w-full rounded-lg border border-border bg-bg px-3 py-2.5 text-sm text-text outline-none transition-colors focus:border-accent min-h-[44px]",children:u.map(c=>{const i=I.includes(c.toLowerCase()),d=o.filter(n=>n.provider===c).length;return e.jsxs("option",{value:c,children:[i?`💻 ${c} (local)`:c," — ",d," model",d!==1?"s":""]},c)})}),g&&e.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap rounded bg-success/15 px-2 py-1 text-xs font-medium text-success self-start mt-0.5 sm:self-auto sm:mt-0",children:[e.jsx(ye,{className:"h-3 w-3"})," Local"]}),!g&&h&&e.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap rounded bg-accent/15 px-2 py-1 text-xs font-medium text-accent-hover self-start mt-0.5 sm:self-auto sm:mt-0",children:[e.jsx(we,{className:"h-3 w-3"})," Cloud"]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx("label",{className:"text-xs text-text-muted",children:"Model"}),e.jsx(se,{title:"Model Selection",description:"The specific AI model TITAN uses to think and respond. Larger models are smarter but slower and cost more. You can switch anytime without losing conversation history."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end gap-2 md:gap-3",children:[e.jsxs("select",{value:j,onChange:c=>N(c.target.value),className:"w-full rounded-lg border border-border bg-bg px-3 py-2.5 text-sm text-text outline-none transition-colors focus:border-accent min-h-[44px]",children:[y.map(c=>e.jsxs("option",{value:c.id,disabled:!c.available,children:[c.name,c.id===m?" (active)":"",c.available?"":" — unavailable"]},c.id)),y.length===0&&e.jsx("option",{disabled:!0,children:"No models for this provider"})]}),e.jsx("button",{onClick:F,disabled:!$,className:"rounded-lg bg-accent px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50 min-h-[44px] w-full sm:w-auto active:scale-[0.98]",children:"Switch"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-bg px-3 py-2.5",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-success animate-pulse flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:"Active:"}),e.jsx("span",{className:"text-xs text-text-secondary font-mono overflow-x-auto scrollbar-thin",children:m||"None"})]})]})}function at(){var G,X,Y;const[o,j]=a.useState(null),[N,F]=a.useState([]),[m,S]=a.useState(!0),[h,k]=a.useState(!1),[u,y]=a.useState(""),[U,$]=a.useState(null),[g,c]=a.useState(null),[i,d]=a.useState(!1),[n,w]=a.useState(""),[C,V]=a.useState("andrew"),[v,q]=a.useState("f5-tts"),[re,K]=a.useState("http://localhost:5006"),[ce,T]=a.useState(["andrew"]),[Oe,_e]=a.useState(null),[Be,De]=a.useState(!1),[qe,Ke]=a.useState(""),E=[{id:"f5-tts",name:"F5-TTS",desc:"Voice cloning with MLX (Apple Silicon)",defaultUrl:"http://localhost:5006",defaultVoices:["andrew"]}],[ze,oe]=a.useState(null),[ie,He]=a.useState(!1),[ne,We]=a.useState(""),[z,R]=a.useState([]),[H,W]=a.useState(!1),[b,le]=a.useState(null),[L,de]=a.useState(null),[O,Q]=a.useState(!1),P=t=>{var s;return((s=t==null?void 0:t.agent)==null?void 0:s.model)??(t==null?void 0:t.model)??""};a.useEffect(()=>{(async()=>{try{const[s,r]=await Promise.all([ee(),Ne()]);j(s),F(r),y(P(s));const l=(s==null?void 0:s.voice)??{};d(l.enabled??!1),w(l.livekitUrl??""),V(l.ttsVoice??"andrew"),q(l.ttsEngine??"f5-tts"),K(l.ttsUrl??"http://localhost:5006")}catch(s){const r=s instanceof Error?s.message:"Failed to load config";$(r),x("error",r)}finally{S(!1)}})()},[]),a.useEffect(()=>{(async()=>{var t;try{const s=await B("/api/voice/voices");if(s.ok){const r=await s.json();(t=r.voices)!=null&&t.length&&T(r.voices)}}catch{}})()},[]);const _=async()=>{Q(!0);try{const[t,s]=await Promise.allSettled([B("/api/voice/health").then(r=>r.json()),B("/api/voice/status").then(r=>r.json())]);t.status==="fulfilled"&&le(t.value),s.status==="fulfilled"&&(de(s.value),s.value.livekitUrl&&!n&&w(s.value.livekitUrl))}catch{}Q(!1)};a.useEffect(()=>{m||_()},[m]),a.useEffect(()=>{i&&fe().then(t=>{var s;oe({installed:t.installed,running:t.running,voices:t.voices}),R(t.voices.map(r=>({name:r,hasTranscript:!1,sizeBytes:0}))),(s=t.voices)!=null&&s.length&&T(["andrew",...t.voices])}).catch(()=>{})},[i]);const xe=async()=>{const t=document.createElement("input");t.type="file",t.accept="audio/wav,audio/mp3,audio/mpeg,audio/flac,.wav,.mp3,.flac",t.onchange=async()=>{var p;const s=(p=t.files)==null?void 0:p[0];if(!s)return;const r=prompt('Name this voice (e.g., "robin", "jarvis"):',s.name.replace(/\.[^.]+$/,""));if(!r)return;const l=prompt("(Optional) Transcript of the audio — improves cloning quality:","")||"";W(!0);try{const f=await s.arrayBuffer(),A=btoa(String.fromCharCode(...new Uint8Array(f))),M=await Ce(r,A,l),ge=M!=null&&M.duration?` Duration: ${M.duration}s,`:"";x("success",`Voice "${r}" uploaded!${ge} preprocessed and normalized.`);const J=await te();R(J.voices||[]),T(["default",...J.voices.map(ve=>ve.name)]),V(r)}catch(f){x("error",f instanceof Error?f.message:"Failed to upload voice")}finally{W(!1)}},t.click()},me=async t=>{try{x("success",`Generating preview for "${t}"...`);const s=["Hello, how can I help you today?","I am ready to assist you with anything you need.","Good morning. It is a pleasure to be of service."],r=s[Math.floor(Math.random()*s.length)],l=await Ve(t,r),p=new Blob([l],{type:"audio/wav"}),f=URL.createObjectURL(p),A=new Audio(f);A.onended=()=>URL.revokeObjectURL(f),A.play()}catch(s){x("error",s instanceof Error?s.message:"Failed to preview voice")}},ue=async t=>{if(confirm(`Delete voice "${t}"?`))try{await Te(t);const s=await te();R(s.voices||[]),T(["andrew",...s.voices.map(r=>r.name)]),C===t&&V("default"),x("success",`Voice "${t}" deleted`)}catch(s){x("error",s instanceof Error?s.message:"Failed to delete voice")}},x=(t,s)=>{c({type:t,message:s}),setTimeout(()=>c(null),3e3)},pe=async()=>{if(!(!u||u===P(o??{})))try{const t=N.find(r=>r.id===u);await Se(u,t==null?void 0:t.provider),ke("model_switched",{model:u,provider:t==null?void 0:t.provider});const s=await ee();j(s),y(P(s)),x("success",`Switched to ${u}`)}catch(t){x("error",t instanceof Error?t.message:"Failed to switch model")}},he=async()=>{var t,s,r,l;k(!0);try{const p=await Le({voice:{enabled:i,livekitUrl:n,ttsVoice:C,ttsEngine:v,ttsUrl:re||"http://localhost:5005",sttUrl:((t=o==null?void 0:o.voice)==null?void 0:t.sttUrl)??"http://localhost:48421",livekitApiKey:((s=o==null?void 0:o.voice)==null?void 0:s.livekitApiKey)??"",livekitApiSecret:((r=o==null?void 0:o.voice)==null?void 0:r.livekitApiSecret)??"",agentUrl:((l=o==null?void 0:o.voice)==null?void 0:l.agentUrl)??""}});j(p),x("success","Settings saved"),i&&_()}catch(p){x("error",p instanceof Error?p.message:"Failed to save settings")}finally{k(!1)}};if(m)return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((t,s)=>e.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))});if(U)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ue,{title:"Settings",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Settings"},{label:"Settings"}]}),e.jsxs("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-error",children:[e.jsx(Z,{className:"h-5 w-5"}),e.jsx("p",{className:"text-sm font-medium",children:"Failed to load settings"})]}),e.jsx("p",{className:"mt-2 text-sm text-text-secondary",children:U}),e.jsx("button",{onClick:()=>window.location.reload(),className:"mt-4 rounded-lg bg-bg-tertiary px-4 py-2 text-sm text-text hover:bg-border transition-colors",children:"Retry"})]})]});const be=o?P(o):"";return e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx("h2",{className:"text-base md:text-lg font-semibold text-text",children:"Settings"}),g&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-3 md:px-4 py-2.5 md:py-2 text-[11px] md:text-sm ${g.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[g.type==="success"?e.jsx(Ee,{className:"h-4 w-4"}):e.jsx(Z,{className:"h-4 w-4"}),g.message]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-3 md:p-6",children:[e.jsx("h3",{className:"mb-3 md:mb-4 text-[11px] md:text-sm font-medium text-text-secondary",children:"Model"}),e.jsx(Re,{models:N,selectedModel:u,onSelect:y,onSwitch:pe,currentModel:be})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-3 md:p-6",children:[e.jsxs("div",{className:"mb-3 md:mb-4 flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-4 w-4 text-accent-hover"}),e.jsx("h3",{className:"text-sm font-medium text-text-secondary",children:"Voice"}),e.jsx("span",{className:"rounded-full bg-accent/20 px-2 py-0.5 text-[9px] font-medium text-purple-light",children:((G=E.find(t=>t.id===v))==null?void 0:G.name)||v})]}),e.jsxs("button",{onClick:_,disabled:O,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-[10px] text-text-muted hover:bg-bg-tertiary hover:text-text-secondary transition-colors",children:[e.jsx(Pe,{className:`h-3 w-3 ${O?"animate-spin":""}`}),O?"Scanning...":"Scan Services"]})]}),e.jsxs("div",{className:"space-y-4",children:[b&&e.jsxs("div",{className:"rounded-lg border border-bg-tertiary bg-bg p-3",children:[e.jsx("p",{className:"mb-2 text-[10px] font-medium uppercase tracking-wider text-text-muted",children:"Service Discovery"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{label:"LiveKit Server",ok:b.livekit},{label:"Voice Agent",ok:b.agent},{label:"STT",ok:b.stt},{label:`TTS (${((X=E.find(t=>t.id===v))==null?void 0:X.name)||"TTS"})`,ok:b.tts}].map(({label:t,ok:s})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{ok:s}),e.jsx("span",{className:`text-xs ${s?"text-text-secondary":"text-text-muted"}`,children:t}),s&&e.jsx("span",{className:"text-[9px] text-success",children:"Online"})]},t))}),(L==null?void 0:L.available)!==void 0&&e.jsx("div",{className:"mt-2 flex items-center gap-2 border-t border-bg-tertiary pt-2",children:L.available?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"h-3.5 w-3.5 text-success"}),e.jsx("span",{className:"text-xs text-success",children:"Voice system ready"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"h-3.5 w-3.5 text-text-muted"}),e.jsx("span",{className:"text-xs text-text-muted",children:L.reason||"Voice not available"})]})})]}),e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:t=>d(t.target.checked),className:"h-4 w-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-sm text-text",children:"Enable Voice Chat"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs text-text-muted",children:"TTS Engine"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:E.map(t=>e.jsxs("button",{type:"button",onClick:()=>{q(t.id),K(t.defaultUrl),V(t.defaultVoices[0]||"default"),T(t.defaultVoices)},className:`rounded-lg border p-3 text-left transition-all min-h-[64px] active:scale-[0.98] sm:min-h-[56px] ${v===t.id?"border-accent bg-accent/10":"border-border hover:border-border-light"}`,children:[e.jsx("div",{className:"text-xs font-medium text-text",children:t.name}),e.jsx("div",{className:"mt-0.5 text-[10px] text-text-muted",children:t.desc})]},t.id))}),e.jsx("div",{className:"mt-3 rounded-xl border border-border bg-bg-secondary p-4 space-y-4",children:ie?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-accent2 animate-spin"}),e.jsx("span",{className:"text-sm font-medium text-text",children:"Installing F5-TTS..."})]}),e.jsx("div",{className:"rounded-lg bg-bg border border-bg-tertiary p-3",children:e.jsx("p",{className:"text-xs text-text-secondary font-mono break-all",children:ne})})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-success shadow-[0_0_6px_rgba(34,197,94,0.4)]"}),e.jsx("span",{className:"text-sm text-text",children:"F5-TTS Running"})]})}),e.jsxs("div",{className:"rounded-lg border border-bg-tertiary bg-bg p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-medium text-text-secondary",children:"Cloned Voices"}),e.jsxs("button",{onClick:xe,disabled:H,className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-accent2 border border-border hover:border-accent2/50 hover:bg-accent2/10 transition-colors disabled:opacity-50",children:[H?e.jsx(ae,{className:"h-3 w-3 animate-spin"}):e.jsx(Ie,{className:"h-3 w-3 rotate-180"}),"Upload Voice"]})]}),e.jsx("p",{className:"text-[10px] text-text-muted leading-relaxed",children:"Upload 5-10 seconds of clear speech. No background noise or music. Adding a transcript significantly improves quality."}),z.length>0?e.jsx("div",{className:"space-y-1.5",children:z.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-bg-tertiary px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-3.5 w-3.5 text-accent2"}),e.jsx("span",{className:"text-sm text-text capitalize",children:t.name}),e.jsxs("span",{className:"text-[9px] text-text-muted",children:[(t.sizeBytes/1024).toFixed(0),"KB"]}),t.hasTranscript&&e.jsx("span",{className:"rounded bg-success/15 px-1 py-0.5 text-[8px] text-success",children:"transcript"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>me(t.name),className:"text-text-muted hover:text-accent2 transition-colors",title:"Preview voice",children:e.jsx(Fe,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>ue(t.name),className:"text-text-muted hover:text-error transition-colors",title:"Delete voice",children:e.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})})})]})]},t.name))}):e.jsx("p",{className:"text-xs text-text-muted",children:"No cloned voices yet. Upload a 5-10 second WAV reference to clone any voice."})]})]})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:["LiveKit URL",(b==null?void 0:b.livekit)&&e.jsx("span",{className:"rounded bg-success/15 px-1.5 py-0.5 text-[9px] font-medium text-success",children:"Connected"})]}),e.jsx("input",{value:n,onChange:t=>w(t.target.value),placeholder:"ws://localhost:7880",className:"w-full rounded-lg border border-border bg-bg px-3 py-2 text-sm text-text outline-none focus:border-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs text-text-muted",children:"Voice"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:ce.map(t=>e.jsx("button",{type:"button",onClick:()=>V(t),className:`rounded-lg border px-3 py-2 text-sm transition-all capitalize ${C===t?"border-accent bg-accent/10 text-text":"border-border text-text-secondary hover:border-border-light hover:text-text"}`,children:t},t))}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:"F5-TTS voice cloning via MLX. Upload a 5-10 second reference audio to clone any voice."})]}),C&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-bg px-3 py-2",children:[e.jsx(D,{className:"h-3.5 w-3.5 text-accent-hover"}),e.jsx("span",{className:"text-xs text-text-muted",children:"Selected:"}),e.jsx("span",{className:"text-xs font-mono text-text-secondary",children:C}),e.jsx("span",{className:"ml-auto rounded bg-accent/15 px-1.5 py-0.5 text-[9px] font-medium text-purple-light",children:((Y=E.find(t=>t.id===v))==null?void 0:Y.name)||v})]})]})]}),e.jsxs("button",{onClick:he,disabled:h,className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(Me,{className:"h-4 w-4"}),h?"Saving...":"Save Settings"]})]})}export{at as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsPanel-DnEvJUFe.js","assets/index-NatBSFxj.js","assets/index-D932CbpQ.css","assets/Input-bFsLI0fq.js","assets/TitanCanvas-Hk49NFcA.js","assets/VoiceOverlay-Dn6iaYgd.js","assets/TitanCanvas-BfitWg9R.css","assets/PageHeader-Cwn3OALc.js","assets/Tooltip-CcoZrKsl.js","assets/circle-check-big-WaW3U3Xl.js","assets/download-YvPDLlFJ.js","assets/play-BPXbHToG.js","assets/SecurityPanel-i1QMctV0.js","assets/AuditPanel-B84Mp16G.js","assets/funnel-DqD9srZu.js","assets/AutonomyPanel-DOtiTFxV.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,j as e,n as o,_ as i}from"./index-NatBSFxj.js";const r=s.lazy(()=>i(()=>import("./SettingsPanel-DnEvJUFe.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),n=s.lazy(()=>i(()=>import("./SecurityPanel-i1QMctV0.js"),__vite__mapDeps([12,1,2,7,5]))),d=s.lazy(()=>i(()=>import("./AuditPanel-B84Mp16G.js"),__vite__mapDeps([13,1,2,4,5,6,14]))),c=s.lazy(()=>i(()=>import("./AutonomyPanel-DOtiTFxV.js"),__vite__mapDeps([15,1,2,4,5,6,9,11]))),x=[{id:"general",label:"General"},{id:"autonomy",label:"Autonomy"},{id:"security",label:"Security"},{id:"audit",label:"Audit Log"}];function u(){const[t,a]=s.useState("general");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:"Settings"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:x.map(l=>e.jsxs("button",{onClick:()=>a(l.id),className:o("px-3 py-2 text-xs font-medium transition-colors relative",t===l.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[l.label,t===l.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},l.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:[t==="general"&&e.jsx(r,{}),t==="autonomy"&&e.jsx(c,{}),t==="security"&&e.jsx(n,{}),t==="audit"&&e.jsx(d,{})]})})]})}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,n as t}from"./index-
|
|
1
|
+
import{j as r,n as t}from"./index-NatBSFxj.js";const s={card:"h-28 rounded-xl border border-border",row:"h-12 rounded-lg",text:"h-4 rounded",metric:"h-24 rounded-xl border border-border"};function m({variant:e="card",count:o=1,className:d}){return r.jsx(r.Fragment,{children:Array.from({length:o},(a,n)=>r.jsx("div",{className:t("skeleton-shimmer",s[e],d)},n))})}export{m as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as j,r as s,
|
|
1
|
+
import{c as j,r as s,ah as T,b as p,j as t}from"./index-NatBSFxj.js";import{P as I}from"./PageHeader-Cwn3OALc.js";import{a as $}from"./TitanCanvas-Hk49NFcA.js";import{T as E}from"./trash-2-C_Jsp23A.js";import{D as P}from"./download-YvPDLlFJ.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,b as l,j as s}from"./index-
|
|
1
|
+
import{r as i,b as l,j as s}from"./index-NatBSFxj.js";import"./Input-bFsLI0fq.js";import{H as M}from"./Tooltip-CcoZrKsl.js";import"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.js";const d={purpose:"var(--soma-purpose)",hunger:"var(--soma-hunger)",curiosity:"var(--soma-curiosity)",safety:"var(--soma-safety)",social:"var(--soma-social)",rest:"var(--soma-rest)"};function J(){var w,T;const[n,k]=i.useState(null),[_,$]=i.useState([]),[u,C]=i.useState([]),[x,v]=i.useState(null),[c,j]=i.useState(null),[f,N]=i.useState(!1),[m,S]=i.useState(null),h=i.useCallback((e,a="error")=>{S({message:e,type:a}),setTimeout(()=>S(null),4e3)},[]),r=i.useCallback(async()=>{try{const e=await l("/api/soma/state");if(e.ok){const a=await e.json();k(a)}}catch{}try{const e=await l("/api/soma/history?hours=24");if(e.ok){const a=await e.json();a.enabled&&$(a.history)}}catch{}try{const e=await l("/api/command-post/approvals?status=pending");if(e.ok){const a=await e.json();C(a.filter(o=>o.type==="soma_proposal"))}}catch{}},[]);i.useEffect(()=>{r();const e=setInterval(r,15e3),a=()=>r();return window.addEventListener("titan:soma:changed",a),()=>{clearInterval(e),window.removeEventListener("titan:soma:changed",a)}},[r]);const R=async e=>{try{const a=await l(`/api/command-post/approvals/${e}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decidedBy:"board"})});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);r()}catch(a){h(`Approve failed: ${a.message}`)}},z=async e=>{try{const a=await l(`/api/command-post/approvals/${e}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decidedBy:"board"})});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);r()}catch(a){h(`Reject failed: ${a.message}`)}},O=async()=>{if(!(!x||c===null)){N(!0);try{const e=await l("/api/soma/setpoints",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({[x]:c})});if(!e.ok)throw new Error(`${e.status} ${e.statusText}`);j(null),r()}catch(e){h(`Setpoint update failed: ${e.message}`)}N(!1)}},P=async(e,a)=>{try{const o=await l("/api/soma/weights",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:a})});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);r()}catch(o){h(`Weight update failed: ${o.message}`)}},A=async(e,a)=>{try{const o=await l(`/api/soma/drives/${e}/disable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({disabled:a})});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);r()}catch(o){h(`Drive toggle failed: ${o.message}`)}};if(!n)return s.jsx("div",{className:"soma-page",children:s.jsxs("div",{className:"soma-page__content",children:[s.jsx("div",{className:"soma-page__title",children:"TITAN-Soma"}),s.jsx("div",{className:"soma-page__subtitle",children:"Loading organism state…"})]})});if(!n.enabled)return s.jsx("div",{className:"soma-page",children:s.jsxs("div",{className:"soma-page__content",style:{maxWidth:640},children:[s.jsx("div",{className:"soma-page__title",children:"TITAN-Soma"}),s.jsx("div",{className:"soma-page__subtitle",children:"Homeostatic digital organism"}),s.jsxs("div",{style:{marginTop:32,padding:24,background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:12},children:[s.jsx("div",{style:{fontSize:14,color:"rgba(255,255,255,0.8)",marginBottom:12},children:n.message||"Soma is not enabled on this gateway."}),s.jsxs("div",{style:{fontSize:12,color:"rgba(255,255,255,0.45)",lineHeight:1.7},children:["To turn on the organism layer, edit ",s.jsx("code",{style:{background:"rgba(255,255,255,0.04)",padding:"2px 6px",borderRadius:4},children:"~/.titan/titan.json"})," and add:",s.jsx("pre",{style:{marginTop:12,padding:12,background:"rgba(0,0,0,0.3)",borderRadius:6,color:"rgba(255,255,255,0.8)",fontSize:11},children:`{
|
|
2
2
|
"organism": {
|
|
3
3
|
"enabled": true
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./index-
|
|
1
|
+
import{j as t}from"./index-NatBSFxj.js";function r({title:m,value:d,icon:s,trend:e,subtitle:x}){return t.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-3 md:p-4 min-h-[100px]",children:[s&&t.jsx("div",{className:"mb-1.5 md:mb-2 text-text-muted",children:s}),t.jsx("p",{className:"text-[11px] md:text-sm text-text-secondary",children:m}),t.jsxs("div",{className:"mt-1 flex items-baseline gap-2",children:[t.jsx("span",{className:"text-xl md:text-2xl font-semibold text-text",children:d}),e&&t.jsx("span",{className:e==="up"?"text-xs md:text-sm text-success":"text-xs md:text-sm text-error",children:e==="up"?"↑":"↓"})]}),x&&t.jsx("p",{className:"mt-1 text-[10px] md:text-xs text-text-muted",children:x})]})}export{r as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,n as g}from"./index-
|
|
1
|
+
import{j as s,n as g}from"./index-NatBSFxj.js";const d={active:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},running:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},completed:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},done:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},succeeded:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},enabled:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},healthy:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},approved:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},connected:{bg:"bg-success/10",text:"text-success",dot:"bg-success"},in_progress:{bg:"bg-accent/10",text:"text-accent",dot:"bg-accent"},in_review:{bg:"bg-accent/10",text:"text-accent",dot:"bg-accent"},processing:{bg:"bg-accent/10",text:"text-accent",dot:"bg-accent"},training:{bg:"bg-accent/10",text:"text-accent",dot:"bg-accent"},deploying:{bg:"bg-accent/10",text:"text-accent",dot:"bg-accent"},warning:{bg:"bg-warning/10",text:"text-warning",dot:"bg-warning"},pending:{bg:"bg-warning/10",text:"text-warning",dot:"bg-warning"},queued:{bg:"bg-warning/10",text:"text-warning",dot:"bg-warning"},backlog:{bg:"bg-warning/10",text:"text-warning",dot:"bg-warning"},todo:{bg:"bg-warning/10",text:"text-warning",dot:"bg-warning"},error:{bg:"bg-error/10",text:"text-error",dot:"bg-error"},failed:{bg:"bg-error/10",text:"text-error",dot:"bg-error"},critical:{bg:"bg-error/10",text:"text-error",dot:"bg-error"},rejected:{bg:"bg-error/10",text:"text-error",dot:"bg-error"},blocked:{bg:"bg-error/10",text:"text-error",dot:"bg-error"},idle:{bg:"bg-text-muted/10",text:"text-text-muted",dot:"bg-text-muted"},disabled:{bg:"bg-text-muted/10",text:"text-text-muted",dot:"bg-text-muted"},stopped:{bg:"bg-text-muted/10",text:"text-text-muted",dot:"bg-text-muted"},paused:{bg:"bg-text-muted/10",text:"text-text-muted",dot:"bg-text-muted"},cancelled:{bg:"bg-text-muted/10",text:"text-text-muted",dot:"bg-text-muted"},unknown:{bg:"bg-text-muted/10",text:"text-text-muted",dot:"bg-text-muted"}},o={bg:"bg-text-muted/10",text:"text-text-muted",dot:"bg-text-muted"};function u(t){return d[t.toLowerCase().replace(/[- ]/g,"_")]??o}function i({status:t,variant:n="pill",size:c="sm",label:r,className:x}){const e=u(t),b=r??t.replace(/_/g," ");return n==="dot"?s.jsxs("span",{className:g("inline-flex items-center gap-1.5",x),children:[s.jsx("span",{className:g("rounded-full",e.dot,c==="sm"?"h-1.5 w-1.5":"h-2 w-2")}),s.jsx("span",{className:g(e.text,c==="sm"?"text-xs":"text-sm"),children:b})]}):s.jsx("span",{className:g("inline-flex items-center rounded-full font-medium capitalize",e.bg,e.text,c==="sm"?"px-2 py-0.5 text-xs":"px-2.5 py-1 text-xs",x),children:b})}export{i as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,aQ as d,j as e,aR as n}from"./index-NatBSFxj.js";import{P as o}from"./PageHeader-Cwn3OALc.js";import{R as x,U as f}from"./TitanCanvas-Hk49NFcA.js";import{T as h}from"./trash-2-C_Jsp23A.js";import"./VoiceOverlay-Dn6iaYgd.js";function v(){const[l,c]=t.useState([]),[r,i]=t.useState(!0),s=t.useCallback(async()=>{i(!0);try{const a=await d();c(a.teams||[])}catch{}i(!1)},[]);t.useEffect(()=>{s()},[s]);const m=async a=>{if(confirm("Delete this team?"))try{await n(a),await s()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(o,{title:"Team Hub",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Security"},{label:"Teams"}]}),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(x,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:l.map(a=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:a.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[a.members.length," members • ",a.description]})]})]}),e.jsx("button",{onClick:()=>m(a.id),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(h,{className:"w-3.5 h-3.5"})})]},a.id))})]})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e,A as G,Z as S,
|
|
1
|
+
import{r as o,j as e,A as G,Z as S,C as I,d as T,ac as V,p as B,ad as $,ae as F,af as q,ag as U}from"./index-NatBSFxj.js";import{S as l}from"./StatCard-CY8lgeWm.js";import{C as W,e as x,h as Z}from"./TitanCanvas-Hk49NFcA.js";import{G as O}from"./git-branch-0FamUEbU.js";import{C as _}from"./chart-column-x6L66Qw7.js";import"./VoiceOverlay-Dn6iaYgd.js";function Y(){var m,u,h,g,j,p,v;const[s,C]=o.useState(null),[i,w]=o.useState(null),[a,M]=o.useState(null),[R,A]=o.useState(0),[L,P]=o.useState(0),[n,k]=o.useState(null),[D,E]=o.useState(!0);return o.useEffect(()=>{const t=async()=>{try{const[c,d,f,N,y,b]=await Promise.allSettled([V(),B(1),$(),F(100),q(100),U()]);c.status==="fulfilled"&&C(c.value),d.status==="fulfilled"&&w(d.value.stats),f.status==="fulfilled"&&M(f.value),N.status==="fulfilled"&&A((N.value.alerts||[]).length),y.status==="fulfilled"&&P((y.value.violations||[]).length),b.status==="fulfilled"&&k(b.value)}catch{}E(!1)};t();const r=setInterval(t,15e3);return()=>clearInterval(r)},[]),D?e.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:Array.from({length:8}).map((t,r)=>e.jsx("div",{className:"h-28 animate-pulse rounded-xl border border-border bg-bg-secondary"},r))}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-text",children:"Telemetry & Monitoring"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(l,{title:"Total Requests",value:((m=s==null?void 0:s.totalRequests)==null?void 0:m.toLocaleString())??"0",icon:e.jsx(G,{className:"h-5 w-5"})}),e.jsx(l,{title:"Avg Latency",value:s!=null&&s.avgLatencyMs?`${Math.round(s.avgLatencyMs)}ms`:"—",icon:e.jsx(W,{className:"h-5 w-5"})}),e.jsx(l,{title:"Error Rate",value:(s==null?void 0:s.errorRate)!==void 0?`${(s.errorRate*100).toFixed(1)}%`:"0%",icon:e.jsx(S,{className:"h-5 w-5"})}),e.jsx(l,{title:"Total Tokens",value:(()=>{const t=s==null?void 0:s.totalTokens;return typeof t=="number"?t.toLocaleString():t&&typeof t=="object"?(t.total??(t.prompt??0)+(t.completion??0)).toLocaleString():"0"})(),icon:e.jsx(I,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(l,{title:"Traces",value:((u=i==null?void 0:i.totalTraces)==null?void 0:u.toString())??"0",icon:e.jsx(O,{className:"h-5 w-5"})}),e.jsx(l,{title:"Avg Rounds/Task",value:((h=i==null?void 0:i.avgRounds)==null?void 0:h.toFixed(1))??"—",icon:e.jsx(_,{className:"h-5 w-5"})}),e.jsx(l,{title:"Soul Tasks",value:((g=a==null?void 0:a.totalTasks)==null?void 0:g.toString())??"0",icon:e.jsx(x,{className:"h-5 w-5"})}),e.jsx(l,{title:"Confidence",value:a!=null&&a.avgConfidence?`${Math.round(a.avgConfidence*100)}%`:"—",icon:e.jsx(x,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(l,{title:"Alerts",value:R.toString(),icon:e.jsx(T,{className:"h-5 w-5"})}),e.jsx(l,{title:"Guardrail Violations",value:L.toString(),icon:e.jsx(T,{className:"h-5 w-5"})}),e.jsx(l,{title:"Total Errors",value:((j=s==null?void 0:s.totalErrors)==null?void 0:j.toString())??"0",icon:e.jsx(S,{className:"h-5 w-5"})}),e.jsx(l,{title:"Learned Patterns",value:((v=(p=a==null?void 0:a.patterns)==null?void 0:p.length)==null?void 0:v.toString())??"0",icon:e.jsx(x,{className:"h-5 w-5"})})]}),n&&e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("h3",{className:"text-sm font-medium text-text-secondary mb-3 flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),"System Profile"]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"OS"})," ",e.jsxs("span",{className:"text-text-secondary ml-1",children:[n.os," ",n.arch]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"CPU"})," ",e.jsxs("span",{className:"text-text-secondary ml-1",children:[n.cpuCores,"c — ",n.cpuModel.split("@")[0].trim()]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"RAM"})," ",e.jsxs("span",{className:"text-text-secondary ml-1",children:[Math.round(n.ramTotalMB/1024),"GB"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"GPU"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.gpuName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Node"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.nodeVersion})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Install"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.installMethod})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Version"})," ",e.jsx("span",{className:"text-text-secondary ml-1",children:n.version})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"ID"})," ",e.jsx("span",{className:"text-text-secondary ml-1 font-mono",children:n.installId.slice(0,8)})]})]})]}),(s==null?void 0:s.topTools)&&s.topTools.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-3",children:"Top Tools"}),e.jsx("div",{className:"space-y-2",children:s.topTools.map((t,r)=>{const c=s.topTools[0].count,d=c>0?t.count/c*100:0;return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary w-24 truncate font-mono",children:t.tool}),e.jsx("div",{className:"flex-1 h-2 rounded-full bg-bg-tertiary overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-accent/60",style:{width:`${d}%`}})}),e.jsx("span",{className:"text-xs text-text-muted w-10 text-right",children:t.count})]},r)})})]}),(a==null?void 0:a.patterns)&&a.patterns.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-3",children:"Learned Task Patterns"}),e.jsx("div",{className:"grid grid-cols-1 gap-2 lg:grid-cols-2",children:a.patterns.slice(0,8).map((t,r)=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-bg-secondary border border-border text-xs",children:[e.jsx("span",{className:"text-text-secondary",children:t.taskType}),e.jsxs("div",{className:"flex items-center gap-3 text-text-muted",children:[e.jsx("span",{className:"font-mono",children:t.bestStrategy}),e.jsxs("span",{children:[t.avgRounds.toFixed(1)," rounds"]}),e.jsxs("span",{className:t.successRate>=.7?"text-success":"text-warning",children:[Math.round(t.successRate*100),"%"]})]})]},r))})]})]})}export{Y as default};
|