titan-agent 5.2.1 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -3
- package/dist/eval/harness.js +49 -0
- package/dist/eval/harness.js.map +1 -1
- package/dist/eval/parity.js +148 -0
- package/dist/eval/parity.js.map +1 -0
- package/dist/eval/record.js +96 -0
- package/dist/eval/record.js.map +1 -0
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/safety.js +31 -1
- package/dist/utils/safety.js.map +1 -1
- package/package.json +5 -1
- package/scripts/eval-gate.sh +189 -0
- package/scripts/eval-record.ts +133 -0
- package/ui/dist/assets/{AuditPanel-DLy0WJQZ.js → AuditPanel-C31LRHZX.js} +1 -1
- package/ui/dist/assets/{AutonomyPanel-DjFAQGns.js → AutonomyPanel-CxQU72ZY.js} +1 -1
- package/ui/dist/assets/{AutopilotPanel-nBluaHA4.js → AutopilotPanel-D4FnBwJm.js} +1 -1
- package/ui/dist/assets/{AutoresearchPanel-BDy8y_Cs.js → AutoresearchPanel-BYHXZ9AO.js} +1 -1
- package/ui/dist/assets/{BackupPanel-B_Fv2pJA.js → BackupPanel-C4CQKf2P.js} +1 -1
- package/ui/dist/assets/{BrowserPanel-DOCT3-Rq.js → BrowserPanel-C-OFYyLm.js} +1 -1
- package/ui/dist/assets/{CPAgents-CpkHf0b8.js → CPAgents-CvkZDm_3.js} +1 -1
- package/ui/dist/assets/{CPDashboard-CnMd6qNK.js → CPDashboard-JmBLBbj7.js} +1 -1
- package/ui/dist/assets/{CPFiles-BDRjJpYl.js → CPFiles-BDToRw0a.js} +1 -1
- package/ui/dist/assets/{CPGoals-2DrwHk62.js → CPGoals-Dh9qJNWa.js} +1 -1
- package/ui/dist/assets/{CPInbox-C6l2o4FD.js → CPInbox-B6iaIbNG.js} +1 -1
- package/ui/dist/assets/{CPSocial-Cea6NptR.js → CPSocial-CsFrwZRC.js} +1 -1
- package/ui/dist/assets/{ChannelsPanel-5EhhyXeg.js → ChannelsPanel-D-S4ktFn.js} +1 -1
- package/ui/dist/assets/{CheckpointsPanel-BVt2oEUe.js → CheckpointsPanel-D-sP9ZuS.js} +1 -1
- package/ui/dist/assets/{CommandPostHub-PXKE62DN.js → CommandPostHub-BhlNyeDH.js} +3 -3
- package/ui/dist/assets/{CronPanel-lAsoKavq.js → CronPanel-Bf3rV7N2.js} +1 -1
- package/ui/dist/assets/{DaemonPanel-xt08Rs10.js → DaemonPanel-GGBWjTG2.js} +1 -1
- package/ui/dist/assets/{DataTable-BHOu7fZP.js → DataTable-D2Px4o6f.js} +1 -1
- package/ui/dist/assets/{EmptyState-Dk7BBthD.js → EmptyState-DH6-Jy6A.js} +1 -1
- package/ui/dist/assets/EvalHarnessPanel-Cz9dRg61.js +2 -0
- package/ui/dist/assets/{EvalPanel-D9rDf1bk.js → EvalPanel-CdjxzHlJ.js} +1 -1
- package/ui/dist/assets/{FilesPanel-CNrDLmix.js → FilesPanel-Dz8TFydL.js} +1 -1
- package/ui/dist/assets/{FleetPanel-DP_ji0AE.js → FleetPanel-CWwWWTD4.js} +1 -1
- package/ui/dist/assets/{HomelabPanel-B4bCsrBw.js → HomelabPanel-C7VBV7AC.js} +1 -1
- package/ui/dist/assets/{InfraView-C5OYx_9s.js → InfraView-B1TgXARJ.js} +2 -2
- package/ui/dist/assets/{InlineEditableField-DyBCbIoN.js → InlineEditableField-DOJNOL8m.js} +1 -1
- package/ui/dist/assets/{Input-DWnbv1Yh.js → Input-BgyHgQ3D.js} +1 -1
- package/ui/dist/assets/{IntegrationsPanel-DsB6hjvE.js → IntegrationsPanel-O26b4nhv.js} +1 -1
- package/ui/dist/assets/{IntelligenceView-PIFGvIg_.js → IntelligenceView-DUhTQ8f_.js} +2 -2
- package/ui/dist/assets/{LearningPanel-D_S4HFX5.js → LearningPanel-DX5S9ovg.js} +1 -1
- package/ui/dist/assets/{LogsPanel-BnWNREPX.js → LogsPanel-DdeTnATQ.js} +1 -1
- package/ui/dist/assets/{McpPanel-CIMxZ2Am.js → McpPanel-BpXWrP1a.js} +1 -1
- package/ui/dist/assets/{MemoryGraphPanel-DD7x4rrm.js → MemoryGraphPanel-CNkZmTUy.js} +1 -1
- package/ui/dist/assets/{MemoryWikiPanel-BPPVAH0b.js → MemoryWikiPanel-o4L8Df-n.js} +1 -1
- package/ui/dist/assets/{MeshPanel-CiuwR3oV.js → MeshPanel-DMBQJFCC.js} +1 -1
- package/ui/dist/assets/{NvidiaPanel-DVntoRrH.js → NvidiaPanel-C8P-tJFG.js} +1 -1
- package/ui/dist/assets/{OrganismPanel-pqIKtHrW.js → OrganismPanel-CcfHDWDk.js} +1 -1
- package/ui/dist/assets/OverviewPanel-BSotI1Zv.js +1 -0
- package/ui/dist/assets/{PageHeader-CF75km05.js → PageHeader-DPJuAgJk.js} +1 -1
- package/ui/dist/assets/{PaperclipPanel-CwN5-cKg.js → PaperclipPanel-aXoXUjo6.js} +1 -1
- package/ui/dist/assets/{PersonasPanel-ClC_TTGX.js → PersonasPanel-DdPZxz2C.js} +1 -1
- package/ui/dist/assets/{RecipesPanel-Di2l-eOe.js → RecipesPanel-D7qffXQN.js} +1 -1
- package/ui/dist/assets/{SecurityPanel-DjC4pXGM.js → SecurityPanel-BDRK5el7.js} +1 -1
- package/ui/dist/assets/{SelfImprovePanel-CNpCp5N4.js → SelfImprovePanel-oYiMwFnA.js} +1 -1
- package/ui/dist/assets/{SelfProposalsPanel-BJL6Fjxo.js → SelfProposalsPanel-DOpNU_rr.js} +1 -1
- package/ui/dist/assets/{SessionsPanel-EAGKDQp0.js → SessionsPanel-eRbM3D9P.js} +1 -1
- package/ui/dist/assets/{SessionsTab-tc0njI15.js → SessionsTab-Jq3UKQCI.js} +1 -1
- package/ui/dist/assets/{SettingsPanel-BdSGImIa.js → SettingsPanel-DBIvKUYY.js} +1 -1
- package/ui/dist/assets/{SettingsView-DQB64bjy.js → SettingsView-yfSY4OLt.js} +2 -2
- package/ui/dist/assets/{SkeletonLoader-P8SFCyGi.js → SkeletonLoader-D1d-Gyyg.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-lDMl_8da.js → SkillsPanel-bubl9nag.js} +1 -1
- package/ui/dist/assets/{SomaView-BG7YvBu2.js → SomaView-D3aFL8Tw.js} +1 -1
- package/ui/dist/assets/{StatCard-Cv2u-yqA.js → StatCard-CEVFsz7t.js} +1 -1
- package/ui/dist/assets/{StatusBadge-JJeoEdCm.js → StatusBadge-DxeA9LNd.js} +1 -1
- package/ui/dist/assets/{TeamsPanel-D-iCyyYd.js → TeamsPanel-D6IJJIR_.js} +1 -1
- package/ui/dist/assets/{TelemetryPanel-DHNFyCwn.js → TelemetryPanel-SMPebdjQ.js} +1 -1
- package/ui/dist/assets/{TitanCanvas-BhurNMK3.js → TitanCanvas-BQU1yxqf.js} +3 -3
- package/ui/dist/assets/ToolsView-DgP4uRPr.js +2 -0
- package/ui/dist/assets/{Tooltip-D4IeQDJL.js → Tooltip-CNPQr7IO.js} +1 -1
- package/ui/dist/assets/{TraceViewer-CMd-Wi0z.js → TraceViewer-BbISy_ET.js} +1 -1
- package/ui/dist/assets/{TrainingPanel-CLtiBq2h.js → TrainingPanel-BdCHcv6t.js} +1 -1
- package/ui/dist/assets/{VoiceOverlay-BXPVdnJc.js → VoiceOverlay-l6yoasVz.js} +1 -1
- package/ui/dist/assets/{VramPanel-DjuwGUzA.js → VramPanel-XLhmen92.js} +1 -1
- package/ui/dist/assets/{WatchView-B7sDnMpl.js → WatchView-Bt-lNNWJ.js} +1 -1
- package/ui/dist/assets/{WorkTab-B5nQ4Y7A.js → WorkTab-IG-F6Qll.js} +1 -1
- package/ui/dist/assets/{WorkflowsPanel-2z0TeXyR.js → WorkflowsPanel-DsMpnwLK.js} +1 -1
- package/ui/dist/assets/{arrow-left-BKOkzkae.js → arrow-left-C_H9Z2Tm.js} +1 -1
- package/ui/dist/assets/{chart-column-D39PCk17.js → chart-column-rR6tb72l.js} +1 -1
- package/ui/dist/assets/{circle-check-big-CMz0QouP.js → circle-check-big-B1hMwau0.js} +1 -1
- package/ui/dist/assets/{dollar-sign-Bu8fZOQl.js → dollar-sign-DhYwsTnR.js} +1 -1
- package/ui/dist/assets/{download-vvx6zJ-U.js → download-UDDcAlZC.js} +1 -1
- package/ui/dist/assets/{eye-off-BPXFIzlW.js → eye-off-Cx0M_VQb.js} +1 -1
- package/ui/dist/assets/{funnel-Bqns-i8I.js → funnel-B7YvM1ei.js} +1 -1
- package/ui/dist/assets/{git-branch-CdmeqL8d.js → git-branch-BhTBN3J6.js} +1 -1
- package/ui/dist/assets/index-D0RJ8701.css +1 -0
- package/ui/dist/assets/{index-C6oarzis.js → index-D7Clon2u.js} +2 -2
- package/ui/dist/assets/layers-B6jDzitD.js +6 -0
- package/ui/dist/assets/{legacy-DFIaZTiF.js → legacy-av079XKu.js} +1 -1
- package/ui/dist/assets/{lightbulb-DOL6Q-iP.js → lightbulb-DRuQ3Chf.js} +1 -1
- package/ui/dist/assets/{pause-B0XymOnS.js → pause-DqkRWPB_.js} +1 -1
- package/ui/dist/assets/{play-Dwp2l5HG.js → play-hUyR3CVS.js} +1 -1
- package/ui/dist/assets/{plug-DRlTjWqQ.js → plug-CvpyjJt_.js} +1 -1
- package/ui/dist/assets/{proxy-sXxWK7WF.js → proxy-Cc5bR828.js} +1 -1
- package/ui/dist/assets/{square-yh0jffQZ.js → square-CdiC0J8Z.js} +1 -1
- package/ui/dist/assets/{target-GxtNG2RW.js → target-DemL8_0v.js} +1 -1
- package/ui/dist/assets/{toggle-right-CYQd_Ux1.js → toggle-right-Dsk892k5.js} +1 -1
- package/ui/dist/assets/{trash-2-B4jp_pAQ.js → trash-2-Byj4OvKB.js} +1 -1
- package/ui/dist/assets/{trending-up-B26tNhFP.js → trending-up-Dh_CffGX.js} +1 -1
- package/ui/dist/assets/{trophy-Bf3ZeSeb.js → trophy-DDr2AePx.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/EvalHarnessPanel-CJv8CUDy.js +0 -1
- package/ui/dist/assets/OverviewPanel-gqYRhmpF.js +0 -6
- package/ui/dist/assets/ToolsView-C8sWxLny.js +0 -2
- package/ui/dist/assets/index-DsFoD9SP.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as l,b as x,j as t,T as E,h,f as v}from"./index-
|
|
1
|
+
import{r as l,b as x,j as t,T as E,h,f as v}from"./index-D7Clon2u.js";import{P as g}from"./PageHeader-DPJuAgJk.js";import{G as I,C as f}from"./TitanCanvas-BQU1yxqf.js";import"./VoiceOverlay-l6yoasVz.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
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};
|
|
@@ -1 +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-
|
|
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-D7Clon2u.js";import{P as D}from"./PageHeader-DPJuAgJk.js";import"./Input-BgyHgQ3D.js";import{D as F}from"./DataTable-D2Px4o6f.js";import{I as P}from"./InlineEditableField-DOJNOL8m.js";import{a as A}from"./TitanCanvas-BQU1yxqf.js";import{T as I}from"./trash-2-Byj4OvKB.js";import"./VoiceOverlay-l6yoasVz.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,b as j,X as A}from"./index-
|
|
1
|
+
import{r as c,j as e,b as j,X as A}from"./index-D7Clon2u.js";import{A as E,m as v}from"./proxy-Cc5bR828.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,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-C6oarzis.js";import"./Input-DWnbv1Yh.js";import{P as Ue}from"./PageHeader-CF75km05.js";import{H as se}from"./Tooltip-D4IeQDJL.js";import{C as Ee}from"./circle-check-big-CMz0QouP.js";import{M as D}from"./VoiceOverlay-BXPVdnJc.js";import{R as Pe,b as Ae,L as ae,c as Me}from"./TitanCanvas-BhurNMK3.js";import{D as Ie}from"./download-vvx6zJ-U.js";import{P as Fe}from"./play-Dwp2l5HG.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};
|
|
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-D7Clon2u.js";import"./Input-BgyHgQ3D.js";import{P as Ue}from"./PageHeader-DPJuAgJk.js";import{H as se}from"./Tooltip-CNPQr7IO.js";import{C as Ee}from"./circle-check-big-B1hMwau0.js";import{M as D}from"./VoiceOverlay-l6yoasVz.js";import{R as Pe,b as Ae,L as ae,c as Me}from"./TitanCanvas-BQU1yxqf.js";import{D as Ie}from"./download-UDDcAlZC.js";import{P as Fe}from"./play-hUyR3CVS.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsPanel-
|
|
2
|
-
import{r as s,j as e,n as o,_ as i}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsPanel-DBIvKUYY.js","assets/index-D7Clon2u.js","assets/index-D0RJ8701.css","assets/Input-BgyHgQ3D.js","assets/TitanCanvas-BQU1yxqf.js","assets/VoiceOverlay-l6yoasVz.js","assets/TitanCanvas-BfitWg9R.css","assets/PageHeader-DPJuAgJk.js","assets/Tooltip-CNPQr7IO.js","assets/circle-check-big-B1hMwau0.js","assets/download-UDDcAlZC.js","assets/play-hUyR3CVS.js","assets/SecurityPanel-BDRK5el7.js","assets/AuditPanel-C31LRHZX.js","assets/funnel-B7YvM1ei.js","assets/AutonomyPanel-CxQU72ZY.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,j as e,n as o,_ as i}from"./index-D7Clon2u.js";const r=s.lazy(()=>i(()=>import("./SettingsPanel-DBIvKUYY.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),n=s.lazy(()=>i(()=>import("./SecurityPanel-BDRK5el7.js"),__vite__mapDeps([12,1,2,7,5]))),d=s.lazy(()=>i(()=>import("./AuditPanel-C31LRHZX.js"),__vite__mapDeps([13,1,2,4,5,6,14]))),c=s.lazy(()=>i(()=>import("./AutonomyPanel-CxQU72ZY.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-D7Clon2u.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,ah as T,b as p,j as t}from"./index-
|
|
1
|
+
import{c as j,r as s,ah as T,b as p,j as t}from"./index-D7Clon2u.js";import{P as I}from"./PageHeader-DPJuAgJk.js";import{a as $}from"./TitanCanvas-BQU1yxqf.js";import{T as E}from"./trash-2-Byj4OvKB.js";import{D as P}from"./download-UDDcAlZC.js";import"./VoiceOverlay-l6yoasVz.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,b as l,j as s}from"./index-
|
|
1
|
+
import{r as i,b as l,j as s}from"./index-D7Clon2u.js";import"./Input-BgyHgQ3D.js";import{H as M}from"./Tooltip-CNPQr7IO.js";import"./TitanCanvas-BQU1yxqf.js";import"./VoiceOverlay-l6yoasVz.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-D7Clon2u.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-D7Clon2u.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,aQ as d,j as e,aR as n}from"./index-
|
|
1
|
+
import{r as t,aQ as d,j as e,aR as n}from"./index-D7Clon2u.js";import{P as o}from"./PageHeader-DPJuAgJk.js";import{R as x,U as f}from"./TitanCanvas-BQU1yxqf.js";import{T as h}from"./trash-2-Byj4OvKB.js";import"./VoiceOverlay-l6yoasVz.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,C as I,d as T,ac as V,p as B,ad as $,ae as F,af as q,ag as U}from"./index-
|
|
1
|
+
import{r as o,j as e,A as G,Z as S,C as I,d as T,ac as V,p as B,ad as $,ae as F,af as q,ag as U}from"./index-D7Clon2u.js";import{S as l}from"./StatCard-CEVFsz7t.js";import{C as W,e as x,h as Z}from"./TitanCanvas-BQU1yxqf.js";import{G as O}from"./git-branch-BhTBN3J6.js";import{C as _}from"./chart-column-rR6tb72l.js";import"./VoiceOverlay-l6yoasVz.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};
|