titan-agent 6.3.1 → 6.3.2
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/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/package.json +1 -1
- package/ui/dist/assets/{AuditPanel-TdDAyJUQ.js → AuditPanel-6hTX-30T.js} +1 -1
- package/ui/dist/assets/{AutonomyPanel-B6EIpuFt.js → AutonomyPanel-bEolzW0c.js} +1 -1
- package/ui/dist/assets/{AutopilotPanel-CLe14-eq.js → AutopilotPanel-BBhP6EEw.js} +1 -1
- package/ui/dist/assets/{AutoresearchPanel-C14q_kh7.js → AutoresearchPanel-CmSoFu9c.js} +1 -1
- package/ui/dist/assets/{BackupPanel-CoEbryip.js → BackupPanel-BMqXOM64.js} +1 -1
- package/ui/dist/assets/{BrowserPanel-CRTJOXQV.js → BrowserPanel-DqpJBtZO.js} +1 -1
- package/ui/dist/assets/{CPActivity-DjT8p5Dn.js → CPActivity-kjPVmtna.js} +1 -1
- package/ui/dist/assets/{CPAgentDetail-CR1ciISN.js → CPAgentDetail-DJVqWbIz.js} +1 -1
- package/ui/dist/assets/{CPAgents-DIYCdpQR.js → CPAgents-DvoKU7K3.js} +1 -1
- package/ui/dist/assets/{CPApprovals-DAKmaSkN.js → CPApprovals-CgkIcjKy.js} +1 -1
- package/ui/dist/assets/{CPCosts-CCCh_VY0.js → CPCosts-Dh2-rKBQ.js} +1 -1
- package/ui/dist/assets/{CPDashboard-CyKZGlHB.js → CPDashboard-Bk5ehnOo.js} +1 -1
- package/ui/dist/assets/{CPFiles-CI252ucO.js → CPFiles-85DnmiZ9.js} +1 -1
- package/ui/dist/assets/{CPGoals-BtcgDUY5.js → CPGoals-CmaEWa0s.js} +1 -1
- package/ui/dist/assets/{CPInbox-igQoKOuB.js → CPInbox-DyrwUxsn.js} +1 -1
- package/ui/dist/assets/{CPIssueDetail-DD5iL5mT.js → CPIssueDetail-tuKkMZU0.js} +1 -1
- package/ui/dist/assets/{CPIssues-C1XUjgdv.js → CPIssues-CRkGwoU7.js} +1 -1
- package/ui/dist/assets/CPLayout-BUN7FasU.js +2 -0
- package/ui/dist/assets/{CPOrg-JyXp44DB.js → CPOrg-BiYIRMSl.js} +1 -1
- package/ui/dist/assets/{CPRuns-C-gZX28e.js → CPRuns-_2GvItJv.js} +1 -1
- package/ui/dist/assets/{CPSocial-sMl4vqmX.js → CPSocial-BBdyKNyq.js} +1 -1
- package/ui/dist/assets/{CPVoice-BXTY3vl7.js → CPVoice-BnYo-G04.js} +1 -1
- package/ui/dist/assets/{ChannelsPanel-rF_yHmYD.js → ChannelsPanel-e1nT5QcW.js} +1 -1
- package/ui/dist/assets/{CheckpointsPanel-DO0QSjuz.js → CheckpointsPanel-BixKyU53.js} +1 -1
- package/ui/dist/assets/{CommandPostHub-BLnNTvBO.js → CommandPostHub-Ckh7LlWG.js} +3 -3
- package/ui/dist/assets/{CronPanel-DELTcCV-.js → CronPanel-BMneWRHA.js} +1 -1
- package/ui/dist/assets/{DataTable-BmbYppBc.js → DataTable-CEjOtKUe.js} +1 -1
- package/ui/dist/assets/{DreamPanel-B28qIraZ.js → DreamPanel-BJO5hRUh.js} +1 -1
- package/ui/dist/assets/{EmptyState-CxJGUl_w.js → EmptyState-CB9me2NW.js} +1 -1
- package/ui/dist/assets/{EvalHarnessPanel-DvI-dsqQ.js → EvalHarnessPanel-Dg_ghVTz.js} +1 -1
- package/ui/dist/assets/{EvalPanel-DKdn69V8.js → EvalPanel-j3fHE-k4.js} +1 -1
- package/ui/dist/assets/{FileViewer-Deg5Z7ng.js → FileViewer-C7fgbngf.js} +1 -1
- package/ui/dist/assets/{FilesPanel-DDRjQukY.js → FilesPanel-Cimj2Z8k.js} +1 -1
- package/ui/dist/assets/{FleetPanel-eEudyOkP.js → FleetPanel-zzprw7Ro.js} +1 -1
- package/ui/dist/assets/{HomelabPanel-Dov1f68P.js → HomelabPanel-C658fL2z.js} +1 -1
- package/ui/dist/assets/InfraView-DAwJClAs.js +2 -0
- package/ui/dist/assets/{InlineEditableField-4ZA-KEfv.js → InlineEditableField-ChiCaepw.js} +1 -1
- package/ui/dist/assets/{Input-C7lzcGqx.js → Input-DoWIY9i3.js} +1 -1
- package/ui/dist/assets/{IntegrationsPanel-BmnWsnvF.js → IntegrationsPanel-Xy3HlXti.js} +1 -1
- package/ui/dist/assets/IntelligenceView-CJ2r76hu.js +2 -0
- package/ui/dist/assets/{LearningPanel-BsKhgbeS.js → LearningPanel-Ka17sHxK.js} +1 -1
- package/ui/dist/assets/{LogsPanel-C-H_axtp.js → LogsPanel-BiELvlMC.js} +1 -1
- package/ui/dist/assets/{McpPanel-BizAlt2h.js → McpPanel-BW2r8V3m.js} +1 -1
- package/ui/dist/assets/{MemoryGraphPanel-Qle7Bodz.js → MemoryGraphPanel-DZTQIsys.js} +1 -1
- package/ui/dist/assets/{MemoryWikiPanel-CKY4HY4k.js → MemoryWikiPanel-BSbG8c80.js} +1 -1
- package/ui/dist/assets/{MeshPanel-D35hLDX4.js → MeshPanel-Ch_uGo4a.js} +1 -1
- package/ui/dist/assets/{MissionCanvas-BU6dvWdk.js → MissionCanvas-BMv0c-RX.js} +1 -1
- package/ui/dist/assets/{MissionChat-BCxqk708.js → MissionChat-CFwKDVc8.js} +1 -1
- package/ui/dist/assets/{MissionLibrary-DtovbHf7.js → MissionLibrary-D2LfLlm2.js} +1 -1
- package/ui/dist/assets/{MissionStart-DQCW6cLo.js → MissionStart-CTyqZWBT.js} +1 -1
- package/ui/dist/assets/{Modal-CpcFi-Gm.js → Modal-BS3rireW.js} +1 -1
- package/ui/dist/assets/{NvidiaPanel-Dwvf8UD2.js → NvidiaPanel-53CiSPrh.js} +1 -1
- package/ui/dist/assets/{OrganismPanel-mhCf2syl.js → OrganismPanel-BRbiiY5k.js} +1 -1
- package/ui/dist/assets/{OverviewPanel-DiOrl6LB.js → OverviewPanel-CmRVwkE7.js} +1 -1
- package/ui/dist/assets/{PageHeader-CPfyiZIM.js → PageHeader-Cx4DHJXy.js} +1 -1
- package/ui/dist/assets/{PersonaProfilesPanel-BvQlozzS.js → PersonaProfilesPanel-hmUdUabW.js} +1 -1
- package/ui/dist/assets/{PersonasPanel-G5Jz55AB.js → PersonasPanel-VfvknF9L.js} +1 -1
- package/ui/dist/assets/{PhoneDeskPanel-Cx4wlgRT.js → PhoneDeskPanel-DX_6zrt5.js} +1 -1
- package/ui/dist/assets/{RecipesPanel-DB6Kuo1a.js → RecipesPanel-B7NygJvl.js} +1 -1
- package/ui/dist/assets/{SecurityPanel-BcnpsElV.js → SecurityPanel-DRZu6PRV.js} +1 -1
- package/ui/dist/assets/{SelfImprovePanel-do5xDzc8.js → SelfImprovePanel-CgJG9v1W.js} +1 -1
- package/ui/dist/assets/{SelfProposalsPanel-DM4B-HLa.js → SelfProposalsPanel-BenuzEGo.js} +1 -1
- package/ui/dist/assets/{SessionsPanel-Bl8h6Bfu.js → SessionsPanel-CFdsWt2W.js} +1 -1
- package/ui/dist/assets/{SessionsTab-hihe8Dc7.js → SessionsTab-8Qtu9BMv.js} +1 -1
- package/ui/dist/assets/{SettingsPanel-Cp8decIS.js → SettingsPanel-CmIAAw_T.js} +1 -1
- package/ui/dist/assets/SettingsView-ByyjhwLz.js +2 -0
- package/ui/dist/assets/{SkeletonLoader-DLzSaIMH.js → SkeletonLoader-crWOfBFq.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-B0VL9cO1.js → SkillsPanel-BINP41r2.js} +1 -1
- package/ui/dist/assets/{SomaView-BejcfdMM.js → SomaView-CzZ6SCuw.js} +1 -1
- package/ui/dist/assets/{StatCard-Bt-57DK2.js → StatCard-DfoksLmM.js} +1 -1
- package/ui/dist/assets/{StatusBadge-BE0SQNPu.js → StatusBadge-FyqmZDG0.js} +1 -1
- package/ui/dist/assets/{Tabs-dEteLxhl.js → Tabs-BMzVMYab.js} +1 -1
- package/ui/dist/assets/{TeamsPanel-7UwGxnbj.js → TeamsPanel-CwVNzD77.js} +1 -1
- package/ui/dist/assets/{TelemetryPanel-CqbkTW3V.js → TelemetryPanel-C3JTWWQO.js} +1 -1
- package/ui/dist/assets/{TitanCanvas-RVuBEoV1.js → TitanCanvas-CmVs4TFr.js} +25 -25
- package/ui/dist/assets/{ToolsView-C97QnPeY.js → ToolsView-C3m7TbnX.js} +2 -2
- package/ui/dist/assets/{Tooltip-BGe4ZrLD.js → Tooltip-DZJl8UaT.js} +1 -1
- package/ui/dist/assets/{TraceViewer-CSj_fZou.js → TraceViewer-CfFZQJ3K.js} +1 -1
- package/ui/dist/assets/{TrainingPanel-43gDnkVS.js → TrainingPanel-BMunX3EV.js} +1 -1
- package/ui/dist/assets/{VoiceOverlay-CvZcewVV.js → VoiceOverlay-DRjTeQgq.js} +1 -1
- package/ui/dist/assets/{VramPanel-nadiVKRZ.js → VramPanel-C4nG82nu.js} +1 -1
- package/ui/dist/assets/{WatchView-CUGArdWk.js → WatchView-Cflz1FfL.js} +1 -1
- package/ui/dist/assets/{WorkTab-iCDNyX60.js → WorkTab-BglKN8Uf.js} +1 -1
- package/ui/dist/assets/{WorkflowsPanel-Do5EOPQ-.js → WorkflowsPanel-BZQu93gE.js} +1 -1
- package/ui/dist/assets/{archive-96Jj-QYz.js → archive-C10aphzL.js} +1 -1
- package/ui/dist/assets/{arrow-left-DvmiAV7y.js → arrow-left-CLTerrT5.js} +1 -1
- package/ui/dist/assets/{book-open-DvAaokKW.js → book-open-DQ4VpfMq.js} +1 -1
- package/ui/dist/assets/{bot-DFsTWhzD.js → bot-DNI_W-iH.js} +1 -1
- package/ui/dist/assets/{chart-column-BWW8khga.js → chart-column-COymYluE.js} +1 -1
- package/ui/dist/assets/{check-4bqUIREX.js → check-Dq1bBdnM.js} +1 -1
- package/ui/dist/assets/{chevron-right-DhAaVOkv.js → chevron-right-Dz0EiJIX.js} +1 -1
- package/ui/dist/assets/{chevron-up-DhONR6eV.js → chevron-up-CaJdgiQv.js} +1 -1
- package/ui/dist/assets/{circle-check-big-CrrpTfnZ.js → circle-check-big-Bi688_yD.js} +1 -1
- package/ui/dist/assets/{circle-stop-BOU58Urf.js → circle-stop-BKeZMLyT.js} +1 -1
- package/ui/dist/assets/{clipboard-list-GcIgVrYh.js → clipboard-list-BvhH8UZ-.js} +1 -1
- package/ui/dist/assets/{clock-D5MlrzQb.js → clock-BiDhhRG4.js} +1 -1
- package/ui/dist/assets/{dollar-sign-B9t2KmrG.js → dollar-sign-XvC0BdrI.js} +1 -1
- package/ui/dist/assets/{download-DzgUP-io.js → download-BUv-3ow-.js} +1 -1
- package/ui/dist/assets/{external-link--90_rW_r.js → external-link-6i_dEGHo.js} +1 -1
- package/ui/dist/assets/{file-text-C-9as3zm.js → file-text-CMteaHPb.js} +1 -1
- package/ui/dist/assets/{flask-conical-BJnD20AK.js → flask-conical-DOupoJs-.js} +1 -1
- package/ui/dist/assets/{folder-BXotS0h-.js → folder-Heg9X62R.js} +1 -1
- package/ui/dist/assets/{funnel-BkW9zcis.js → funnel-C1qSeehb.js} +1 -1
- package/ui/dist/assets/{git-branch-D7pbvkyu.js → git-branch-BgrSzLGu.js} +1 -1
- package/ui/dist/assets/{index-DczEfArU.js → index-CfeeNofL.js} +23 -23
- package/ui/dist/assets/{layers-BgUh-m00.js → layers-BXjHgthV.js} +1 -1
- package/ui/dist/assets/{legacy-Wbf7An22.js → legacy-CMWeVEm-.js} +1 -1
- package/ui/dist/assets/{lightbulb-4Yox7P7Z.js → lightbulb-CaU3yf0V.js} +1 -1
- package/ui/dist/assets/{list-todo-JeleiL5r.js → list-todo-DIH1DDut.js} +1 -1
- package/ui/dist/assets/{message-square-C9bK5TAD.js → message-square-CAJnwIi8.js} +1 -1
- package/ui/dist/assets/{mic-DwEnBcFd.js → mic-a150MaF_.js} +1 -1
- package/ui/dist/assets/{missions-Jbe_PHaT.js → missions-BCmxIqis.js} +1 -1
- package/ui/dist/assets/{network-BjQmrmO8.js → network-DpJozzT9.js} +1 -1
- package/ui/dist/assets/{pause-9vYiD-5Y.js → pause-B7pXF6wS.js} +1 -1
- package/ui/dist/assets/{pencil-CygyIvE1.js → pencil-DNQZmkMU.js} +1 -1
- package/ui/dist/assets/{play-7ImYx-M6.js → play-CB_hciEJ.js} +1 -1
- package/ui/dist/assets/{plug-DXmJpsfC.js → plug-UdiCBZ6I.js} +1 -1
- package/ui/dist/assets/{plus-LIrhsu2s.js → plus-BNliIo_L.js} +1 -1
- package/ui/dist/assets/{proxy-B72L9I2p.js → proxy-tgCU20-X.js} +1 -1
- package/ui/dist/assets/{radio-DN9FsrLZ.js → radio-KEVgfxWk.js} +1 -1
- package/ui/dist/assets/{refresh-cw-DyPWslHB.js → refresh-cw-C4BAymqq.js} +1 -1
- package/ui/dist/assets/{rotate-ccw-C7z7lzst.js → rotate-ccw-CyT1wcCY.js} +1 -1
- package/ui/dist/assets/{save-Bl0vY0Ur.js → save-ICOKiEQf.js} +1 -1
- package/ui/dist/assets/{search-DLl1kVch.js → search-qz2VMyBQ.js} +1 -1
- package/ui/dist/assets/{send-BqZ0Qzz-.js → send-AYGyxY6d.js} +1 -1
- package/ui/dist/assets/{server-DvPKxeOK.js → server-DMkFokTU.js} +1 -1
- package/ui/dist/assets/{shield-check-DMM8OpD5.js → shield-check-Dtr3ujKk.js} +1 -1
- package/ui/dist/assets/{terminal-DD6OAIa2.js → terminal-ucriUmF-.js} +1 -1
- package/ui/dist/assets/{test-tube-BoC1tTKm.js → test-tube-Co4Kjj0G.js} +1 -1
- package/ui/dist/assets/{toggle-right-CrEdx-9K.js → toggle-right-NKDEGJdm.js} +1 -1
- package/ui/dist/assets/{trash-2-Co50XYSn.js → trash-2-CJjOlqMp.js} +1 -1
- package/ui/dist/assets/{trending-up-SFD19agk.js → trending-up-CC4itzlz.js} +1 -1
- package/ui/dist/assets/{trophy-DLTd-oCR.js → trophy-BP9FY35i.js} +1 -1
- package/ui/dist/assets/{volume-2-vQvjPYVu.js → volume-2-CAQ1nA-B.js} +1 -1
- package/ui/dist/assets/{wifi-off-DVwDeeLz.js → wifi-off-jrnDcc0y.js} +1 -1
- package/ui/dist/index.html +1 -1
- package/ui/dist/sw.js +1 -1
- package/ui/dist/assets/CPLayout-VXhuxAHd.js +0 -2
- package/ui/dist/assets/InfraView-DgasEqoR.js +0 -2
- package/ui/dist/assets/IntelligenceView-DXYSyS1a.js +0 -2
- package/ui/dist/assets/SettingsView-BZIgBz0P.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,y as k,j as e,D as T,F as P}from"./index-
|
|
1
|
+
import{r as s,y as k,j as e,D as T,F as P}from"./index-CfeeNofL.js";import{B as u}from"./Input-DoWIY9i3.js";import{S as D}from"./StatusBadge-FyqmZDG0.js";import{P as z}from"./PageHeader-Cx4DHJXy.js";import{E}from"./EmptyState-CB9me2NW.js";import{T as L}from"./Tabs-BMzVMYab.js";import{M}from"./Modal-BS3rireW.js";import{S as $}from"./SkeletonLoader-crWOfBFq.js";import{P as A}from"./plus-BNliIo_L.js";import{L as B}from"./list-todo-DIH1DDut.js";import"./clsx-B-dksMZM.js";import"./chevron-right-Dz0EiJIX.js";import"./proxy-tgCU20-X.js";function R(a){const r=Math.floor((Date.now()-new Date(a).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}const _={critical:"text-error",high:"text-warning",medium:"text-accent",low:"text-text-muted"},F=[{id:"all",label:"All"},{id:"backlog",label:"Backlog"},{id:"todo",label:"Todo"},{id:"in_progress",label:"In Progress"},{id:"in_review",label:"In Review"},{id:"done",label:"Done"},{id:"blocked",label:"Blocked"}];function ee(){const[a,r]=s.useState([]),[c,w]=s.useState(!0),[l,m]=s.useState(null),[o,y]=s.useState("all"),[v,i]=s.useState(!1),[n,h]=s.useState(""),[p,b]=s.useState("medium"),[f,g]=s.useState(""),[C,j]=s.useState(!1),d=s.useCallback(async()=>{try{const t=await k();r(t),m(null)}catch(t){m(t instanceof Error?t.message:"Failed to load issues")}w(!1)},[]);s.useEffect(()=>{d()},[d]);const N=async()=>{if(n.trim()){j(!0);try{await P({title:n,description:f,priority:p}),i(!1),h(""),g(""),b("medium"),await d()}catch{}j(!1)}},x=o==="all"?a:a.filter(t=>t.status===o),S=F.map(t=>({...t,count:t.id==="all"?a.length:a.filter(I=>I.status===t.id).length}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{title:"Issues",breadcrumbs:[{label:"Command Post"},{label:"Issues"}],actions:e.jsx(u,{size:"sm",icon:e.jsx(A,{size:14}),onClick:()=>i(!0),children:"New Issue"})}),e.jsx(L,{tabs:S,activeTab:o,onChange:y}),c&&e.jsx($,{variant:"row",count:6}),l&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:l}),!c&&!l&&x.length===0&&e.jsx(E,{icon:e.jsx(B,{size:32}),title:"No issues",description:o==="all"?"Create your first issue to get started.":`No ${o.replace(/_/g," ")} issues.`,action:{label:"New Issue",onClick:()=>i(!0)}}),!c&&!l&&x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(t=>e.jsxs(T,{to:`/command-post/issues/${t.id}`,className:"flex items-center gap-3 px-4 py-3 hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx(D,{status:t.status,variant:"dot",size:"sm"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.title}),e.jsx("span",{className:`text-xs font-medium uppercase ${_[t.priority]??"text-text-muted"}`,children:t.priority}),t.assigneeAgentId&&e.jsx("span",{className:"text-xs text-text-muted truncate max-w-[100px]",children:t.assigneeAgentId}),e.jsx("span",{className:"text-xs text-text-muted font-mono",children:t.identifier}),e.jsx("span",{className:"text-xs text-text-muted flex-shrink-0",children:R(t.updatedAt)})]},t.id))}),e.jsx(M,{open:v,onClose:()=>i(!1),title:"New Issue",footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",size:"sm",onClick:()=>i(!1),children:"Cancel"}),e.jsx(u,{size:"sm",onClick:N,loading:C,disabled:!n.trim(),children:"Create"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Title"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent",placeholder:"Issue title...",value:n,onChange:t=>h(t.target.value),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Priority"}),e.jsxs("select",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text focus:outline-none focus:border-accent",value:p,onChange:t=>b(t.target.value),children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Description"}),e.jsx("textarea",{className:"w-full rounded-lg border border-border bg-bg-tertiary px-3 py-2 text-sm text-text placeholder:text-text-muted focus:outline-none focus:border-accent min-h-[80px] resize-y",placeholder:"Describe the issue...",value:f,onChange:t=>g(t.target.value)})]})]})})]})}export{ee as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CommandPostHub-Ckh7LlWG.js","assets/index-CfeeNofL.js","assets/index-DmgXt1oB.css","assets/Input-DoWIY9i3.js","assets/clsx-B-dksMZM.js","assets/Modal-BS3rireW.js","assets/proxy-tgCU20-X.js","assets/InlineEditableField-ChiCaepw.js","assets/check-Dq1bBdnM.js","assets/pencil-DNQZmkMU.js","assets/Tooltip-DZJl8UaT.js","assets/approvalHeadline-DB9SgR-9.js","assets/chevron-right-Dz0EiJIX.js","assets/bot-DNI_W-iH.js","assets/pause-B7pXF6wS.js","assets/dollar-sign-XvC0BdrI.js","assets/git-branch-BgrSzLGu.js","assets/chart-column-COymYluE.js","assets/clock-BiDhhRG4.js","assets/message-square-CAJnwIi8.js","assets/file-text-CMteaHPb.js","assets/terminal-ucriUmF-.js","assets/refresh-cw-C4BAymqq.js","assets/circle-stop-BKeZMLyT.js","assets/send-AYGyxY6d.js","assets/plus-BNliIo_L.js","assets/trash-2-CJjOlqMp.js","assets/CPIssues-CRkGwoU7.js","assets/StatusBadge-FyqmZDG0.js","assets/PageHeader-Cx4DHJXy.js","assets/EmptyState-CB9me2NW.js","assets/Tabs-BMzVMYab.js","assets/SkeletonLoader-crWOfBFq.js","assets/list-todo-DIH1DDut.js","assets/CPIssueDetail-tuKkMZU0.js","assets/arrow-left-CLTerrT5.js","assets/CPAgents-DvoKU7K3.js","assets/CPAgentDetail-DJVqWbIz.js","assets/circle-check-big-Bi688_yD.js","assets/save-ICOKiEQf.js","assets/CPApprovals-CgkIcjKy.js","assets/shield-check-Dtr3ujKk.js","assets/CPActivity-kjPVmtna.js","assets/CPGoals-CmaEWa0s.js","assets/CPRuns-_2GvItJv.js","assets/play-CB_hciEJ.js","assets/CPCosts-Dh2-rKBQ.js","assets/CPOrg-BiYIRMSl.js","assets/network-DpJozzT9.js","assets/CPFiles-85DnmiZ9.js","assets/folder-Heg9X62R.js","assets/flask-conical-DOupoJs-.js","assets/search-qz2VMyBQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as t,r as s,q as _,v as e,N as l,_ as o}from"./index-CfeeNofL.js";const a=s.lazy(()=>o(()=>import("./CommandPostHub-Ckh7LlWG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))),i=s.lazy(()=>o(()=>import("./CPIssues-CRkGwoU7.js"),__vite__mapDeps([27,1,2,3,4,28,29,12,30,31,5,6,32,25,33]))),r=s.lazy(()=>o(()=>import("./CPIssueDetail-tuKkMZU0.js"),__vite__mapDeps([34,1,2,3,4,28,29,12,32,35,19,24]))),n=s.lazy(()=>o(()=>import("./CPAgents-DvoKU7K3.js"),__vite__mapDeps([36,1,2,3,4,28,29,12,30,32]))),x=s.lazy(()=>o(()=>import("./CPAgentDetail-DJVqWbIz.js"),__vite__mapDeps([37,1,2,3,4,28,29,12,30,31,32,35,38,15,18,39]))),m=s.lazy(()=>o(()=>import("./CPApprovals-CgkIcjKy.js"),__vite__mapDeps([40,1,2,3,4,28,29,12,30,31,32,11,41,8]))),j=s.lazy(()=>o(()=>import("./CPActivity-kjPVmtna.js"),__vite__mapDeps([42,1,2,3,4,29,12,30,31,32,41,15,13]))),p=s.lazy(()=>o(()=>import("./CPGoals-CmaEWa0s.js"),__vite__mapDeps([43,1,2,3,4,28,29,12,30,5,6,32,25,26]))),u=s.lazy(()=>o(()=>import("./CPRuns-_2GvItJv.js"),__vite__mapDeps([44,1,2,3,4,28,29,12,30,32,45]))),c=s.lazy(()=>o(()=>import("./CPCosts-Dh2-rKBQ.js"),__vite__mapDeps([46,1,2,3,4,28,29,12,30,5,6,32,25,15,26]))),d=s.lazy(()=>o(()=>import("./CPOrg-BiYIRMSl.js"),__vite__mapDeps([47,1,2,3,4,28,29,12,30,32,48,26]))),P=s.lazy(()=>o(()=>import("./CPFiles-85DnmiZ9.js"),__vite__mapDeps([49,1,2,50,51,52,22,20])));function E(){return t.jsx("div",{className:"flex items-center justify-center h-full text-sm",style:{color:"#c4b49a"},children:"Loading..."})}function h(){return t.jsx("div",{className:"h-full overflow-hidden",children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(s.Suspense,{fallback:t.jsx(E,{}),children:t.jsxs(_,{children:[t.jsx(e,{index:!0,element:t.jsx(a,{})}),t.jsx(e,{path:"dashboard",element:t.jsx(a,{})}),t.jsx(e,{path:"issues",element:t.jsx(i,{})}),t.jsx(e,{path:"issues/:id",element:t.jsx(r,{})}),t.jsx(e,{path:"agents",element:t.jsx(n,{})}),t.jsx(e,{path:"agents/:id",element:t.jsx(x,{})}),t.jsx(e,{path:"approvals",element:t.jsx(m,{})}),t.jsx(e,{path:"activity",element:t.jsx(j,{})}),t.jsx(e,{path:"goals",element:t.jsx(p,{})}),t.jsx(e,{path:"runs",element:t.jsx(u,{})}),t.jsx(e,{path:"costs",element:t.jsx(c,{})}),t.jsx(e,{path:"org",element:t.jsx(d,{})}),t.jsx(e,{path:"files",element:t.jsx(P,{})}),t.jsx(e,{path:"*",element:t.jsx(l,{to:"/command-post",replace:!0})})]})})})})}export{h as CPLayout,h as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,a0 as u,a1 as b,j as e}from"./index-
|
|
1
|
+
import{r as i,a0 as u,a1 as b,j as e}from"./index-CfeeNofL.js";import"./Input-DoWIY9i3.js";import{S as j}from"./StatusBadge-FyqmZDG0.js";import{P as f}from"./PageHeader-Cx4DHJXy.js";import{E as v}from"./EmptyState-CB9me2NW.js";import{S as y}from"./SkeletonLoader-crWOfBFq.js";import{N}from"./network-DpJozzT9.js";import{T as C}from"./trash-2-CJjOlqMp.js";import"./clsx-B-dksMZM.js";import"./chevron-right-Dz0EiJIX.js";function w(t){const s=t.split("/");return s[s.length-1]}function x({node:t,depth:s,onDelete:o}){const l=t.role==="Company";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-3 py-2",style:{paddingLeft:`${s*32+16}px`},children:[s>0&&e.jsx("div",{className:"flex items-center gap-0 -ml-5",children:e.jsx("div",{className:"w-4 border-t border-border-light"})}),e.jsxs("div",{className:`border rounded-lg p-3 flex-1 max-w-sm transition-colors group ${l?"bg-accent/5 border-accent/20 hover:border-accent/40":"bg-bg-secondary border-border hover:border-border-light"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx(j,{status:t.status,size:"sm"})]}),l&&o&&e.jsx("button",{onClick:a=>{a.stopPropagation(),o(t.id,t.name)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-error/20 text-text-muted hover:text-error transition-all",title:`Delete ${t.name}`,children:e.jsx(C,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[l&&e.jsx("span",{className:"text-accent text-[9px] font-medium uppercase tracking-wider",children:"Company"}),!l&&e.jsx("span",{className:"capitalize",children:t.role}),t.title&&e.jsx("span",{children:t.title}),t.model&&e.jsx("span",{children:w(t.model)})]}),l&&t.reports.length>0&&e.jsxs("div",{className:"text-[10px] text-text-muted mt-1",children:[t.reports.length," agent",t.reports.length!==1?"s":""]})]})]}),t.reports.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute border-l border-border-light",style:{left:`${(s+1)*32+16}px`,top:0,height:"100%"}}),t.reports.map(a=>e.jsx(x,{node:a,depth:s+1,onDelete:o},a.id))]})]})}function A(){const[t,s]=i.useState([]),[o,l]=i.useState(!0),[a,c]=i.useState(null),[p,m]=i.useState(null),n=i.useCallback(async()=>{try{const r=await u();s(r),c(null)}catch(r){c(r instanceof Error?r.message:"Failed to load org chart")}l(!1)},[]);i.useEffect(()=>{n()},[n]);const g=i.useCallback(async(r,h)=>{if(confirm(`Delete company "${h}"?
|
|
2
2
|
|
|
3
3
|
This will:
|
|
4
4
|
• Stop the heartbeat runner
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,Y as h,$ as f,j as e}from"./index-
|
|
1
|
+
import{r as a,Y as h,$ as f,j as e}from"./index-CfeeNofL.js";import"./Input-DoWIY9i3.js";import{S as j}from"./StatusBadge-FyqmZDG0.js";import{P as g}from"./PageHeader-Cx4DHJXy.js";import{E as y}from"./EmptyState-CB9me2NW.js";import{S as b}from"./SkeletonLoader-crWOfBFq.js";import{P as N}from"./play-CB_hciEJ.js";import"./clsx-B-dksMZM.js";import"./chevron-right-Dz0EiJIX.js";function v(s){const r=Math.floor((Date.now()-new Date(s).getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function S(s){return s?s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${(s/6e4).toFixed(1)}m`:"-"}function D(){const[s,r]=a.useState([]),[x,m]=a.useState([]),[n,d]=a.useState(!0),[o,i]=a.useState(null),[l,u]=a.useState(""),c=a.useCallback(async()=>{try{const[t,p]=await Promise.all([h(l||void 0,100),f()]);r(t),m(p),i(null)}catch(t){i(t instanceof Error?t.message:"Failed to load runs")}d(!1)},[l]);return a.useEffect(()=>{d(!0),c()},[c]),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{title:"Runs",breadcrumbs:[{label:"Command Post"},{label:"Runs"}],actions:e.jsxs("select",{className:"rounded-lg border border-border bg-bg-tertiary px-3 py-1.5 text-xs text-text focus:outline-none focus:border-accent",value:l,onChange:t=>u(t.target.value),children:[e.jsx("option",{value:"",children:"All agents"}),x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})}),n&&e.jsx(b,{variant:"row",count:8}),o&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:o}),!n&&!o&&s.length===0&&e.jsx(y,{icon:e.jsx(N,{size:32}),title:"No runs",description:"Agent runs will appear here as they execute."}),!n&&!o&&s.length>0&&e.jsx("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Agent"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Source"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Duration"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Tools"}),e.jsx("th",{className:"px-4 py-2.5 text-text-muted font-medium",children:"Started"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:s.map(t=>e.jsxs("tr",{className:"hover:bg-bg-tertiary/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-2.5 text-text font-medium",children:t.agentId}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary capitalize",children:t.source}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(j,{status:t.status,size:"sm"})}),e.jsx("td",{className:"px-4 py-2.5 text-text-secondary font-mono",children:S(t.durationMs)}),e.jsx("td",{className:"px-4 py-2.5 text-text-muted",children:t.toolsUsed.length>0?e.jsxs("span",{title:t.toolsUsed.join(", "),children:[t.toolsUsed.length," tool",t.toolsUsed.length!==1?"s":""]}):"-"}),e.jsxs("td",{className:"px-4 py-2.5 text-text-muted",children:[v(t.startedAt)," ago"]})]},t.id))})]})})})]})}export{D as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as v,r as n,bP as A,bQ as M,j as e,i as D,k as L,l as q,bR as _,bS as I,bT as O,bU as z}from"./index-
|
|
1
|
+
import{c as v,r as n,bP as A,bQ as M,j as e,i as D,k as L,l as q,bR as _,bS as I,bT as O,bU as z}from"./index-CfeeNofL.js";import{R as b}from"./refresh-cw-C4BAymqq.js";import{S as G}from"./send-AYGyxY6d.js";import{L as H}from"./lightbulb-CaU3yf0V.js";import{C as F}from"./clock-BiDhhRG4.js";import{M as Q}from"./message-square-CAJnwIi8.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as t,b as N}from"./index-
|
|
1
|
+
import{r as i,j as t,b as N}from"./index-CfeeNofL.js";import"./Input-DoWIY9i3.js";import{P as k}from"./PageHeader-Cx4DHJXy.js";import{C as S}from"./circle-stop-BKeZMLyT.js";import{M as C}from"./mic-a150MaF_.js";import{V as b}from"./volume-2-CAQ1nA-B.js";import{S as T}from"./send-AYGyxY6d.js";import"./clsx-B-dksMZM.js";import"./chevron-right-Dz0EiJIX.js";async function R(o,l){const c=await N(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok)throw new Error(`HTTP ${c.status}`);return c.json()}function I(){const[o,l]=i.useState(""),[c,u]=i.useState([]),[h,d]=i.useState(!1),[p,j]=i.useState(!0),m=i.useRef(null),a=i.useRef(null);i.useEffect(()=>{const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(e){const s=new e;s.lang="en-US",s.continuous=!1,s.interimResults=!1,s.onresult=r=>{var n,g;const x=((g=(n=r.results[0])==null?void 0:n[0])==null?void 0:g.transcript)||"";l(x),d(!1)},s.onerror=()=>d(!1),s.onend=()=>d(!1),m.current=s}},[]);const f=async()=>{const e=o.trim();if(!e)return;const s={id:`e-${Date.now()}`,question:e,loading:!0,at:new Date().toISOString()};u(r=>[s,...r].slice(0,20)),l("");try{const r=await R("/api/voice/ask",{question:e,voice:"default",speak:p});u(x=>x.map(n=>n.id===s.id?{...n,loading:!1,answer:r.answer,activeDrivers:r.activeDrivers,ttsUrl:r.ttsUrl}:n)),r.ttsUrl&&p&&a.current&&(a.current.src=r.ttsUrl,a.current.play().catch(()=>{}))}catch(r){u(x=>x.map(n=>n.id===s.id?{...n,loading:!1,error:r.message}:n))}},v=()=>{const e=m.current;if(!e){alert("Speech recognition not supported in this browser. Use Chrome.");return}try{e.start(),d(!0)}catch{}},w=()=>{const e=m.current;e&&e.stop(),d(!1)},y=!!(window.SpeechRecognition||window.webkitSpeechRecognition);return t.jsxs("div",{className:"space-y-4 flex flex-col h-[calc(100vh-180px)]",children:[t.jsx(k,{title:"Voice Ask",breadcrumbs:[{label:"Command Post"},{label:"Voice"}]}),t.jsx("audio",{ref:a}),t.jsxs("div",{className:"flex items-center gap-2 bg-bg-secondary border border-border rounded-xl px-3 py-2",children:[y&&(h?t.jsx("button",{onClick:w,className:"p-2 rounded bg-error/20 text-error hover:bg-error/30",title:"Stop listening",children:t.jsx(S,{size:18})}):t.jsx("button",{onClick:v,className:"p-2 rounded hover:bg-bg-tertiary text-text-muted",title:"Voice input (Chrome only)",children:t.jsx(C,{size:18})})),t.jsx("input",{value:o,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),f())},placeholder:h?"Listening…":'Ask TITAN — "What are you working on?" or give it instructions',className:"flex-1 bg-transparent text-sm outline-none"}),t.jsx("button",{onClick:()=>j(e=>!e),className:`p-2 rounded hover:bg-bg-tertiary ${p?"text-accent":"text-text-muted"}`,title:`TTS ${p?"ON":"OFF"}`,children:t.jsx(b,{size:16})}),t.jsxs("button",{onClick:f,disabled:!o.trim(),className:"px-3 py-1.5 rounded bg-accent/20 border border-accent/40 text-accent text-sm hover:bg-accent/30 disabled:opacity-50 flex items-center gap-1",children:[t.jsx(T,{size:14})," Ask"]})]}),t.jsxs("div",{className:"flex-1 overflow-auto space-y-3",children:[c.length===0&&t.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:'Ask a question to start. TITAN has driver-aware chat, so "what are you doing?" gets a real answer.'}),c.map(e=>t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"text-xs text-text-muted mt-1 flex-shrink-0 w-10",children:"You"}),t.jsx("div",{className:"text-sm text-text",children:e.question})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"text-xs text-accent mt-1 flex-shrink-0 w-10",children:"TITAN"}),t.jsxs("div",{className:"text-sm text-text-secondary flex-1",children:[e.loading&&t.jsx("span",{className:"text-text-muted",children:"thinking…"}),e.error&&t.jsxs("span",{className:"text-error",children:["error: ",e.error]}),e.answer&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"whitespace-pre-wrap",children:e.answer}),t.jsxs("div",{className:"text-[11px] text-text-muted flex items-center gap-2",children:[t.jsxs("span",{children:["drivers: ",e.activeDrivers??"?"]}),e.ttsUrl&&t.jsxs("button",{onClick:()=>{a.current&&(a.current.src=e.ttsUrl,a.current.play().catch(()=>{}))},className:"text-accent hover:underline flex items-center gap-0.5",children:[t.jsx(b,{size:10})," play"]})]})]})]})]})]},e.id))]})]})}export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as e,i as $,ao as E,ap as D,V as F,an as K,E as I,aq as R}from"./index-DczEfArU.js";import{P as O}from"./PageHeader-CPfyiZIM.js";import{R as W}from"./refresh-cw-DyPWslHB.js";import{C as _}from"./circle-check-big-CrrpTfnZ.js";import{C as G}from"./chevron-right-DhAaVOkv.js";import{S as H}from"./save-Bl0vY0Ur.js";const L=[{id:"discord",label:"Discord",description:"Discord bot via discord.js",fields:[{key:"token",label:"Bot Token",placeholder:"Bot token from Discord Developer Portal"}]},{id:"telegram",label:"Telegram",description:"Telegram bot via Grammy",fields:[{key:"token",label:"Bot Token",placeholder:"Token from @BotFather"}]},{id:"slack",label:"Slack",description:"Slack workspace via Bolt SDK",fields:[{key:"token",label:"Bot Token",placeholder:"xoxb-..."},{key:"apiKey",label:"Signing Secret",placeholder:"Signing secret from Slack app settings"}]},{id:"whatsapp",label:"WhatsApp",description:"WhatsApp via Twilio",fields:[{key:"token",label:"Auth Token",placeholder:"Twilio auth token"},{key:"apiKey",label:"Account SID",placeholder:"Twilio account SID"}]},{id:"googlechat",label:"Google Chat",description:"Google Chat spaces",fields:[{key:"token",label:"Service Account Key",placeholder:"JSON key path or content"}]},{id:"matrix",label:"Matrix",description:"Matrix protocol (Element, etc.)",fields:[{key:"token",label:"Access Token",placeholder:"Matrix access token"}]},{id:"signal",label:"Signal",description:"Signal messenger",fields:[{key:"token",label:"API Token",placeholder:"Signal API token"}]},{id:"msteams",label:"Microsoft Teams",description:"MS Teams via Bot Framework",fields:[{key:"token",label:"App Password",placeholder:"Bot framework app password"},{key:"apiKey",label:"App ID",placeholder:"Bot framework app ID"}]},{id:"irc",label:"IRC",description:"Internet Relay Chat",fields:[{key:"token",label:"Password",placeholder:"NickServ password (optional)"}]},{id:"mattermost",label:"Mattermost",description:"Self-hosted team chat",fields:[{key:"token",label:"Bot Token",placeholder:"Mattermost bot access token"}]},{id:"lark",label:"Lark",description:"Lark/Feishu messaging",fields:[{key:"token",label:"App Token",placeholder:"Lark app token"},{key:"apiKey",label:"App Secret",placeholder:"Lark app secret"}]},{id:"email_inbound",label:"Email (Inbound)",description:"IMAP email webhook",fields:[{key:"token",label:"IMAP Password",placeholder:"IMAP password or app password"}]},{id:"line",label:"LINE",description:"LINE messaging platform",fields:[{key:"token",label:"Channel Access Token",placeholder:"LINE channel access token"},{key:"apiKey",label:"Channel Secret",placeholder:"LINE channel secret"}]},{id:"zulip",label:"Zulip",description:"Zulip team chat",fields:[{key:"apiKey",label:"API Key",placeholder:"Zulip API key"}]}],Z=[{value:"pairing",label:"Pairing",desc:"User must pair first"},{value:"open",label:"Open",desc:"Anyone can DM"},{value:"closed",label:"Closed",desc:"DMs disabled"}];function q({def:l,config:o,status:b,onSave:f,saving:v}){const[d,k]=a.useState(!1),[x,N]=a.useState(o.enabled),[p,c]=a.useState(""),[m,u]=a.useState(""),[g,w]=a.useState(o.dmPolicy),[y,t]=a.useState(!1),[n,h]=a.useState(!1),[r,i]=a.useState(!1),j=v===l.id,S=(b==null?void 0:b.status)==="connected",A=!!o.token,P=!!o.apiKey,M=()=>{N(!x),i(!0)},B=async()=>{const s={enabled:x,dmPolicy:g};p&&(s.token=p),m&&(s.apiKey=m),await f(l.id,s),c(""),u(""),i(!1)},C=l.fields.find(s=>s.key==="token"),T=l.fields.find(s=>s.key==="apiKey");return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary",children:[e.jsxs("button",{onClick:()=>k(!d),className:"flex w-full items-center justify-between px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[d?e.jsx(F,{className:"h-4 w-4 text-text-muted"}):e.jsx(G,{className:"h-4 w-4 text-text-muted"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text",children:l.label}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:l.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[S&&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"}),"Connected"]}),e.jsx("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${o.enabled?"bg-accent/10 text-accent-hover":"bg-border-light/20 text-text-muted"}`,children:o.enabled?"Enabled":"Disabled"})]})]}),d&&e.jsxs("div",{className:"border-t border-bg-tertiary px-4 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-text-secondary",children:"Enabled"}),e.jsx("button",{onClick:M,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${x?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${x?"translate-x-6":"translate-x-1"}`})})]}),C&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[C.label,A&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-token`,name:`channel-${l.id}-token`,type:y?"text":"password",value:p,onChange:s=>{c(s.target.value),i(!0)},placeholder:A?"(configured — enter new value to change)":C.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>t(!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:y?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),T&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[T.label,P&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-api-key`,name:`channel-${l.id}-api-key`,type:n?"text":"password",value:m,onChange:s=>{u(s.target.value),i(!0)},placeholder:P?"(configured — enter new value to change)":T.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>h(!n),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:n?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"DM Policy"}),e.jsx("div",{className:"flex gap-2",children:Z.map(s=>e.jsx("button",{onClick:()=>{w(s.value),i(!0)},className:`rounded-lg border px-3 py-1.5 text-xs transition-colors ${g===s.value?"border-accent bg-accent/10 text-accent-hover":"border-border text-text-muted hover:border-border-light"}`,title:s.desc,children:s.label},s.value))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:B,disabled:j||!r,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(H,{className:"h-3.5 w-3.5"}),j?"Saving...":"Save"]})})]})]})}function Y(){const[l,o]=a.useState([]),[b,f]=a.useState({}),[v,d]=a.useState(!0),[k,x]=a.useState(null),[N,p]=a.useState(null),[c,m]=a.useState(null),u=async()=>{try{const[t,n]=await Promise.all([E(),D()]);o(t),f(n)}catch(t){x(t instanceof Error?t.message:"Failed to fetch channels")}finally{d(!1)}};a.useEffect(()=>{u()},[]);const g=(t,n)=>{m({type:t,message:n}),setTimeout(()=>m(null),3e3)},w=async(t,n)=>{var h;p(t);try{await R(t,n);const[r,i]=await Promise.all([E(),D()]);o(r),f(i);const j=((h=L.find(S=>S.id===t))==null?void 0:h.label)??t;g("success",`${j} settings saved (restart gateway to apply)`)}catch(r){g("error",r instanceof Error?r.message:"Failed to save")}finally{p(null)}};if(v)return e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((t,n)=>e.jsx("div",{className:"h-14 animate-pulse rounded-xl border border-border bg-bg-secondary"},n))});if(k)return e.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:k});const y={enabled:!1,allowFrom:[],dmPolicy:"pairing"};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(O,{title:"Channels",subtitle:`Configure messaging channels — ${l.filter(t=>t.status==="connected").length} connected`,breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Channels"}],actions:e.jsxs("button",{onClick:()=>{d(!0),u()},className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:border-border-light hover:text-text",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),"Refresh"]})}),c&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${c.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[c.type==="success"?e.jsx(_,{className:"h-4 w-4"}):e.jsx($,{className:"h-4 w-4"}),c.message]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Built-in"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:"WebChat"}),e.jsx("span",{className:"text-xs text-text-muted",children:"HTTP/WebSocket — always enabled"})]}),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"}),"Connected"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Messaging Channels"}),e.jsx("div",{className:"space-y-2",children:L.map(t=>{const n=b[t.id]??y,h=l.find(r=>r.name===t.id||r.type===t.id);return e.jsx(q,{def:t,config:n,status:h,onSave:w,saving:N},t.id)})})]}),e.jsx("p",{className:"text-xs text-text-muted text-center",children:"Channel changes are saved to config. Restart the gateway to connect/disconnect channels."})]})}export{Y as default};
|
|
1
|
+
import{r as a,j as e,i as $,ao as E,ap as D,V as F,an as K,E as I,aq as R}from"./index-CfeeNofL.js";import{P as O}from"./PageHeader-Cx4DHJXy.js";import{R as W}from"./refresh-cw-C4BAymqq.js";import{C as _}from"./circle-check-big-Bi688_yD.js";import{C as G}from"./chevron-right-Dz0EiJIX.js";import{S as H}from"./save-ICOKiEQf.js";const L=[{id:"discord",label:"Discord",description:"Discord bot via discord.js",fields:[{key:"token",label:"Bot Token",placeholder:"Bot token from Discord Developer Portal"}]},{id:"telegram",label:"Telegram",description:"Telegram bot via Grammy",fields:[{key:"token",label:"Bot Token",placeholder:"Token from @BotFather"}]},{id:"slack",label:"Slack",description:"Slack workspace via Bolt SDK",fields:[{key:"token",label:"Bot Token",placeholder:"xoxb-..."},{key:"apiKey",label:"Signing Secret",placeholder:"Signing secret from Slack app settings"}]},{id:"whatsapp",label:"WhatsApp",description:"WhatsApp via Twilio",fields:[{key:"token",label:"Auth Token",placeholder:"Twilio auth token"},{key:"apiKey",label:"Account SID",placeholder:"Twilio account SID"}]},{id:"googlechat",label:"Google Chat",description:"Google Chat spaces",fields:[{key:"token",label:"Service Account Key",placeholder:"JSON key path or content"}]},{id:"matrix",label:"Matrix",description:"Matrix protocol (Element, etc.)",fields:[{key:"token",label:"Access Token",placeholder:"Matrix access token"}]},{id:"signal",label:"Signal",description:"Signal messenger",fields:[{key:"token",label:"API Token",placeholder:"Signal API token"}]},{id:"msteams",label:"Microsoft Teams",description:"MS Teams via Bot Framework",fields:[{key:"token",label:"App Password",placeholder:"Bot framework app password"},{key:"apiKey",label:"App ID",placeholder:"Bot framework app ID"}]},{id:"irc",label:"IRC",description:"Internet Relay Chat",fields:[{key:"token",label:"Password",placeholder:"NickServ password (optional)"}]},{id:"mattermost",label:"Mattermost",description:"Self-hosted team chat",fields:[{key:"token",label:"Bot Token",placeholder:"Mattermost bot access token"}]},{id:"lark",label:"Lark",description:"Lark/Feishu messaging",fields:[{key:"token",label:"App Token",placeholder:"Lark app token"},{key:"apiKey",label:"App Secret",placeholder:"Lark app secret"}]},{id:"email_inbound",label:"Email (Inbound)",description:"IMAP email webhook",fields:[{key:"token",label:"IMAP Password",placeholder:"IMAP password or app password"}]},{id:"line",label:"LINE",description:"LINE messaging platform",fields:[{key:"token",label:"Channel Access Token",placeholder:"LINE channel access token"},{key:"apiKey",label:"Channel Secret",placeholder:"LINE channel secret"}]},{id:"zulip",label:"Zulip",description:"Zulip team chat",fields:[{key:"apiKey",label:"API Key",placeholder:"Zulip API key"}]}],Z=[{value:"pairing",label:"Pairing",desc:"User must pair first"},{value:"open",label:"Open",desc:"Anyone can DM"},{value:"closed",label:"Closed",desc:"DMs disabled"}];function q({def:l,config:o,status:b,onSave:f,saving:v}){const[d,k]=a.useState(!1),[x,N]=a.useState(o.enabled),[p,c]=a.useState(""),[m,u]=a.useState(""),[g,w]=a.useState(o.dmPolicy),[y,t]=a.useState(!1),[n,h]=a.useState(!1),[r,i]=a.useState(!1),j=v===l.id,S=(b==null?void 0:b.status)==="connected",A=!!o.token,P=!!o.apiKey,M=()=>{N(!x),i(!0)},B=async()=>{const s={enabled:x,dmPolicy:g};p&&(s.token=p),m&&(s.apiKey=m),await f(l.id,s),c(""),u(""),i(!1)},C=l.fields.find(s=>s.key==="token"),T=l.fields.find(s=>s.key==="apiKey");return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary",children:[e.jsxs("button",{onClick:()=>k(!d),className:"flex w-full items-center justify-between px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[d?e.jsx(F,{className:"h-4 w-4 text-text-muted"}):e.jsx(G,{className:"h-4 w-4 text-text-muted"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text",children:l.label}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:l.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[S&&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"}),"Connected"]}),e.jsx("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${o.enabled?"bg-accent/10 text-accent-hover":"bg-border-light/20 text-text-muted"}`,children:o.enabled?"Enabled":"Disabled"})]})]}),d&&e.jsxs("div",{className:"border-t border-bg-tertiary px-4 py-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-text-secondary",children:"Enabled"}),e.jsx("button",{onClick:M,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${x?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${x?"translate-x-6":"translate-x-1"}`})})]}),C&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[C.label,A&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-token`,name:`channel-${l.id}-token`,type:y?"text":"password",value:p,onChange:s=>{c(s.target.value),i(!0)},placeholder:A?"(configured — enter new value to change)":C.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>t(!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:y?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),T&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[T.label,P&&e.jsx("span",{className:"rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success",children:"set"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:`channel-${l.id}-api-key`,name:`channel-${l.id}-api-key`,type:n?"text":"password",value:m,onChange:s=>{u(s.target.value),i(!0)},placeholder:P?"(configured — enter new value to change)":T.placeholder,className:"w-full rounded-lg border border-border bg-bg px-3 py-2 pr-10 text-sm text-text outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>h(!n),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary",children:n?e.jsx(K,{className:"h-4 w-4"}):e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-text-muted",children:"DM Policy"}),e.jsx("div",{className:"flex gap-2",children:Z.map(s=>e.jsx("button",{onClick:()=>{w(s.value),i(!0)},className:`rounded-lg border px-3 py-1.5 text-xs transition-colors ${g===s.value?"border-accent bg-accent/10 text-accent-hover":"border-border text-text-muted hover:border-border-light"}`,title:s.desc,children:s.label},s.value))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:B,disabled:j||!r,className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/80 disabled:opacity-50",children:[e.jsx(H,{className:"h-3.5 w-3.5"}),j?"Saving...":"Save"]})})]})]})}function Y(){const[l,o]=a.useState([]),[b,f]=a.useState({}),[v,d]=a.useState(!0),[k,x]=a.useState(null),[N,p]=a.useState(null),[c,m]=a.useState(null),u=async()=>{try{const[t,n]=await Promise.all([E(),D()]);o(t),f(n)}catch(t){x(t instanceof Error?t.message:"Failed to fetch channels")}finally{d(!1)}};a.useEffect(()=>{u()},[]);const g=(t,n)=>{m({type:t,message:n}),setTimeout(()=>m(null),3e3)},w=async(t,n)=>{var h;p(t);try{await R(t,n);const[r,i]=await Promise.all([E(),D()]);o(r),f(i);const j=((h=L.find(S=>S.id===t))==null?void 0:h.label)??t;g("success",`${j} settings saved (restart gateway to apply)`)}catch(r){g("error",r instanceof Error?r.message:"Failed to save")}finally{p(null)}};if(v)return e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((t,n)=>e.jsx("div",{className:"h-14 animate-pulse rounded-xl border border-border bg-bg-secondary"},n))});if(k)return e.jsx("div",{className:"rounded-xl border border-error/50 bg-bg-secondary p-6 text-center text-error",children:k});const y={enabled:!1,allowFrom:[],dmPolicy:"pairing"};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(O,{title:"Channels",subtitle:`Configure messaging channels — ${l.filter(t=>t.status==="connected").length} connected`,breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Channels"}],actions:e.jsxs("button",{onClick:()=>{d(!0),u()},className:"flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-text-secondary hover:border-border-light hover:text-text",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),"Refresh"]})}),c&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-4 py-2 text-sm ${c.type==="success"?"border-success/50 text-success":"border-error/50 text-error"}`,children:[c.type==="success"?e.jsx(_,{className:"h-4 w-4"}):e.jsx($,{className:"h-4 w-4"}),c.message]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Built-in"}),e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:"WebChat"}),e.jsx("span",{className:"text-xs text-text-muted",children:"HTTP/WebSocket — always enabled"})]}),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"}),"Connected"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-muted mb-3",children:"Messaging Channels"}),e.jsx("div",{className:"space-y-2",children:L.map(t=>{const n=b[t.id]??y,h=l.find(r=>r.name===t.id||r.type===t.id);return e.jsx(q,{def:t,config:n,status:h,onSave:w,saving:N},t.id)})})]}),e.jsx("p",{className:"text-xs text-text-muted text-center",children:"Channel changes are saved to config. Restart the gateway to connect/disconnect channels."})]})}export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,bD as l,j as e,bE as d}from"./index-
|
|
1
|
+
import{r as a,bD as l,j as e,bE as d}from"./index-CfeeNofL.js";import{P as m}from"./PageHeader-Cx4DHJXy.js";import{R as h}from"./refresh-cw-C4BAymqq.js";import{S as x}from"./save-ICOKiEQf.js";import{T as p}from"./trash-2-CJjOlqMp.js";import"./chevron-right-Dz0EiJIX.js";function k(){const[c,n]=a.useState([]),[i,r]=a.useState(!0),t=a.useCallback(async()=>{r(!0);try{const s=await l();n(s.checkpoints||[])}catch{}r(!1)},[]);a.useEffect(()=>{t()},[t]);const o=async s=>{if(confirm("Delete this checkpoint?"))try{await d(s),await t()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{title:"Checkpoints",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Checkpoints"}]}),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(h,{className:`w-4 h-4 ${i?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:c.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-[#e4e4e7]",children:[s.sessionId.slice(0,16),"..."]}),e.jsx("div",{className:"text-xs text-[#52525b]",children:new Date(s.createdAt).toLocaleString()})]})]}),e.jsx("button",{onClick:()=>o(s.sessionId),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(p,{className:"w-3.5 h-3.5"})})]},s.sessionId))})]})}export{k as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkTab-
|
|
2
|
-
import{c as O,r as s,j as e,aL as ie,k as L,l as E,A as I,K as G,Y as te,b6 as ce,W as se,w as de,T as xe,h as ae,U as ue,s as me,_ as A,b as W,a0 as pe,b7 as he,z as be,y as ge,a3 as je,b8 as ve,b9 as fe,a1 as ye,O as Ne,P as we,F as Ce,ba as $,bb as ke,bc as Se,bd as ze,a4 as Te,be as Ae,bf as De}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkTab-BglKN8Uf.js","assets/index-CfeeNofL.js","assets/index-DmgXt1oB.css","assets/proxy-tgCU20-X.js","assets/external-link-6i_dEGHo.js","assets/rotate-ccw-CyT1wcCY.js","assets/plus-BNliIo_L.js","assets/play-CB_hciEJ.js","assets/trash-2-CJjOlqMp.js","assets/pause-B7pXF6wS.js","assets/SessionsTab-8Qtu9BMv.js","assets/CPInbox-DyrwUxsn.js","assets/Input-DoWIY9i3.js","assets/clsx-B-dksMZM.js","assets/PageHeader-Cx4DHJXy.js","assets/chevron-right-Dz0EiJIX.js","assets/EmptyState-CB9me2NW.js","assets/Tabs-BMzVMYab.js","assets/SkeletonLoader-crWOfBFq.js","assets/approvalHeadline-DB9SgR-9.js","assets/message-square-CAJnwIi8.js","assets/bot-DNI_W-iH.js","assets/clock-BiDhhRG4.js","assets/send-AYGyxY6d.js","assets/shield-check-Dtr3ujKk.js","assets/check-Dq1bBdnM.js","assets/funnel-C1qSeehb.js","assets/chevron-up-CaJdgiQv.js","assets/CPFiles-85DnmiZ9.js","assets/folder-Heg9X62R.js","assets/flask-conical-DOupoJs-.js","assets/search-qz2VMyBQ.js","assets/refresh-cw-C4BAymqq.js","assets/file-text-CMteaHPb.js","assets/TraceViewer-CfFZQJ3K.js","assets/trending-up-CC4itzlz.js","assets/git-branch-BgrSzLGu.js","assets/chart-column-COymYluE.js","assets/arrow-left-CLTerrT5.js","assets/CPSocial-BBdyKNyq.js","assets/lightbulb-CaU3yf0V.js","assets/CPDashboard-Bk5ehnOo.js","assets/StatusBadge-FyqmZDG0.js","assets/list-todo-DIH1DDut.js","assets/dollar-sign-XvC0BdrI.js","assets/CPGoals-CmaEWa0s.js","assets/Modal-BS3rireW.js","assets/CPAgents-DvoKU7K3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as O,r as s,j as e,aL as ie,k as L,l as E,A as I,K as G,Y as te,b6 as ce,W as se,w as de,T as xe,h as ae,U as ue,s as me,_ as A,b as W,a0 as pe,b7 as he,z as be,y as ge,a3 as je,b8 as ve,b9 as fe,a1 as ye,O as Ne,P as we,F as Ce,ba as $,bb as ke,bc as Se,bd as ze,a4 as Te,be as Ae,bf as De}from"./index-CfeeNofL.js";import{B as Q}from"./Input-DoWIY9i3.js";import{M as _}from"./Modal-BS3rireW.js";import{I as D}from"./InlineEditableField-ChiCaepw.js";import{H as Pe}from"./Tooltip-DZJl8UaT.js";import{e as _e}from"./approvalHeadline-DB9SgR-9.js";import{C as Y}from"./chevron-right-Dz0EiJIX.js";import{B as $e}from"./bot-DNI_W-iH.js";import{P as Ie}from"./pause-B7pXF6wS.js";import{D as K}from"./dollar-sign-XvC0BdrI.js";import{G as re}from"./git-branch-BgrSzLGu.js";import{C as ne}from"./chart-column-COymYluE.js";import{C as le}from"./clock-BiDhhRG4.js";import{M as H}from"./message-square-CAJnwIi8.js";import{F as Me}from"./file-text-CMteaHPb.js";import{T as Le}from"./terminal-ucriUmF-.js";import{R as Ee}from"./refresh-cw-C4BAymqq.js";import{C as Re}from"./circle-stop-BKeZMLyT.js";import{S as Fe}from"./send-AYGyxY6d.js";import{P as B}from"./plus-BNliIo_L.js";import{T as J}from"./trash-2-CJjOlqMp.js";import"./clsx-B-dksMZM.js";import"./proxy-tgCU20-X.js";import"./check-Dq1bBdnM.js";import"./pencil-DNQZmkMU.js";/**
|
|
3
3
|
* @license lucide-react v0.513.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -21,4 +21,4 @@ import{c as O,r as s,j as e,aL as ie,k as L,l as E,A as I,K as G,Y as te,b6 as c
|
|
|
21
21
|
* See the LICENSE file in the root directory of this source tree.
|
|
22
22
|
*/const We=[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]],oe=O("scale",We);function Z({open:t,title:x,message:l,confirmLabel:b="Confirm",cancelLabel:i="Cancel",variant:v="danger",onConfirm:m,onCancel:c}){const[g,p]=s.useState(!1),a=async()=>{p(!0);try{await m()}finally{p(!1)}};return e.jsx(_,{open:t,onClose:()=>!g&&c(),title:x,size:"sm",footer:e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:c,disabled:g,children:i}),e.jsx(Q,{variant:v==="danger"?"danger":"primary",size:"sm",onClick:a,loading:g,children:b})]}),children:e.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:l})})}function He(t){switch(t){case"active":return e.jsx(I,{size:12,className:"text-success animate-pulse"});case"paused":return e.jsx(Ie,{size:12,className:"text-warning"});case"error":return e.jsx(G,{size:12,className:"text-error"});default:return e.jsx($e,{size:12,className:"text-text-muted"})}}function qe(t){switch(t){case"active":return"border-success/30 bg-success/5";case"paused":return"border-warning/30 bg-warning/5";case"error":return"border-error/30 bg-error/5";default:return"border-border bg-bg-secondary"}}function Ge({agents:t,runs:x,collapsed:l=!1,onToggle:b,onAgentClick:i}){const[v,m]=s.useState(null);return l?e.jsxs("div",{className:"w-10 border-l border-border bg-bg-secondary flex flex-col items-center py-3 gap-3 shrink-0",children:[e.jsx("button",{onClick:b,className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted",children:e.jsx(ie,{size:14})}),t.map(c=>e.jsxs("button",{className:"relative",title:c.name,onClick:()=>i==null?void 0:i(c),children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-bold ${c.status==="error"?"bg-error/20 text-error":c.status==="active"?"bg-success/20 text-success":"bg-bg-tertiary text-text-muted"}`,children:c.name.charAt(0).toUpperCase()}),c.status==="active"&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-success animate-pulse"})]},c.id))]}):e.jsxs("div",{className:"w-64 border-l border-border bg-bg-secondary flex flex-col h-full shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[e.jsx("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Agents"}),e.jsx("button",{onClick:b,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted",children:e.jsx(Y,{size:14})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:[t.length===0&&e.jsx("div",{className:"text-center py-4 text-xs text-text-muted",children:"No agents registered"}),t.map(c=>{var f;const g=v===c.id,p=x.filter(j=>j.agentId===c.id),a=p[0],d=p.filter(j=>j.status==="failed"||j.status==="error").length;return e.jsxs("div",{className:`rounded-lg border p-2 cursor-pointer transition-colors ${qe(c.status)}`,onClick:j=>{j.target.closest(".expand-toggle")?m(g?null:c.id):i==null||i(c)},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center text-[10px] font-bold ${c.status==="error"?"bg-error/20 text-error":c.status==="active"?"bg-success/20 text-success":"bg-bg-tertiary text-text-muted"}`,children:c.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-medium truncate",children:c.name}),e.jsxs("div",{className:"text-[10px] text-text-muted flex items-center gap-1",children:[He(c.status),e.jsx("span",{className:"capitalize",children:c.status}),c.model&&e.jsxs("span",{className:"truncate",children:["· ",c.model.split("/").pop()]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[c.status==="active"&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),e.jsx("button",{className:"expand-toggle p-0.5 rounded hover:bg-bg-tertiary text-text-muted",onClick:j=>{j.stopPropagation(),m(g?null:c.id)},children:e.jsx(Y,{size:12,className:`transition-transform ${g?"rotate-90":""}`})})]})]}),g&&e.jsxs("div",{className:"mt-2 space-y-2 border-t border-border/50 pt-2",children:[e.jsxs("div",{className:"text-[10px] text-text-muted space-y-0.5",children:[e.jsxs("div",{children:["Role: ",c.role||"general"]}),e.jsxs("div",{children:["Tasks: ",c.totalTasksCompleted??0," completed"]}),c.totalCostUsd!==void 0&&e.jsxs("div",{children:["Cost: $",c.totalCostUsd.toFixed(2)]}),d>0&&e.jsxs("div",{className:"text-error",children:[d," failed run",d===1?"":"s"]})]}),a&&e.jsxs("div",{className:"text-[10px] bg-bg rounded p-1.5 border border-border",children:[e.jsxs("div",{className:"font-medium text-text-secondary flex items-center gap-1",children:[a.status==="succeeded"?e.jsx(L,{size:10,className:"text-success"}):a.status==="failed"||a.status==="error"?e.jsx(E,{size:10,className:"text-error"}):e.jsx(I,{size:10,className:"text-cyan animate-pulse"}),"Latest run"]}),e.jsxs("div",{className:a.status==="failed"||a.status==="error"?"text-error":"text-success",children:[a.status," · ",((f=a.toolsUsed)==null?void 0:f.length)??0," tools"]}),a.error&&e.jsx("div",{className:"text-error truncate mt-0.5",children:a.error})]})]})]},c.id)})]})]})}function ee(t){const x={active:"bg-success/10 text-success border-success/20",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",paused:"bg-warning/10 text-warning border-warning/20",error:"bg-error/10 text-error border-error/20",stopped:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"};return x[t]||x.idle}function V(t){const x=Math.floor((Date.now()-new Date(t).getTime())/1e3);return x<60?`${x}s`:x<3600?`${Math.floor(x/60)}m`:x<86400?`${Math.floor(x/3600)}h`:`${Math.floor(x/86400)}d`}function Ke({agent:t,onClose:x}){const[l,b]=s.useState([]),[i,v]=s.useState([]),[m,c]=s.useState(!0),[g,p]=s.useState(null),a=s.useCallback(async()=>{try{const[o,u]=await Promise.all([te(t.id,10),ce(20,void 0)]);b(o),v(u.traces||[])}catch{}c(!1)},[t.id]);s.useEffect(()=>{a();const o=setInterval(a,1e4);return()=>clearInterval(o)},[a]);const d=l[0],f=l.filter(o=>o.status==="failed"||o.status==="error"),j=l.reduce((o,u)=>o+u.toolsUsed.length,0);return e.jsx(_,{open:!0,onClose:x,size:"lg",title:t.name,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold border ${ee(t.status)}`,children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border capitalize ${ee(t.status)}`,children:t.status})]}),e.jsxs("div",{className:"text-[11px] text-text-muted mt-0.5",children:[t.title||t.role," · ",t.model.split("/").pop()," · heartbeat ",V(t.lastHeartbeat)," ago"]})]})]}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:[{icon:L,label:"Tasks",value:t.totalTasksCompleted,color:"text-success"},{icon:K,label:"Cost",value:`$${t.totalCostUsd.toFixed(2)}`,color:"text-warning"},{icon:se,label:"Tools",value:j,color:"text-accent"},{icon:E,label:"Failed",value:f.length,color:f.length>0?"text-error":"text-text-muted"}].map(o=>e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg p-2.5 text-center",children:[e.jsx(o.icon,{size:14,className:`mx-auto mb-1 ${o.color}`}),e.jsx("div",{className:"text-sm font-bold text-text",children:o.value}),e.jsx("div",{className:"text-[9px] text-text-muted uppercase tracking-wider",children:o.label})]},o.label))}),t.status==="active"&&d&&d.status==="running"&&e.jsxs("div",{className:"bg-success/5 border border-success/20 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-success mb-1",children:[e.jsx(I,{size:12,className:"animate-pulse"}),e.jsx("span",{className:"font-medium",children:"Currently working"})]}),e.jsxs("div",{className:"text-[11px] text-text-secondary",children:["Run started ",V(d.startedAt)," ago · ",d.toolsUsed.length," tools used so far"]})]}),t.status==="error"&&(d==null?void 0:d.error)&&e.jsxs("div",{className:"bg-error/5 border border-error/20 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-error mb-1",children:[e.jsx(G,{size:12}),e.jsx("span",{className:"font-medium",children:"Last error"})]}),e.jsx("div",{className:"text-[11px] text-text-secondary font-mono",children:d.error})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-text-secondary",children:[e.jsx(re,{size:12,className:"text-accent"}),"Recent Runs"]}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[l.length," total"]})]}),m?e.jsx("div",{className:"space-y-1.5",children:[1,2,3].map(o=>e.jsx("div",{className:"h-10 rounded-lg bg-bg-secondary animate-pulse"},o))}):l.length===0?e.jsx("div",{className:"text-center py-4 text-[11px] text-text-muted",children:"No runs recorded yet"}):e.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto pr-1",children:l.map(o=>e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2 rounded-lg bg-bg-secondary border border-border",children:[o.status==="succeeded"?e.jsx(L,{size:12,className:"text-success shrink-0"}):o.status==="failed"||o.status==="error"?e.jsx(E,{size:12,className:"text-error shrink-0"}):e.jsx(Je,{size:12,className:"text-cyan animate-spin shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-[11px] text-text-secondary truncate",children:[o.source," · ",o.toolsUsed.length," tools"]}),e.jsxs("div",{className:"text-[10px] text-text-muted",children:[o.durationMs?`${o.durationMs}ms`:"..."," · ",V(o.startedAt)," ago"]})]}),o.error&&e.jsx("span",{className:"text-[10px] text-error truncate max-w-[120px]",title:o.error,children:o.error})]},o.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-text-secondary",children:[e.jsx(ne,{size:12,className:"text-accent"}),"Recent Traces"]}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[i.length," loaded"]})]}),i.length===0?e.jsx("div",{className:"text-center py-4 text-[11px] text-text-muted",children:"No traces available"}):e.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto pr-1",children:i.slice(0,10).map(o=>e.jsxs("button",{onClick:()=>p(o),className:"w-full text-left px-2.5 py-2 rounded-lg bg-bg-secondary border border-border hover:bg-bg-secondary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o.status==="running"?e.jsx(I,{size:12,className:"text-cyan animate-pulse shrink-0"}):o.status==="completed"?e.jsx(L,{size:12,className:"text-success shrink-0"}):e.jsx(E,{size:12,className:"text-error shrink-0"}),e.jsx("span",{className:"text-[11px] text-text-secondary truncate flex-1",children:o.message}),e.jsx("span",{className:"text-[10px] text-text-muted shrink-0",children:o.totalMs?`${o.totalMs}ms`:"..."})]}),e.jsxs("div",{className:"flex gap-2 mt-0.5 text-[10px] text-text-muted ml-5",children:[e.jsxs("span",{children:[o.toolCalls.length," tools"]}),e.jsxs("span",{children:[o.rounds," rounds"]}),o.error&&e.jsx("span",{className:"text-error truncate",children:o.error})]})]},o.traceId))})]}),g&&e.jsx(Ze,{trace:g,onClose:()=>p(null)})]})})}function Je({size:t,className:x}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",className:`animate-spin ${x||""}`,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",fill:"none",strokeDasharray:"31.4 31.4",opacity:"0.3"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",fill:"none"})]})}function Ze({trace:t,onClose:x}){return e.jsx(_,{open:!0,onClose:x,size:"md",title:`Trace ${t.traceId.slice(0,8)}`,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-xs text-text-secondary truncate",children:t.message}),e.jsxs("div",{className:"flex gap-3 text-[10px] text-text-muted",children:[e.jsx("span",{className:t.status==="completed"?"text-success":t.status==="failed"?"text-error":"text-cyan",children:t.status}),e.jsxs("span",{children:[t.totalMs,"ms"]}),e.jsxs("span",{children:[t.rounds," rounds"]}),t.model&&e.jsx("span",{children:t.model.split("/").pop()})]}),t.spans.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted mb-1",children:"Spans"}),e.jsx("div",{className:"space-y-1",children:t.spans.map((l,b)=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx(le,{size:10,className:"text-text-muted shrink-0"}),e.jsx("span",{className:"text-text-secondary font-mono",children:l.name}),e.jsxs("span",{className:"text-text-muted",children:[l.durationMs,"ms"]})]},b))})]}),t.toolCalls.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted mb-1",children:"Tool Calls"}),e.jsx("div",{className:"space-y-1",children:t.toolCalls.map((l,b)=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx(se,{size:10,className:l.success?"text-success":"text-error"}),e.jsx("span",{className:"text-text-secondary font-mono",children:l.tool}),e.jsxs("span",{className:"text-text-muted",children:[l.durationMs,"ms"]}),e.jsxs("span",{className:"text-text-muted",children:["round ",l.round]})]},b))})]}),t.error&&e.jsxs("div",{className:"bg-error/5 border border-error/20 rounded-lg p-2.5",children:[e.jsx("div",{className:"text-[10px] text-error uppercase tracking-wider mb-1",children:"Error"}),e.jsx("div",{className:"text-[11px] text-text-secondary font-mono",children:t.error})]})]})})}function T({label:t}){return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin"}),e.jsxs("span",{className:"text-sm text-text-muted",children:["Loading ",t,"…"]})]})})}function F(t){const x=Math.floor((Date.now()-new Date(t).getTime())/1e3);return x<60?`${x}s`:x<3600?`${Math.floor(x/60)}m`:x<86400?`${Math.floor(x/3600)}h`:`${Math.floor(x/86400)}d`}function q({status:t}){const x={active:"bg-success/10 text-success",idle:"bg-warning/10 text-warning",running:"bg-cyan/10 text-cyan",paused:"bg-info/10 text-info",error:"bg-error/10 text-error",stopped:"bg-bg-tertiary text-text-muted",pending:"bg-warning/10 text-warning",approved:"bg-success/10 text-success",rejected:"bg-error/10 text-error",succeeded:"bg-success/10 text-success",failed:"bg-error/10 text-error",backlog:"bg-bg-tertiary text-text-muted",todo:"bg-info/10 text-info",in_progress:"bg-cyan/10 text-cyan",in_review:"bg-purple/10 text-purple-light",done:"bg-success/10 text-success",blocked:"bg-error/10 text-error",cancelled:"bg-bg-tertiary text-text-muted",critical:"bg-error/10 text-error",high:"bg-warning/10 text-warning",medium:"bg-warning/10 text-warning",low:"bg-bg-tertiary text-text-muted"},l=t||"unknown";return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium ${x[l]||"bg-bg-tertiary text-text-muted"}`,children:l.replace("_"," ")})}function P({icon:t,title:x,count:l,action:b,help:i}){return e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t,{size:14,className:"text-accent-light"}),e.jsx("h2",{className:"text-sm font-semibold text-text",children:x}),l!==void 0&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-accent/10 text-accent-light",children:l}),i&&e.jsx(Pe,{title:i.title,description:i.description})]}),b]})}function Qe({agents:t}){const[x,l]=s.useState([]),[b,i]=s.useState([]),[v,m]=s.useState(!1),[c,g]=s.useState(""),[p,a]=s.useState(""),[d,f]=s.useState(null),j=s.useCallback(()=>{pe().then(l).catch(()=>{}),he().then(n=>i(n)).catch(()=>{})},[]);s.useEffect(()=>{j()},[j]);const o=async()=>{c.trim()&&(await ve({name:c.trim(),mission:p.trim()||void 0}),g(""),a(""),m(!1),j())},u=async(n,h,N)=>{try{await fe(n,{[h]:N}),j()}catch(z){alert(`Save failed: ${z.message}`)}},r=async()=>{d&&(await ye(d.id),f(null),j())},y=async(n,h,N)=>{try{await Ae(n,{[h]:N||void 0}),j()}catch(z){alert(`Save failed: ${z.message}`)}},C=["ceo","manager","engineer","researcher","general"];function S(n,h=0){var z;const N=((z=t.find(w=>w.id===n.id))==null?void 0:z.reportsTo)||"";return n.model&&n.model.split("/").pop(),e.jsxs("div",{className:h>0?"ml-6 border-l border-border pl-4":"",children:[e.jsxs("div",{className:"bg-bg-tertiary/30 border border-border rounded-xl p-3.5 mb-2 max-w-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("span",{className:"text-[14px] font-semibold text-text min-w-0",children:e.jsx(D,{value:n.name,onSave:w=>y(n.id,"name",w),placeholder:"Agent name"})}),e.jsx(q,{status:n.status})]}),e.jsxs("div",{className:"grid grid-cols-[72px_1fr] gap-x-3 gap-y-1.5 text-[11px]",children:[e.jsx("span",{className:"text-text-muted",children:"Title"}),e.jsx("span",{className:"text-text-secondary min-w-0",children:e.jsx(D,{value:n.title||"",onSave:w=>y(n.id,"title",w),placeholder:"Add a title",emptyLabel:"—"})}),e.jsx("span",{className:"text-text-muted",children:"Role"}),e.jsx("select",{value:n.role,onChange:w=>y(n.id,"role",w.target.value),className:"bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[11px] text-text-secondary capitalize focus:outline-none focus:border-accent/30 justify-self-start",children:C.map(w=>e.jsx("option",{value:w,children:w},w))}),e.jsx("span",{className:"text-text-muted",children:"Reports to"}),e.jsxs("select",{value:N,onChange:w=>y(n.id,"reportsTo",w.target.value),className:"bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[11px] text-text-secondary focus:outline-none focus:border-accent/30 justify-self-start",children:[e.jsx("option",{value:"",children:"— nobody"}),t.filter(w=>w.id!==n.id).map(w=>e.jsx("option",{value:w.id,children:w.name},w.id))]}),e.jsx("span",{className:"text-text-muted",children:"Model"}),e.jsx("span",{className:"text-text-secondary min-w-0",children:e.jsx(D,{value:n.model||"",onSave:w=>y(n.id,"model",w),placeholder:"e.g. ollama/qwen3.5:cloud",emptyLabel:"—"})})]})]}),n.reports.map(w=>S(w,h+1))]},n.id)}return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:X,title:"Organization Chart",count:t.length}),e.jsx("div",{className:"p-4",children:x.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(X,{size:24,className:"mx-auto mb-2 text-text/10"}),e.jsx("p",{className:"text-[12px] text-text-muted",children:"No agents in org chart yet"}),e.jsx("p",{className:"text-[10px] text-text-muted mt-1",children:'Spawn agents from the Agents tab, then set "Reports to" on each to build the hierarchy.'})]}):x.map(n=>S(n))})]}),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:R,title:"Companies",count:b.length,action:e.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(B,{size:10})," New"]})}),v&&e.jsxs("div",{className:"p-4 border-b border-border bg-bg-secondary/30 space-y-2",children:[e.jsx("input",{value:c,onChange:n=>g(n.target.value),placeholder:"Company name...",className:"w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[13px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30",onKeyDown:n=>n.key==="Enter"&&o()}),e.jsx("input",{value:p,onChange:n=>a(n.target.value),placeholder:"Mission (optional)...",className:"w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[12px] text-text-secondary placeholder-white/15 focus:outline-none focus:border-accent/30"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:o,className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded-lg",children:"Create"}),e.jsx("button",{onClick:()=>m(!1),className:"px-3 py-1.5 text-[11px] text-text-muted",children:"Cancel"})]})]}),e.jsx("div",{className:"divide-y divide-border/30",children:b.length===0?e.jsx("div",{className:"py-6 text-center text-[12px] text-text-muted",children:'No companies yet — click "+ New" to create one.'}):b.map(n=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 hover:bg-bg-secondary/30 transition-colors",children:[e.jsx(R,{size:14,className:"text-accent-light flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsx("div",{className:"text-[13px] text-text font-medium",children:e.jsx(D,{value:n.name,onSave:h=>u(n.id,"name",h),placeholder:"Company name"})}),e.jsx("div",{className:"text-[10px] text-text-muted",children:e.jsx(D,{value:n.mission||"",onSave:h=>u(n.id,"mission",h),placeholder:"Add a mission",emptyLabel:"(no mission — click to add)"})})]}),e.jsx(q,{status:n.status||"active"}),e.jsx("button",{onClick:()=>f({id:n.id,name:n.name}),className:"p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors",title:"Delete company",children:e.jsx(J,{size:12})})]},n.id))})]}),e.jsx(Z,{open:!!d,title:`Delete company "${(d==null?void 0:d.name)||""}"?`,message:"This removes the company record. Agents and goals linked to it stay; they just lose the company association. This can't be undone.",confirmLabel:"Delete",onConfirm:r,onCancel:()=>f(null)})]})}function Ye({agents:t}){const[x,l]=s.useState([]),[b,i]=s.useState(""),[v,m]=s.useState(!1),[c,g]=s.useState(""),[p,a]=s.useState("medium"),[d,f]=s.useState(null),[j,o]=s.useState(null),u=s.useCallback(()=>{ge(b?{status:b}:void 0).then(l).catch(()=>{})},[b]);s.useEffect(()=>{u()},[u]);const r=async()=>{c.trim()&&(await Ce({title:c,priority:p}),g(""),m(!1),u())},y=async(h,N)=>{await $(h,{status:N}),u()},C=async(h,N)=>{await $(h,{assigneeAgentId:N||void 0}),u()},S=async()=>{j&&(await Se(j),o(null),d===j&&f(null),u())},n=["backlog","todo","in_progress","in_review","done","blocked"];return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("button",{onClick:()=>i(""),className:`px-2.5 py-1 text-[10px] rounded-lg transition-colors ${b?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent text-text"}`,children:"All"}),n.map(h=>e.jsx("button",{onClick:()=>i(h),className:`px-2.5 py-1 text-[10px] rounded-lg transition-colors ${b===h?"bg-accent text-text":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:h.replace("_"," ")},h))]}),e.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1 px-3 py-1.5 text-[11px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(B,{size:12})," New Issue"]})]}),v&&e.jsxs("div",{className:"bg-bg-tertiary/30 border border-border rounded-xl p-4 space-y-3",children:[e.jsx("input",{value:c,onChange:h=>g(h.target.value),placeholder:"Issue title...",className:"w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[13px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30",onKeyDown:h=>h.key==="Enter"&&r()}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:p,onChange:h=>a(h.target.value),className:"bg-bg-tertiary border border-border rounded-lg px-2 py-1.5 text-[11px] text-text-secondary focus:outline-none",children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]}),e.jsx("button",{onClick:r,className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded-lg",children:"Create"}),e.jsx("button",{onClick:()=>m(!1),className:"px-3 py-1.5 text-[11px] text-text-muted hover:text-text-secondary",children:"Cancel"})]})]}),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:R,title:"Issues",count:x.length}),e.jsx("div",{className:"divide-y divide-border/30",children:x.length===0?e.jsx("div",{className:"py-8 text-center text-[12px] text-text-muted",children:'No issues found — click "+ New Issue" to create one.'}):x.map(h=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 hover:bg-bg-secondary/30 transition-colors",children:[e.jsx("span",{className:"text-[10px] text-text-muted font-mono w-14",children:h.identifier}),e.jsx(q,{status:h.priority||"medium"}),e.jsx("button",{onClick:()=>f(h.id),className:"text-[12px] text-text-secondary flex-1 truncate text-left hover:text-text transition-colors",title:"Open details",children:h.title}),e.jsxs("select",{value:h.assigneeAgentId||"",onChange:N=>C(h.id,N.target.value),onClick:N=>N.stopPropagation(),className:"bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[10px] text-text-secondary focus:outline-none max-w-[120px]",title:"Assignee",children:[e.jsx("option",{value:"",children:"unassigned"}),t.map(N=>e.jsx("option",{value:N.id,children:N.name},N.id))]}),e.jsxs("select",{value:h.status,onChange:N=>y(h.id,N.target.value),onClick:N=>N.stopPropagation(),className:"bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[10px] text-text-secondary focus:outline-none",children:[n.map(N=>e.jsx("option",{value:N,children:N.replace("_"," ")},N)),e.jsx("option",{value:"cancelled",children:"cancelled"})]}),e.jsx("button",{onClick:()=>o(h.id),className:"p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors",title:"Delete issue",children:e.jsx(J,{size:12})})]},h.id))})]}),d&&e.jsx(Xe,{issueId:d,agents:t,onClose:()=>{f(null),u()},onRequestDelete:()=>o(d)}),e.jsx(Z,{open:!!j,title:"Delete this issue?",message:"This can't be undone. The issue and all its comments will be removed.",confirmLabel:"Delete",onConfirm:S,onCancel:()=>o(null)})]})}function Xe({issueId:t,agents:x,onClose:l,onRequestDelete:b}){var u;const[i,v]=s.useState(null),[m,c]=s.useState(""),[g,p]=s.useState(!1),a=s.useCallback(async()=>{try{const r=await ke(t);v(r)}catch{}},[t]);s.useEffect(()=>{a()},[a]);const d=async(r,y)=>{await $(t,{[r]:y}),a()},f=async r=>{await $(t,{priority:r}),a()},j=async r=>{await $(t,{assigneeAgentId:r||void 0}),a()},o=async()=>{if(m.trim()){p(!0);try{await De(t,m.trim(),{user:"board"}),c(""),a()}finally{p(!1)}}};return e.jsx(_,{open:!0,onClose:l,size:"lg",title:i?`${i.identifier}`:"Loading…",children:i?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted/70 mb-1",children:"Title"}),e.jsx("div",{className:"text-[14px] text-text",children:e.jsx(D,{value:i.title,onSave:r=>d("title",r),placeholder:"Issue title"})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-text-muted/70 mb-1",children:"Description"}),e.jsx("div",{className:"text-[12px] text-text-secondary whitespace-pre-wrap",children:e.jsx(D,{value:i.description||"",onSave:r=>d("description",r),placeholder:"Add a description…",multiline:!0,emptyLabel:"(none — click to add)"})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-[11px]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-text-muted/70 uppercase tracking-wider text-[10px] mb-1",children:"Priority"}),e.jsxs("select",{value:i.priority||"medium",onChange:r=>f(r.target.value),className:"bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none w-full",children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-text-muted/70 uppercase tracking-wider text-[10px] mb-1",children:"Assignee"}),e.jsxs("select",{value:i.assigneeAgentId||"",onChange:r=>j(r.target.value),className:"bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none w-full",children:[e.jsx("option",{value:"",children:"unassigned"}),x.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-text-muted/70 uppercase tracking-wider text-[10px] mb-1",children:"Status"}),e.jsx("div",{className:"text-text capitalize",children:i.status.replace(/_/g," ")})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-text-muted/70 mb-2",children:["Comments (",((u=i.comments)==null?void 0:u.length)||0,")"]}),e.jsx("div",{className:"space-y-2 max-h-[240px] overflow-y-auto pr-1",children:(i.comments||[]).length===0?e.jsx("div",{className:"text-[11px] text-text-muted italic",children:"No comments yet."}):i.comments.map(r=>e.jsxs("div",{className:"bg-bg-secondary/30 border border-border/50 rounded-lg px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-muted/70 mb-1",children:[e.jsx("span",{className:"text-text-secondary",children:r.authorAgentId||r.authorUser||"unknown"}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[F(r.createdAt)," ago"]})]}),e.jsx("div",{className:"text-[12px] text-text whitespace-pre-wrap",children:r.body})]},r.id))}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("input",{value:m,onChange:r=>c(r.target.value),onKeyDown:r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),o())},placeholder:"Add a comment — Enter to post",disabled:g,className:"flex-1 bg-bg-tertiary border border-border rounded px-3 py-1.5 text-[12px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30"}),e.jsx("button",{onClick:o,disabled:g||!m.trim(),className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50",children:"Post"})]})]}),e.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-border",children:[e.jsxs("span",{className:"text-[10px] text-text-muted",children:["Created ",F(i.createdAt)," ago"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:b,className:"px-3 py-1.5 text-[11px] text-error hover:bg-error/10 rounded",children:"Delete issue"}),e.jsx("button",{onClick:l,className:"px-3 py-1.5 text-[11px] text-text-secondary hover:text-text bg-bg-tertiary rounded",children:"Close"})]})]})]}):e.jsx("div",{className:"py-8 text-center text-[12px] text-text-muted",children:"Loading…"})})}function et({budgets:t,onRefresh:x}){const[l,b]=s.useState(null),[i,v]=s.useState(!1),[m,c]=s.useState(null),g=async()=>{m&&(await je(m.id),c(null),x())};return e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:K,title:"Budget Policies",count:t.length,action:e.jsxs("button",{onClick:()=>v(!0),className:"flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(B,{size:10})," New Budget"]})}),e.jsx("div",{className:"p-4 space-y-3",children:t.length===0?e.jsx("div",{className:"text-center py-6 text-[12px] text-text-muted",children:'No budget policies yet — click "+ New Budget" to set spending limits per agent, goal, or globally.'}):t.map(p=>{const a=p.limitUsd>0?Math.min(100,p.currentSpend/p.limitUsd*100):0,d=a>=100?"bg-error":a>=80?"bg-warning":"bg-success";return e.jsxs("div",{className:"bg-bg-tertiary/30 border border-border rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-[12px] font-medium text-text",children:p.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-text-muted capitalize",children:p.scope.type}),e.jsx("span",{className:"text-[10px] text-text-muted",children:p.period}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${p.enabled?"text-success bg-success/10":"text-text-muted bg-bg-tertiary"}`,children:p.enabled?"on":"off"}),e.jsx("button",{onClick:()=>b(p),className:"text-[10px] text-text-muted hover:text-text-secondary px-1",title:"Edit budget",children:"Edit"}),e.jsx("button",{onClick:()=>c(p),className:"p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors",title:"Delete budget",children:e.jsx(J,{size:12})})]})]}),e.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden mb-1.5",children:e.jsx("div",{className:`h-full ${d} rounded-full transition-all`,style:{width:`${a}%`}})}),e.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted",children:[e.jsxs("span",{children:["$",p.currentSpend.toFixed(2)," spent"]}),e.jsxs("span",{children:["$",p.limitUsd.toFixed(2)," limit · action: ",p.action]})]})]},p.id)})}),(i||l)&&e.jsx(tt,{existing:l,onClose:()=>{v(!1),b(null)},onSaved:()=>{v(!1),b(null),x()}}),e.jsx(Z,{open:!!m,title:`Delete budget "${(m==null?void 0:m.name)||""}"?`,message:"The policy and its spend history are removed. Agents/goals it covered will no longer be budget-enforced unless another policy applies.",confirmLabel:"Delete",onConfirm:g,onCancel:()=>c(null)})]})}function tt({existing:t,onClose:x,onSaved:l}){var z,w;const b=!!t,[i,v]=s.useState((t==null?void 0:t.name)||""),[m,c]=s.useState((t==null?void 0:t.scope.type)||"global"),[g,p]=s.useState((t==null?void 0:t.scope.targetId)||""),[a,d]=s.useState((t==null?void 0:t.period)||"daily"),[f,j]=s.useState(((z=t==null?void 0:t.limitUsd)==null?void 0:z.toString())||"10"),[o,u]=s.useState(((w=t==null?void 0:t.warningThresholdPercent)==null?void 0:w.toString())||"80"),[r,y]=s.useState((t==null?void 0:t.action)||"warn"),[C,S]=s.useState((t==null?void 0:t.enabled)??!0),[n,h]=s.useState(!1),N=async()=>{if(i.trim()){h(!0);try{const k={name:i.trim(),scope:{type:m,targetId:m==="global"?void 0:g||void 0},period:a,limitUsd:Number(f)||0,warningThresholdPercent:Number(o)||80,action:r,enabled:C};b&&t?await ze(t.id,k):await Te(k),l()}catch(k){alert(`Save failed: ${k.message}`)}finally{h(!1)}}};return e.jsx(_,{open:!0,onClose:x,size:"md",title:b?"Edit Budget Policy":"New Budget Policy",footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:x,className:"px-3 py-1.5 text-[11px] text-text-secondary hover:text-text",children:"Cancel"}),e.jsx("button",{onClick:N,disabled:n||!i.trim(),className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50",children:n?"Saving…":b?"Save changes":"Create budget"})]}),children:e.jsxs("div",{className:"space-y-3 text-[12px]",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Name"}),e.jsx("input",{value:i,onChange:k=>v(k.target.value),placeholder:"e.g. Daily global cap",className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Scope"}),e.jsxs("select",{value:m,onChange:k=>c(k.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"global",children:"Global (all agents)"}),e.jsx("option",{value:"agent",children:"Per-agent"}),e.jsx("option",{value:"goal",children:"Per-goal"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Target ID"}),e.jsx("input",{value:g,onChange:k=>p(k.target.value),placeholder:m==="global"?"n/a":m==="agent"?"agent-id":"goal-id",disabled:m==="global",className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none disabled:opacity-40"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Period"}),e.jsxs("select",{value:a,onChange:k=>d(k.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Limit (USD)"}),e.jsx("input",{type:"number",step:"0.01",value:f,onChange:k=>j(k.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Warn at %"}),e.jsx("input",{type:"number",min:"1",max:"100",value:o,onChange:k=>u(k.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Action at limit"}),e.jsxs("select",{value:r,onChange:k=>y(k.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"warn",children:"Warn only"}),e.jsx("option",{value:"pause",children:"Pause agent"}),e.jsx("option",{value:"stop",children:"Stop agent"})]})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsxs("label",{className:"flex items-center gap-2 text-text-secondary cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:k=>S(k.target.checked),className:"accent-accent"}),e.jsx("span",{children:"Enabled"})]})})]})]})})}function st({dashboard:t}){const[x,l]=s.useState([]),[b,i]=s.useState(""),[v,m]=s.useState(!1),[c,g]=s.useState(""),[p,a]=s.useState(),d=s.useRef(null),f=s.useRef(null),j=s.useCallback(()=>{var y;const u=t,r=u.agents.map(C=>`${C.name} (${C.status}, ${C.role}, cost=$${C.totalCostUsd.toFixed(2)})`).join("; ")||"none";return`[COMMAND POST] ${u.totalAgents} agents (${u.activeAgents} active), ${u.activeCheckouts} locked tasks, budget ${Math.round(u.budgetUtilization??0)}% used, ${((y=u.goalTree)==null?void 0:y.length)??0} goals. Agents: ${r}. You manage this agent organization. Be concise.
|
|
23
23
|
|
|
24
|
-
`},[t]),o=s.useCallback(async()=>{const u=b.trim();if(!u||v)return;i(""),l(S=>[...S,{role:"user",content:u}]),m(!0),g("");const r=new AbortController;d.current=r;let y="",C=p;try{await me(j()+u,p,S=>{S.type==="token"&&(y+=S.data,g(y)),S.type==="done"&&S.sessionId&&(C=S.sessionId)},r.signal),C&&a(C),y&&l(S=>[...S,{role:"assistant",content:y}])}catch(S){S.name!=="AbortError"&&l(n=>[...n,{role:"assistant",content:`Error: ${S.message}`}])}finally{m(!1),g(""),d.current=null}},[b,v,p,j]);return s.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[x,c]),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden flex flex-col",style:{height:400},children:[e.jsx(P,{icon:H,title:"Console",action:v?e.jsxs("button",{onClick:()=>{var u;return(u=d.current)==null?void 0:u.abort()},className:"text-[10px] text-error flex items-center gap-1",children:[e.jsx(Re,{size:12}),"Stop"]}):void 0}),e.jsxs("div",{ref:f,className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:[x.length===0&&!v&&e.jsxs("div",{className:"text-center py-6",children:[e.jsx("p",{className:"text-[11px] text-text-muted mb-3",children:"Manage your organization through natural language"}),e.jsx("div",{className:"flex flex-wrap justify-center gap-1.5",children:["Status report","Create issue: Research competitors","Spawn a research agent","Set $50/day budget"].map(u=>e.jsx("button",{onClick:()=>i(u),className:"text-[10px] text-text-muted hover:text-text-muted px-2.5 py-1 rounded-full border border-border hover:border-border-light",children:u},u))})]}),x.map((u,r)=>e.jsx("div",{className:`flex ${u.role==="user"?"justify-end":"justify-start"}`,children:e.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-xl text-[12px] leading-relaxed whitespace-pre-wrap ${u.role==="user"?"bg-accent/80 text-text rounded-br-sm":"bg-bg-tertiary text-text-secondary border border-border rounded-bl-sm"}`,children:u.content})},r)),v&&c&&e.jsx("div",{className:"flex justify-start",children:e.jsxs("div",{className:"max-w-[85%] px-3 py-2 rounded-xl rounded-bl-sm bg-bg-tertiary text-text-secondary border border-border text-[12px] whitespace-pre-wrap",children:[c,e.jsx("span",{className:"inline-block w-1 h-3.5 bg-accent-light ml-0.5 animate-pulse"})]})}),v&&!c&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"px-3 py-2 rounded-xl bg-bg-tertiary border border-border",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce"}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce",style:{animationDelay:"300ms"}})]})})})]}),e.jsx("div",{className:"px-3 py-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:b,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),o())},placeholder:"Tell Command Post what to do...",className:"flex-1 bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[12px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30"}),e.jsx("button",{onClick:o,disabled:!b.trim()||v,className:"p-2 rounded-lg bg-accent text-text hover:bg-accent-hover disabled:opacity-30",children:e.jsx(Fe,{size:14})})]})})]})}function at({onClose:t,onCreated:x}){const[l,b]=s.useState(""),[i,v]=s.useState([{role:"pragmatist",model:""},{role:"skeptic",model:""}]),[m,c]=s.useState(2),[g,p]=s.useState("judge"),[a,d]=s.useState(!1),f=()=>{i.length>=5||v([...i,{role:`participant-${i.length+1}`,model:""}])},j=r=>{i.length<=2||v(i.filter((y,C)=>C!==r))},o=(r,y)=>{v(i.map((C,S)=>S===r?{...C,...y}:C))},u=async()=>{if(!(!l.trim()||i.length<2)){d(!0);try{const r=await W("/api/command-post/debates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:l.trim(),participants:i.map(y=>({role:y.role.trim()||"participant",model:y.model.trim()||void 0})),rounds:m,resolution:g})});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);x()}catch(r){alert(`Debate failed: ${r.message}`)}finally{d(!1)}}};return e.jsx(_,{open:!0,onClose:t,title:"Start a new debate",size:"lg",footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t,className:"px-3 py-1.5 text-[11px] text-text-secondary hover:text-text",children:"Cancel"}),e.jsx("button",{onClick:u,disabled:a||!l.trim()||i.length<2,className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50",children:a?"Running debate…":"Run debate"})]}),children:e.jsxs("div",{className:"space-y-3 text-[12px]",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Question"}),e.jsx("textarea",{value:l,onChange:r=>b(r.target.value),placeholder:"e.g. Should we cache the Ollama probe results for 7 days or 30 days?",rows:2,className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40 resize-none"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:["Participants (",i.length,"/5)"]}),e.jsx("button",{onClick:f,disabled:i.length>=5,className:"text-[10px] text-accent-light/70 hover:text-accent-light disabled:opacity-40",children:"+ Add participant"})]}),e.jsx("div",{className:"space-y-2",children:i.map((r,y)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("input",{value:r.role,onChange:C=>o(y,{role:C.target.value}),placeholder:"role (e.g. pragmatist)",className:"flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none"}),e.jsx("input",{value:r.model,onChange:C=>o(y,{model:C.target.value}),placeholder:"model (optional — defaults to agent.model)",className:"flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text-secondary focus:outline-none"}),e.jsx("button",{onClick:()=>j(y),disabled:i.length<=2,className:"text-text-muted hover:text-error disabled:opacity-20 px-1",title:"Remove",children:"×"})]},y))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Rounds"}),e.jsx("select",{value:m,onChange:r=>c(Number(r.target.value)),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[1,2,3,4].map(r=>e.jsxs("option",{value:r,children:[r," round",r===1?"":"s"]},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Resolution"}),e.jsxs("select",{value:g,onChange:r=>p(r.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"judge",children:"Judge (LLM picks winner)"}),e.jsx("option",{value:"synthesize",children:"Synthesize (LLM merges)"}),e.jsx("option",{value:"vote",children:"Vote (word-overlap consensus)"})]})]})]}),e.jsx("div",{className:"text-[10px] text-text-muted/70 italic",children:"Runs live — 1-3 minutes depending on model + rounds. Transcript saves automatically."})]})})}function rt(){const[t,x]=s.useState([]),[l,b]=s.useState("pending"),[i,v]=s.useState(!1),m=s.useCallback(async()=>{v(!0);try{const a=await be(l==="all"?void 0:l);x(a)}catch{}v(!1)},[l]);s.useEffect(()=>{m()},[m]);const c=async a=>{try{await Ne(a,"board")}catch{}m()},g=async a=>{try{await we(a,"board")}catch{}m()},p=t.filter(a=>l==="all"?!0:a.status===l);return e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:ae,title:"Approvals",count:p.length,help:{title:"Approvals",description:"Human-in-the-loop decisions for hiring agents, budget overrides, goal proposals, and self-modification requests."},action:e.jsx("div",{className:"flex items-center gap-2",children:["pending","approved","rejected","all"].map(a=>e.jsx("button",{onClick:()=>b(a),className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${l===a?"bg-accent text-text":"bg-bg-tertiary text-text-muted hover:text-text"}`,children:a},a))})}),e.jsx("div",{className:"divide-y divide-border/30",children:i?e.jsx("div",{className:"py-8 text-center text-[12px] text-text-muted",children:"Loading..."}):p.length===0?e.jsxs("div",{className:"py-8 text-center text-[12px] text-text-muted",children:["No ",l," approvals."]}):p.map(a=>{var d;return e.jsxs("div",{className:"px-4 py-3 hover:bg-bg-tertiary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-[12px] text-text flex-1 truncate pr-2",children:a.type.replace(/_/g," ")}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full ${a.status==="pending"?"bg-warning/10 text-warning":a.status==="approved"?"bg-success/10 text-success":"bg-error/10 text-error"}`,children:a.status})]}),e.jsx("div",{className:"text-[10px] text-text-muted mb-2 truncate",children:(d=_e(a))==null?void 0:d.headline}),a.status==="pending"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>c(a.id),className:"px-2 py-0.5 text-[10px] bg-success text-text rounded hover:bg-success/80",children:"Approve"}),e.jsx("button",{onClick:()=>g(a.id),className:"px-2 py-0.5 text-[10px] bg-error text-text rounded hover:bg-error/80",children:"Reject"})]}),a.decidedBy&&e.jsxs("div",{className:"text-[10px] text-text-muted mt-1",children:["By ",a.decidedBy," ",a.decidedAt?F(a.decidedAt)+" ago":""]})]},a.id)})})]})}function nt(){const[t,x]=s.useState([]),[l,b]=s.useState(null),[i,v]=s.useState(!1),[m,c]=s.useState(!1),g=s.useCallback(async()=>{v(!0);try{const a=await W("/api/command-post/debates");if(a.ok){const d=await a.json();x((d==null?void 0:d.items)||[])}}catch{}v(!1)},[]);s.useEffect(()=>{g()},[g]);const p=async a=>{try{const d=await W(`/api/command-post/debates/${a}`);if(d.ok){const f=await d.json();b(f)}}catch{}};if(l){const a=new Map;for(const d of l.turns){const f=a.get(d.round)||[];f.push(d),a.set(d.round,f)}return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{onClick:()=>b(null),className:"text-[11px] text-text-muted hover:text-text-secondary",children:"← Back to debates"}),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl p-4",children:[e.jsx("div",{className:"text-[13px] font-semibold text-text mb-1",children:l.question}),e.jsxs("div",{className:"text-[10px] text-text-muted/70",children:[l.resolution," • ",l.rounds," round",l.rounds===1?"":"s"," • ",(l.durationMs/1e3).toFixed(1),"s"]}),l.winner&&e.jsxs("div",{className:"mt-3 p-3 bg-success/[0.06] border border-success/30 rounded-lg",children:[e.jsxs("div",{className:"text-[11px] text-success/80/80 uppercase tracking-wider",children:["Winner: ",l.winner.role]}),e.jsx("div",{className:"text-[12px] text-text mt-1",children:l.winner.content}),l.winner.justification&&e.jsx("div",{className:"text-[10px] text-text-muted italic mt-2",children:l.winner.justification})]})]}),[...a.entries()].sort((d,f)=>d[0]-f[0]).map(([d,f])=>e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2 border-b border-border/50 text-[11px] font-medium text-text-secondary uppercase tracking-wider",children:["Round ",d]}),e.jsx("div",{className:"divide-y divide-border/30",children:f.map((j,o)=>e.jsxs("div",{className:"px-4 py-3",children:[e.jsx("div",{className:"text-[11px] font-semibold text-accent-light/80 mb-1",children:j.role}),e.jsx("div",{className:"text-[11px] text-text-secondary whitespace-pre-wrap",children:j.content}),e.jsxs("div",{className:"text-[9px] text-text-muted mt-1",children:[j.model.split("/").pop()," • ",j.durationMs,"ms"]})]},o))})]},d))]})}return e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:oe,title:"Debates",count:t.length,help:{title:"Debates",description:"Pit two or more agents against each other to explore different sides of a decision. Useful for risk assessment and trade-off analysis."},action:e.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(B,{size:10})," New Debate"]})}),m&&e.jsx(at,{onClose:()=>c(!1),onCreated:()=>{c(!1),g()}}),e.jsx("div",{className:"divide-y divide-border/30",children:i?e.jsx("div",{className:"py-8 text-center text-[12px] text-text-muted",children:"Loading..."}):t.length===0?e.jsxs("div",{className:"py-8 text-center text-[12px] text-text-muted",children:["No debates yet. Call the ",e.jsx("code",{className:"text-accent-light/70",children:"agent_debate"})," tool to start one."]}):t.map(a=>e.jsxs("button",{onClick:()=>p(a.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("div",{className:"text-[12px] text-text flex-1 truncate pr-2",children:a.question}),e.jsxs("span",{className:"text-[10px] text-text-muted whitespace-nowrap",children:[F(a.startedAt)," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[e.jsx("span",{children:a.resolution}),e.jsxs("span",{children:[a.rounds," round",a.rounds===1?"":"s"]}),e.jsxs("span",{children:[(a.durationMs/1e3).toFixed(1),"s"]}),a.winnerRole&&e.jsxs("span",{className:"text-success/80/70",children:["winner: ",a.winnerRole]})]})]},a.id))})]})}const lt=[{label:"Overview",tabs:[{id:"Dashboard",label:"Dashboard",icon:ne}]},{label:"Operations",tabs:[{id:"Social",label:"Social",icon:H},{id:"Inbox",label:"Inbox",icon:Ve},{id:"Goals",label:"Goals",icon:xe},{id:"Work",label:"Work",icon:R},{id:"Sessions",label:"Sessions",icon:le}]},{label:"Governance",tabs:[{id:"Issues",label:"Issues",icon:H},{id:"Approvals",label:"Approvals",icon:ae},{id:"Org Chart",label:"Org Chart",icon:re},{id:"Agents",label:"Agents",icon:ue},{id:"Files",label:"Files",icon:Me},{id:"Debates",label:"Debates",icon:oe},{id:"Costs",label:"Costs",icon:K}]},{label:"System",tabs:[{id:"Traces",label:"Traces",icon:I},{id:"Console",label:"Console",icon:Le}]}],ot=s.lazy(()=>A(()=>import("./WorkTab-iCDNyX60.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),it=s.lazy(()=>A(()=>import("./SessionsTab-hihe8Dc7.js"),__vite__mapDeps([10,1,2,3]))),ct=s.lazy(()=>A(()=>import("./CPInbox-igQoKOuB.js"),__vite__mapDeps([11,1,2,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,5]))),dt=s.lazy(()=>A(()=>import("./CPFiles-CI252ucO.js"),__vite__mapDeps([28,1,2,29,30,31,32,33]))),xt=s.lazy(()=>A(()=>import("./TraceViewer-CSj_fZou.js"),__vite__mapDeps([34,1,2,35,36,22,37,31,38]))),ut=s.lazy(()=>A(()=>import("./CPSocial-sMl4vqmX.js"),__vite__mapDeps([39,1,2,32,23,40,22,20]))),mt=s.lazy(()=>A(()=>import("./CPDashboard-CyKZGlHB.js"),__vite__mapDeps([41,1,2,12,13,42,14,15,18,32,43,44]))),pt=s.lazy(()=>A(()=>import("./CPGoals-BtcgDUY5.js"),__vite__mapDeps([45,1,2,12,13,42,14,15,16,46,3,18,6,8]))),ht=s.lazy(()=>A(()=>import("./CPAgents-DIYCdpQR.js"),__vite__mapDeps([47,1,2,12,13,42,14,15,16,18])));function Bt(){const[t,x]=s.useState("Dashboard"),[l,b]=s.useState(null),[i,v]=s.useState([]),[m,c]=s.useState(!0),[g,p]=s.useState(null),[a,d]=s.useState([]),[f,j]=s.useState(!1),[o,u]=s.useState(null),r=s.useCallback(async()=>{try{const[n,h]=await Promise.allSettled([de(),te()]);n.status==="fulfilled"&&(b(n.value),d(n.value.recentActivity||[])),h.status==="fulfilled"&&v(h.value),p(null)}catch(n){p(n.message)}c(!1)},[]);if(s.useEffect(()=>{r()},[r]),s.useEffect(()=>{if(!l)return;const n=localStorage.getItem("titan-token"),h=n?`/api/command-post/stream?token=${n}`:"/api/command-post/stream",N=new EventSource(h);let z=0;return N.addEventListener("commandpost:activity",w=>{z=0;try{d(k=>[...k.slice(-49),JSON.parse(w.data)])}catch{}}),N.addEventListener("commandpost:agent:status",w=>{z=0;try{const k=JSON.parse(w.data);b(M=>M&&{...M,agents:M.agents.map(U=>U.id===k.agentId?{...U,status:k.status}:U)})}catch{}}),N.onerror=()=>{z++,z>5&&N.close()},()=>N.close()},[l]),s.useEffect(()=>{const n=setInterval(r,3e4);return()=>clearInterval(n)},[r]),m)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading Command Post..."})]})});if(g)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(G,{className:"mx-auto mb-3 text-warning",size:32}),e.jsx("p",{className:"text-sm text-text-secondary mb-4",children:g}),e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm bg-bg-tertiary rounded-lg hover:bg-border text-text-secondary transition-colors",children:"Retry"})]})});const y=l??{agents:[],totalAgents:0,activeAgents:0,activeCheckouts:0,budgetUtilization:0,recentActivity:[],checkouts:[],budgets:[],goalTree:[],companies:[]},C=lt.flatMap(n=>n.tabs.map(h=>({...h,group:n.label}))),S=()=>{switch(t){case"Dashboard":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"dashboard"}),children:e.jsx(mt,{})});case"Social":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"social"}),children:e.jsx(ut,{})});case"Inbox":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"inbox"}),children:e.jsx(ct,{})});case"Goals":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"goals"}),children:e.jsx(pt,{})});case"Work":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"work"}),children:e.jsx(ot,{})});case"Sessions":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"sessions"}),children:e.jsx(it,{})});case"Issues":return e.jsx(Ye,{agents:y.agents});case"Approvals":return e.jsx(rt,{});case"Org Chart":return e.jsx(Qe,{agents:y.agents});case"Agents":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"agents"}),children:e.jsx(ht,{})});case"Files":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"files"}),children:e.jsx(dt,{})});case"Debates":return e.jsx(nt,{});case"Costs":return e.jsx(et,{budgets:y.budgets,onRefresh:r});case"Traces":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"traces"}),children:e.jsx(xt,{})});case"Console":return e.jsx(st,{dashboard:y});default:return null}};return e.jsxs("div",{className:"h-full flex overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",children:[e.jsx("div",{className:"sticky top-0 z-20 border-b border-border bg-bg/95 backdrop-blur",children:e.jsxs("div",{className:"flex items-center gap-3 px-4 md:px-6 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-sm font-bold text-text",children:"Command Post"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:"Agent governance"})]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-x-auto",children:e.jsx("div",{className:"flex items-center gap-1",children:C.map(n=>{const h=t===n.id;return e.jsxs("button",{onClick:()=>x(n.id),title:`${n.group}: ${n.label}`,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-[12px] transition-all duration-150 ${h?"bg-accent/10 text-accent-light font-medium":"text-text-secondary hover:text-text hover:bg-bg-tertiary/50"}`,children:[e.jsx(n.icon,{size:14,className:h?"text-accent-light":"text-text-muted"}),e.jsx("span",{children:n.label})]},n.id)})})}),e.jsxs("button",{onClick:r,className:"shrink-0 flex items-center justify-center gap-1.5 px-2.5 py-1.5 text-[11px] text-text-muted bg-bg-tertiary/50 border border-border rounded-lg hover:bg-bg-tertiary transition-colors",children:[e.jsx(Ee,{size:12,className:m?"animate-spin":""}),"Refresh"]})]})}),e.jsx("div",{className:"max-w-6xl mx-auto px-4 md:px-6 py-4 md:py-6",children:e.jsx(S,{})})]}),e.jsx(Ge,{collapsed:f,onToggle:()=>j(!f),agents:y.agents,runs:i,onAgentClick:n=>u(n)}),o&&e.jsx(Ke,{agent:o,onClose:()=>u(null)})]})}export{Bt as default};
|
|
24
|
+
`},[t]),o=s.useCallback(async()=>{const u=b.trim();if(!u||v)return;i(""),l(S=>[...S,{role:"user",content:u}]),m(!0),g("");const r=new AbortController;d.current=r;let y="",C=p;try{await me(j()+u,p,S=>{S.type==="token"&&(y+=S.data,g(y)),S.type==="done"&&S.sessionId&&(C=S.sessionId)},r.signal),C&&a(C),y&&l(S=>[...S,{role:"assistant",content:y}])}catch(S){S.name!=="AbortError"&&l(n=>[...n,{role:"assistant",content:`Error: ${S.message}`}])}finally{m(!1),g(""),d.current=null}},[b,v,p,j]);return s.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[x,c]),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden flex flex-col",style:{height:400},children:[e.jsx(P,{icon:H,title:"Console",action:v?e.jsxs("button",{onClick:()=>{var u;return(u=d.current)==null?void 0:u.abort()},className:"text-[10px] text-error flex items-center gap-1",children:[e.jsx(Re,{size:12}),"Stop"]}):void 0}),e.jsxs("div",{ref:f,className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:[x.length===0&&!v&&e.jsxs("div",{className:"text-center py-6",children:[e.jsx("p",{className:"text-[11px] text-text-muted mb-3",children:"Manage your organization through natural language"}),e.jsx("div",{className:"flex flex-wrap justify-center gap-1.5",children:["Status report","Create issue: Research competitors","Spawn a research agent","Set $50/day budget"].map(u=>e.jsx("button",{onClick:()=>i(u),className:"text-[10px] text-text-muted hover:text-text-muted px-2.5 py-1 rounded-full border border-border hover:border-border-light",children:u},u))})]}),x.map((u,r)=>e.jsx("div",{className:`flex ${u.role==="user"?"justify-end":"justify-start"}`,children:e.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-xl text-[12px] leading-relaxed whitespace-pre-wrap ${u.role==="user"?"bg-accent/80 text-text rounded-br-sm":"bg-bg-tertiary text-text-secondary border border-border rounded-bl-sm"}`,children:u.content})},r)),v&&c&&e.jsx("div",{className:"flex justify-start",children:e.jsxs("div",{className:"max-w-[85%] px-3 py-2 rounded-xl rounded-bl-sm bg-bg-tertiary text-text-secondary border border-border text-[12px] whitespace-pre-wrap",children:[c,e.jsx("span",{className:"inline-block w-1 h-3.5 bg-accent-light ml-0.5 animate-pulse"})]})}),v&&!c&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"px-3 py-2 rounded-xl bg-bg-tertiary border border-border",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce"}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce",style:{animationDelay:"300ms"}})]})})})]}),e.jsx("div",{className:"px-3 py-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:b,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),o())},placeholder:"Tell Command Post what to do...",className:"flex-1 bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[12px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30"}),e.jsx("button",{onClick:o,disabled:!b.trim()||v,className:"p-2 rounded-lg bg-accent text-text hover:bg-accent-hover disabled:opacity-30",children:e.jsx(Fe,{size:14})})]})})]})}function at({onClose:t,onCreated:x}){const[l,b]=s.useState(""),[i,v]=s.useState([{role:"pragmatist",model:""},{role:"skeptic",model:""}]),[m,c]=s.useState(2),[g,p]=s.useState("judge"),[a,d]=s.useState(!1),f=()=>{i.length>=5||v([...i,{role:`participant-${i.length+1}`,model:""}])},j=r=>{i.length<=2||v(i.filter((y,C)=>C!==r))},o=(r,y)=>{v(i.map((C,S)=>S===r?{...C,...y}:C))},u=async()=>{if(!(!l.trim()||i.length<2)){d(!0);try{const r=await W("/api/command-post/debates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:l.trim(),participants:i.map(y=>({role:y.role.trim()||"participant",model:y.model.trim()||void 0})),rounds:m,resolution:g})});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);x()}catch(r){alert(`Debate failed: ${r.message}`)}finally{d(!1)}}};return e.jsx(_,{open:!0,onClose:t,title:"Start a new debate",size:"lg",footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t,className:"px-3 py-1.5 text-[11px] text-text-secondary hover:text-text",children:"Cancel"}),e.jsx("button",{onClick:u,disabled:a||!l.trim()||i.length<2,className:"px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50",children:a?"Running debate…":"Run debate"})]}),children:e.jsxs("div",{className:"space-y-3 text-[12px]",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Question"}),e.jsx("textarea",{value:l,onChange:r=>b(r.target.value),placeholder:"e.g. Should we cache the Ollama probe results for 7 days or 30 days?",rows:2,className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40 resize-none"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:["Participants (",i.length,"/5)"]}),e.jsx("button",{onClick:f,disabled:i.length>=5,className:"text-[10px] text-accent-light/70 hover:text-accent-light disabled:opacity-40",children:"+ Add participant"})]}),e.jsx("div",{className:"space-y-2",children:i.map((r,y)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("input",{value:r.role,onChange:C=>o(y,{role:C.target.value}),placeholder:"role (e.g. pragmatist)",className:"flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none"}),e.jsx("input",{value:r.model,onChange:C=>o(y,{model:C.target.value}),placeholder:"model (optional — defaults to agent.model)",className:"flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text-secondary focus:outline-none"}),e.jsx("button",{onClick:()=>j(y),disabled:i.length<=2,className:"text-text-muted hover:text-error disabled:opacity-20 px-1",title:"Remove",children:"×"})]},y))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Rounds"}),e.jsx("select",{value:m,onChange:r=>c(Number(r.target.value)),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[1,2,3,4].map(r=>e.jsxs("option",{value:r,children:[r," round",r===1?"":"s"]},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted",children:"Resolution"}),e.jsxs("select",{value:g,onChange:r=>p(r.target.value),className:"mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none",children:[e.jsx("option",{value:"judge",children:"Judge (LLM picks winner)"}),e.jsx("option",{value:"synthesize",children:"Synthesize (LLM merges)"}),e.jsx("option",{value:"vote",children:"Vote (word-overlap consensus)"})]})]})]}),e.jsx("div",{className:"text-[10px] text-text-muted/70 italic",children:"Runs live — 1-3 minutes depending on model + rounds. Transcript saves automatically."})]})})}function rt(){const[t,x]=s.useState([]),[l,b]=s.useState("pending"),[i,v]=s.useState(!1),m=s.useCallback(async()=>{v(!0);try{const a=await be(l==="all"?void 0:l);x(a)}catch{}v(!1)},[l]);s.useEffect(()=>{m()},[m]);const c=async a=>{try{await Ne(a,"board")}catch{}m()},g=async a=>{try{await we(a,"board")}catch{}m()},p=t.filter(a=>l==="all"?!0:a.status===l);return e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:ae,title:"Approvals",count:p.length,help:{title:"Approvals",description:"Human-in-the-loop decisions for hiring agents, budget overrides, goal proposals, and self-modification requests."},action:e.jsx("div",{className:"flex items-center gap-2",children:["pending","approved","rejected","all"].map(a=>e.jsx("button",{onClick:()=>b(a),className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${l===a?"bg-accent text-text":"bg-bg-tertiary text-text-muted hover:text-text"}`,children:a},a))})}),e.jsx("div",{className:"divide-y divide-border/30",children:i?e.jsx("div",{className:"py-8 text-center text-[12px] text-text-muted",children:"Loading..."}):p.length===0?e.jsxs("div",{className:"py-8 text-center text-[12px] text-text-muted",children:["No ",l," approvals."]}):p.map(a=>{var d;return e.jsxs("div",{className:"px-4 py-3 hover:bg-bg-tertiary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-[12px] text-text flex-1 truncate pr-2",children:a.type.replace(/_/g," ")}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full ${a.status==="pending"?"bg-warning/10 text-warning":a.status==="approved"?"bg-success/10 text-success":"bg-error/10 text-error"}`,children:a.status})]}),e.jsx("div",{className:"text-[10px] text-text-muted mb-2 truncate",children:(d=_e(a))==null?void 0:d.headline}),a.status==="pending"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>c(a.id),className:"px-2 py-0.5 text-[10px] bg-success text-text rounded hover:bg-success/80",children:"Approve"}),e.jsx("button",{onClick:()=>g(a.id),className:"px-2 py-0.5 text-[10px] bg-error text-text rounded hover:bg-error/80",children:"Reject"})]}),a.decidedBy&&e.jsxs("div",{className:"text-[10px] text-text-muted mt-1",children:["By ",a.decidedBy," ",a.decidedAt?F(a.decidedAt)+" ago":""]})]},a.id)})})]})}function nt(){const[t,x]=s.useState([]),[l,b]=s.useState(null),[i,v]=s.useState(!1),[m,c]=s.useState(!1),g=s.useCallback(async()=>{v(!0);try{const a=await W("/api/command-post/debates");if(a.ok){const d=await a.json();x((d==null?void 0:d.items)||[])}}catch{}v(!1)},[]);s.useEffect(()=>{g()},[g]);const p=async a=>{try{const d=await W(`/api/command-post/debates/${a}`);if(d.ok){const f=await d.json();b(f)}}catch{}};if(l){const a=new Map;for(const d of l.turns){const f=a.get(d.round)||[];f.push(d),a.set(d.round,f)}return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{onClick:()=>b(null),className:"text-[11px] text-text-muted hover:text-text-secondary",children:"← Back to debates"}),e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl p-4",children:[e.jsx("div",{className:"text-[13px] font-semibold text-text mb-1",children:l.question}),e.jsxs("div",{className:"text-[10px] text-text-muted/70",children:[l.resolution," • ",l.rounds," round",l.rounds===1?"":"s"," • ",(l.durationMs/1e3).toFixed(1),"s"]}),l.winner&&e.jsxs("div",{className:"mt-3 p-3 bg-success/[0.06] border border-success/30 rounded-lg",children:[e.jsxs("div",{className:"text-[11px] text-success/80/80 uppercase tracking-wider",children:["Winner: ",l.winner.role]}),e.jsx("div",{className:"text-[12px] text-text mt-1",children:l.winner.content}),l.winner.justification&&e.jsx("div",{className:"text-[10px] text-text-muted italic mt-2",children:l.winner.justification})]})]}),[...a.entries()].sort((d,f)=>d[0]-f[0]).map(([d,f])=>e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2 border-b border-border/50 text-[11px] font-medium text-text-secondary uppercase tracking-wider",children:["Round ",d]}),e.jsx("div",{className:"divide-y divide-border/30",children:f.map((j,o)=>e.jsxs("div",{className:"px-4 py-3",children:[e.jsx("div",{className:"text-[11px] font-semibold text-accent-light/80 mb-1",children:j.role}),e.jsx("div",{className:"text-[11px] text-text-secondary whitespace-pre-wrap",children:j.content}),e.jsxs("div",{className:"text-[9px] text-text-muted mt-1",children:[j.model.split("/").pop()," • ",j.durationMs,"ms"]})]},o))})]},d))]})}return e.jsxs("div",{className:"bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden",children:[e.jsx(P,{icon:oe,title:"Debates",count:t.length,help:{title:"Debates",description:"Pit two or more agents against each other to explore different sides of a decision. Useful for risk assessment and trade-off analysis."},action:e.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover",children:[e.jsx(B,{size:10})," New Debate"]})}),m&&e.jsx(at,{onClose:()=>c(!1),onCreated:()=>{c(!1),g()}}),e.jsx("div",{className:"divide-y divide-border/30",children:i?e.jsx("div",{className:"py-8 text-center text-[12px] text-text-muted",children:"Loading..."}):t.length===0?e.jsxs("div",{className:"py-8 text-center text-[12px] text-text-muted",children:["No debates yet. Call the ",e.jsx("code",{className:"text-accent-light/70",children:"agent_debate"})," tool to start one."]}):t.map(a=>e.jsxs("button",{onClick:()=>p(a.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("div",{className:"text-[12px] text-text flex-1 truncate pr-2",children:a.question}),e.jsxs("span",{className:"text-[10px] text-text-muted whitespace-nowrap",children:[F(a.startedAt)," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[e.jsx("span",{children:a.resolution}),e.jsxs("span",{children:[a.rounds," round",a.rounds===1?"":"s"]}),e.jsxs("span",{children:[(a.durationMs/1e3).toFixed(1),"s"]}),a.winnerRole&&e.jsxs("span",{className:"text-success/80/70",children:["winner: ",a.winnerRole]})]})]},a.id))})]})}const lt=[{label:"Overview",tabs:[{id:"Dashboard",label:"Dashboard",icon:ne}]},{label:"Operations",tabs:[{id:"Social",label:"Social",icon:H},{id:"Inbox",label:"Inbox",icon:Ve},{id:"Goals",label:"Goals",icon:xe},{id:"Work",label:"Work",icon:R},{id:"Sessions",label:"Sessions",icon:le}]},{label:"Governance",tabs:[{id:"Issues",label:"Issues",icon:H},{id:"Approvals",label:"Approvals",icon:ae},{id:"Org Chart",label:"Org Chart",icon:re},{id:"Agents",label:"Agents",icon:ue},{id:"Files",label:"Files",icon:Me},{id:"Debates",label:"Debates",icon:oe},{id:"Costs",label:"Costs",icon:K}]},{label:"System",tabs:[{id:"Traces",label:"Traces",icon:I},{id:"Console",label:"Console",icon:Le}]}],ot=s.lazy(()=>A(()=>import("./WorkTab-BglKN8Uf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),it=s.lazy(()=>A(()=>import("./SessionsTab-8Qtu9BMv.js"),__vite__mapDeps([10,1,2,3]))),ct=s.lazy(()=>A(()=>import("./CPInbox-DyrwUxsn.js"),__vite__mapDeps([11,1,2,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,5]))),dt=s.lazy(()=>A(()=>import("./CPFiles-85DnmiZ9.js"),__vite__mapDeps([28,1,2,29,30,31,32,33]))),xt=s.lazy(()=>A(()=>import("./TraceViewer-CfFZQJ3K.js"),__vite__mapDeps([34,1,2,35,36,22,37,31,38]))),ut=s.lazy(()=>A(()=>import("./CPSocial-BBdyKNyq.js"),__vite__mapDeps([39,1,2,32,23,40,22,20]))),mt=s.lazy(()=>A(()=>import("./CPDashboard-Bk5ehnOo.js"),__vite__mapDeps([41,1,2,12,13,42,14,15,18,32,43,44]))),pt=s.lazy(()=>A(()=>import("./CPGoals-CmaEWa0s.js"),__vite__mapDeps([45,1,2,12,13,42,14,15,16,46,3,18,6,8]))),ht=s.lazy(()=>A(()=>import("./CPAgents-DvoKU7K3.js"),__vite__mapDeps([47,1,2,12,13,42,14,15,16,18])));function Bt(){const[t,x]=s.useState("Dashboard"),[l,b]=s.useState(null),[i,v]=s.useState([]),[m,c]=s.useState(!0),[g,p]=s.useState(null),[a,d]=s.useState([]),[f,j]=s.useState(!1),[o,u]=s.useState(null),r=s.useCallback(async()=>{try{const[n,h]=await Promise.allSettled([de(),te()]);n.status==="fulfilled"&&(b(n.value),d(n.value.recentActivity||[])),h.status==="fulfilled"&&v(h.value),p(null)}catch(n){p(n.message)}c(!1)},[]);if(s.useEffect(()=>{r()},[r]),s.useEffect(()=>{if(!l)return;const n=localStorage.getItem("titan-token"),h=n?`/api/command-post/stream?token=${n}`:"/api/command-post/stream",N=new EventSource(h);let z=0;return N.addEventListener("commandpost:activity",w=>{z=0;try{d(k=>[...k.slice(-49),JSON.parse(w.data)])}catch{}}),N.addEventListener("commandpost:agent:status",w=>{z=0;try{const k=JSON.parse(w.data);b(M=>M&&{...M,agents:M.agents.map(U=>U.id===k.agentId?{...U,status:k.status}:U)})}catch{}}),N.onerror=()=>{z++,z>5&&N.close()},()=>N.close()},[l]),s.useEffect(()=>{const n=setInterval(r,3e4);return()=>clearInterval(n)},[r]),m)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading Command Post..."})]})});if(g)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(G,{className:"mx-auto mb-3 text-warning",size:32}),e.jsx("p",{className:"text-sm text-text-secondary mb-4",children:g}),e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm bg-bg-tertiary rounded-lg hover:bg-border text-text-secondary transition-colors",children:"Retry"})]})});const y=l??{agents:[],totalAgents:0,activeAgents:0,activeCheckouts:0,budgetUtilization:0,recentActivity:[],checkouts:[],budgets:[],goalTree:[],companies:[]},C=lt.flatMap(n=>n.tabs.map(h=>({...h,group:n.label}))),S=()=>{switch(t){case"Dashboard":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"dashboard"}),children:e.jsx(mt,{})});case"Social":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"social"}),children:e.jsx(ut,{})});case"Inbox":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"inbox"}),children:e.jsx(ct,{})});case"Goals":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"goals"}),children:e.jsx(pt,{})});case"Work":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"work"}),children:e.jsx(ot,{})});case"Sessions":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"sessions"}),children:e.jsx(it,{})});case"Issues":return e.jsx(Ye,{agents:y.agents});case"Approvals":return e.jsx(rt,{});case"Org Chart":return e.jsx(Qe,{agents:y.agents});case"Agents":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"agents"}),children:e.jsx(ht,{})});case"Files":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"files"}),children:e.jsx(dt,{})});case"Debates":return e.jsx(nt,{});case"Costs":return e.jsx(et,{budgets:y.budgets,onRefresh:r});case"Traces":return e.jsx(s.Suspense,{fallback:e.jsx(T,{label:"traces"}),children:e.jsx(xt,{})});case"Console":return e.jsx(st,{dashboard:y});default:return null}};return e.jsxs("div",{className:"h-full flex overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",children:[e.jsx("div",{className:"sticky top-0 z-20 border-b border-border bg-bg/95 backdrop-blur",children:e.jsxs("div",{className:"flex items-center gap-3 px-4 md:px-6 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-sm font-bold text-text",children:"Command Post"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:"Agent governance"})]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-x-auto",children:e.jsx("div",{className:"flex items-center gap-1",children:C.map(n=>{const h=t===n.id;return e.jsxs("button",{onClick:()=>x(n.id),title:`${n.group}: ${n.label}`,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-[12px] transition-all duration-150 ${h?"bg-accent/10 text-accent-light font-medium":"text-text-secondary hover:text-text hover:bg-bg-tertiary/50"}`,children:[e.jsx(n.icon,{size:14,className:h?"text-accent-light":"text-text-muted"}),e.jsx("span",{children:n.label})]},n.id)})})}),e.jsxs("button",{onClick:r,className:"shrink-0 flex items-center justify-center gap-1.5 px-2.5 py-1.5 text-[11px] text-text-muted bg-bg-tertiary/50 border border-border rounded-lg hover:bg-bg-tertiary transition-colors",children:[e.jsx(Ee,{size:12,className:m?"animate-spin":""}),"Refresh"]})]})}),e.jsx("div",{className:"max-w-6xl mx-auto px-4 md:px-6 py-4 md:py-6",children:e.jsx(S,{})})]}),e.jsx(Ge,{collapsed:f,onToggle:()=>j(!f),agents:y.agents,runs:i,onAgentClick:n=>u(n)}),o&&e.jsx(Ke,{agent:o,onClose:()=>u(null)})]})}export{Bt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,aT as d,j as e,aU as m,aV as x}from"./index-
|
|
1
|
+
import{r as t,aT as d,j as e,aU as m,aV as x}from"./index-CfeeNofL.js";import{P as h}from"./PageHeader-Cx4DHJXy.js";import{R as f}from"./refresh-cw-C4BAymqq.js";import{C as b}from"./clock-BiDhhRG4.js";import{T as g,a as p}from"./toggle-right-NKDEGJdm.js";import{T as u}from"./trash-2-CJjOlqMp.js";import"./chevron-right-Dz0EiJIX.js";function k(){const[o,c]=t.useState([]),[r,l]=t.useState(!0),s=t.useCallback(async()=>{l(!0);try{const a=await d();c(a.jobs||[])}catch{}l(!1)},[]);t.useEffect(()=>{s()},[s]);const i=async a=>{try{await m(a),await s()}catch{}},n=async a=>{if(confirm("Delete this cron job?"))try{await x(a),await s()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{title:"Cron Scheduler",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Cron"}]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:s,disabled:r,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(f,{className:`w-4 h-4 ${r?"animate-spin":""}`})," Refresh"]})}),e.jsx("div",{className:"space-y-2",children:o.map(a=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(b,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:a.name}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[a.schedule," • ",a.command]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>i(a.id),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46]",children:a.enabled?e.jsx(g,{className:"w-4 h-4 text-emerald-400"}):e.jsx(p,{className:"w-4 h-4 text-[#52525b]"})}),e.jsx("button",{onClick:()=>n(a.id),className:"p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400",children:e.jsx(u,{className:"w-3.5 h-3.5"})})]})]},a.id))})]})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-CfeeNofL.js";function i({columns:s,data:d,onRowClick:a,emptyMessage:x="No data available"}){return e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-bg-secondary",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-bg-tertiary",children:s.map(t=>e.jsx("th",{className:`px-4 py-3 text-sm font-medium text-text-secondary ${t.className??""}`,children:t.header},t.key))})}),e.jsx("tbody",{children:d.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length,className:"px-4 py-12 text-center text-text-muted",children:x})}):d.map((t,n)=>e.jsx("tr",{onClick:()=>a==null?void 0:a(t),className:`border-t border-border transition-colors hover:bg-bg-tertiary/50 ${a?"cursor-pointer":""}`,children:s.map(r=>e.jsx("td",{className:`px-4 py-3 text-text ${r.className??""}`,children:r.render?r.render(t):String(t[r.key]??"")},r.key))},n))})]})})}export{i as D};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as D,r as n,aa as v,ab as w,ac as M,ad as $,j as e,f as G,K as P}from"./index-
|
|
1
|
+
import{c as D,r as n,aa as v,ab as w,ac as M,ad as $,j as e,f as G,K as P}from"./index-CfeeNofL.js";import{P as R}from"./PageHeader-Cx4DHJXy.js";import{R as _}from"./refresh-cw-C4BAymqq.js";import"./chevron-right-Dz0EiJIX.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./index-
|
|
1
|
+
import{j as t}from"./index-CfeeNofL.js";import{B as r}from"./Input-DoWIY9i3.js";function n({icon:s,title:x,description:m,action:e,className:a}){return t.jsxs("div",{className:`flex flex-col items-center justify-center py-16 text-center ${a??""}`,children:[s&&t.jsx("div",{className:"mb-4 text-text-muted opacity-50",children:s}),t.jsx("h3",{className:"text-sm font-medium text-text-secondary",children:x}),m&&t.jsx("p",{className:"mt-1 max-w-sm text-xs text-text-muted",children:m}),e&&t.jsx(r,{variant:"secondary",size:"sm",onClick:e.onClick,className:"mt-4",children:e.label})]})}export{n as E};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as S,r as p,j as e,B as $,bK as w,L as _,i as E,V as F,l as C,W as k}from"./index-
|
|
1
|
+
import{b as S,r as p,j as e,B as $,bK as w,L as _,i as E,V as F,l as C,W as k}from"./index-CfeeNofL.js";import{L as P}from"./layers-BXjHgthV.js";import{T as I}from"./trending-up-CC4itzlz.js";import{R as M}from"./refresh-cw-C4BAymqq.js";import{P as A}from"./play-CB_hciEJ.js";import{C as B}from"./chevron-right-Dz0EiJIX.js";import{C as R}from"./circle-check-big-Bi688_yD.js";const L={"widget-creation":"Widget Creation",safety:"Safety","tool-routing":"Tool Routing","gate-format":"Gate Format",pipeline:"Pipeline Classification",adversarial:"Adversarial","tool-routing-v2":"Tool Routing v2",session:"Session Management","widget-v2":"Widget v2","gate-format-v2":"Gate Format v2",content:"Content Quality"};async function D(){const s=await S("/api/eval/suites");if(!s.ok)throw new Error(`/api/eval/suites failed: ${s.status}`);const i=await s.json();return Array.isArray(i.suites)?i.suites:[]}async function U(s){const i=await S("/api/eval/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({suite:s})});if(!i.ok){const a=await i.text().catch(()=>"");throw new Error(`/api/eval/run failed: ${i.status} ${a.slice(0,200)}`)}return i.json()}function O(s){return s.total?Math.round(s.passed/s.total*100):NaN}function N(s){return Number.isNaN(s)?"slate":s>=100?"emerald":s>=80?"amber":"red"}function W(s){const i=[];for(const a of s.split(`
|
|
2
2
|
`)){const n=a.trim();if(!n||n.startsWith("#"))continue;const l=n.match(/^([a-zA-Z_:][a-zA-Z0-9_:]*)(?:\{([^}]*)\})?\s+([0-9eE+\-.NaN]+)/);if(!l)continue;const c={};if(l[2])for(const f of l[2].split(",")){const[u,...x]=f.split("=");if(!u)continue;const g=x.join("=").trim().replace(/^"|"$/g,"");c[u.trim()]=g}const r=Number(l[3]);Number.isNaN(r)||i.push({name:l[1],labels:c,value:r})}return i}async function q(s){const i=await S("/metrics");if(!i.ok)throw new Error(`/metrics failed: ${i.status}`);const a=await i.text(),n=W(a);return s?n.filter(l=>l.name===s||l.name.startsWith(`${s}_`)):n}const y={emerald:"bg-emerald-500/15 text-emerald-300 border-emerald-500/40",amber:"bg-amber-500/15 text-amber-300 border-amber-500/40",red:"bg-red-500/15 text-red-300 border-red-500/40",slate:"bg-slate-500/15 text-slate-300 border-slate-500/40"},J=[{id:"suites",label:"Suites",icon:P},{id:"memory",label:"Memory Regression",icon:$},{id:"redteam",label:"Red Team",icon:w},{id:"trends",label:"Trends",icon:I}];function re(){const[s,i]=p.useState("suites"),[a,n]=p.useState([]),[l,c]=p.useState(!1),[r,f]=p.useState(null),u=p.useCallback(async()=>{c(!0);try{const t=await D();n(m=>{const h=new Map(m.map(b=>[b.name,b]));return t.map(b=>h.get(b)??{name:b,status:"idle"})})}catch(t){console.error("listEvalSuites failed:",t),n([])}finally{c(!1)}},[]);p.useEffect(()=>{u()},[u]);const x=p.useCallback(async t=>{n(m=>m.map(h=>h.name===t?{...h,status:"running",error:void 0}:h));try{const m=await U(t);n(h=>h.map(b=>b.name===t?{...b,status:"done",result:m}:b))}catch(m){n(h=>h.map(b=>b.name===t?{...b,status:"error",error:m.message}:b))}},[]),g=p.useCallback(async()=>{for(const t of a)await x(t.name)},[a,x]),v=a.reduce((t,m)=>{var h,b,T;return{total:t.total+(((h=m.result)==null?void 0:h.total)??0),passed:t.passed+(((b=m.result)==null?void 0:b.passed)??0),failed:t.failed+(((T=m.result)==null?void 0:T.failed)??0)}},{total:0,passed:0,failed:0}),j=O(v),o=N(j),d=a.some(t=>t.status==="running");return e.jsxs("div",{className:"flex h-full flex-col gap-4 p-4 text-slate-200",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Eval Harness"}),e.jsx("div",{className:"flex items-center gap-1 rounded border border-slate-700 bg-slate-800/40 p-0.5",children:J.map(t=>{const m=t.icon,h=t.id===s;return e.jsxs("button",{onClick:()=>i(t.id),className:`flex items-center gap-1.5 rounded px-2.5 py-1 text-xs ${h?"bg-slate-700/80 text-slate-100":"text-slate-400 hover:bg-slate-700/30"}`,children:[e.jsx(m,{className:"h-3 w-3"}),t.label]},t.id)})}),s==="suites"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:u,disabled:l||d,className:"rounded border border-slate-700 bg-slate-800/40 p-1.5 hover:bg-slate-800 disabled:opacity-50",title:"Refresh suite list",children:e.jsx(M,{className:`h-3.5 w-3.5 ${l?"animate-spin":""}`})}),e.jsxs("button",{onClick:g,disabled:a.length===0||d,className:"ml-auto flex items-center gap-1.5 rounded border border-emerald-500/40 bg-emerald-500/10 px-3 py-1.5 text-sm text-emerald-300 hover:bg-emerald-500/20 disabled:opacity-50",children:[d?e.jsx(_,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(A,{className:"h-3.5 w-3.5"}),"Run all suites"]})]})]}),s==="suites"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`flex items-center gap-3 rounded-lg border p-3 text-sm ${y[o]}`,children:[e.jsxs("div",{className:"font-medium",children:["Overall: ",v.passed,"/",v.total," passed",Number.isFinite(j)&&e.jsxs("span",{className:"ml-2 opacity-80",children:["(",j,"%)"]})]}),v.failed>0&&e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),v.failed," failure",v.failed===1?"":"s"]})]}),e.jsxs("div",{className:"flex-1 space-y-2 overflow-auto",children:[a.length===0&&!l&&e.jsxs("div",{className:"rounded border border-slate-700 bg-slate-800/30 p-4 text-center text-sm text-slate-400",children:["No eval suites available. Verify ",e.jsx("code",{className:"font-mono text-xs",children:"/api/eval/suites"})," on the gateway."]}),a.map(t=>e.jsx(H,{suite:t,expanded:r===t.name,onToggle:()=>f(m=>m===t.name?null:t.name),onRun:()=>x(t.name)},t.name))]})]}),s==="memory"&&e.jsx(z,{suites:a,onRun:x}),s==="redteam"&&e.jsx(V,{suites:a,onRun:x}),s==="trends"&&e.jsx(G,{})]})}function z({suites:s,onRun:i}){const a=s.flatMap(l=>{var c;return(((c=l.result)==null?void 0:c.results)??[]).filter(r=>/memory|recall|stale|distract|context/i.test(r.name)).map(r=>({suite:l.name,case:r}))});if(a.length===0)return e.jsx("div",{className:"flex flex-1 items-center justify-center rounded border border-dashed border-slate-700 bg-slate-800/20 p-8 text-center",children:e.jsxs("div",{children:[e.jsx($,{className:"mx-auto mb-2 h-6 w-6 text-slate-500"}),e.jsx("div",{className:"text-sm text-slate-300",children:"No memory regression results yet."}),e.jsxs("div",{className:"mt-1 text-xs text-slate-500",children:["Run a suite that contains memory cases (session, content). Multi-turn fact recall is asserted via tape replay in ",e.jsx("code",{className:"font-mono",children:"tests/eval/memory.test.ts"}),"."]}),e.jsxs("div",{className:"mt-3 flex justify-center gap-2",children:[e.jsx("button",{onClick:()=>i("session"),className:"rounded border border-emerald-500/40 bg-emerald-500/10 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/20",children:"Run session suite"}),e.jsx("button",{onClick:()=>i("content"),className:"rounded border border-emerald-500/40 bg-emerald-500/10 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/20",children:"Run content suite"})]})]})});const n=a.filter(l=>l.case.passed).length;return e.jsxs("div",{className:"flex flex-1 flex-col gap-3 overflow-auto",children:[e.jsx("div",{className:`rounded-lg border p-3 text-sm ${y[N(n/a.length*100)]}`,children:e.jsxs("div",{className:"font-medium",children:["Memory recall: ",n,"/",a.length," cases passed",e.jsxs("span",{className:"ml-2 opacity-80",children:["(",Math.round(n/a.length*100),"%)"]})]})}),e.jsx("div",{className:"space-y-1.5",children:a.map(l=>e.jsxs("div",{className:`rounded p-2 text-xs ${l.case.passed?"bg-slate-800/30":"bg-red-950/30"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l.case.passed?e.jsx(R,{className:"h-3.5 w-3.5 text-emerald-400"}):e.jsx(C,{className:"h-3.5 w-3.5 text-red-400"}),e.jsx("div",{className:"font-mono text-slate-200",children:l.case.name}),e.jsx("div",{className:"ml-auto text-[10px] text-slate-500",children:l.suite})]}),!l.case.passed&&l.case.errors.length>0&&e.jsx("ul",{className:"mt-1 ml-5 list-disc text-red-300",children:l.case.errors.map((c,r)=>e.jsx("li",{children:c},r))})]},`${l.suite}/${l.case.name}`))})]})}const K=[{id:"ignore-prev",label:"Ignore-previous",pattern:/ignore.*(previous|prior)|disregard|forget/i},{id:"dan",label:"DAN / persona swap",pattern:/\bDAN\b|do anything|jailbreak/i},{id:"prompt-extract",label:"Prompt extraction",pattern:/system prompt|reveal|extract|leak/i},{id:"path-traversal",label:"Path traversal",pattern:/\.\.\/|\/etc\/passwd|path traversal/i},{id:"shell-inject",label:"Shell injection",pattern:/;.*rm|`whoami`|\$\(|\| ?bash/i},{id:"url-scheme",label:"URL scheme abuse",pattern:/file:\/\/|dict:\/\/|gopher:\/\//i},{id:"markdown-js",label:"Markdown JS link",pattern:/\[.*\]\(javascript:/i},{id:"other",label:"Other",pattern:/.*/}];function V({suites:s,onRun:i}){var c;const a=s.find(r=>r.name==="adversarial"),n=((c=a==null?void 0:a.result)==null?void 0:c.results)??[];if(n.length===0)return e.jsx("div",{className:"flex flex-1 items-center justify-center rounded border border-dashed border-slate-700 bg-slate-800/20 p-8 text-center",children:e.jsxs("div",{children:[e.jsx(w,{className:"mx-auto mb-2 h-6 w-6 text-slate-500"}),e.jsx("div",{className:"text-sm text-slate-300",children:"No red-team results yet."}),e.jsx("div",{className:"mt-1 text-xs text-slate-500",children:"Run the adversarial suite to populate this grid."}),e.jsx("button",{onClick:()=>i("adversarial"),className:"mt-3 rounded border border-red-500/40 bg-red-500/10 px-3 py-1 text-xs text-red-300 hover:bg-red-500/20",children:"Run adversarial suite"})]})});const l=K.map(r=>{const f=n.filter(x=>r.pattern.test(x.name)||r.pattern.test(x.content||"")),u=f.filter(x=>x.passed).length;return{vector:r,total:f.length,blocked:u,matched:f}}).filter(r=>r.total>0);return e.jsxs("div",{className:"flex flex-1 flex-col gap-3 overflow-auto",children:[e.jsx("div",{className:"text-xs text-slate-400",children:"Pass = attack BLOCKED (TITAN refused or sanitized). Fail = attack possibly EXPLOITED — investigate the case."}),e.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:l.map(r=>{const f=r.total>0?Math.round(r.blocked/r.total*100):0,u=N(f);return e.jsxs("div",{className:`rounded-lg border p-3 ${y[u]}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),r.vector.label]}),e.jsxs("div",{className:"mt-1 text-xs",children:[r.blocked,"/",r.total," blocked (",f,"%)"]}),e.jsxs("div",{className:"mt-2 space-y-1",children:[r.matched.slice(0,4).map(x=>e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[x.passed?e.jsx(R,{className:"h-2.5 w-2.5 text-emerald-400"}):e.jsx(C,{className:"h-2.5 w-2.5 text-red-400"}),e.jsx("span",{className:"font-mono",children:x.name})]},x.name)),r.matched.length>4&&e.jsxs("div",{className:"text-[10px] text-slate-500",children:["+ ",r.matched.length-4," more"]})]})]},r.vector.id)})})]})}function G(){const[s,i]=p.useState([]),[a,n]=p.useState(!1),[l,c]=p.useState(null),[r,f]=p.useState(null),u=p.useCallback(async()=>{n(!0),c(null);try{const o=await q("titan_eval");i(o),f(new Date)}catch(o){c(o.message)}finally{n(!1)}},[]);p.useEffect(()=>{u();const o=setInterval(u,3e4);return()=>clearInterval(o)},[u]);const x=p.useMemo(()=>s.filter(o=>o.name==="titan_eval_pass_rate"&&o.labels.suite).map(o=>({suite:o.labels.suite,rate:o.value})).sort((o,d)=>o.rate-d.rate),[s]),g=p.useMemo(()=>{const o=new Map;for(const d of s){if(!d.labels.suite)continue;const t=o.get(d.labels.suite)??{passed:0,failed:0,timeouts:0,errors:0};d.name==="titan_eval_cases_total"?d.labels.outcome==="passed"?t.passed=d.value:d.labels.outcome==="failed"&&(t.failed=d.value):d.name==="titan_eval_timeout_total"?t.timeouts+=d.value:d.name==="titan_eval_error_total"&&(t.errors+=d.value),o.set(d.labels.suite,t)}return o},[s]),v=p.useMemo(()=>{let o=0,d=0;for(const t of g.values())o+=t.timeouts,d+=t.errors;return{timeouts:o,errors:d}},[g]),j=100;return e.jsxs("div",{className:"flex flex-1 flex-col gap-3 overflow-auto",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsxs("span",{children:["Live from ",e.jsx("code",{className:"font-mono",children:"/metrics"})," (titan_eval_* gauges + counters)."]}),e.jsx("span",{className:"ml-auto",children:r?`updated ${r.toLocaleTimeString()}`:""}),e.jsx("button",{onClick:u,disabled:a,className:"rounded border border-slate-700 bg-slate-800/40 p-1 hover:bg-slate-800 disabled:opacity-50",children:e.jsx(M,{className:`h-3 w-3 ${a?"animate-spin":""}`})})]}),(v.timeouts>0||v.errors>0)&&e.jsxs("div",{className:"flex items-center gap-2 rounded border border-amber-500/40 bg-amber-500/10 p-2 text-xs text-amber-300",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:"Operational drift:"}),v.timeouts>0&&e.jsxs("span",{children:[e.jsx("strong",{children:v.timeouts})," timeout",v.timeouts===1?"":"s"]}),v.errors>0&&e.jsxs("span",{children:[e.jsx("strong",{children:v.errors})," error",v.errors===1?"":"s"]}),e.jsx("span",{className:"ml-auto opacity-70",children:"across all suites, lifetime totals from /metrics"})]}),l&&e.jsx("div",{className:"rounded border border-red-500/40 bg-red-500/10 p-2 text-xs text-red-300",children:l}),x.length===0&&!l&&e.jsxs("div",{className:"rounded border border-dashed border-slate-700 bg-slate-800/20 p-6 text-center text-sm text-slate-400",children:["No eval pass-rate metrics yet. Run a suite via the Suites tab to populate ",e.jsx("code",{className:"font-mono",children:"titan_eval_pass_rate"}),"."]}),e.jsx("div",{className:"space-y-1.5",children:x.map(({suite:o,rate:d})=>{const t=g.get(o),m=N(d),h=L[o]??o;return e.jsx("div",{className:`rounded border p-2 text-xs ${y[m]}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-32 truncate font-medium text-slate-200",children:h}),e.jsx("div",{className:"relative h-4 flex-1 overflow-hidden rounded bg-slate-800/60",children:e.jsx("div",{className:`h-full ${m==="emerald"?"bg-emerald-500/60":m==="amber"?"bg-amber-500/60":m==="red"?"bg-red-500/60":"bg-slate-500/60"}`,style:{width:`${d/j*100}%`}})}),e.jsxs("div",{className:"w-16 text-right font-mono",children:[d,"%"]}),t&&e.jsxs("div",{className:"w-44 text-right text-[10px] text-slate-500",children:[t.passed,"/",t.passed+t.failed," ever",t.timeouts>0&&e.jsxs("span",{className:"ml-1 text-amber-400",children:["· ",t.timeouts," timeout",t.timeouts===1?"":"s"]}),t.errors>0&&e.jsxs("span",{className:"ml-1 text-red-400",children:["· ",t.errors," error",t.errors===1?"":"s"]})]})]})},o)})})]})}function H({suite:s,expanded:i,onToggle:a,onRun:n}){var f;const l=L[s.name]??s.name,c=s.result?O(s.result):NaN,r=N(c);return e.jsxs("div",{className:`rounded-lg border ${y[r]}`,children:[e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx("button",{onClick:a,disabled:!s.result,className:"text-slate-300 disabled:opacity-30","aria-label":i?"Collapse":"Expand",children:i?e.jsx(F,{className:"h-4 w-4"}):e.jsx(B,{className:"h-4 w-4"})}),e.jsx("div",{className:"font-medium text-slate-100",children:l}),e.jsx("div",{className:"text-xs text-slate-400",children:s.result?`${s.result.passed}/${s.result.total} (${c}%)`:s.status==="running"?"running…":s.status==="error"?`error: ${s.error}`:"idle"}),((f=s.result)==null?void 0:f.durationMs)!==void 0&&e.jsxs("div",{className:"text-xs text-slate-500",children:[(s.result.durationMs/1e3).toFixed(1),"s"]}),e.jsxs("button",{onClick:n,disabled:s.status==="running",className:"ml-auto flex items-center gap-1 rounded border border-slate-600 bg-slate-800/60 px-2 py-1 text-xs text-slate-200 hover:bg-slate-800 disabled:opacity-50",children:[s.status==="running"?e.jsx(_,{className:"h-3 w-3 animate-spin"}):e.jsx(A,{className:"h-3 w-3"}),"Run"]})]}),i&&s.result&&e.jsx("div",{className:"space-y-1.5 border-t border-slate-700/40 px-3 py-2",children:s.result.results.map(u=>e.jsx(X,{caseResult:u},u.name))})]})}function X({caseResult:s}){const i=s.expectedToolSequence!==void 0&&JSON.stringify(s.expectedToolSequence)!==JSON.stringify(s.toolsUsed);return e.jsxs("div",{className:`rounded p-2 text-xs ${s.passed?"bg-slate-800/30":"bg-red-950/30"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s.passed?e.jsx(R,{className:"h-3.5 w-3.5 text-emerald-400"}):e.jsx(C,{className:"h-3.5 w-3.5 text-red-400"}),e.jsx("div",{className:"font-mono text-slate-200",children:s.name}),e.jsxs("div",{className:"ml-auto text-slate-500",children:[s.durationMs,"ms"]})]}),!s.passed&&s.errors.length>0&&e.jsx("ul",{className:"mt-1 ml-5 list-disc text-red-300",children:s.errors.map((a,n)=>e.jsx("li",{children:a},n))}),i&&e.jsxs("div",{className:"mt-2 ml-5 grid grid-cols-2 gap-2 rounded bg-slate-900/40 p-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1 text-slate-400",children:[e.jsx(k,{className:"h-3 w-3"})," expected"]}),(s.expectedToolSequence??[]).map((a,n)=>e.jsxs("div",{className:"font-mono text-emerald-300",children:[n+1,". ",a]},n))]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1 text-slate-400",children:[e.jsx(k,{className:"h-3 w-3"})," actual"]}),s.toolsUsed.length===0&&e.jsx("div",{className:"italic text-slate-500",children:"(no tool calls)"}),s.toolsUsed.map((a,n)=>{var r;const c=((r=s.expectedToolSequence)==null?void 0:r[n])===a;return e.jsxs("div",{className:`font-mono ${c?"text-emerald-300":"text-red-300"}`,children:[n+1,". ",a]},n)})]})]})]})}export{re as default};
|