titan-agent 5.0.2 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/agent.js +48 -3
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/agentLoop.js +83 -5
- package/dist/agent/agentLoop.js.map +1 -1
- package/dist/agent/commandPost.js +1 -1
- package/dist/agent/commandPost.js.map +1 -1
- package/dist/agent/goalProposer.js +2 -2
- package/dist/agent/goalProposer.js.map +1 -1
- package/dist/agent/missionDriver.js +1 -1
- package/dist/agent/missionDriver.js.map +1 -1
- package/dist/agent/promptBudget.js +85 -0
- package/dist/agent/promptBudget.js.map +1 -0
- package/dist/agent/structuredSpawn.js +1 -1
- package/dist/agent/structuredSpawn.js.map +1 -1
- package/dist/agent/subtaskTaxonomy.js +1 -1
- package/dist/agent/subtaskTaxonomy.js.map +1 -1
- package/dist/agent/systemPromptParts.js +10 -1
- package/dist/agent/systemPromptParts.js.map +1 -1
- package/dist/agent/toolRunner.js +16 -0
- package/dist/agent/toolRunner.js.map +1 -1
- package/dist/agent/toolSearch.js +4 -1
- package/dist/agent/toolSearch.js.map +1 -1
- package/dist/analytics/bugReports.js +1 -1
- package/dist/analytics/bugReports.js.map +1 -1
- package/dist/channels/messenger.js +1 -1
- package/dist/channels/messenger.js.map +1 -1
- package/dist/eval/harness.js +141 -0
- package/dist/eval/harness.js.map +1 -0
- package/dist/gateway/server.js +374 -74
- package/dist/gateway/server.js.map +1 -1
- package/dist/hooks/shellHooks.js +1 -1
- package/dist/hooks/shellHooks.js.map +1 -1
- package/dist/lib/auto-heal/repair-strategies.js.map +1 -1
- package/dist/memory/promptIncludes.js +58 -0
- package/dist/memory/promptIncludes.js.map +1 -0
- package/dist/organism/alertsStore.js +70 -0
- package/dist/organism/alertsStore.js.map +1 -0
- package/dist/plugins/memoryRetrieval.js.map +1 -1
- package/dist/providers/ollama.js +7 -7
- package/dist/providers/ollama.js.map +1 -1
- package/dist/safety/invariants.js +60 -0
- package/dist/safety/invariants.js.map +1 -0
- package/dist/safety/opusReview.js +1 -1
- package/dist/safety/opusReview.js.map +1 -1
- package/dist/security/commandScanner.js +2 -2
- package/dist/security/commandScanner.js.map +1 -1
- package/dist/security/secretGuard.js +4 -4
- package/dist/security/secretGuard.js.map +1 -1
- package/dist/skills/builtin/widget_gallery.js +28 -1
- package/dist/skills/builtin/widget_gallery.js.map +1 -1
- package/dist/skills/frontmatterLoader.js +119 -0
- package/dist/skills/frontmatterLoader.js.map +1 -0
- package/dist/skills/registry.js +20 -0
- package/dist/skills/registry.js.map +1 -1
- package/dist/testing/testHealthMonitor.js +1 -2
- package/dist/testing/testHealthMonitor.js.map +1 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/replyQuality.js +1 -1
- package/dist/utils/replyQuality.js.map +1 -1
- package/dist/utils/tokens.js +1 -1
- package/dist/utils/tokens.js.map +1 -1
- package/docs/bleeding-edge-agents-2026.md +450 -0
- package/docs/langchain-analysis.md +598 -0
- package/docs/langchain-code-analysis.md +363 -0
- package/docs/space-agent-analysis.md +300 -0
- package/package.json +1 -1
- package/ui/dist/assets/{AuditPanel-G7YA1HzV.js → AuditPanel-B84Mp16G.js} +2 -2
- package/ui/dist/assets/AutonomyPanel-DOtiTFxV.js +11 -0
- package/ui/dist/assets/{AutopilotPanel-CHRjxdh0.js → AutopilotPanel-nTb1Dnru.js} +1 -1
- package/ui/dist/assets/AutoresearchPanel-D46mX8VF.js +6 -0
- package/ui/dist/assets/BackupPanel-DGM1XXbG.js +1 -0
- package/ui/dist/assets/BrowserPanel-Cn1tTN3y.js +6 -0
- package/ui/dist/assets/{CPAgents-D5533PhK.js → CPAgents-CEraUkME.js} +1 -1
- package/ui/dist/assets/{CPDashboard-C-GgqDsI.js → CPDashboard-B_yidGAe.js} +2 -2
- package/ui/dist/assets/CPFiles-BBS8jtYH.js +1 -0
- package/ui/dist/assets/CPGoals-DL5v21TZ.js +1 -0
- package/ui/dist/assets/CPInbox-CyLQJBYF.js +11 -0
- package/ui/dist/assets/{CPSocial-mUQsrSh5.js → CPSocial-BkEtQ1Um.js} +3 -3
- package/ui/dist/assets/ChannelsPanel-CD2kHhA5.js +1 -0
- package/ui/dist/assets/CheckpointsPanel-BrUTFPu_.js +1 -0
- package/ui/dist/assets/CommandPostHub-BPPaUv1B.js +29 -0
- package/ui/dist/assets/CronPanel-CsfQctFp.js +1 -0
- package/ui/dist/assets/DaemonPanel-CNUggBbL.js +1 -0
- package/ui/dist/assets/DataTable-DuAEp_QJ.js +1 -0
- package/ui/dist/assets/{EmptyState-D60-wQrz.js → EmptyState-DFrAEZDm.js} +1 -1
- package/ui/dist/assets/EvalPanel-DEX0a5-b.js +1 -0
- package/ui/dist/assets/{FilesPanel-BNN3h_HW.js → FilesPanel-DATsiAqG.js} +1 -1
- package/ui/dist/assets/FleetPanel-QYQKqx4W.js +1 -0
- package/ui/dist/assets/{HomelabPanel-1mfhRBh6.js → HomelabPanel-DhuXd3ZD.js} +2 -2
- package/ui/dist/assets/{InfraView-Df6SFI7b.js → InfraView-eS7cpESw.js} +2 -2
- package/ui/dist/assets/InlineEditableField-zIAnW4AR.js +1 -0
- package/ui/dist/assets/{Input-DYukme8A.js → Input-bFsLI0fq.js} +1 -1
- package/ui/dist/assets/IntegrationsPanel-C_FswSRN.js +1 -0
- package/ui/dist/assets/IntelligenceView-smQ6aBwx.js +2 -0
- package/ui/dist/assets/{LearningPanel-BPx05bBu.js → LearningPanel-BEgF_iND.js} +1 -1
- package/ui/dist/assets/{LogsPanel-D3Qfp2SE.js → LogsPanel-Br1P8ST6.js} +1 -1
- package/ui/dist/assets/McpPanel-ByvQ12J_.js +1 -0
- package/ui/dist/assets/{MemoryGraphPanel-BFovwaSG.js → MemoryGraphPanel-BGOeSaET.js} +1 -1
- package/ui/dist/assets/MemoryWikiPanel-CR8btd66.js +11 -0
- package/ui/dist/assets/MeshPanel-BjkcSOMz.js +11 -0
- package/ui/dist/assets/NvidiaPanel-NYt42w7L.js +1 -0
- package/ui/dist/assets/OrganismPanel-PHvISvVn.js +1 -0
- package/ui/dist/assets/OverviewPanel-q35zdMr6.js +6 -0
- package/ui/dist/assets/{PageHeader-BdvxKoad.js → PageHeader-Cwn3OALc.js} +1 -1
- package/ui/dist/assets/PaperclipPanel-BDpQki0d.js +1 -0
- package/ui/dist/assets/{PersonasPanel-BpI6Npxv.js → PersonasPanel-DxrGW5C4.js} +1 -1
- package/ui/dist/assets/RecipesPanel-CYRdBx5u.js +1 -0
- package/ui/dist/assets/{SecurityPanel-CBDsEAFz.js → SecurityPanel-i1QMctV0.js} +1 -1
- package/ui/dist/assets/SelfImprovePanel-DbybAZWp.js +1 -0
- package/ui/dist/assets/SelfProposalsPanel-DtcTUDDd.js +2 -0
- package/ui/dist/assets/SessionsPanel-B7QmOizR.js +1 -0
- package/ui/dist/assets/SessionsTab-BdJj_vsI.js +1 -0
- package/ui/dist/assets/{SettingsPanel-BiWHsOAJ.js → SettingsPanel-DnEvJUFe.js} +1 -1
- package/ui/dist/assets/SettingsView-C39dk_yr.js +2 -0
- package/ui/dist/assets/{SkeletonLoader-CGtpZJ-7.js → SkeletonLoader-CsiR8ED9.js} +1 -1
- package/ui/dist/assets/{SkillsPanel-Z_9jA6dU.js → SkillsPanel-DM4qBFDS.js} +1 -1
- package/ui/dist/assets/{SomaView-AP3BXqf-.js → SomaView-CWnPKEQI.js} +1 -1
- package/ui/dist/assets/{StatCard-CrnvXPg5.js → StatCard-CY8lgeWm.js} +1 -1
- package/ui/dist/assets/{StatusBadge-B6r5EWBA.js → StatusBadge-CGvKbP7R.js} +1 -1
- package/ui/dist/assets/TeamsPanel-Bf6GaUni.js +1 -0
- package/ui/dist/assets/{TelemetryPanel-D6o14H-i.js → TelemetryPanel-JZ90gJXC.js} +1 -1
- package/ui/dist/assets/TitanCanvas-Hk49NFcA.js +1092 -0
- package/ui/dist/assets/ToolsView-Cq7Fuq3i.js +2 -0
- package/ui/dist/assets/{Tooltip-DNsYGHC9.js → Tooltip-CcoZrKsl.js} +1 -1
- package/ui/dist/assets/{TraceViewer-TOpdmqLF.js → TraceViewer-ojGf0drx.js} +1 -1
- package/ui/dist/assets/TrainingPanel-CWnP4H2l.js +1 -0
- package/ui/dist/assets/{VoiceOverlay-XIyCbAP7.js → VoiceOverlay-Dn6iaYgd.js} +1 -1
- package/ui/dist/assets/VramPanel-CLd9Ggck.js +1 -0
- package/ui/dist/assets/WatchView-CQBemwsm.js +13 -0
- package/ui/dist/assets/WorkTab-BOfTN-Bd.js +1 -0
- package/ui/dist/assets/WorkflowsPanel-qzNS0p0u.js +11 -0
- package/ui/dist/assets/{arrow-left-CQF-yBIU.js → arrow-left-c-8OFZUV.js} +1 -1
- package/ui/dist/assets/{chart-column-1smg0GbX.js → chart-column-x6L66Qw7.js} +1 -1
- package/ui/dist/assets/{circle-check-big-BiMDFx6C.js → circle-check-big-WaW3U3Xl.js} +1 -1
- package/ui/dist/assets/{dollar-sign-DMYH4Q_a.js → dollar-sign-D2Oce4Ru.js} +1 -1
- package/ui/dist/assets/{download-BYFd-yl6.js → download-YvPDLlFJ.js} +1 -1
- package/ui/dist/assets/eye-off-DIMcxsdQ.js +6 -0
- package/ui/dist/assets/{funnel-pWBglhfw.js → funnel-DqD9srZu.js} +1 -1
- package/ui/dist/assets/{git-branch-Cgqic2Us.js → git-branch-0FamUEbU.js} +1 -1
- package/ui/dist/assets/index-D932CbpQ.css +1 -0
- package/ui/dist/assets/index-NatBSFxj.js +227 -0
- package/ui/dist/assets/{legacy-BHbi-Nm_.js → legacy-DOO7F5cq.js} +1 -1
- package/ui/dist/assets/{lightbulb-D_y0Mtyq.js → lightbulb-Bk6KlR6q.js} +1 -1
- package/ui/dist/assets/pause-DDC_zUiJ.js +6 -0
- package/ui/dist/assets/{play-2xR4_zUG.js → play-BPXbHToG.js} +1 -1
- package/ui/dist/assets/{plug-DhvhYYy_.js → plug-Dxp-sWVF.js} +1 -1
- package/ui/dist/assets/proxy-vU7v4NVM.js +9 -0
- package/ui/dist/assets/square-Bn_0tYME.js +6 -0
- package/ui/dist/assets/target-BrtxUtzl.js +6 -0
- package/ui/dist/assets/toggle-right-CYphlpN5.js +11 -0
- package/ui/dist/assets/{trash-2-DmRaMz9e.js → trash-2-C_Jsp23A.js} +1 -1
- package/ui/dist/assets/{trending-up-DsDcs3Jo.js → trending-up-DrtLViSm.js} +1 -1
- package/ui/dist/assets/trophy-DdRzAOfo.js +6 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/CPFiles-G7veSjMg.js +0 -6
- package/ui/dist/assets/CPGoals-C3DlKJrJ.js +0 -1
- package/ui/dist/assets/CPInbox-D10curQs.js +0 -16
- package/ui/dist/assets/ChannelsPanel-M3pO2htW.js +0 -1
- package/ui/dist/assets/CommandPostHub-CW9OY1A4.js +0 -37
- package/ui/dist/assets/InlineEditableField-CH-jR3LC.js +0 -11
- package/ui/dist/assets/IntegrationsPanel-EaN999Te.js +0 -1
- package/ui/dist/assets/IntelligenceView-Q4DBmJpJ.js +0 -2
- package/ui/dist/assets/McpPanel-zC7jTaSx.js +0 -6
- package/ui/dist/assets/MeshPanel-CqtYZ74K.js +0 -11
- package/ui/dist/assets/NvidiaPanel-BVIZFHet.js +0 -1
- package/ui/dist/assets/SelfImprovePanel-PSCYO6sx.js +0 -11
- package/ui/dist/assets/SessionsTab-Cn3dGgjX.js +0 -1
- package/ui/dist/assets/SettingsView-3BSIzAfW.js +0 -2
- package/ui/dist/assets/TitanCanvas-cnb7R1gS.js +0 -1056
- package/ui/dist/assets/ToolsView-Dp-xUWJG.js +0 -2
- package/ui/dist/assets/WorkTab-Pgq-iLz9.js +0 -1
- package/ui/dist/assets/WorkflowsPanel-B91LeW7r.js +0 -21
- package/ui/dist/assets/eye-BfW7UcEC.js +0 -11
- package/ui/dist/assets/index-BWSnB6Kr.js +0 -227
- package/ui/dist/assets/index-Dtw1pbjc.css +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkillsPanel-Z_9jA6dU.js","assets/index-BWSnB6Kr.js","assets/index-Dtw1pbjc.css","assets/PageHeader-BdvxKoad.js","assets/VoiceOverlay-XIyCbAP7.js","assets/TitanCanvas-cnb7R1gS.js","assets/TitanCanvas-BfitWg9R.css","assets/trash-2-DmRaMz9e.js","assets/download-BYFd-yl6.js","assets/McpPanel-zC7jTaSx.js","assets/plug-DhvhYYy_.js","assets/IntegrationsPanel-EaN999Te.js","assets/circle-check-big-BiMDFx6C.js","assets/eye-BfW7UcEC.js","assets/ChannelsPanel-M3pO2htW.js","assets/MeshPanel-CqtYZ74K.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as l,j as e,n,_ as i}from"./index-BWSnB6Kr.js";const o=l.lazy(()=>i(()=>import("./SkillsPanel-Z_9jA6dU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),r=l.lazy(()=>i(()=>import("./McpPanel-zC7jTaSx.js"),__vite__mapDeps([9,1,2,10,5,4,6,7]))),c=l.lazy(()=>i(()=>import("./IntegrationsPanel-EaN999Te.js"),__vite__mapDeps([11,1,2,10,12,13,5,4,6]))),d=l.lazy(()=>i(()=>import("./ChannelsPanel-M3pO2htW.js"),__vite__mapDeps([14,1,2,3,4,5,6,12,13]))),x=l.lazy(()=>i(()=>import("./MeshPanel-CqtYZ74K.js"),__vite__mapDeps([15,1,2,5,4,6]))),m=[{id:"skills",label:"Skills"},{id:"mcp",label:"MCP Servers"},{id:"integrations",label:"Integrations"},{id:"channels",label:"Channels"},{id:"mesh",label:"Mesh Network"}];function h(){const[s,a]=l.useState("skills");return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-0",children:[e.jsx("h1",{className:"text-sm font-semibold text-text mb-3",children:"Tools & Connections"}),e.jsx("div",{className:"flex items-center gap-0.5 border-b border-border/50",children:m.map(t=>e.jsxs("button",{onClick:()=>a(t.id),className:n("px-3 py-2 text-xs font-medium transition-colors relative",s===t.id?"text-accent":"text-text-muted hover:text-text-secondary"),children:[t.label,s===t.id&&e.jsx("div",{className:"absolute bottom-0 left-1 right-1 h-[2px] bg-accent rounded-full"})]},t.id))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-5",children:e.jsxs(l.Suspense,{fallback:e.jsx("div",{className:"skeleton-shimmer h-40 rounded-lg"}),children:[s==="skills"&&e.jsx(o,{}),s==="mcp"&&e.jsx(r,{}),s==="integrations"&&e.jsx(c,{}),s==="channels"&&e.jsx(d,{}),s==="mesh"&&e.jsx(x,{})]})})]})}export{h as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as e,X as L,b as S,e as J,aw as q}from"./index-BWSnB6Kr.js";import{A as D,m as $}from"./CommandPostHub-CW9OY1A4.js";import{E as K,l as B,P as U}from"./TitanCanvas-cnb7R1gS.js";import{P as F}from"./play-2xR4_zUG.js";import{T as M}from"./trash-2-DmRaMz9e.js";import{P as _}from"./InlineEditableField-CH-jR3LC.js";import"./Input-DYukme8A.js";import"./Tooltip-DNsYGHC9.js";import"./VoiceOverlay-XIyCbAP7.js";import"./dollar-sign-DMYH4Q_a.js";import"./git-branch-Cgqic2Us.js";import"./chart-column-1smg0GbX.js";function V({open:a,approval:s,onClose:l}){var N,k,w;const[c,n]=o.useState(null),[p,r]=o.useState(!1),[y,m]=o.useState(!1),u=(N=s==null?void 0:s.payload)==null?void 0:N.goalId;if(o.useEffect(()=>{if(!a||!u){n(null),m(!1);return}let b=!1;const C=async()=>{try{const f=await S(`/api/goals/${u}`);if(!f.ok){b||(m(!0),r(!1));return}const h=await f.json();if(b)return;n(h.goal||h),m(!1),r(!1)}catch{b||(m(!0),r(!1))}};r(!0),C();const d=setInterval(C,5e3);return()=>{b=!0,clearInterval(d)}},[a,u]),o.useEffect(()=>{if(!a)return;const b=C=>{C.key==="Escape"&&l()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[a,l]),!s)return null;const j=s.title||((k=s.payload)==null?void 0:k.title)||"Approval",x=(w=s.payload)==null?void 0:w.rationale;return e.jsx(D,{children:a&&e.jsxs(e.Fragment,{children:[e.jsx($.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},onClick:l,style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.55)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)",zIndex:99}},"backdrop"),e.jsxs($.aside,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{duration:.28,ease:[.32,.72,0,1]},style:{position:"fixed",top:0,right:0,bottom:0,width:"min(540px, 100vw)",background:"rgba(10, 12, 20, 0.96)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderLeft:"1px solid rgba(167, 139, 250, 0.15)",display:"flex",flexDirection:"column",zIndex:100,color:"#f8f9fc",boxShadow:"-20px 0 60px rgba(0,0,0,0.5)"},role:"dialog","aria-modal":"true",children:[e.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"flex-start",gap:12},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.15em",color:"rgba(255,255,255,0.35)",fontWeight:600,marginBottom:6},children:"Proposal"}),e.jsx("div",{style:{fontSize:17,fontWeight:600,lineHeight:1.3,marginBottom:6},children:j}),e.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.35)"},children:e.jsx(G,{status:s.status})})]}),e.jsx("button",{onClick:l,"aria-label":"Close",style:{background:"transparent",border:0,color:"rgba(255,255,255,0.55)",cursor:"pointer",padding:6,borderRadius:8},children:e.jsx(L,{size:18})})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:[x&&e.jsx(z,{label:"Why this",children:e.jsx("div",{style:{fontSize:13,color:"rgba(255,255,255,0.75)",lineHeight:1.5},children:x})}),!u&&s.status==="pending"&&e.jsx(z,{label:"Status",children:e.jsx("div",{style:{fontSize:13,color:"rgba(251, 191, 36, 0.9)"},children:"Waiting for approval. Once approved, a goal will be created and TITAN will start working on it."})}),!u&&s.status==="rejected"&&e.jsx(z,{label:"Status",children:e.jsx("div",{style:{fontSize:13,color:"rgba(255,255,255,0.5)"},children:"Rejected. No work started."})}),u&&e.jsxs(e.Fragment,{children:[p&&!c&&e.jsx(z,{label:"Progress",children:e.jsx("div",{style:{fontSize:13,color:"rgba(255,255,255,0.4)"},children:"Loading goal…"})}),y&&e.jsx(z,{label:"Progress",children:e.jsx("div",{style:{fontSize:13,color:"rgba(255,255,255,0.4)"},children:"Goal linked to this approval wasn't found (may have been deleted)."})}),c&&e.jsx(X,{goal:c})]})]}),e.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid rgba(255,255,255,0.06)",display:"flex",gap:10},children:[u&&e.jsxs("a",{href:"/command-post",onClick:b=>{b.preventDefault(),window.location.hash="#watch",l()},style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:8,background:"rgba(167, 139, 250, 0.12)",color:"#c4b5fd",fontSize:12,fontWeight:500,textDecoration:"none",cursor:"pointer"},children:[e.jsx(K,{size:12})," Watch live"]}),e.jsx("button",{onClick:l,style:{padding:"8px 14px",borderRadius:8,background:"rgba(255,255,255,0.04)",border:0,color:"rgba(255,255,255,0.55)",fontSize:12,cursor:"pointer"},children:"Close"})]})]},"panel")]})})}function X({goal:a}){const s=a.subtasks||[],l=s.filter(r=>r.status==="done"||r.status==="skipped").length,c=s.filter(r=>r.status==="failed").length,n=s.filter(r=>r.status==="running").length,p=s.length?l/s.length*100:a.progress||0;return e.jsxs(e.Fragment,{children:[e.jsxs(z,{label:"Progress",children:[e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,marginBottom:6},children:[e.jsxs("span",{style:{color:"rgba(255,255,255,0.6)"},children:[l," / ",s.length," complete"]}),e.jsxs("span",{style:{color:"rgba(255,255,255,0.4)",fontVariantNumeric:"tabular-nums"},children:[p.toFixed(0),"%"]})]}),e.jsx("div",{style:{height:6,borderRadius:3,background:"rgba(255,255,255,0.04)",overflow:"hidden"},children:e.jsx("div",{style:{width:`${p}%`,height:"100%",background:c>0?"linear-gradient(to right, #34d399, #fbbf24)":"var(--color-emerald)",transition:"width 0.5s"}})})]}),e.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)",display:"flex",gap:12},children:[e.jsx(G,{status:a.status}),n>0&&e.jsxs("span",{children:["· ",n," running"]}),c>0&&e.jsxs("span",{style:{color:"rgba(239, 68, 68, 0.9)"},children:["· ",c," failed"]})]})]}),s.length>0&&e.jsx(z,{label:"Subtasks",children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:s.map(r=>e.jsx(Y,{goalId:a.id,subtask:r},r.id))})})]})}function Y({goalId:a,subtask:s}){const l=O(s.status),c=s.status==="running",[n,p]=o.useState(!1),r=async()=>{p(!0);try{await S(`/api/goals/${a}/subtasks/${s.id}/retry`,{method:"POST"})}catch(m){alert(`Retry failed: ${m.message}`)}p(!1)},y=async()=>{p(!0);try{await S(`/api/goals/${a}/subtasks/${s.id}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({result:"Marked complete from Command Post"})})}catch(m){alert(`Mark-done failed: ${m.message}`)}p(!1)};return e.jsxs("div",{style:{padding:"10px 12px",borderRadius:8,background:"rgba(255,255,255,0.02)",borderLeft:`2px solid ${l}`,fontSize:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:s.error||s.result?6:0},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:l,boxShadow:`0 0 ${c?10:5}px ${l}`,animation:c?"subtask-pulse 1.4s ease-in-out infinite":"none",flexShrink:0}}),e.jsx("span",{style:{flex:1,color:"rgba(255,255,255,0.85)",lineHeight:1.4},children:s.title}),s.status==="failed"&&e.jsx("button",{onClick:r,disabled:n,title:"Reset + retry",style:{background:"transparent",border:0,padding:4,borderRadius:4,color:"#fbbf24",cursor:"pointer",opacity:n?.4:.8},children:e.jsx(B,{size:12})}),s.status==="pending"&&e.jsx("button",{onClick:y,disabled:n,title:"Mark done",style:{background:"transparent",border:0,padding:4,borderRadius:4,color:"var(--color-emerald)",cursor:"pointer",opacity:n?.4:.8},children:e.jsx(J,{size:12})}),e.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.1em",color:l,fontWeight:600,flexShrink:0},children:s.status})]}),s.error&&e.jsx("div",{style:{fontSize:11,color:"rgba(239, 68, 68, 0.85)",padding:"6px 8px",borderRadius:6,background:"rgba(239, 68, 68, 0.06)",marginLeft:18},children:s.error}),s.result&&s.status==="done"&&e.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.55)",lineHeight:1.4,marginLeft:18,marginTop:4},children:[s.result.slice(0,240),s.result.length>240?"…":""]}),e.jsx("style",{children:"@keyframes subtask-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }"})]})}function G({status:a}){const s=O(a);return e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:999,background:`${s}15`,color:s,fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em"},children:a})}function O(a){switch(a){case"done":case"completed":case"approved":case"active":return"var(--color-emerald)";case"running":return"var(--color-cyan)";case"failed":case"rejected":return"var(--color-error)";case"skipped":return"var(--color-text-secondary)";case"pending":case"paused":return"#fbbf24";default:return"#9ca3af"}}function z({label:a,children:s}){return e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("div",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.15em",color:"rgba(255,255,255,0.35)",fontWeight:600,marginBottom:8},children:a}),s]})}function pe(){const[a,s]=o.useState([]),[l,c]=o.useState(!0),[n,p]=o.useState(null),[r,y]=o.useState(null),[m,u]=o.useState(!1),[j,x]=o.useState(null),[N,k]=o.useState(null),{toast:w}=q(),b=async()=>{try{const t=await S("/api/goals");if(t.ok){const i=await t.json();s(i.goals||[])}}catch{}},C=async t=>{k(t.id);const i=t.status==="paused"?"active":"paused";try{await S(`/api/goals/${t.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:i})}),await b()}catch(g){w("error",`Update failed: ${g.message}`)}k(null)},d=async t=>{k(t.id);try{await S(`/api/goals/${t.id}`,{method:"DELETE"}),await b()}catch(i){w("error",`Delete failed: ${i.message}`)}k(null),x(null)},f=async t=>{k(t.id);try{const i=(t.subtasks||[]).filter(g=>g.status==="failed");for(const g of i)await S(`/api/goals/${t.id}/subtasks/${g.id}/retry`,{method:"POST"});t.status!=="active"&&await S(`/api/goals/${t.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"active"})}),await b()}catch(i){w("error",`Restart failed: ${i.message}`)}k(null)};o.useEffect(()=>{let t=!0;const i=async()=>{try{const v=await S("/api/goals");if(!v.ok)return;const T=await v.json();if(!t)return;s(T.goals||[]),c(!1)}catch{}};i();const g=setInterval(i,1e4);return()=>{t=!1,clearInterval(g)}},[]),o.useEffect(()=>{const t=localStorage.getItem("titan-token")||localStorage.getItem("titan_token")||"",i=`/api/watch/stream${t?`?token=${encodeURIComponent(t)}`:""}`,g=new EventSource(i);return g.onmessage=v=>{try{const T=JSON.parse(v.data);if(T.type!=="event")return;if(T.topic==="initiative:start"||T.topic==="initiative:round"){const I=T.raw||{};y({goalTitle:I.goalTitle||"",subtaskTitle:I.subtaskTitle||"",round:I.round,maxRounds:I.maxRounds})}(T.topic==="initiative:complete"||T.topic==="initiative:no_progress")&&y(null)}catch{}},g.onerror=()=>{},()=>g.close()},[]);const h=o.useMemo(()=>a.filter(t=>t.status==="active").sort((t,i)=>(t.priority||5)-(i.priority||5)),[a]),A=o.useMemo(()=>a.filter(t=>t.status==="paused"),[a]),P=o.useMemo(()=>a.filter(t=>t.status==="completed").sort((t,i)=>(i.completedAt||i.updatedAt||"").localeCompare(t.completedAt||t.updatedAt||"")).slice(0,5),[a]),R=o.useMemo(()=>{const t=[];for(const i of h){const g=new Set((i.subtasks||[]).filter(v=>v.status==="done"||v.status==="skipped").map(v=>v.id));for(const v of i.subtasks||[]){if(v.status!=="pending")continue;(v.dependsOn||[]).every(H=>g.has(H))&&t.push({goal:i,subtask:v})}}return t},[h]),W=o.useMemo(()=>{const t=[];for(const i of a)if(!(i.status!=="active"&&i.status!=="paused"))for(const g of i.subtasks||[])g.status==="failed"&&t.push({goal:i,subtask:g});return t.slice(0,5)},[a]);return l?e.jsx("div",{className:"flex items-center justify-center h-64 text-sm text-text-muted",children:"Loading work…"}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-[11px] text-text-muted",children:[a.filter(t=>t.status==="active").length," active · ",a.filter(t=>t.status==="paused").length," paused · ",a.filter(t=>t.status==="completed").length," completed"]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] font-medium rounded-lg bg-indigo-600 text-white hover:bg-indigo-500 transition-colors",children:[e.jsx(U,{size:13})," New goal"]})]}),e.jsx(E,{label:"Now",count:r?1:0,children:e.jsx(D,{mode:"wait",children:r?e.jsxs($.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.25},className:"p-4 rounded-xl border border-cyan-500/20 bg-cyan-500/[0.04]",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-cyan-400 animate-pulse",style:{boxShadow:"0 0 12px #22d3ee"}}),e.jsx("span",{className:"text-[11px] text-cyan-300 uppercase tracking-wider font-semibold",children:"executing"}),r.round&&r.maxRounds&&e.jsxs("span",{className:"text-[11px] text-text-muted",children:["round ",r.round,"/",r.maxRounds]})]}),e.jsx("div",{className:"text-[15px] font-medium text-white/95 mb-1",children:r.subtaskTitle||"(unnamed subtask)"}),r.goalTitle&&e.jsxs("div",{className:"text-[11px] text-text-muted",children:["in goal: ",r.goalTitle]})]},`${r.goalTitle}-${r.subtaskTitle}`):e.jsxs($.div,{initial:{opacity:0},animate:{opacity:1},className:"p-6 rounded-xl border border-border text-center",children:[e.jsx("div",{className:"text-[13px] text-text-muted",children:"Nothing running right now."}),e.jsx("div",{className:"text-[11px] text-text-muted mt-1",children:R.length>0?`${R.length} task${R.length===1?"":"s"} queued — TITAN will start within 10 seconds`:h.length>0?`${h.length} goal${h.length===1?"":"s"} active — waiting for driver to begin`:"No work in queue. Approve a proposal from the Inbox to get started."})]},"idle")})}),R.length>0&&e.jsx(E,{label:"Up next",count:R.length,children:e.jsx("div",{className:"space-y-2",children:R.slice(0,3).map(({goal:t,subtask:i},g)=>e.jsxs("div",{onClick:()=>p(t),className:"flex items-center gap-3 p-3 rounded-lg bg-bg-secondary/30 border border-border/30 hover:bg-bg-secondary cursor-pointer transition-colors",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400/60"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] text-white/85 truncate",children:i.title}),e.jsx("div",{className:"text-[11px] text-text-muted truncate",children:t.title})]}),g===0&&e.jsx("span",{className:"text-[10px] text-cyan-300/70 uppercase tracking-wider",children:"next"})]},`${t.id}-${i.id}`))})}),e.jsx(E,{label:"Active goals",count:h.length,children:h.length===0?e.jsx("div",{className:"p-6 rounded-xl border border-border text-center text-[12px] text-text-muted",children:"No active goals. TITAN is idle. (Soma may propose one shortly.)"}):e.jsx("div",{className:"space-y-2",children:h.map(t=>e.jsx(Z,{goal:t,busy:N===t.id,onClick:()=>p(t),onPauseToggle:()=>C(t),onDelete:()=>x(t),onRestart:()=>f(t)},t.id))})}),P.length>0&&e.jsx(E,{label:"Recently done",count:P.length,children:e.jsx("div",{className:"space-y-2",children:P.map(t=>e.jsxs("div",{onClick:()=>p(t),className:"flex items-center gap-3 p-3 rounded-lg bg-emerald-500/[0.03] border border-emerald-500/10 hover:bg-emerald-500/[0.06] cursor-pointer",children:[e.jsx("span",{className:"text-emerald-400",children:"✓"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] text-white/85 truncate",children:t.title}),e.jsxs("div",{className:"text-[11px] text-text-muted",children:["completed ",ee(t.completedAt||t.updatedAt)]})]})]},t.id))})}),(A.length>0||W.length>0)&&e.jsx(E,{label:"Needs attention",count:A.length+W.length,children:e.jsxs("div",{className:"space-y-2",children:[A.map(t=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-amber-500/[0.03] border border-amber-500/15 hover:bg-amber-500/[0.06]",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400"}),e.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>p(t),children:[e.jsx("div",{className:"text-[13px] text-white/85 truncate",children:t.title}),e.jsx("div",{className:"text-[11px] text-text-muted",children:"paused"})]}),e.jsx("button",{onClick:i=>{i.stopPropagation(),C(t)},disabled:N===t.id,title:"Resume",className:"p-1.5 rounded hover:bg-bg-tertiary text-emerald-400/70 hover:text-emerald-400 disabled:opacity-40",children:e.jsx(F,{size:12})}),e.jsx("button",{onClick:i=>{i.stopPropagation(),x(t)},disabled:N===t.id,title:"Delete",className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-red-400 disabled:opacity-40",children:e.jsx(M,{size:12})})]},t.id)),W.map(({goal:t,subtask:i})=>e.jsxs("div",{onClick:()=>p(t),className:"flex items-start gap-3 p-3 rounded-lg bg-red-500/[0.03] border border-red-500/15 hover:bg-red-500/[0.06] cursor-pointer",children:[e.jsx("span",{className:"text-red-400 mt-0.5",children:"✗"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] text-white/85 truncate",children:i.title}),e.jsxs("div",{className:"text-[11px] text-text-muted truncate",children:["in ",t.title]}),i.error&&e.jsx("div",{className:"text-[11px] text-red-300/70 mt-1 truncate",children:i.error})]})]},`${t.id}-${i.id}`))]})}),e.jsx(V,{open:n!==null,approval:n?{id:n.id,title:n.title,status:n.status,payload:{goalId:n.id,title:n.title,description:n.description,rationale:n.description}}:null,onClose:()=>p(null)}),e.jsx(Q,{open:m,onClose:()=>u(!1),onCreated:async()=>{u(!1),await b()}}),e.jsx(D,{children:j&&e.jsx($.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(6px)",zIndex:200,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>x(null),children:e.jsxs($.div,{initial:{scale:.96,y:8},animate:{scale:1,y:0},exit:{scale:.96,y:8},onClick:t=>t.stopPropagation(),style:{background:"rgba(15, 17, 26, 0.98)",border:"1px solid rgba(239, 68, 68, 0.25)",borderRadius:16,padding:24,maxWidth:440,width:"calc(100% - 32px)",color:"#f8f9fc"},children:[e.jsx("div",{className:"text-[16px] font-semibold mb-2",children:"Delete this goal?"}),e.jsx("div",{className:"text-[13px] text-white/55 mb-1",children:j.title}),e.jsxs("div",{className:"text-[11px] text-text-muted mb-5",children:["All ",(j.subtasks||[]).length," subtasks will be removed. Can't undo."]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:()=>x(null),className:"px-4 py-2 rounded-lg text-[12px] text-text-secondary hover:bg-bg-tertiary",children:"Cancel"}),e.jsx("button",{onClick:()=>d(j),disabled:N===j.id,className:"px-4 py-2 rounded-lg text-[12px] font-medium bg-red-600 text-white hover:bg-red-500 disabled:opacity-50",children:"Delete goal"})]})]})})})]})}function Q({open:a,onClose:s,onCreated:l}){const[c,n]=o.useState(""),[p,r]=o.useState(""),[y,m]=o.useState([]),[u,j]=o.useState(""),[x,N]=o.useState(!1),[k,w]=o.useState(null);o.useEffect(()=>{a||(n(""),r(""),m([]),j(""),w(null))},[a]),o.useEffect(()=>{if(!a)return;const d=f=>{f.key==="Escape"&&s()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[a,s]);const b=()=>{const d=u.trim();d&&(m(f=>[...f,d]),j(""))},C=async()=>{if(!c.trim()){w("Title is required");return}N(!0),w(null);try{const d={title:c.trim(),description:p.trim()||c.trim(),subtasks:y.map(h=>({title:h,description:h}))},f=await S("/api/goals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!f.ok){const h=await f.text().catch(()=>"");throw new Error(h||`HTTP ${f.status}`)}l()}catch(d){w(d.message)}N(!1)};return e.jsx(D,{children:a&&e.jsx($.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(6px)",zIndex:200,display:"flex",alignItems:"center",justifyContent:"center",padding:16},onClick:s,children:e.jsxs($.div,{initial:{scale:.96,y:8},animate:{scale:1,y:0},exit:{scale:.96,y:8},onClick:d=>d.stopPropagation(),style:{background:"rgba(15, 17, 26, 0.98)",border:"1px solid rgba(99, 102, 241, 0.25)",borderRadius:16,padding:24,maxWidth:520,width:"100%",color:"#f8f9fc"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsx("h2",{className:"text-[16px] font-semibold",children:"New goal"}),e.jsx("button",{onClick:s,className:"text-white/55 hover:text-text p-1",children:e.jsx(L,{size:18})})]}),e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold block mb-1.5",children:"Title"}),e.jsx("input",{value:c,onChange:d=>n(d.target.value),placeholder:"Build the Polymarket monitor",autoFocus:!0,className:"w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[14px] text-white/95 placeholder-white/25 focus:outline-none focus:border-indigo-500/50 mb-4"}),e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold block mb-1.5",children:"Description (optional)"}),e.jsx("textarea",{value:p,onChange:d=>r(d.target.value),placeholder:"What should TITAN accomplish? Why?",rows:3,className:"w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[13px] text-white/85 placeholder-white/25 focus:outline-none focus:border-indigo-500/50 resize-none mb-4"}),e.jsx("label",{className:"text-[10px] uppercase tracking-wider text-text-muted font-semibold block mb-1.5",children:"Subtasks (optional)"}),e.jsx("div",{className:"space-y-1.5 mb-2",children:y.map((d,f)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-bg-tertiary/30 border border-border/50",children:[e.jsxs("span",{className:"text-[11px] text-text-muted tabular-nums",children:[f+1,"."]}),e.jsx("span",{className:"flex-1 text-[12px] text-text",children:d}),e.jsx("button",{onClick:()=>m(h=>h.filter((A,P)=>P!==f)),className:"text-text-muted hover:text-red-400","aria-label":"Remove",children:e.jsx(L,{size:12})})]},f))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:u,onChange:d=>j(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),b())},placeholder:"Add a subtask (press Enter)",className:"flex-1 bg-bg-tertiary border border-border rounded-lg px-3 py-1.5 text-[12px] text-white/85 placeholder-white/25 focus:outline-none focus:border-indigo-500/50"}),e.jsx("button",{onClick:b,disabled:!u.trim(),className:"px-3 rounded-lg text-[12px] bg-bg-tertiary text-text-secondary hover:bg-bg-tertiary disabled:opacity-30",children:"Add"})]}),y.length===0&&e.jsx("p",{className:"text-[10px] text-text-muted italic mt-2",children:"Leaving subtasks empty is fine — TITAN can plan them itself."}),k&&e.jsx("div",{className:"mt-4 p-2 rounded-lg bg-red-500/[0.08] border border-red-500/20 text-[12px] text-red-300",children:k}),e.jsxs("div",{className:"flex gap-2 justify-end mt-6",children:[e.jsx("button",{onClick:s,className:"px-4 py-2 rounded-lg text-[12px] text-text-secondary hover:bg-bg-tertiary",children:"Cancel"}),e.jsx("button",{onClick:C,disabled:x||!c.trim(),className:"px-4 py-2 rounded-lg text-[12px] font-medium bg-indigo-600 text-white hover:bg-indigo-500 disabled:opacity-50",children:x?"Creating…":"Create goal"})]})]})})})}function Z({goal:a,busy:s,onClick:l,onPauseToggle:c,onDelete:n,onRestart:p}){const r=a.subtasks||[],y=r.filter(x=>x.status==="done"||x.status==="skipped").length,m=r.filter(x=>x.status==="running").length,u=r.filter(x=>x.status==="failed").length,j=r.length?y/r.length*100:a.progress||0;return e.jsxs("div",{className:"group p-3 rounded-lg bg-bg-secondary/30 border border-border/50 hover:bg-bg-secondary transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-1.5",children:[e.jsx("div",{onClick:l,className:"flex-1 min-w-0 cursor-pointer",children:e.jsx("div",{className:"text-[13px] text-text truncate font-medium",children:a.title})}),e.jsxs("span",{className:"text-[10px] text-text-muted flex-shrink-0 tabular-nums",children:[y,"/",r.length]}),e.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u>0&&e.jsx("button",{onClick:x=>{x.stopPropagation(),p()},disabled:s,title:`Retry ${u} failed subtask${u===1?"":"s"}`,className:"p-1.5 rounded hover:bg-bg-tertiary text-amber-300/70 hover:text-amber-300 disabled:opacity-40",children:e.jsx(B,{size:12})}),e.jsx("button",{onClick:x=>{x.stopPropagation(),c()},disabled:s,title:a.status==="paused"?"Resume":"Pause",className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text disabled:opacity-40",children:a.status==="paused"?e.jsx(F,{size:12}):e.jsx(_,{size:12})}),e.jsx("button",{onClick:x=>{x.stopPropagation(),n()},disabled:s,title:"Delete",className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-red-400 disabled:opacity-40",children:e.jsx(M,{size:12})})]})]}),e.jsx("div",{className:"h-1 rounded-full bg-bg-tertiary overflow-hidden mb-2 cursor-pointer",onClick:l,children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${j}%`,background:u>0?"linear-gradient(to right, #34d399, #fbbf24)":"var(--color-emerald)"}})}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-text-muted cursor-pointer",onClick:l,children:[m>0&&e.jsxs("span",{className:"text-cyan-300/80",children:["▶ ",m," running"]}),u>0&&e.jsxs("span",{className:"text-red-300/80",children:["✗ ",u," failed"]}),m===0&&u===0&&r.length>0&&e.jsxs("span",{children:[r.length-y," pending"]}),r.length===0&&e.jsx("span",{className:"italic text-text-muted",children:"no subtasks yet"})]})]})}function E({label:a,count:s,children:l}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("h3",{className:"text-[11px] uppercase tracking-wider text-text-muted font-semibold",children:a}),s!==void 0&&s>0&&e.jsx("span",{className:"text-[10px] text-text-muted tabular-nums",children:s})]}),l]})}function ee(a){if(!a)return"";const s=Date.parse(a);if(isNaN(s))return"";const l=Math.max(0,Math.floor((Date.now()-s)/1e3));if(l<60)return`${l}s ago`;const c=Math.floor(l/60);if(c<60)return`${c}m ago`;const n=Math.floor(c/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}export{pe as default};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{c as T,r as d,j as e,b as G,Z as P,f as z,e as D,T as B}from"./index-BWSnB6Kr.js";import{P as Z}from"./PageHeader-BdvxKoad.js";import"./Input-DYukme8A.js";import{T as A,P as J,I as q}from"./InlineEditableField-CH-jR3LC.js";import{R as N,P as I,C as E,d as O}from"./TitanCanvas-cnb7R1gS.js";import{a as U,C as X}from"./VoiceOverlay-XIyCbAP7.js";import{P as $}from"./play-2xR4_zUG.js";import{T as _}from"./trash-2-DmRaMz9e.js";/**
|
|
2
|
-
* @license lucide-react v0.513.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const K=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Q=T("circle",K);/**
|
|
7
|
-
* @license lucide-react v0.513.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const V=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Y=T("timer",V);/**
|
|
12
|
-
* @license lucide-react v0.513.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ee=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],F=T("toggle-left",ee);/**
|
|
17
|
-
* @license lucide-react v0.513.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const te=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],L=T("toggle-right",te);function H(t){const o=t.split(" ");if(o.length!==5)return t;const[l,c,x,r,n]=o,g={0:"Sun",1:"Mon",2:"Tue",3:"Wed",4:"Thu",5:"Fri",6:"Sat",7:"Sun"};if(x==="*"&&r==="*"){const p=`${c.padStart(2,"0")}:${l.padStart(2,"0")}`;return n==="*"?`Daily at ${p}`:n==="1-5"?`Weekdays at ${p}`:n==="0,6"?`Weekends at ${p}`:`${n.split(",").map(m=>g[m]||m).join(", ")} at ${p}`}return l.startsWith("*/")?`Every ${l.slice(2)} min`:c.startsWith("*/")?`Every ${c.slice(2)} hours`:t}function S(t){const o=Date.now()-new Date(t).getTime(),l=Math.floor(o/6e4);if(l<1)return"just now";if(l<60)return`${l}m ago`;const c=Math.floor(l/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}const u=async(t,o)=>{const l=await G(t,{headers:{"Content-Type":"application/json"},...o});if(!l.ok)throw new Error(`API ${l.status}`);return l.json()};function R({icon:t,title:o,count:l,accent:c="var(--color-accent)"}){return e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(t,{className:"w-5 h-5",style:{color:c}}),e.jsx("h2",{className:"text-base font-semibold text-text",children:o}),l!==void 0&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-bg-tertiary text-text-secondary",children:l})]})}function M({status:t}){const o={active:{bg:"#34d39920",text:"var(--color-emerald)"},completed:{bg:"#6366f120",text:"var(--color-accent)"},paused:{bg:"#f59e0b20",text:"var(--color-warning)"},failed:{bg:"#ef444420",text:"var(--color-error)"},pending:{bg:"#52525b20",text:"var(--color-text-secondary)"},running:{bg:"#22d3ee20",text:"var(--color-cyan)"},done:{bg:"#34d39920",text:"var(--color-emerald)"},skipped:{bg:"#52525b20",text:"var(--color-border-light)"},ok:{bg:"#34d39920",text:"var(--color-emerald)"},notable:{bg:"#f59e0b20",text:"var(--color-warning)"},urgent:{bg:"#ef444420",text:"var(--color-error)"}},l=o[t]||o.pending;return e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium capitalize",style:{backgroundColor:l.bg,color:l.text},children:t})}function se({status:t}){switch(t){case"done":return e.jsx(D,{className:"w-3.5 h-3.5 text-emerald"});case"failed":return e.jsx(z,{className:"w-3.5 h-3.5 text-error"});case"running":return e.jsx(N,{className:"w-3.5 h-3.5 animate-spin text-cyan"});case"skipped":return e.jsx(J,{className:"w-3.5 h-3.5 text-text-muted"});default:return e.jsx(Q,{className:"w-3.5 h-3.5 text-text-muted"})}}function ae({goals:t,onRefresh:o}){const[l,c]=d.useState(new Set),[x,r]=d.useState(!1),[n,g]=d.useState(""),[p,f]=d.useState(""),m=a=>{c(y=>{const b=new Set(y);return b.has(a)?b.delete(a):b.add(a),b})},v=async()=>{n.trim()&&(await u("/api/goals",{method:"POST",body:JSON.stringify({title:n,description:p})}),g(""),f(""),r(!1),o())},h=async a=>{await u(`/api/goals/${a}`,{method:"DELETE"}),o()},s=async(a,y)=>{const b=y==="paused"?"active":"paused";try{await u(`/api/goals/${a}`,{method:"PATCH",body:JSON.stringify({status:b})}),o()}catch(w){alert(`Update failed: ${w.message}`)}},j=async(a,y)=>{try{await u(`/api/goals/${a}/subtasks/${y}/retry`,{method:"POST"}),o()}catch(b){alert(`Retry failed: ${b.message}`)}},k=async(a,y,b)=>{try{await u(`/api/goals/${a}/subtasks/${y}`,{method:"PATCH",body:JSON.stringify({title:b})}),o()}catch(w){alert(`Save failed: ${w.message}`)}},C=async(a,y)=>{await u(`/api/goals/${a}/subtasks/${y}/complete`,{method:"POST",body:JSON.stringify({result:"Completed via dashboard"})}),o()};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx(R,{icon:A,title:"Active Goals",count:t.length,accent:"#34d399"}),e.jsxs("button",{onClick:()=>r(!x),className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg transition-colors bg-bg-tertiary text-text-secondary",onMouseEnter:a=>{a.currentTarget.style.backgroundColor="#34d39930",a.currentTarget.style.color="var(--color-emerald)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor="var(--color-bg-tertiary)",a.currentTarget.style.color="var(--color-text-secondary)"},children:[e.jsx(I,{className:"w-3.5 h-3.5"})," New Goal"]})]}),x&&e.jsxs("div",{className:"rounded-lg p-4 mb-4",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsx("input",{id:"workflow-goal-title",name:"workflow-goal-title",type:"text",placeholder:"Goal title...",value:n,onChange:a=>g(a.target.value),className:"w-full px-3 py-2 rounded-lg text-sm mb-2 outline-none",style:{backgroundColor:"var(--color-bg)",border:"1px solid #27272a",color:"var(--color-text)"}}),e.jsx("textarea",{id:"workflow-goal-description",name:"workflow-goal-description",placeholder:"Description (optional)...",value:p,onChange:a=>f(a.target.value),rows:2,className:"w-full px-3 py-2 rounded-lg text-sm mb-3 outline-none resize-none",style:{backgroundColor:"var(--color-bg)",border:"1px solid #27272a",color:"var(--color-text)"}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:v,className:"text-xs px-4 py-1.5 rounded-lg font-medium transition-opacity hover:opacity-80",style:{backgroundColor:"var(--color-emerald)",color:"var(--color-bg)"},children:"Create"}),e.jsx("button",{onClick:()=>r(!1),className:"text-xs px-4 py-1.5 rounded-lg transition-colors hover:opacity-80 bg-bg-tertiary text-text-secondary",children:"Cancel"})]})]}),t.length===0?e.jsxs("div",{className:"rounded-lg p-6 text-center",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsx(A,{className:"w-8 h-8 mx-auto mb-2 text-text-muted"}),e.jsx("p",{className:"text-sm text-text-muted",children:"No goals yet. Create one to get started."})]}):e.jsx("div",{className:"space-y-2",children:t.map(a=>{const y=l.has(a.id),b=a.subtasks.filter(i=>i.status==="done"||i.status==="skipped").length,w=a.subtasks.length;return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 cursor-pointer select-none",onClick:()=>m(a.id),children:[y?e.jsx(U,{className:"w-4 h-4 flex-shrink-0 text-text-muted"}):e.jsx(X,{className:"w-4 h-4 flex-shrink-0 text-text-muted"}),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-medium truncate text-text",children:a.title}),e.jsx(M,{status:a.status})]}),w>0&&e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden bg-bg-tertiary",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${a.progress}%`,backgroundColor:"var(--color-emerald)"}})}),e.jsxs("span",{className:"text-xs flex-shrink-0 text-text-secondary",children:[b,"/",w]})]})]}),a.status!=="completed"&&e.jsx("button",{onClick:i=>{i.stopPropagation(),s(a.id,a.status)},className:"p-1 rounded hover:opacity-80 flex-shrink-0",title:a.status==="paused"?"Resume goal":"Pause goal",children:a.status==="paused"?e.jsx($,{className:"w-3.5 h-3.5 text-emerald"}):e.jsx(J,{className:"w-3.5 h-3.5",style:{color:"#fbbf24"}})}),e.jsx("button",{onClick:i=>{i.stopPropagation(),h(a.id)},className:"p-1 rounded hover:opacity-80 flex-shrink-0",title:"Delete goal",children:e.jsx(_,{className:"w-3.5 h-3.5 text-text-muted"})})]}),y&&a.subtasks.length>0&&e.jsx("div",{className:"px-4 pb-3 border-t",style:{borderColor:"var(--color-bg-tertiary)"},children:e.jsx("div",{className:"space-y-1.5 mt-2",children:a.subtasks.map(i=>e.jsxs("div",{className:"flex items-center gap-2 py-1 px-2 rounded bg-bg",children:[e.jsx(se,{status:i.status}),e.jsx("span",{className:"text-xs flex-1 min-w-0",style:{color:i.status==="done"?"var(--color-border-light)":"var(--color-text-secondary)"},children:e.jsx(q,{value:i.title,onSave:W=>k(a.id,i.id,W),placeholder:"Subtask title"})}),i.status==="failed"&&i.error&&e.jsx("span",{className:"text-xs truncate max-w-40 text-error",title:i.error,children:i.error}),i.status==="failed"&&e.jsxs("button",{onClick:()=>j(a.id,i.id),className:"text-xs px-2 py-0.5 rounded transition-colors hover:opacity-80",style:{backgroundColor:"var(--color-bg-tertiary)",color:"#fbbf24"},title:"Reset to pending, clear error, retry",children:[e.jsx(N,{className:"w-3 h-3 inline"})," Retry"]}),i.status==="pending"&&e.jsx("button",{onClick:()=>C(a.id,i.id),className:"text-xs px-2 py-0.5 rounded transition-colors hover:opacity-80",style:{backgroundColor:"var(--color-bg-tertiary)",color:"var(--color-emerald)"},children:"Done"})]},i.id))})})]},a.id)})})]})}function le({jobs:t,onRefresh:o}){const[l,c]=d.useState(!1),[x,r]=d.useState(""),[n,g]=d.useState(""),[p,f]=d.useState(""),m=async()=>{!x.trim()||!n.trim()||!p.trim()||(await u("/api/cron",{method:"POST",body:JSON.stringify({name:x,schedule:n,command:p})}),r(""),g(""),f(""),c(!1),o())},v=async(s,j)=>{await u(`/api/cron/${s}/toggle`,{method:"POST",body:JSON.stringify({enabled:!j})}),o()},h=async s=>{await u(`/api/cron/${s}`,{method:"DELETE"}),o()};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx(R,{icon:E,title:"Scheduled Tasks",count:t.length,accent:"#22d3ee"}),e.jsxs("button",{onClick:()=>c(!l),className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg transition-colors bg-bg-tertiary text-text-secondary",onMouseEnter:s=>{s.currentTarget.style.backgroundColor="#22d3ee30",s.currentTarget.style.color="var(--color-cyan)"},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="var(--color-bg-tertiary)",s.currentTarget.style.color="var(--color-text-secondary)"},children:[e.jsx(I,{className:"w-3.5 h-3.5"})," New Cron"]})]}),l&&e.jsxs("div",{className:"rounded-lg p-4 mb-4",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 mb-2",children:[e.jsx("input",{id:"workflow-cron-name",name:"workflow-cron-name",type:"text",placeholder:"Job name...",value:x,onChange:s=>r(s.target.value),className:"px-3 py-2 rounded-lg text-sm outline-none",style:{backgroundColor:"var(--color-bg)",border:"1px solid #27272a",color:"var(--color-text)"}}),e.jsx("input",{id:"workflow-cron-schedule",name:"workflow-cron-schedule",type:"text",placeholder:"Schedule (e.g. */5 * * * *)",value:n,onChange:s=>g(s.target.value),className:"px-3 py-2 rounded-lg text-sm outline-none",style:{backgroundColor:"var(--color-bg)",border:"1px solid #27272a",color:"var(--color-text)"}})]}),e.jsx("input",{id:"workflow-cron-command",name:"workflow-cron-command",type:"text",placeholder:"Command to execute...",value:p,onChange:s=>f(s.target.value),className:"w-full px-3 py-2 rounded-lg text-sm mb-3 outline-none",style:{backgroundColor:"var(--color-bg)",border:"1px solid #27272a",color:"var(--color-text)"}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:m,className:"text-xs px-4 py-1.5 rounded-lg font-medium transition-opacity hover:opacity-80",style:{backgroundColor:"var(--color-cyan)",color:"var(--color-bg)"},children:"Create"}),e.jsx("button",{onClick:()=>c(!1),className:"text-xs px-4 py-1.5 rounded-lg transition-colors hover:opacity-80 bg-bg-tertiary text-text-secondary",children:"Cancel"})]})]}),t.length===0?e.jsxs("div",{className:"rounded-lg p-6 text-center",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsx(E,{className:"w-8 h-8 mx-auto mb-2 text-text-muted"}),e.jsx("p",{className:"text-sm text-text-muted",children:"No scheduled tasks. Create a cron job to automate tasks."})]}):e.jsx("div",{className:"space-y-2",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-3 rounded-lg px-4 py-3",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsx("button",{onClick:()=>v(s.id,s.enabled),title:s.enabled?"Disable":"Enable",children:s.enabled?e.jsx(L,{className:"w-5 h-5 text-emerald"}):e.jsx(F,{className:"w-5 h-5 text-text-muted"})}),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-medium truncate",style:{color:s.enabled?"var(--color-text)":"var(--color-border-light)"},children:s.name}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--color-bg-tertiary)",color:"var(--color-cyan)"},children:H(s.schedule)})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[e.jsx("span",{className:"text-xs font-mono truncate text-text-muted",children:s.command}),s.last_run&&e.jsxs("span",{className:"text-xs flex-shrink-0 text-text-muted",children:["Last: ",S(s.last_run)]})]})]}),e.jsx("button",{onClick:()=>h(s.id),className:"p-1 rounded hover:opacity-80 flex-shrink-0",title:"Delete",children:e.jsx(_,{className:"w-3.5 h-3.5 text-text-muted"})})]},s.id))})]})}function re({recipes:t,onRefresh:o}){const[l,c]=d.useState(null),x=async r=>{c(r);try{await u(`/api/recipes/${r}/run`,{method:"POST",body:JSON.stringify({params:{}})}),o()}finally{c(null)}};return e.jsxs("div",{children:[e.jsx(R,{icon:O,title:"Recipes",count:t.length,accent:"#6366f1"}),t.length===0?e.jsxs("div",{className:"rounded-lg p-6 text-center",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsx(O,{className:"w-8 h-8 mx-auto mb-2 text-text-muted"}),e.jsx("p",{className:"text-sm text-text-muted",children:"No recipes available."})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:t.map(r=>{var n;return e.jsxs("div",{className:"rounded-lg p-4 flex flex-col",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-sm font-medium truncate text-text",children:r.name}),r.slashCommand&&e.jsxs("span",{className:"text-xs font-mono text-accent",children:["/",r.slashCommand]})]}),e.jsxs("button",{onClick:()=>x(r.id),disabled:l===r.id,className:"flex items-center gap-1 text-xs px-2.5 py-1 rounded-lg transition-opacity hover:opacity-80 flex-shrink-0",style:{backgroundColor:"#6366f130",color:"var(--color-accent)"},children:[l===r.id?e.jsx(N,{className:"w-3 h-3 animate-spin"}):e.jsx($,{className:"w-3 h-3"}),"Run"]})]}),e.jsx("p",{className:"text-xs flex-1 line-clamp-2 mb-2 text-text-secondary",children:r.description}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[r.steps.length," step",r.steps.length!==1?"s":""]}),(n=r.tags)==null?void 0:n.map(g=>e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:g},g)),r.lastRunAt&&e.jsxs("span",{className:"text-xs ml-auto text-text-muted",children:["Ran ",S(r.lastRunAt)]})]})]},r.id)})})]})}function oe({status:t,history:o,onRefresh:l}){const[c,x]=d.useState(!1),[r,n]=d.useState(!1),g=async()=>{x(!0);try{await u("/api/autopilot/toggle",{method:"POST",body:JSON.stringify({enabled:!(t!=null&&t.enabled)})}),l()}finally{x(!1)}},p=async()=>{n(!0);try{await u("/api/autopilot/run",{method:"POST"}),l()}finally{n(!1)}},f=m=>{switch(m){case"urgent":return e.jsx(B,{className:"w-3.5 h-3.5 text-error"});case"notable":return e.jsx(P,{className:"w-3.5 h-3.5 text-warning"});default:return e.jsx(D,{className:"w-3.5 h-3.5 text-emerald"})}};return e.jsxs("div",{children:[e.jsx(R,{icon:P,title:"Autopilot",accent:"#f59e0b"}),e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsxs("div",{className:"flex items-center gap-4 px-4 py-3",children:[e.jsx("button",{onClick:g,disabled:c,title:t!=null&&t.enabled?"Disable autopilot":"Enable autopilot",children:t!=null&&t.enabled?e.jsx(L,{className:"w-6 h-6 text-emerald"}):e.jsx(F,{className:"w-6 h-6 text-text-muted"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:t!=null&&t.enabled?"Active":"Disabled"}),(t==null?void 0:t.isRunning)&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-cyan",children:[e.jsx(N,{className:"w-3 h-3 animate-spin"})," Running..."]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[e.jsx(Y,{className:"w-3 h-3 inline mr-1"}),t!=null&&t.schedule?H(t.schedule):"No schedule"]}),e.jsxs("span",{className:"text-xs text-text-muted",children:[(t==null?void 0:t.totalRuns)??0," total runs"]}),(t==null?void 0:t.lastRun)&&e.jsxs("span",{className:"text-xs text-text-muted",children:["Last: ",S(t.lastRun.timestamp)]})]})]}),e.jsxs("button",{onClick:p,disabled:r||(t==null?void 0:t.isRunning),className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-lg transition-opacity hover:opacity-80",style:{backgroundColor:"#f59e0b30",color:"var(--color-warning)"},children:[r?e.jsx(N,{className:"w-3 h-3 animate-spin"}):e.jsx($,{className:"w-3 h-3"}),"Run Now"]})]}),o.length>0&&e.jsxs("div",{className:"border-t",style:{borderColor:"var(--color-bg-tertiary)"},children:[e.jsx("div",{className:"px-4 py-2",children:e.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Recent Runs"})}),e.jsx("div",{className:"divide-y",style:{borderColor:"var(--color-bg-tertiary)"},children:o.slice(-5).reverse().map((m,v)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",children:[f(m.classification),e.jsx("span",{className:"text-xs flex-1 truncate text-text-secondary",children:m.skipped?`Skipped: ${m.summary}`:m.summary.slice(0,120)}),e.jsx(M,{status:m.classification}),e.jsx("span",{className:"text-xs flex-shrink-0 text-text-muted",children:S(m.timestamp)})]},v))})]})]})]})}function ge(){const[t,o]=d.useState([]),[l,c]=d.useState([]),[x,r]=d.useState([]),[n,g]=d.useState(null),[p,f]=d.useState([]),[m,v]=d.useState(!0),h=d.useCallback(async()=>{try{const[s,j,k,C,a]=await Promise.allSettled([u("/api/goals"),u("/api/cron"),u("/api/recipes"),u("/api/autopilot/status"),u("/api/autopilot/history?limit=5")]);s.status==="fulfilled"&&o(s.value.goals||[]),j.status==="fulfilled"&&c(j.value.jobs||[]),k.status==="fulfilled"&&r(k.value.recipes||[]),C.status==="fulfilled"&&g(C.value),a.status==="fulfilled"&&f(Array.isArray(a.value)?a.value:[])}finally{v(!1)}},[]);return d.useEffect(()=>{h();const s=setInterval(h,15e3);return()=>clearInterval(s)},[h]),m?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(N,{className:"w-6 h-6 animate-spin text-text-muted"})}):e.jsxs("div",{className:"space-y-8",children:[e.jsx(Z,{title:"Workflows",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"},{label:"Workflows"}],actions:e.jsx("button",{onClick:()=>{v(!0),h()},className:"p-2 rounded-lg transition-colors hover:opacity-80 bg-bg-tertiary",title:"Refresh",children:e.jsx(N,{className:"w-4 h-4 text-text-secondary"})})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[{label:"Goals",value:t.filter(s=>s.status==="active").length,total:t.length,color:"var(--color-emerald)"},{label:"Cron Jobs",value:l.filter(s=>s.enabled).length,total:l.length,color:"var(--color-cyan)"},{label:"Recipes",value:x.length,color:"var(--color-accent)"},{label:"Autopilot Runs",value:(n==null?void 0:n.totalRuns)??0,color:"var(--color-warning)"}].map(s=>e.jsxs("div",{className:"rounded-lg px-4 py-3",style:{backgroundColor:"var(--color-bg-secondary)",border:"1px solid #27272a"},children:[e.jsx("p",{className:"text-xs mb-1 text-text-muted",children:s.label}),e.jsxs("p",{className:"text-lg font-bold",style:{color:s.color},children:[s.value,s.total!==void 0&&s.total!==s.value&&e.jsxs("span",{className:"text-xs font-normal ml-1 text-text-muted",children:["/ ",s.total]})]})]},s.label))}),e.jsx(ae,{goals:t,onRefresh:h}),e.jsx(le,{jobs:l,onRefresh:h}),e.jsx(re,{recipes:x,onRefresh:h}),e.jsx(oe,{status:n,history:p,onRefresh:h})]})}export{ge as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{c as e}from"./index-BWSnB6Kr.js";/**
|
|
2
|
-
* @license lucide-react v0.513.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const c=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],t=e("eye-off",c);/**
|
|
7
|
-
* @license lucide-react v0.513.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const a=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],y=e("eye",a);export{t as E,y as a};
|