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,6 +1,6 @@
|
|
|
1
|
-
import{c as S,r as d,j as e
|
|
1
|
+
import{c as S,r as d,j as e,a0 as A,a1 as k}from"./index-NatBSFxj.js";import{R as C}from"./TitanCanvas-Hk49NFcA.js";import{F as T}from"./funnel-DqD9srZu.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const M=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],h=S("clipboard-list",M);function D(){var b;const[c,p]=d.useState([]),[r,v]=d.useState(null),[g,i]=d.useState(!0),[a,l]=d.useState(""),[n,x]=d.useState(""),m=async()=>{i(!0);try{const[t,s]=await Promise.all([A({source:a||void 0,action:n||void 0,limit:100}),k(24)]);p(t),v(s)}catch{}i(!1)};d.useEffect(()=>{m()},[a,n]);const j=t=>t==="success"?"text-[var(--success)]":t==="failure"?"text-[var(--error)]":t==="escalated"?"text-[var(--warning)]":"text-[var(--text-muted)]",f=t=>t==="success"?"bg-[var(--success)]/10 border-[var(--success)]/20":t==="failure"?"bg-[var(--error)]/10 border-[var(--error)]/20":t==="escalated"?"bg-[var(--warning)]/10 border-[var(--warning)]/20":"bg-[var(--bg-tertiary)] border-[var(--border)]",u=t=>t.startsWith("daemon")?"bg-purple-500/10 text-purple-400 border-purple-500/20":t==="autopilot"?"bg-blue-500/10 text-blue-400 border-blue-500/20":t==="user"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":t==="initiative"?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-[var(--bg-tertiary)] text-[var(--text-muted)] border-[var(--border)]",N=t=>{try{const s=new Date(t),o=new Date().getTime()-s.getTime();return o<6e4?`${Math.round(o/1e3)}s ago`:o<36e5?`${Math.round(o/6e4)}m ago`:o<864e5?`${Math.round(o/36e5)}h ago`:s.toLocaleDateString()}catch{return t}},y=[...new Set(c.map(t=>t.source))].sort(),w=[...new Set(c.map(t=>t.action))].sort();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{className:"w-6 h-6 text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[var(--text)]",children:"Audit Log"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Every autonomous action logged for accountability"})]})]}),e.jsx("button",{onClick:m,className:"p-2 rounded-md border border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors",children:e.jsx(C,{size:14})})]}),r&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Actions (24h)"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--text)]",children:r.totalActions})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Success Rate"}),e.jsxs("p",{className:`text-2xl font-bold ${r.successRate>=80?"text-[var(--success)]":r.successRate>=50?"text-[var(--warning)]":"text-[var(--error)]"}`,children:[r.successRate,"%"]})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Sources"}),e.jsx("p",{className:"text-2xl font-bold text-[var(--text)]",children:Object.keys(r.bySource).length})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Top Tool"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--accent)] truncate",children:((b=r.topTools[0])==null?void 0:b.tool)||"none"})]})]}),r&&Object.keys(r.bySource).length>0&&e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-3",children:"Actions by Source (24h)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(r.bySource).sort((t,s)=>s[1]-t[1]).map(([t,s])=>e.jsxs("button",{onClick:()=>l(a===t?"":t),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${a===t?"bg-[var(--accent)] text-white border-[var(--accent)]":u(t)}`,children:[t,": ",s]},t))})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(T,{size:14,className:"text-[var(--text-muted)]"}),e.jsxs("select",{value:a,onChange:t=>l(t.target.value),className:"px-3 py-1.5 text-xs bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md text-[var(--text)]",children:[e.jsx("option",{value:"",children:"All Sources"}),y.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:n,onChange:t=>x(t.target.value),className:"px-3 py-1.5 text-xs bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md text-[var(--text)]",children:[e.jsx("option",{value:"",children:"All Actions"}),w.map(t=>e.jsx("option",{value:t,children:t},t))]}),(a||n)&&e.jsx("button",{onClick:()=>{l(""),x("")},className:"text-xs text-[var(--accent)] hover:underline",children:"Clear"})]}),g?e.jsx("div",{className:"text-[var(--text-muted)] text-sm",children:"Loading audit log..."}):c.length===0?e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-8 text-center",children:[e.jsx(h,{className:"w-10 h-10 text-[var(--text-muted)] mx-auto mb-3"}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:"No audit entries found"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Autonomous actions will appear here as TITAN operates."})]}):e.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg 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-[var(--border)] text-[var(--text-muted)]",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Time"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Action"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Source"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Tool"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Result"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Detail"})]})}),e.jsx("tbody",{children:c.map((t,s)=>e.jsxs("tr",{className:"border-b border-[var(--border)]/50 last:border-0 hover:bg-[var(--bg-tertiary)] transition-colors",children:[e.jsx("td",{className:"px-4 py-2 text-[var(--text-muted)] whitespace-nowrap",children:N(t.timestamp)}),e.jsx("td",{className:"px-4 py-2 text-[var(--text)] font-medium",children:t.action}),e.jsx("td",{className:"px-4 py-2",children:e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] border ${u(t.source)}`,children:t.source})}),e.jsx("td",{className:"px-4 py-2 text-[var(--text-secondary)] font-mono",children:t.tool||"-"}),e.jsx("td",{className:"px-4 py-2",children:t.result?e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] border ${f(t.result)} ${j(t.result)}`,children:t.result}):"-"}),e.jsx("td",{className:"px-4 py-2 text-[var(--text-muted)] max-w-[200px] truncate",children:t.detail?JSON.stringify(t.detail):"-"})]},s))})]})})})]})}export{D as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as M,r as c,K as B,j as e,e as q,Z as E,$ as F,t as C,b,S as g,G as O,d as T}from"./index-NatBSFxj.js";import{L as I,c as G,R as V,q as P,g as D,B as H,h as U,N as J,e as Z,U as K,M as W,D as Q}from"./TitanCanvas-Hk49NFcA.js";import{C as X}from"./circle-check-big-WaW3U3Xl.js";import{P as Y}from"./play-BPXbHToG.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
|
+
* @license lucide-react v0.513.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ee=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],se=M("graduation-cap",ee);/**
|
|
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 te=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ae=M("puzzle",te),v=[{key:"autonomy-mode",label:"Autonomous Mode",description:"TITAN acts without asking for approval on moderate-risk tools. Supervised = asks for dangerous ops. Locked = asks for everything.",icon:e.jsx(E,{className:"h-4 w-4"}),section:"autonomy",field:"mode",danger:!0},{key:"autonomy-autoProposeGoals",label:"Auto-Propose Goals",description:"TITAN can create its own goals from drives, observations, and initiatives.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"autonomy",field:"autoProposeGoals"},{key:"autonomy-proactiveInitiative",label:"Proactive Initiative",description:"TITAN takes initiative on its own between user messages.",icon:e.jsx(D,{className:"h-4 w-4"}),section:"autonomy",field:"proactiveInitiative"},{key:"selfMod-enabled",label:"Self-Modification",description:"Captures autonomous code changes and queues them for review.",icon:e.jsx(H,{className:"h-4 w-4"}),section:"selfMod",field:"enabled",danger:!0},{key:"selfMod-autoPR",label:"Auto-Open PRs",description:"When specialists approve a self-mod, automatically open a GitHub PR.",icon:e.jsx(oe,{className:"h-4 w-4"}),section:"selfMod",field:"autoPR"},{key:"commandPost-enabled",label:"Command Post",description:"Org chart, agent registry, approvals, budgets, and goal tracking.",icon:e.jsx(U,{className:"h-4 w-4"}),section:"commandPost",field:"enabled"},{key:"mesh-enabled",label:"Mesh Networking",description:"Distributed TITAN nodes. Share tasks and models across machines.",icon:e.jsx(J,{className:"h-4 w-4"}),section:"mesh",field:"enabled"},{key:"autopilot-enabled",label:"Autopilot",description:"Nightly autonomous checks, goal reviews, and self-improvement runs.",icon:e.jsx(Y,{className:"h-4 w-4"}),section:"autopilot",field:"enabled"},{key:"autopilot-selfInitiate",label:"Autopilot Self-Initiate",description:"Autopilot can create and start its own goals without human trigger.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"autopilot",field:"selfInitiate"},{key:"brain-enabled",label:"Brain (Local Router)",description:"Small local model routes tools instead of sending full schemas to the cloud LLM.",icon:e.jsx(Z,{className:"h-4 w-4"}),section:"brain",field:"enabled"},{key:"mcp-server-enabled",label:"MCP Server",description:"Expose TITAN tools as a Model Context Protocol server for other AI apps.",icon:e.jsx(ae,{className:"h-4 w-4"}),section:"mcp",field:"serverEnabled"},{key:"training-enabled",label:"Model Training",description:"Fine-tune local LoRA adapters from session history.",icon:e.jsx(se,{className:"h-4 w-4"}),section:"training",field:"enabled"},{key:"teams-enabled",label:"Teams",description:"Multi-user teams with roles, invites, and permissions.",icon:e.jsx(K,{className:"h-4 w-4"}),section:"teams",field:"enabled"},{key:"tunnel-enabled",label:"Cloudflare Tunnel",description:"Expose TITAN securely on the public internet via Cloudflare.",icon:e.jsx(O,{className:"h-4 w-4"}),section:"tunnel",field:"enabled"},{key:"vault-enabled",label:"Vault",description:"Encrypted secret storage for API keys and credentials.",icon:e.jsx(T,{className:"h-4 w-4"}),section:"vault",field:"enabled"},{key:"capsolver-enabled",label:"CAPTCHA Solver",description:"Automatically solve CAPTCHAs during web browsing.",icon:e.jsx(T,{className:"h-4 w-4"}),section:"capsolver",field:"enabled"},{key:"deliberation-autoDetect",label:"Auto-Deliberation",description:"TITAN automatically deliberates on complex tasks before acting.",icon:e.jsx(W,{className:"h-4 w-4"}),section:"deliberation",field:"autoDetect"},{key:"selfImprove-autoApply",label:"Auto-Apply Self-Improvements",description:"Apply prompt and config improvements automatically without approval.",icon:e.jsx(g,{className:"h-4 w-4"}),section:"selfImprove",field:"autoApply"},{key:"memory-vectorSearchEnabled",label:"Vector Memory Search",description:"Semantic search across episodic memories using embeddings.",icon:e.jsx(Q,{className:"h-4 w-4"}),section:"memory",field:"vectorSearchEnabled"}];function oe({className:r}){return e.jsx("svg",{className:r,viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})})}function R({active:r}){return r?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/15 px-2 py-0.5 text-[10px] font-medium text-success",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),"ON"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-bg-tertiary px-2 py-0.5 text-[10px] font-medium text-text-muted",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-border-light"}),"OFF"]})}function de(){const[r,y]=c.useState(null),[$,N]=c.useState(!0),[x,j]=c.useState(!1),[h,m]=c.useState(!1),[u,w]=c.useState(null),[d,k]=c.useState(new Set),[f,A]=c.useState({}),l=c.useCallback((s,t)=>{w({type:s,message:t}),setTimeout(()=>w(null),4e3)},[]);c.useEffect(()=>{B().then(s=>{y(s),N(!1)}).catch(s=>{l("error",s instanceof Error?s.message:"Failed to load config"),N(!1)})},[l]);const p=(s,t)=>{if(t==="serverEnabled"){const a=r==null?void 0:r.mcp,n=a==null?void 0:a.server;return!!(n!=null&&n.enabled)}if(t==="selfInitiate"){const a=r==null?void 0:r.autopilot,n=a==null?void 0:a.goals;return!!(n!=null&&n.selfInitiate)}const o=`${s}.${t}`;if(o in f)return f[o];const i=r==null?void 0:r[s];return i?i[t]:!1},S=(s,t,o)=>{const i=`${s}.${t}`;A(a=>({...a,[i]:o})),k(a=>new Set(a).add(i))},L=v.filter(s=>{const t=p(s.section,s.field);return typeof t=="boolean"?t:t==="autonomous"}).length,z=async()=>{j(!0);try{const s={};for(const o of d){const[i,a]=o.split("."),n=f[o];s[i]||(s[i]={}),a==="serverEnabled"?(s.mcp||(s.mcp={}),s.mcp.server={enabled:n}):a==="selfInitiate"?(s.autopilot||(s.autopilot={}),s.autopilot.goals={selfInitiate:n}):s[i][a]=n}const t=await F(s);y(t),A({}),k(new Set),C("autonomy_settings_saved",{changedCount:d.size}),l("success",`Saved ${d.size} change${d.size!==1?"s":""}`)}catch(s){l("error",s instanceof Error?s.message:"Failed to save")}finally{j(!1)}},_=async()=>{m(!0);try{const s=await b("/api/system/request-restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Settings change via Autonomy Panel",requestedBy:"user"})});if(!s.ok){const n=await s.json().catch(()=>({error:"Request failed"}));l("error",n.error||"Restart request failed"),m(!1);return}const{approval:t}=await s.json(),o=await b(`/api/command-post/approvals/${t.id}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decidedBy:"user",note:"Approved via Autonomy Panel"})});if(!o.ok){const n=await o.json().catch(()=>({error:"Approval failed"}));l("error",n.error||"Restart approval failed"),m(!1);return}l("info","TITAN is restarting..."),C("titan_restart_initiated",{source:"autonomy_panel"});let i=0;const a=setInterval(async()=>{i++;try{(await b("/api/health")).ok&&(clearInterval(a),m(!1),l("success","TITAN restarted successfully"))}catch{}i>30&&(clearInterval(a),m(!1),l("error","Restart timed out — check Titan PC"))},2e3)}catch(s){l("error",s instanceof Error?s.message:"Restart failed"),m(!1)}};return $?e.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((s,t)=>e.jsx("div",{className:"h-32 animate-pulse rounded-xl border border-border bg-bg-secondary"},t))}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-text",children:"Autonomy & Features"}),e.jsxs("p",{className:"mt-0.5 text-xs text-text-muted",children:[L," of ",v.length," features active"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d.size>0&&e.jsxs("span",{className:"rounded-full bg-accent/15 px-2.5 py-1 text-[10px] font-medium text-accent",children:[d.size," unsaved"]}),e.jsxs("button",{onClick:z,disabled:x||d.size===0,className:"flex items-center gap-1.5 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:[x?e.jsx(I,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(G,{className:"h-3.5 w-3.5"}),x?"Saving…":"Save Changes"]})]})]}),u&&e.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-3 py-2 text-xs ${u.type==="success"?"border-success/50 text-success":u.type==="error"?"border-error/50 text-error":"border-accent/50 text-accent"}`,children:[u.type==="success"?e.jsx(X,{className:"h-4 w-4"}):u.type==="error"?e.jsx(q,{className:"h-4 w-4"}):e.jsx(V,{className:"h-4 w-4 animate-spin"}),u.message]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(E,{className:"h-4 w-4 text-accent"}),e.jsx("h3",{className:"text-sm font-medium text-text",children:"Autonomy Level"}),e.jsx(R,{active:p("autonomy","mode")==="autonomous"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:["locked","supervised","autonomous"].map(s=>e.jsxs("button",{onClick:()=>S("autonomy","mode",s),className:`rounded-lg border p-3 text-left transition-all ${p("autonomy","mode")===s?"border-accent bg-accent/10":"border-border hover:border-border-light"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-text capitalize",children:s}),s==="autonomous"&&e.jsx("span",{className:"text-[9px] text-error",children:"High"}),s==="supervised"&&e.jsx("span",{className:"text-[9px] text-warning",children:"Med"}),s==="locked"&&e.jsx("span",{className:"text-[9px] text-success",children:"Low"})]}),e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted leading-relaxed",children:[s==="locked"&&"Asks for approval on every tool call.",s==="supervised"&&"Auto-approves safe tools. Asks for dangerous ops.",s==="autonomous"&&"Full auto. Only asks for destructive/rare ops."]})]},s))})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:v.filter(s=>s.field!=="mode").map(s=>{const t=p(s.section,s.field),o=typeof t=="boolean"?t:!1,i=d.has(`${s.section}.${s.field}`);return e.jsxs("div",{className:`flex items-start gap-3 rounded-xl border p-3 transition-colors ${i?"border-accent/40 bg-accent/5":"border-border bg-bg-secondary"}`,children:[e.jsx("div",{className:`mt-0.5 flex-shrink-0 rounded-lg p-2 ${o?"bg-accent/15 text-accent":"bg-bg-tertiary text-text-muted"}`,children:s.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:s.label}),e.jsx(R,{active:o})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-text-muted leading-relaxed",children:s.description})]}),e.jsxs("label",{className:"flex-shrink-0 relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:a=>S(s.section,s.field,a.target.checked),className:"sr-only peer"}),e.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${o?"bg-accent":"bg-border"}`,children:e.jsx("div",{className:`absolute top-[2px] left-[2px] bg-white w-4 h-4 rounded-full transition-transform ${o?"translate-x-4":"translate-x-0"}`})})]})]},s.key)})}),e.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/5 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(P,{className:"h-4 w-4 text-warning mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"Restart TITAN"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-text-muted",children:"Some feature changes require a full restart to take effect. This will briefly interrupt service."})]}),e.jsxs("button",{onClick:_,disabled:h,className:"flex items-center gap-1.5 rounded-lg border border-warning/50 px-3 py-1.5 text-xs font-medium text-warning transition-colors hover:bg-warning/10 disabled:opacity-50",children:[h?e.jsx(I,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(P,{className:"h-3.5 w-3.5"}),h?"Restarting…":"Restart"]})]})})]})}export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,b as n,j as e}from"./index-
|
|
1
|
+
import{r,b as n,j as e}from"./index-NatBSFxj.js";import{P as c}from"./PageHeader-Cwn3OALc.js";import"./VoiceOverlay-Dn6iaYgd.js";function p(){const[t,s]=r.useState(null),[l,i]=r.useState(!0);return r.useEffect(()=>{n("/api/config",{headers:{"Content-Type":"application/json"}}).then(a=>a.json()).then(a=>{var o,d;return s({mode:((o=a.autonomy)==null?void 0:o.mode)||"supervised",interval:(d=a.autonomy)==null?void 0:d.autopilotIntervalMs})}).catch(()=>s({mode:"supervised"})).finally(()=>i(!1))},[]),l?e.jsx("div",{className:"text-[var(--text-muted)]",children:"Loading autopilot config..."}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(c,{title:"Autopilot",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Agent"},{label:"Autopilot"}]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Mode"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)] capitalize",children:t==null?void 0:t.mode})]}),e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Interval"}),e.jsx("p",{className:"text-lg font-semibold text-[var(--text)]",children:t!=null&&t.interval?`${Math.round(t.interval/6e4)} min`:"Not set"})]})]}),e.jsx("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Autopilot mode enables TITAN to run scheduled tasks automatically. Configure via titan.json."})})]})}export{p as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as q,r as p,b as T,j as e,az as O}from"./index-NatBSFxj.js";import{o as A,R as W,C as B}from"./TitanCanvas-Hk49NFcA.js";import{P as D}from"./play-BPXbHToG.js";import{P as H}from"./pause-DDC_zUiJ.js";import{T as G}from"./trophy-DdRzAOfo.js";import{T as U}from"./trending-up-DrtLViSm.js";import{a as V,C as J}from"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
|
+
* @license lucide-react v0.513.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const X=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Y=q("settings-2",X);function L(t){const x=Date.now()-new Date(t).getTime(),i=Math.floor(x/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function P(t){if(t<60)return`${Math.round(t)}s`;const x=Math.floor(t/60),i=Math.round(t%60);return`${x}m ${i}s`}function K({runs:t}){if(t.length<2)return e.jsx("div",{className:"flex items-center justify-center h-[200px] rounded-xl border border-bg-tertiary bg-bg-secondary text-text-muted text-sm",children:"Need at least 2 runs to show chart"});const x=800,i=200,a={top:20,right:20,bottom:30,left:50},b=x-a.left-a.right,$=i-a.top-a.bottom,N=t.map(r=>r.val_score),y=Math.max(0,Math.min(...N)-5),_=Math.min(100,Math.max(...N)+5),j=t.length>0?t[0].val_score:null,f=r=>a.left+r/(t.length-1)*b,S=r=>a.top+$-(r-y)/(_-y)*$,v=t.map((r,l)=>`${l===0?"M":"L"} ${f(l)} ${S(r.val_score)}`).join(" "),d=j!=null?S(j):null;return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4 overflow-x-auto",children:[e.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Val Score Over Time"}),e.jsxs("svg",{viewBox:`0 0 ${x} ${i}`,className:"w-full",style:{minWidth:400},children:[[0,.25,.5,.75,1].map(r=>{const l=a.top+$*(1-r),R=y+(_-y)*r;return e.jsxs("g",{children:[e.jsx("line",{x1:a.left,y1:l,x2:x-a.right,y2:l,stroke:"#27272a",strokeWidth:"1"}),e.jsx("text",{x:a.left-8,y:l+4,textAnchor:"end",fill:"#52525b",fontSize:"10",children:R.toFixed(0)})]},r)}),j!=null&&j>=y&&j<=_&&d!=null&&e.jsxs("g",{children:[e.jsx("line",{x1:a.left,y1:d,x2:x-a.right,y2:d,stroke:"#eab308",strokeWidth:"1",strokeDasharray:"6,4"}),e.jsx("text",{x:x-a.right+4,y:d+3,fill:"#eab308",fontSize:"9",children:"baseline"})]}),e.jsx("path",{d:v,fill:"none",stroke:"#8b5cf6",strokeWidth:"2"}),t.map((r,l)=>{const R=l>0&&r.val_score>t[l-1].val_score,m=l>0&&r.val_score<t[l-1].val_score?"var(--color-error)":R?"var(--color-success)":"var(--color-purple)";return e.jsx("circle",{cx:f(l),cy:S(r.val_score),r:"4",fill:m,stroke:"#18181b",strokeWidth:"2",children:e.jsxs("title",{children:["Run ",l+1,": ",r.val_score," (",L(r.timestamp),")"]})},l)}),t.map((r,l)=>t.length>10&&l%Math.ceil(t.length/10)!==0&&l!==t.length-1?null:e.jsxs("text",{x:f(l),y:i-5,textAnchor:"middle",fill:"#52525b",fontSize:"9",children:["#",l+1]},l))]})]})}function C({icon:t,label:x,value:i,sub:a,color:b="text-text"}){return e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-text-muted",children:t}),e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wider",children:x})]}),e.jsx("div",{className:`text-2xl font-bold ${b}`,children:i}),a&&e.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function le(){const[t,x]=p.useState([]),[i,a]=p.useState(!0),[b,$]=p.useState(!1),[N,y]=p.useState(null),[_,j]=p.useState(!1),[f,S]=p.useState(!1),v=p.useRef(null),d=p.useCallback((s,h)=>{y({type:s,message:h}),setTimeout(()=>y(null),3e3)},[]),r=p.useCallback(async()=>{try{const s=await T("/api/autoresearch/results");if(s.ok){const h=await s.json();x(h.runs||[])}}catch{}finally{a(!1)}},[]);p.useEffect(()=>{r()},[r]),p.useEffect(()=>(f?v.current&&(clearInterval(v.current),v.current=null):v.current=setInterval(r,3e4),()=>{v.current&&clearInterval(v.current)}),[f,r]);const l=async()=>{j(!0);try{(await T("/api/autoresearch/trigger",{method:"POST"})).ok?d("success","Autoresearch experiment started"):d("error","Failed to trigger experiment")}catch{d("error","Failed to connect to API")}finally{j(!1)}},R=async()=>{try{(await T("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:"Deploy the best autoresearch LoRA adapter to Ollama. Use train_deploy."})})).ok?d("success","Deploying best model to Ollama..."):d("error","Failed to start deployment")}catch{d("error","Connection error")}},w=t.length>0?Math.max(...t.map(s=>s.val_score)):0,m=t.length>0?t[0].val_score:null,k=m!=null&&t.length>0?t.reduce((s,h)=>s+(h.val_score-m),0)/t.length:null,u=t.length>0?t[t.length-1]:null,g=u==null?void 0:u.hyperparams,z=(s,h)=>{const c=[],n=s.hyperparams,o=h.hyperparams;return n.lr!==o.lr&&c.push(`LR: ${o.lr} → ${n.lr}`),n.rank!==o.rank&&c.push(`Rank: ${o.rank} → ${n.rank}`),n.alpha!==o.alpha&&c.push(`Alpha: ${o.alpha} → ${n.alpha}`),n.epochs!==o.epochs&&c.push(`Epochs: ${o.epochs} → ${n.epochs}`),n.batch_size!==o.batch_size&&c.push(`Batch: ${o.batch_size} → ${n.batch_size}`),n.dropout!==o.dropout&&c.push(`Dropout: ${o.dropout} → ${n.dropout}`),n.grad_accum!==o.grad_accum&&c.push(`GradAccum: ${o.grad_accum} → ${n.grad_accum}`),n.max_seq_len!==o.max_seq_len&&c.push(`SeqLen: ${o.max_seq_len} → ${n.max_seq_len}`),c.length>0?c:["No changes"]};return i?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsx("div",{className:"h-20 animate-pulse rounded-xl border border-border bg-bg-secondary"},s))}):e.jsxs("div",{className:"space-y-6 max-w-6xl",children:[N&&e.jsx("div",{className:`fixed top-4 right-4 z-50 rounded-lg px-4 py-2.5 text-sm font-medium shadow-lg ${N.type==="success"?"bg-success/20 text-success border border-success/30":"bg-error/20 text-error border border-error/30"}`,children:N.message}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-xl font-bold text-text flex items-center gap-2",children:[e.jsx(A,{className:"h-5 w-5 text-purple"}),"Autoresearch"]}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:"Autonomous hyper-parameter search and LoRA fine-tuning"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>S(!f),className:"flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary",children:[f?e.jsx(D,{className:"h-3 w-3"}):e.jsx(H,{className:"h-3 w-3"}),f?"Resume":"Pause"]}),e.jsx("button",{onClick:r,className:"flex items-center gap-1 rounded-lg border border-bg-tertiary px-2.5 py-1.5 text-xs text-text-secondary hover:bg-bg-tertiary",children:e.jsx(W,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(C,{icon:e.jsx(A,{className:"h-4 w-4"}),label:"Total Runs",value:t.length}),e.jsx(C,{icon:e.jsx(G,{className:"h-4 w-4"}),label:"Best Val Score",value:w>0?w.toFixed(1):"—",sub:m!=null&&w>m?`+${(w-m).toFixed(1)} from baseline`:void 0,color:m!=null&&w>m?"text-success":"text-text"}),e.jsx(C,{icon:e.jsx(U,{className:"h-4 w-4"}),label:"Avg Improvement",value:k!=null?`${k>=0?"+":""}${k.toFixed(1)}`:"—",color:k!=null?k>0?"text-success":k<0?"text-error":"text-text":"text-text"}),e.jsx(C,{icon:e.jsx(B,{className:"h-4 w-4"}),label:"Last Run",value:u?L(u.timestamp):"Never",sub:u?`Score: ${u.val_score}`:void 0})]}),e.jsx(K,{runs:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:l,disabled:_,className:"flex items-center gap-2 rounded-lg bg-purple px-4 py-2 text-sm font-medium text-white hover:bg-[#7c3aed] disabled:opacity-50",children:[e.jsx(D,{className:"h-4 w-4"}),_?"Starting...":"Run Experiment"]}),e.jsxs("button",{onClick:R,disabled:t.length===0,className:"flex items-center gap-2 rounded-lg border border-bg-tertiary px-4 py-2 text-sm font-medium text-text-secondary hover:bg-bg-tertiary disabled:opacity-50",children:[e.jsx(O,{className:"h-4 w-4"}),"Deploy Best Model"]}),u&&e.jsxs("span",{className:"text-xs text-text-muted",children:[u.num_examples," training examples · ",P(u.training_time_s)]})]}),t.length>0&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-bg-tertiary",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:"What Made TITAN Better"}),e.jsx("p",{className:"text-[10px] text-text-muted",children:"Experiment history — how each change affected val_score"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-bg-tertiary",children:[e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"#"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted",children:"Changes"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Score"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Δ"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Duration"}),e.jsx("th",{className:"px-4 py-2 text-[10px] font-medium text-text-muted text-right",children:"Examples"})]})}),e.jsx("tbody",{children:[...t].reverse().map((s,h)=>{const c=t.length-1-h,n=c>0?t[c-1]:null,o=n?s.val_score-n.val_score:m!=null?s.val_score-m:0,F=n?z(s,n):["Initial run"],M=new Date(s.timestamp);return e.jsxs("tr",{className:"border-b border-bg-tertiary last:border-0 hover:bg-[#27272a30]",children:[e.jsx("td",{className:"px-4 py-2 text-text-muted font-mono",children:c+1}),e.jsxs("td",{className:"px-4 py-2 text-text-secondary",children:[M.toLocaleDateString()," ",M.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}),e.jsx("td",{className:"px-4 py-2 text-text-secondary",children:F.map((E,I)=>e.jsx("span",{className:"inline-block mr-1.5 rounded bg-bg-tertiary px-1.5 py-0.5 text-[10px] font-mono",children:E},I))}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-text font-medium",children:s.val_score.toFixed(1)}),e.jsx("td",{className:"px-4 py-2 text-right font-mono",children:e.jsxs("span",{className:o>0?"text-success":o<0?"text-error":"text-text-muted",children:[o>0?"+":"",o.toFixed(1)]})}),e.jsx("td",{className:"px-4 py-2 text-right text-text-muted",children:P(s.training_time_s)}),e.jsx("td",{className:"px-4 py-2 text-right text-text-muted",children:s.num_examples})]},c)})})]})})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>$(!b),className:"flex w-full items-center gap-2 text-xs font-medium text-text-secondary uppercase tracking-wider hover:text-text",children:[b?e.jsx(V,{className:"h-3.5 w-3.5"}):e.jsx(J,{className:"h-3.5 w-3.5"}),e.jsx(Y,{className:"h-3.5 w-3.5"}),"Current Hyperparameters"]}),b&&g&&e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4",children:[{label:"Learning Rate",value:g.lr},{label:"LoRA Rank",value:g.rank},{label:"LoRA Alpha",value:g.alpha},{label:"Dropout",value:g.dropout},{label:"Epochs",value:g.epochs},{label:"Batch Size",value:g.batch_size},{label:"Grad Accum",value:g.grad_accum},{label:"Max Seq Len",value:g.max_seq_len}].map(({label:s,value:h})=>e.jsxs("div",{className:"rounded-lg border border-bg-tertiary bg-bg-secondary px-3 py-2",children:[e.jsx("div",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:s}),e.jsx("div",{className:"text-sm font-mono text-text mt-0.5",children:h})]},s))}),b&&!g&&e.jsx("div",{className:"mt-3 rounded-lg border border-bg-tertiary bg-bg-secondary px-4 py-3 text-xs text-text-muted",children:"No runs yet — hyperparameters will appear after the first experiment"})]}),t.length===0&&e.jsxs("div",{className:"rounded-xl border border-bg-tertiary bg-bg-secondary p-8 text-center",children:[e.jsx(A,{className:"h-8 w-8 text-text-muted mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-text-secondary",children:"No autoresearch runs yet"}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:'Click "Run Experiment" to start fine-tuning qwen3.5:35b on the RTX 5090'})]})]})}export{le as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,aH as p,j as e,aI as u,aJ as h}from"./index-NatBSFxj.js";import{P as g}from"./PageHeader-Cwn3OALc.js";import{P as b,R as y,A as j}from"./TitanCanvas-Hk49NFcA.js";import{C as v}from"./circle-check-big-WaW3U3Xl.js";import"./VoiceOverlay-Dn6iaYgd.js";function S(){const[i,x]=s.useState([]),[c,r]=s.useState(!0),[l,n]=s.useState(!1),[d,o]=s.useState(null),t=s.useCallback(async()=>{r(!0);try{const a=await p();x(a.backups||[])}catch{}r(!1)},[]);s.useEffect(()=>{t()},[t]);const m=async()=>{n(!0);try{await u(),await t()}catch{}n(!1)},f=async a=>{o(a);try{await h(a),alert("Backup verified successfully")}catch{alert("Backup verification failed")}o(null)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{title:"Backup Manager",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"System"},{label:"Backups"}]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:m,disabled:l,className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(b,{className:"w-4 h-4"})," ",l?"Creating...":"Create Backup"]}),e.jsxs("button",{onClick:t,disabled:c,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(y,{className:`w-4 h-4 ${c?"animate-spin":""}`})," Refresh"]})]}),i.length===0&&!c&&e.jsx("div",{className:"text-sm text-[#52525b]",children:"No backups found."}),e.jsx("div",{className:"space-y-2",children:i.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(j,{className:"w-4 h-4 text-[#6366f1]"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-[#e4e4e7]",children:new Date(a.createdAt).toLocaleString()}),e.jsxs("div",{className:"text-xs text-[#52525b]",children:[(a.sizeBytes/1024/1024).toFixed(1)," MB"]})]})]}),e.jsxs("button",{onClick:()=>f(a.path),disabled:d===a.path,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] text-xs hover:bg-[#3f3f46] disabled:opacity-50",children:[e.jsx(v,{className:"w-3.5 h-3.5"})," ",d===a.path?"Verifying...":"Verify"]})]},a.path))})]})}export{S as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as i,r as s,j as e,G as m,a$ as p}from"./index-NatBSFxj.js";import{P as h}from"./PageHeader-Cwn3OALc.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
|
+
* @license lucide-react v0.513.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const x=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],u=i("wand-sparkles",x);function v(){const[t,n]=s.useState(""),[r,o]=s.useState(""),[l,d]=s.useState(!1),c=async()=>{if(t.trim()){d(!0);try{const a=await p(t);o(a.token||a.error||"No result")}catch(a){o(String(a))}d(!1)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{title:"Browser Tools",breadcrumbs:[{label:"Admin",href:"/overview"},{label:"Tools"},{label:"Browser"}]}),e.jsxs("div",{className:"p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(m,{className:"w-4 h-4 text-[#6366f1]"}),e.jsx("span",{className:"text-sm font-medium text-[#e4e4e7]",children:"Captcha Solver"})]}),e.jsx("textarea",{value:t,onChange:a=>n(a.target.value),placeholder:"Paste base64 image...",className:"w-full h-24 p-2 rounded-md bg-[#27272a] border border-[#3f3f46] text-xs text-[#e4e4e7] placeholder-[#52525b] font-mono resize-none"}),e.jsxs("button",{onClick:c,disabled:l,className:"mt-2 flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50",children:[e.jsx(u,{className:"w-4 h-4"})," ",l?"Solving...":"Solve Captcha"]}),r&&e.jsx("div",{className:"mt-2 p-2 rounded-md bg-[#27272a] text-xs text-[#e4e4e7] font-mono break-all",children:r})]})]})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,
|
|
1
|
+
import{r,bb as m,j as e,aA as p,X as u,b as h}from"./index-NatBSFxj.js";import"./Input-bFsLI0fq.js";import{S as j}from"./StatusBadge-CGvKbP7R.js";import{P as f}from"./PageHeader-Cwn3OALc.js";import{E as g}from"./EmptyState-DFrAEZDm.js";import{S as b}from"./SkeletonLoader-CsiR8ED9.js";import{U as N}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.js";function y(a){const s=Math.floor((Date.now()-new Date(a).getTime())/1e3);return s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}function v(a){const s=a.split("/");return s[s.length-1]}function D(){const[a,s]=r.useState([]),[c,d]=r.useState(!0),[o,l]=r.useState(null),i=r.useCallback(async()=>{try{const t=await m();s(t),l(null)}catch(t){l(t instanceof Error?t.message:"Failed to load agents")}d(!1)},[]);r.useEffect(()=>{i()},[i]);const x=async(t,n)=>{n.preventDefault(),n.stopPropagation();try{await h(`/api/command-post/agents/${t}`,{method:"DELETE"}),await i()}catch{}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(f,{title:"Agents",breadcrumbs:[{label:"Command Post"},{label:"Agents"}]}),c&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.jsx(b,{variant:"card",count:6})}),o&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:o}),!c&&!o&&a.length===0&&e.jsx(g,{icon:e.jsx(N,{size:32}),title:"No agents registered",description:"Agents will appear here once they connect to Command Post."}),!c&&!o&&a.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:a.map(t=>e.jsxs(p,{to:`/command-post/agents/${t.id}`,className:"relative bg-bg-secondary border border-border rounded-xl p-4 hover:border-border-light transition-colors group",children:[t.role!=="ceo"&&e.jsx("button",{onClick:n=>x(t.id,n),className:"absolute top-3 right-3 p-1 rounded-md text-text-muted hover:text-error hover:bg-error/10 opacity-0 group-hover:opacity-100 transition-all",title:"Remove agent",children:e.jsx(u,{size:14})}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:t.name}),e.jsx(j,{status:t.status,size:"sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Role"}),e.jsx("span",{className:"text-xs text-text-secondary capitalize",children:t.role})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Model"}),e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[140px]",children:v(t.model)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Last Heartbeat"}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[y(t.lastHeartbeat)," ago"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Tasks Done"}),e.jsx("span",{className:"text-xs text-text-secondary",children:t.totalTasksCompleted})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-muted uppercase",children:"Cost"}),e.jsxs("span",{className:"text-xs text-text-secondary",children:["$",t.totalCostUsd.toFixed(4)]})]})]})]},t.id))})]})}export{D as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as se,r as g,j as t,q as le,
|
|
1
|
+
import{c as se,r as g,j as t,q as le,bo as ae,bc as re,ba as oe,A as _,aA as q}from"./index-NatBSFxj.js";import"./Input-bFsLI0fq.js";import{S as ie}from"./StatusBadge-CGvKbP7R.js";import{P as G}from"./PageHeader-Cwn3OALc.js";import{S as ne}from"./SkeletonLoader-CsiR8ED9.js";import{R as ce,U as de}from"./TitanCanvas-Hk49NFcA.js";import{D as xe}from"./dollar-sign-D2Oce4Ru.js";import{T as me}from"./target-BrtxUtzl.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const he=[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],V=se("list-todo",he),J={idle:"var(--color-text-secondary)",active:"var(--color-success)",paused:"var(--color-warning)",error:"var(--color-error)",stopped:"var(--color-border-light)"},fe={ceo:"C",manager:"M",engineer:"E",researcher:"R",general:"G"};function ge({agents:c,activity:d}){const u=g.useRef(null),M=g.useRef(c),p=g.useRef(d);return M.current=c,p.current=d,g.useEffect(()=>{const b=u.current;if(!b)return;const e=b.getContext("2d");if(!e)return;const w=window.devicePixelRatio||1;let C,z=0;const y=()=>{const o=b.clientWidth,x=b.clientHeight;b.width=o*w,b.height=x*w,e.setTransform(w,0,0,w,0,0)};y(),window.addEventListener("resize",y);const R=()=>{z++;const o=z/15,x=b.clientWidth,m=b.clientHeight,a=M.current,j=p.current;e.fillStyle="var(--color-bg)",e.fillRect(0,0,x,m),e.strokeStyle="#141418",e.lineWidth=.5;for(let s=0;s<x;s+=24)e.beginPath(),e.moveTo(s,m*.72),e.lineTo(s,m),e.stroke();for(let s=m*.72;s<m;s+=24)e.beginPath(),e.moveTo(0,s),e.lineTo(x,s),e.stroke();if(a.length===0){e.fillStyle="var(--color-bg-tertiary)",e.font="12px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("No agents registered",x/2,m/2-10),e.font="10px -apple-system, BlinkMacSystemFont, sans-serif",e.fillStyle="var(--color-border)",e.fillText("Spawn agents to see them here",x/2,m/2+10),e.textAlign="start",C=requestAnimationFrame(R);return}const I=Math.min(a.length,8),k=Math.min(120,(x-20)/I),Q=(x-k*I)/2+k/2;for(let s=0;s<I;s++){const A=a[s],l=Q+s*k,r=m*.55,h=A.status==="active"?"active":A.status,L=J[h]||J.idle,i=Math.sin(o*.8+s*1.5)*1.5,$=j.some(n=>n.agentId===A.id&&Date.now()-new Date(n.timestamp).getTime()<3e4),D=Math.min(70,k-10),P=10,B=l-D/2,S=r+16;e.fillStyle="var(--color-border)",e.fillRect(B,S,D,P),e.fillStyle="var(--color-border-light)",e.fillRect(B+1,S+1,D-2,P-2),e.fillStyle="var(--color-border)",e.fillRect(B+3,S+P,3,14),e.fillRect(B+D-6,S+P,3,14);const F=26,O=18,W=l-F/2,H=S-O;e.fillStyle="var(--color-bg-tertiary)",e.fillRect(W,H,F,O);const U=h==="error"?"var(--color-error)":h==="active"?"var(--color-success)":"var(--color-accent)";if(e.fillStyle=U+"30",e.fillRect(W+2,H+2,F-4,O-4),h==="active"||$){e.fillStyle=U+"60";const n=2+Math.floor(o%3);for(let f=0;f<n;f++){const T=6+Math.sin(o*2+f+s)*5;e.fillRect(W+3,H+3+f*4,T,1.5)}}e.fillStyle="var(--color-border)",e.fillRect(l-2,S-1,4,3),e.fillStyle="#1e1e22",e.fillRect(l-10,r+10+i,20,8),e.fillRect(l-11,r-2+i,3,20),e.fillStyle="var(--color-border)",e.fillRect(l-7,r+i,14,12);const v=h==="active"&&$?Math.sin(o*1.5+s)*1.5:0;e.fillStyle="var(--color-border-light)",e.fillRect(l-6,r-10+i+v,12,10);const X=Math.sin(o*.3+s*2)>.95?1:2;if(e.fillStyle=L,h==="stopped"?(e.fillRect(l-4,r-7+i+v,2,1),e.fillRect(l-3,r-6+i+v,2,1),e.fillRect(l+1,r-7+i+v,2,1),e.fillRect(l+2,r-6+i+v,2,1)):(e.fillRect(l-4,r-7+i+v,2,X),e.fillRect(l+2,r-7+i+v,2,X)),e.fillStyle="var(--color-border-light)",e.fillRect(l-1,r-14+i+v,2,4),e.fillStyle=L,e.beginPath(),e.arc(l,r-15+i+v,2,0,Math.PI*2),e.fill(),h==="active"&&(e.globalAlpha=.3+Math.sin(o*3+s)*.2,e.beginPath(),e.arc(l,r-15+i+v,5,0,Math.PI*2),e.fill(),e.globalAlpha=1),h==="active"&&$){const n=Math.sin(o*6+s)*2,f=Math.sin(o*6+s+Math.PI)*2;e.fillStyle="var(--color-border)",e.fillRect(l-11,r+3+i+n,4,3),e.fillRect(l+7,r+3+i+f,4,3)}else e.fillStyle="var(--color-border)",e.fillRect(l-10,r+5+i,3,6),e.fillRect(l+7,r+5+i,3,6);if(h==="active"&&$){for(let n=0;n<2;n++){const f=o*1.5+n*Math.PI+s,T=14+Math.sin(o+n)*4,ee=l+Math.cos(f)*T,te=r-3+Math.sin(f)*T*.4+i;e.globalAlpha=.25+Math.sin(o*2+n)*.15,e.fillStyle=L,e.beginPath(),e.arc(ee,te,1,0,Math.PI*2),e.fill()}e.globalAlpha=1}if(h==="error"){for(let n=0;n<3;n++){const f=l+Math.sin(o*4+n*2)*12,T=r-5+Math.cos(o*3+n)*8+i;e.globalAlpha=.4+Math.sin(o+n)*.3,e.fillStyle="var(--color-error)",e.fillRect(f-1,T-1,2,2)}e.globalAlpha=1}e.fillStyle=h==="stopped"?"var(--color-border)":"var(--color-text-muted)",e.font="9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center";const Y=Math.max(44,D+14);let N=A.name;if(e.measureText(N).width>Y){for(;N.length>1&&e.measureText(N+"…").width>Y;)N=N.slice(0,-1);N=N.trimEnd()+"…"}e.fillText(N,l,S+P+24);const Z=fe[A.role]||"G";e.fillStyle=L+"60",e.font="bold 7px -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(Z,l,S+P+33),e.textAlign="start"}if(e.fillStyle="var(--color-bg-tertiary)",e.font="bold 9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("COMMAND POST",x/2,m-6),e.textAlign="start",j.length>0){const s=j[j.length-1];if(Date.now()-new Date(s.timestamp).getTime()<6e4){e.fillStyle="var(--color-accent)40",e.fillRect(0,0,x,16),e.fillStyle="var(--color-accent-light)",e.font="8px -apple-system, BlinkMacSystemFont, sans-serif";const l=s.message.length>60?s.message.slice(0,57)+"...":s.message;e.textAlign="center",e.fillText(l,x/2,11),e.textAlign="start"}}C=requestAnimationFrame(R)};return R(),()=>{cancelAnimationFrame(C),window.removeEventListener("resize",y)}},[]),t.jsx("canvas",{ref:u,className:"w-full rounded-xl border border-border",style:{height:220,imageRendering:"pixelated"}})}function K(c){const d=Math.floor((Date.now()-new Date(c).getTime())/1e3);return d<60?`${d}s`:d<3600?`${Math.floor(d/60)}m`:d<86400?`${Math.floor(d/3600)}h`:`${Math.floor(d/86400)}d`}function E({icon:c,label:d,value:u,sub:M,color:p}){return t.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(c,{size:14,className:p}),t.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:d})]}),t.jsx("div",{className:"text-2xl font-bold text-text",children:u}),M&&t.jsx("div",{className:"text-[11px] text-text-muted mt-1",children:M})]})}function we(){var m;const[c,d]=g.useState(null),[u,M]=g.useState([]),[p,b]=g.useState([]),[e,w]=g.useState(0),[C,z]=g.useState(!0),y=g.useCallback(async()=>{try{const[a,j,I,k]=await Promise.all([le(),ae(20),re(),ie("pending")]);d(a),M(j),b(I),w(k.length)}catch{}z(!1)},[]);if(g.useEffect(()=>{y();const a=setInterval(y,15e3);return()=>clearInterval(a)},[y]),C)return t.jsxs("div",{className:"space-y-6",children:[t.jsx(G,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.jsx(ne,{variant:"metric",count:4})})]});if(!c)return t.jsx("div",{className:"text-center py-12 text-text-muted",children:"Failed to load dashboard"});const R=c.budgetUtilization??0,o=p.filter(a=>a.status==="in_progress").length,x=p.filter(a=>a.status==="blocked").length;return t.jsxs("div",{className:"space-y-6",children:[t.jsx(G,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}],actions:t.jsx("button",{onClick:y,className:"p-1.5 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:t.jsx(ce,{size:16})})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[t.jsx(E,{icon:de,label:"Agents Enabled",value:c.totalAgents,sub:`${c.activeAgents} running, ${Math.max(0,c.totalAgents-c.activeAgents)} paused`,color:"text-info"}),t.jsx(E,{icon:V,label:"Tasks In Progress",value:o,sub:`${p.length} open, ${x} blocked`,color:"text-warning"}),t.jsx(E,{icon:xe,label:"Budget Used",value:`${Math.round(R)}%`,sub:R>=80?"Nearing limit":"Healthy",color:R>=80?"text-error":"text-success"}),t.jsx(E,{icon:me,label:"Goals",value:((m=c.goalTree)==null?void 0:m.length)??0,sub:"in hierarchy",color:"text-purple"})]}),c.agents.length>0&&t.jsx(ge,{agents:c.agents,activity:u}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Activity"})]}),t.jsx(q,{to:"/command-post/activity",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:u.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No activity yet"}):[...u].reverse().slice(0,15).map((a,j)=>t.jsxs("div",{className:"flex items-start gap-2 px-4 py-2",children:[t.jsx(_,{size:12,className:"text-text-muted mt-0.5 flex-shrink-0"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1",children:a.message}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:K(a.timestamp)})]},`${a.timestamp}-${j}`))})]}),t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(V,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Issues"})]}),t.jsx(q,{to:"/command-post/issues",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:p.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No issues yet"}):p.slice(0,10).map(a=>t.jsxs(q,{to:`/command-post/issues/${a.id}`,className:"flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors",children:[t.jsx(oe,{status:a.status,variant:"dot",size:"sm"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1 truncate",children:a.title}),a.assigneeAgentId&&t.jsx("span",{className:"text-[10px] text-text-muted",children:a.assigneeAgentId}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:K(a.updatedAt)})]},a.id))})]})]})]})}export{we as default};
|
|
6
|
+
*/const he=[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],V=se("list-todo",he),J={idle:"var(--color-text-secondary)",active:"var(--color-success)",paused:"var(--color-warning)",error:"var(--color-error)",stopped:"var(--color-border-light)"},fe={ceo:"C",manager:"M",engineer:"E",researcher:"R",general:"G"};function ge({agents:c,activity:d}){const u=g.useRef(null),M=g.useRef(c),p=g.useRef(d);return M.current=c,p.current=d,g.useEffect(()=>{const b=u.current;if(!b)return;const e=b.getContext("2d");if(!e)return;const w=window.devicePixelRatio||1;let C,L=0;const y=()=>{const i=b.clientWidth,x=b.clientHeight;b.width=i*w,b.height=x*w,e.setTransform(w,0,0,w,0,0)};y(),window.addEventListener("resize",y);const R=()=>{L++;const i=L/15,x=b.clientWidth,m=b.clientHeight,a=M.current,j=p.current;e.fillStyle="var(--color-bg)",e.fillRect(0,0,x,m),e.strokeStyle="#141418",e.lineWidth=.5;for(let s=0;s<x;s+=24)e.beginPath(),e.moveTo(s,m*.72),e.lineTo(s,m),e.stroke();for(let s=m*.72;s<m;s+=24)e.beginPath(),e.moveTo(0,s),e.lineTo(x,s),e.stroke();if(a.length===0){e.fillStyle="var(--color-bg-tertiary)",e.font="12px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("No agents registered",x/2,m/2-10),e.font="10px -apple-system, BlinkMacSystemFont, sans-serif",e.fillStyle="var(--color-border)",e.fillText("Spawn agents to see them here",x/2,m/2+10),e.textAlign="start",C=requestAnimationFrame(R);return}const I=Math.min(a.length,8),k=Math.min(120,(x-20)/I),Q=(x-k*I)/2+k/2;for(let s=0;s<I;s++){const A=a[s],l=Q+s*k,r=m*.55,h=A.status==="active"?"active":A.status,$=J[h]||J.idle,o=Math.sin(i*.8+s*1.5)*1.5,z=j.some(n=>n.agentId===A.id&&Date.now()-new Date(n.timestamp).getTime()<3e4),D=Math.min(70,k-10),P=10,E=l-D/2,S=r+16;e.fillStyle="var(--color-border)",e.fillRect(E,S,D,P),e.fillStyle="var(--color-border-light)",e.fillRect(E+1,S+1,D-2,P-2),e.fillStyle="var(--color-border)",e.fillRect(E+3,S+P,3,14),e.fillRect(E+D-6,S+P,3,14);const B=26,W=18,H=l-B/2,O=S-W;e.fillStyle="var(--color-bg-tertiary)",e.fillRect(H,O,B,W);const U=h==="error"?"var(--color-error)":h==="active"?"var(--color-success)":"var(--color-accent)";if(e.fillStyle=U+"30",e.fillRect(H+2,O+2,B-4,W-4),h==="active"||z){e.fillStyle=U+"60";const n=2+Math.floor(i%3);for(let f=0;f<n;f++){const T=6+Math.sin(i*2+f+s)*5;e.fillRect(H+3,O+3+f*4,T,1.5)}}e.fillStyle="var(--color-border)",e.fillRect(l-2,S-1,4,3),e.fillStyle="#1e1e22",e.fillRect(l-10,r+10+o,20,8),e.fillRect(l-11,r-2+o,3,20),e.fillStyle="var(--color-border)",e.fillRect(l-7,r+o,14,12);const v=h==="active"&&z?Math.sin(i*1.5+s)*1.5:0;e.fillStyle="var(--color-border-light)",e.fillRect(l-6,r-10+o+v,12,10);const X=Math.sin(i*.3+s*2)>.95?1:2;if(e.fillStyle=$,h==="stopped"?(e.fillRect(l-4,r-7+o+v,2,1),e.fillRect(l-3,r-6+o+v,2,1),e.fillRect(l+1,r-7+o+v,2,1),e.fillRect(l+2,r-6+o+v,2,1)):(e.fillRect(l-4,r-7+o+v,2,X),e.fillRect(l+2,r-7+o+v,2,X)),e.fillStyle="var(--color-border-light)",e.fillRect(l-1,r-14+o+v,2,4),e.fillStyle=$,e.beginPath(),e.arc(l,r-15+o+v,2,0,Math.PI*2),e.fill(),h==="active"&&(e.globalAlpha=.3+Math.sin(i*3+s)*.2,e.beginPath(),e.arc(l,r-15+o+v,5,0,Math.PI*2),e.fill(),e.globalAlpha=1),h==="active"&&z){const n=Math.sin(i*6+s)*2,f=Math.sin(i*6+s+Math.PI)*2;e.fillStyle="var(--color-border)",e.fillRect(l-11,r+3+o+n,4,3),e.fillRect(l+7,r+3+o+f,4,3)}else e.fillStyle="var(--color-border)",e.fillRect(l-10,r+5+o,3,6),e.fillRect(l+7,r+5+o,3,6);if(h==="active"&&z){for(let n=0;n<2;n++){const f=i*1.5+n*Math.PI+s,T=14+Math.sin(i+n)*4,ee=l+Math.cos(f)*T,te=r-3+Math.sin(f)*T*.4+o;e.globalAlpha=.25+Math.sin(i*2+n)*.15,e.fillStyle=$,e.beginPath(),e.arc(ee,te,1,0,Math.PI*2),e.fill()}e.globalAlpha=1}if(h==="error"){for(let n=0;n<3;n++){const f=l+Math.sin(i*4+n*2)*12,T=r-5+Math.cos(i*3+n)*8+o;e.globalAlpha=.4+Math.sin(i+n)*.3,e.fillStyle="var(--color-error)",e.fillRect(f-1,T-1,2,2)}e.globalAlpha=1}e.fillStyle=h==="stopped"?"var(--color-border)":"var(--color-text-muted)",e.font="9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center";const Y=Math.max(44,D+14);let N=A.name;if(e.measureText(N).width>Y){for(;N.length>1&&e.measureText(N+"…").width>Y;)N=N.slice(0,-1);N=N.trimEnd()+"…"}e.fillText(N,l,S+P+24);const Z=fe[A.role]||"G";e.fillStyle=$+"60",e.font="bold 7px -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(Z,l,S+P+33),e.textAlign="start"}if(e.fillStyle="var(--color-bg-tertiary)",e.font="bold 9px -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.fillText("COMMAND POST",x/2,m-6),e.textAlign="start",j.length>0){const s=j[j.length-1];if(Date.now()-new Date(s.timestamp).getTime()<6e4){e.fillStyle="var(--color-accent)40",e.fillRect(0,0,x,16),e.fillStyle="var(--color-accent-light)",e.font="8px -apple-system, BlinkMacSystemFont, sans-serif";const l=s.message.length>60?s.message.slice(0,57)+"...":s.message;e.textAlign="center",e.fillText(l,x/2,11),e.textAlign="start"}}C=requestAnimationFrame(R)};return R(),()=>{cancelAnimationFrame(C),window.removeEventListener("resize",y)}},[]),t.jsx("canvas",{ref:u,className:"w-full rounded-xl border border-border",style:{height:220,imageRendering:"pixelated"}})}function K(c){const d=Math.floor((Date.now()-new Date(c).getTime())/1e3);return d<60?`${d}s`:d<3600?`${Math.floor(d/60)}m`:d<86400?`${Math.floor(d/3600)}h`:`${Math.floor(d/86400)}d`}function F({icon:c,label:d,value:u,sub:M,color:p}){return t.jsxs("div",{className:"bg-bg-tertiary/50 border border-border rounded-xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(c,{size:14,className:p}),t.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:d})]}),t.jsx("div",{className:"text-2xl font-bold text-text",children:u}),M&&t.jsx("div",{className:"text-[11px] text-text-muted mt-1",children:M})]})}function we(){var m;const[c,d]=g.useState(null),[u,M]=g.useState([]),[p,b]=g.useState([]),[e,w]=g.useState(0),[C,L]=g.useState(!0),y=g.useCallback(async()=>{try{const[a,j,I,k]=await Promise.all([le(),ae(20),re(),oe("pending")]);d(a),M(j),b(I),w(k.length)}catch{}L(!1)},[]);if(g.useEffect(()=>{y();const a=setInterval(y,15e3);return()=>clearInterval(a)},[y]),C)return t.jsxs("div",{className:"space-y-6",children:[t.jsx(G,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.jsx(ne,{variant:"metric",count:4})})]});if(!c)return t.jsx("div",{className:"text-center py-12 text-text-muted",children:"Failed to load dashboard"});const R=c.budgetUtilization??0,i=p.filter(a=>a.status==="in_progress").length,x=p.filter(a=>a.status==="blocked").length;return t.jsxs("div",{className:"space-y-6",children:[t.jsx(G,{title:"Dashboard",breadcrumbs:[{label:"Command Post"},{label:"Dashboard"}],actions:t.jsx("button",{onClick:y,className:"p-1.5 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:t.jsx(ce,{size:16})})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[t.jsx(F,{icon:de,label:"Agents Enabled",value:c.totalAgents,sub:`${c.activeAgents} running, ${Math.max(0,c.totalAgents-c.activeAgents)} paused`,color:"text-info"}),t.jsx(F,{icon:V,label:"Tasks In Progress",value:i,sub:`${p.length} open, ${x} blocked`,color:"text-warning"}),t.jsx(F,{icon:xe,label:"Budget Used",value:`${Math.round(R)}%`,sub:R>=80?"Nearing limit":"Healthy",color:R>=80?"text-error":"text-success"}),t.jsx(F,{icon:me,label:"Goals",value:((m=c.goalTree)==null?void 0:m.length)??0,sub:"in hierarchy",color:"text-purple"})]}),c.agents.length>0&&t.jsx(ge,{agents:c.agents,activity:u}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Activity"})]}),t.jsx(q,{to:"/command-post/activity",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:u.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No activity yet"}):[...u].reverse().slice(0,15).map((a,j)=>t.jsxs("div",{className:"flex items-start gap-2 px-4 py-2",children:[t.jsx(_,{size:12,className:"text-text-muted mt-0.5 flex-shrink-0"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1",children:a.message}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:K(a.timestamp)})]},`${a.timestamp}-${j}`))})]}),t.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(V,{size:14,className:"text-accent"}),t.jsx("h3",{className:"text-sm font-semibold text-text",children:"Recent Issues"})]}),t.jsx(q,{to:"/command-post/issues",className:"text-[10px] text-accent hover:text-accent-hover",children:"View all"})]}),t.jsx("div",{className:"max-h-72 overflow-y-auto divide-y divide-border",children:p.length===0?t.jsx("div",{className:"py-8 text-center text-xs text-text-muted",children:"No issues yet"}):p.slice(0,10).map(a=>t.jsxs(q,{to:`/command-post/issues/${a.id}`,className:"flex items-center gap-2 px-4 py-2 hover:bg-bg-tertiary transition-colors",children:[t.jsx(ie,{status:a.status,variant:"dot",size:"sm"}),t.jsx("span",{className:"text-[11px] text-text-secondary flex-1 truncate",children:a.title}),a.assigneeAgentId&&t.jsx("span",{className:"text-[10px] text-text-muted",children:a.assigneeAgentId}),t.jsx("span",{className:"text-[10px] text-text-muted flex-shrink-0",children:K(a.updatedAt)})]},a.id))})]})]})]})}export{we as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,j as e,b as f,X as j}from"./index-NatBSFxj.js";import{s as N,o as y,a as v,R as p,F as w}from"./TitanCanvas-Hk49NFcA.js";import"./VoiceOverlay-Dn6iaYgd.js";async function h(t){const a=await f(t);if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()}function b(t){return t===void 0?"—":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}K`:`${(t/1024/1024).toFixed(1)}M`}function g(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function k({path:t,onClose:a}){const[r,c]=i.useState(null);return i.useEffect(()=>{c(null),h(`/api/files/content?path=${encodeURIComponent(t)}`).then(l=>c(l)).catch(l=>c({error:String(l)}))},[t]),e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",onClick:a,children:e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl w-full max-w-5xl max-h-[90vh] flex flex-col shadow-2xl",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text truncate",children:t}),r&&"sizeBytes"in r&&e.jsxs("div",{className:"text-xs text-text-muted",children:[b(r.sizeBytes)," · ",r.encoding,r.truncated?" · truncated at 1MB":""]})]}),e.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted",title:"Close",children:e.jsx(j,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r===null&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),r&&"error"in r&&e.jsx("div",{className:"text-error text-sm py-8 text-center",children:r.error}),r&&"content"in r&&e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:r.content})]})]})})}function C(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(""),[o,n]=i.useState(null),d=i.useCallback(async()=>{c(!0);try{const s=await h("/api/files/edited?limit=300");a(s.files||[])}catch{}c(!1)},[]);i.useEffect(()=>{d()},[d]);const x=l?t.filter(s=>s.path.toLowerCase().includes(l.toLowerCase())):t;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-bg-secondary",children:[e.jsx(v,{size:14,className:"text-text-muted"}),e.jsx("input",{type:"text",placeholder:"Filter by path…",value:l,onChange:s=>m(s.target.value),className:"flex-1 bg-transparent text-sm outline-none"})]}),e.jsxs("button",{onClick:d,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",title:"Refresh",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[x.length," / ",t.length]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&x.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:l?"No files match filter":"No file edits recorded yet"}),x.length>0&&e.jsx("div",{className:"divide-y divide-border rounded-xl border border-border bg-bg-secondary overflow-hidden",children:x.map(s=>e.jsxs("button",{onClick:()=>s.readable&&s.exists&&n(s.path),disabled:!s.readable||!s.exists,className:"w-full flex items-start gap-3 px-4 py-2.5 text-left hover:bg-bg-tertiary transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(w,{size:14,className:s.isSelfMod?"text-accent mt-0.5 flex-shrink-0":"text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-mono text-text truncate",children:s.path}),e.jsxs("div",{className:"text-xs text-text-muted mt-0.5 flex items-center gap-2 flex-wrap",children:[s.isSelfMod&&e.jsx("span",{className:"px-1 rounded bg-accent/15 text-accent text-[10px]",children:"self-mod"}),e.jsxs("span",{children:["×",s.writeCount]}),s.tools.length>0&&e.jsx("span",{children:s.tools.join("+")}),s.channels.length>0&&e.jsxs("span",{children:["via ",s.channels.join(", ")]}),!s.exists&&e.jsx("span",{className:"text-warn",children:"deleted"}),e.jsx("span",{children:b(s.sizeBytes)})]})]}),e.jsx("div",{className:"text-xs text-text-muted flex-shrink-0",children:g(s.lastWrittenAt)})]},s.path))}),o&&e.jsx(k,{path:o,onClose:()=>n(null)})]})}function S(){const[t,a]=i.useState([]),[r,c]=i.useState(!0),[l,m]=i.useState(null),o=i.useCallback(async()=>{c(!0);try{const n=await h("/api/research/recent?limit=50");a(n.research||[])}catch{}c(!1)},[]);return i.useEffect(()=>{o()},[o]),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:o,className:"px-3 py-1.5 rounded-lg border border-border bg-bg-secondary text-sm hover:bg-bg-tertiary flex items-center gap-1.5",children:[e.jsx(p,{size:14,className:r?"animate-spin":""}),r?"Loading":"Refresh"]}),e.jsxs("div",{className:"text-xs text-text-muted",children:[t.length," items"]})]}),r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"Loading…"}),!r&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-text-muted text-sm",children:"No research recorded yet. Complete a goal and results will appear here."}),e.jsx("div",{className:"space-y-2",children:t.map(n=>{var u;const d=l===n.id,x=n.content.slice(0,200),s=n.subtaskTitle?`${n.goalTitle} — ${n.subtaskTitle}`:((u=n.tags)==null?void 0:u.join(" · "))||n.kind;return e.jsxs("div",{className:"rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("button",{onClick:()=>m(d?null:n.id),className:"w-full text-left px-4 py-3 hover:bg-bg-tertiary transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary text-text-muted uppercase tracking-wide font-medium",children:n.kind.replace(/_/g," ")}),e.jsx("span",{className:"text-xs text-text-muted",children:g(n.at)})]}),e.jsx("div",{className:"text-sm font-medium text-text truncate",children:s}),!d&&e.jsxs("div",{className:"text-xs text-text-secondary mt-1 line-clamp-2",children:[x,n.content.length>200?"…":""]})]}),d&&e.jsx("div",{className:"px-4 pb-4",children:e.jsx("pre",{className:"text-[12px] font-mono leading-snug whitespace-pre-wrap text-text-secondary",children:n.content})})]},n.id)})})]})}function T(){const[t,a]=i.useState("files");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>a("files"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="files"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(N,{size:14})," Files edited"]}),e.jsxs("button",{onClick:()=>a("research"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${t==="research"?"bg-accent/15 text-accent border border-accent/30":"text-text-secondary hover:text-text hover:bg-bg-tertiary border border-transparent"}`,children:[e.jsx(y,{size:14})," Research"]})]}),t==="files"?e.jsx(C,{}):e.jsx(S,{})]})}export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,bp as D,j as e,X as $,b as N}from"./index-NatBSFxj.js";import{B as j}from"./Input-bFsLI0fq.js";import{S as T}from"./StatusBadge-CGvKbP7R.js";import{P as M}from"./PageHeader-Cwn3OALc.js";import{E as O}from"./EmptyState-DFrAEZDm.js";import{M as A}from"./CommandPostHub-BPPaUv1B.js";import{S as F}from"./SkeletonLoader-CsiR8ED9.js";import{P as L}from"./TitanCanvas-Hk49NFcA.js";import{T as y}from"./target-BrtxUtzl.js";import{a as B,C as I}from"./VoiceOverlay-Dn6iaYgd.js";import{T as U}from"./trash-2-C_Jsp23A.js";import"./proxy-vU7v4NVM.js";import"./InlineEditableField-zIAnW4AR.js";import"./Tooltip-CcoZrKsl.js";import"./pause-DDC_zUiJ.js";import"./dollar-sign-D2Oce4Ru.js";import"./git-branch-0FamUEbU.js";import"./chart-column-x6L66Qw7.js";function _(t){const a=Math.floor((Date.now()-new Date(t).getTime())/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}const H=["pending","in_progress","completed","blocked"];function J({node:t,onClose:a,onRefresh:l}){const[d,c]=i.useState(!1),[x,m]=i.useState(!1),r=t.goal,g=async()=>{c(!0);try{await N(`/api/goals/${r.id}`,{method:"DELETE"}),l(),a()}catch{}c(!1)},o=async n=>{m(!0);try{await N(`/api/goals/${r.id}`,{method:"PATCH",body:JSON.stringify({status:n})}),l()}catch{}m(!1)};return e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-text",children:r.title}),r.description&&e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:r.description})]}),e.jsx("button",{onClick:a,className:"p-1 text-text-muted hover:text-text rounded-lg hover:bg-bg-tertiary transition-colors",children:e.jsx($,{size:16})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Status: "}),e.jsx(T,{status:r.status,size:"sm"})]}),r.progress>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Progress: "}),e.jsxs("span",{className:"text-text font-medium",children:[Math.round(r.progress),"%"]})]}),t.children.length>0&&e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Sub-goals: "}),e.jsxs("span",{className:"text-text font-medium",children:[t.children.filter(n=>n.goal.status==="completed"||n.goal.status==="done").length,"/",t.children.length," done"]})]}),e.jsxs("div",{className:"bg-bg-tertiary/50 rounded-lg px-3 py-2",children:[e.jsx("span",{className:"text-text-muted",children:"Updated: "}),e.jsxs("span",{className:"text-text font-medium",children:[_(r.updatedAt||r.createdAt||new Date().toISOString())," ago"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-2",children:"Change Status"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:H.map(n=>e.jsx("button",{disabled:x||r.status===n,onClick:()=>o(n),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${r.status===n?"bg-accent/20 text-accent border border-accent/30":"bg-bg-tertiary text-text-secondary hover:bg-bg-tertiary/80 border border-border"} disabled:opacity-50`,children:n.replace("_"," ")},n))})]}),e.jsx("div",{className:"pt-2 border-t border-border flex justify-end",children:e.jsxs("button",{onClick:g,disabled:d,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-error hover:bg-error/10 transition-colors disabled:opacity-50",children:[e.jsx(U,{size:12}),d?"Deleting...":"Delete Goal"]})})]})}function z({node:t,expanded:a,toggleExpand:l,selectedId:d,onSelect:c}){const x=t.children.length>0,m=a.has(t.goal.id),r=d===t.goal.id,g=t.children.filter(o=>o.goal.status==="completed"||o.goal.status==="done").length;return e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-2 py-2 px-3 rounded-lg transition-colors cursor-pointer group ${r?"bg-accent/10 border-l-2 border-accent":"hover:bg-bg-tertiary/50"}`,style:{paddingLeft:`${t.depth*24+12}px`},onClick:()=>c(t),children:[x?e.jsx("button",{onClick:o=>{o.stopPropagation(),l(t.goal.id)},className:"p-0.5 rounded hover:bg-bg-tertiary transition-colors",children:m?e.jsx(B,{size:14,className:"text-text-muted"}):e.jsx(I,{size:14,className:"text-text-muted"})}):e.jsx("span",{className:"w-[18px] flex-shrink-0"}),e.jsx(y,{size:14,className:r?"text-accent":"text-text-muted"}),e.jsx("span",{className:"text-sm text-text flex-1 truncate",children:t.goal.title}),e.jsx(T,{status:t.goal.status,size:"sm"}),x&&e.jsxs("span",{className:"text-[10px] text-text-muted",children:[g,"/",t.children.length]}),t.goal.progress>0&&e.jsx("div",{className:"w-16 h-1.5 bg-bg-tertiary rounded-full overflow-hidden flex-shrink-0",children:e.jsx("div",{className:"h-full bg-accent rounded-full transition-all",style:{width:`${Math.min(100,t.goal.progress)}%`}})})]}),x&&m&&e.jsx("div",{children:t.children.map(o=>e.jsx(z,{node:o,expanded:a,toggleExpand:l,selectedId:d,onSelect:c},o.goal.id))})]})}function E(t,a){for(const l of t){if(l.goal.id===a)return l;const d=E(l.children,a);if(d)return d}return null}function de(){const[t,a]=i.useState([]),[l,d]=i.useState(!0),[c,x]=i.useState(null),[m,r]=i.useState(new Set),[g,o]=i.useState(null),[n,u]=i.useState(!1),[p,v]=i.useState(""),[P,S]=i.useState(!1),b=i.useCallback(async()=>{try{const s=await D();a(s),r(new Set(s.map(h=>h.goal.id))),x(null)}catch(s){x(s instanceof Error?s.message:"Failed to load goals")}d(!1)},[]);i.useEffect(()=>{b()},[b]);const C=s=>{r(h=>{const f=new Set(h);return f.has(s)?f.delete(s):f.add(s),f})},G=s=>{o(h=>h===s.goal.id?null:s.goal.id),s.children.length>0&&!m.has(s.goal.id)&&C(s.goal.id)},w=async()=>{if(p.trim()){S(!0);try{await N("/api/command-post/goals",{method:"POST",body:JSON.stringify({title:p.trim()})}),u(!1),v(""),await b()}catch{}S(!1)}},k=g?E(t,g):null;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(M,{title:"Goals",breadcrumbs:[{label:"Command Post"},{label:"Goals"}],actions:e.jsx(j,{size:"sm",icon:e.jsx(L,{size:14}),onClick:()=>u(!0),children:"Create Goal"})}),l&&e.jsx(F,{variant:"row",count:5}),c&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:c}),!l&&!c&&t.length===0&&e.jsx(O,{icon:e.jsx(y,{size:32}),title:"No goals",description:"Create your first goal to start organizing agent work.",action:{label:"Create Goal",onClick:()=>u(!0)}}),!l&&!c&&t.length>0&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"lg:col-span-2 rounded-xl border border-border bg-bg-secondary overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[t.length," top-level goal",t.length!==1?"s":""]}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Click a goal to view details"})]}),e.jsx("div",{className:"divide-y divide-border",children:t.map(s=>e.jsx(z,{node:s,expanded:m,toggleExpand:C,selectedId:g,onSelect:G},s.goal.id))})]}),e.jsx("div",{className:"lg:col-span-1",children:k?e.jsx(J,{node:k,onClose:()=>o(null),onRefresh:b}):e.jsxs("div",{className:"bg-bg-secondary border border-border rounded-xl p-8 text-center",children:[e.jsx(y,{size:24,className:"text-text-muted mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Select a goal to view details"})]})})]}),e.jsx(A,{open:n,onClose:()=>u(!1),title:"Create Goal",footer:e.jsxs(e.Fragment,{children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>u(!1),children:"Cancel"}),e.jsx(j,{size:"sm",onClick:w,loading:P,disabled:!p.trim(),children:"Create"})]}),children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-muted mb-1",children:"Goal 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:"Enter goal title...",value:p,onChange:s=>v(s.target.value),onKeyDown:s=>s.key==="Enter"&&w(),autoFocus:!0})]})})]})}export{de as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as L,j as e,n as C,r as h,b7 as P,b8 as J,b9 as Y,i as Z,ba as ee,o as te,bb as se,bc as re,h as ae,T as E,X as B,aA as q,bd as ne,be as ie,bf as oe,bg as le,b as de}from"./index-NatBSFxj.js";import{B as v}from"./Input-bFsLI0fq.js";import{P as ce}from"./PageHeader-Cwn3OALc.js";import{E as ue}from"./EmptyState-DFrAEZDm.js";import{S as pe}from"./SkeletonLoader-CsiR8ED9.js";import{M as D,B as U,C as z,S as xe,n as he,k as F,r as ge,q as me}from"./TitanCanvas-Hk49NFcA.js";import{F as fe}from"./funnel-DqD9srZu.js";import{S as be}from"./square-Bn_0tYME.js";import{a as ye}from"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
|
+
* @license lucide-react v0.513.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ve=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],je=L("inbox",ve);/**
|
|
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 ke=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],we=L("square-check-big",ke);function Ne({tabs:n,activeTab:s,onChange:p,className:m}){return e.jsx("div",{className:C("flex gap-1 border-b border-border",m),children:n.map(u=>e.jsxs("button",{onClick:()=>p(u.id),className:C("flex items-center gap-1.5 px-3 py-2 text-sm font-medium transition-colors border-b-2 -mb-px",s===u.id?"border-accent text-accent":"border-transparent text-text-muted hover:text-text-secondary"),children:[u.icon,u.label,u.count!==void 0&&e.jsx("span",{className:C("ml-1 rounded-full px-1.5 py-0.5 text-[10px] font-medium",s===u.id?"bg-accent/15 text-accent":"bg-bg-tertiary text-text-muted"),children:u.count})]},u.id))})}function $e(n){var u,f;const s=n.payload||{},p=s.kind;if(p==="driver_blocked"){const o=s.question||"Specialist needs clarification",l=[];return s.goalTitle&&l.push(`Goal: ${s.goalTitle}`),s.subtaskTitle&&l.push(`Task: ${s.subtaskTitle}`),s.specialist&&l.push(`Agent: ${s.specialist}`),s.attempts&&l.push(`${s.attempts} attempt(s)`),s.lastError&&l.push(`Error: ${String(s.lastError).slice(0,120)}`),{kindLabel:"Driver blocked",headline:o.length>120?o.slice(0,120)+"…":o,detail:l.join(" · ")||void 0,urgency:"high"}}if(p==="self_mod_pr"){const o=n.payload,l=o.initialFileCount,x=o.firstFile,a=o.proposedBy,b=[];return typeof l=="number"&&l>0&&b.push(`${l} file${l===1?"":"s"}`),x&&b.push(x.split("/").slice(-2).join("/")),s.target&&b.push(`→ ${s.target}`),a&&b.push(`by ${a}`),{kindLabel:"Self-mod PR",headline:s.goalTitle?`Code changes for: ${s.goalTitle}`:"Code changes pending review",detail:b.length>0?b.join(" · "):s.suggestedAction,urgency:"medium"}}if(p==="self_repair"){const l=(s.evidence||{}).driveId,x=s.finding||"finding";return{kindLabel:"Self-repair",headline:s.reason||`${x}${l?` (${l})`:""}`,detail:s.suggestedAction,urgency:s.severity||"medium"}}if(p==="canary_regression"){const o=s.regressions||[],l=o.length>0?o.map(x=>`${x.taskId} ${(x.baseline*100).toFixed(0)}%→${(x.current*100).toFixed(0)}%`).join(", "):null;return{kindLabel:"Canary regression",headline:l?`Quality drop on ${o.length} task(s): ${l}`:s.reason||"Model quality regression detected",detail:s.suggestedAction||(s.model?`Model: ${s.model}`:void 0),urgency:"high"}}if(n.type==="goal_proposal"||n.type==="soma_proposal"||p==="goal_proposal")return{kindLabel:n.type==="soma_proposal"?"Soma proposal":"New goal proposal",headline:s.title||s.goalTitle||"Goal proposal",detail:((u=s.description)==null?void 0:u.slice(0,180))||((f=s.rationale)==null?void 0:f.slice(0,180)),urgency:"medium"};if(n.type==="hire_agent")return{kindLabel:"Hire agent",headline:s.name?`Hire "${s.name}" as ${s.role||"agent"}`:"Hire new agent",urgency:"medium"};if(n.type==="budget_override")return{kindLabel:"Budget override",headline:"Agent requesting budget continuation",detail:s.reason,urgency:"medium"};const m=s.question||s.title||s.goalTitle||s.reason||s.finding||s.description||s.rationale||`${n.type.replace(/_/g," ")} from ${n.requestedBy}`;return{kindLabel:(p||n.type).replace(/_/g," "),headline:String(m).slice(0,200),urgency:s.urgency||"low"}}function Se(n){return new Date(n).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ae({approval:n,onReply:s}){const[p,m]=h.useState(""),[u,f]=h.useState(!1),{toast:o}=P(),l=n.thread||[],x=async()=>{if(p.trim()){f(!0);try{await Y(n.id,"user",p.trim()),m(""),s==null||s(),o("success","Reply sent")}catch{o("error","Failed to send reply")}f(!1)}};return e.jsxs("div",{className:"space-y-3 mt-3",children:[l.length===0&&e.jsxs("div",{className:"text-xs text-text-muted italic flex items-center gap-1",children:[e.jsx(D,{size:12}),"No replies yet. Start the conversation below."]}),l.map(a=>e.jsxs("div",{className:`flex gap-2 ${a.authorUser?"flex-row":"flex-row-reverse"}`,children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${a.authorUser?"bg-accent/20 text-accent":"bg-warning/20 text-warning"}`,children:a.authorUser?e.jsx(J,{size:12}):e.jsx(U,{size:12})}),e.jsxs("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${a.authorUser?"bg-bg-tertiary text-text":"bg-warning/10 text-text border border-warning/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"font-semibold",children:a.authorUser||a.authorAgentId||"Agent"}),e.jsx(z,{size:10,className:"text-text-muted"}),e.jsx("span",{className:"text-text-muted",children:Se(a.createdAt)})]}),e.jsx("div",{className:"whitespace-pre-wrap",children:a.body})]})]},a.id)),e.jsxs("div",{className:"flex items-end gap-2 pt-2",children:[e.jsx("textarea",{value:p,onChange:a=>m(a.target.value),placeholder:"Reply to this agent...",className:"flex-1 min-h-[60px] rounded-lg border border-border bg-bg px-3 py-2 text-xs text-text outline-none focus:border-accent resize-none",onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),x())}}),e.jsx("button",{onClick:x,disabled:u||!p.trim(),className:"h-8 w-8 rounded-lg bg-accent text-white flex items-center justify-center disabled:opacity-40 hover:bg-accent/90 transition-colors",children:e.jsx(xe,{size:14})})]})]})}function Ce(n){const s=Math.floor((Date.now()-new Date(n).getTime())/1e3);return s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}function ze(n){return!!n.snoozedUntil&&new Date(n.snoozedUntil)>new Date}function Pe(){const[n,s]=h.useState([]),[p,m]=h.useState(!0),[u,f]=h.useState(null),[o,l]=h.useState("all"),[x,a]=h.useState(null),[b,M]=h.useState(null),[N,S]=h.useState(new Set),[$,H]=h.useState("all"),{toast:g}=P(),V=Z(),y=h.useCallback(async()=>{try{const[t,d,i,k]=await Promise.all([ee("pending"),te(void 0,50),se(),re({status:"blocked"})]),c=[];t.forEach(r=>{const w=$e(r),j=r.type==="custom"&&r.payload.kind==="driver_blocked",I=r.type==="custom"&&r.payload.kind==="self_mod_pr";c.push({id:`approval-${r.id}`,kind:"approval",icon:he,iconColor:j?"text-error":I?"text-warning":"text-accent",urgency:j||I?"high":"medium",message:`${w.kindLabel}: ${w.headline}`,timestamp:r.createdAt,data:r})}),d.filter(r=>r.status==="failed"||r.status==="error").forEach(r=>c.push({id:`run-${r.id}`,kind:"failed_run",icon:ae,iconColor:"text-error",urgency:"high",message:`Run failed: ${r.agentId} — ${r.error??"unknown error"}`,timestamp:r.finishedAt??r.startedAt,data:r})),i.filter(r=>r.status==="error").forEach(r=>c.push({id:`agent-${r.id}`,kind:"error_agent",icon:E,iconColor:"text-error",urgency:"high",message:`Agent error: ${r.name}`,timestamp:r.lastHeartbeat,data:r})),k.forEach(r=>c.push({id:`issue-${r.id}`,kind:"blocked_issue",icon:E,iconColor:"text-warning",urgency:"medium",message:`Blocked: ${r.identifier} — ${r.title}`,timestamp:r.updatedAt,data:r})),c.sort((r,w)=>{const j={high:0,medium:1,low:2};return j[r.urgency]!==j[w.urgency]?j[r.urgency]-j[w.urgency]:new Date(w.timestamp).getTime()-new Date(r.timestamp).getTime()}),s(c),f(null)}catch(t){f(t instanceof Error?t.message:"Failed to load inbox")}m(!1)},[]);h.useEffect(()=>{y()},[y]);const K=async t=>{a(t.id);try{await ie(t.id,"user"),await y();const d=t.type==="goal_proposal"||t.type==="soma_proposal",i=t.type==="custom"&&t.payload.kind==="driver_blocked";g("success",d?"Work approved — TITAN is starting…":i?"Unblocked — TITAN is resuming…":"Approved"),(d||i)&&V("/command-post",{state:{tab:"Work"}})}catch{g("error","Approval failed")}a(null)},O=async t=>{a(t.id);try{await oe(t.id,"user"),await y(),g("success","Rejected")}catch{g("error","Reject failed")}a(null)},W=async(t,d)=>{a(t.id);try{const i=new Date(Date.now()+d*6e4).toISOString();await le(t.id,i),await y(),g("success",`Snoozed for ${d}m`)}catch{g("error","Snooze failed")}a(null)},G=async t=>{a(t.id);try{const d=await de(`/api/command-post/runs/${t.id}/retry`,{method:"POST"});if(!d.ok)throw new Error(`${d.status} ${d.statusText}`);await y(),g("success","Retry queued — TITAN will try again")}catch{g("error","Retry failed")}a(null)},X=t=>{S(d=>{const i=new Set(d);return i.has(t)?i.delete(t):i.add(t),i})},_=async t=>{const d=Array.from(N).map(i=>{var k;return(k=n.find(c=>c.id===i))==null?void 0:k.data}).filter(i=>(i==null?void 0:i.id)!==void 0).map(i=>i.id);if(d.length!==0){a("batch");try{await ne(d,t,"user"),S(new Set),await y(),g("success",`${t==="approve"?"Approved":"Rejected"} ${d.length} item(s)`)}catch{g("error","Batch action failed")}a(null)}},A=n.filter(t=>o==="all"?!0:o==="approvals"?t.kind==="approval":o==="failed_runs"?t.kind==="failed_run":o==="errors"?t.kind==="error_agent"||t.kind==="blocked_issue":!0).filter(t=>$==="all"?!0:t.kind==="approval"?t.data.requestedBy===$:t.kind==="failed_run"?t.data.agentId===$:!0),T=n.filter(t=>t.kind==="approval"),Q=[{id:"all",label:"All",count:n.length},{id:"approvals",label:"Approvals",count:T.length},{id:"failed_runs",label:"Failed Runs",count:n.filter(t=>t.kind==="failed_run").length},{id:"errors",label:"Errors",count:n.filter(t=>t.kind==="error_agent"||t.kind==="blocked_issue").length}],R=Array.from(new Set(T.map(t=>t.data.requestedBy))).filter(Boolean);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(ce,{title:"Inbox",breadcrumbs:[{label:"Command Post"},{label:"Inbox"}]}),N.size>0&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[e.jsxs("span",{className:"text-xs font-medium text-accent",children:[N.size," selected"]}),e.jsx("div",{className:"flex-1"}),e.jsx(v,{size:"sm",variant:"ghost",onClick:()=>_("approve"),loading:x==="batch",icon:e.jsx(F,{size:14}),children:"Approve All"}),e.jsx(v,{size:"sm",variant:"ghost",onClick:()=>_("reject"),loading:x==="batch",icon:e.jsx(B,{size:14}),children:"Reject All"}),e.jsx("button",{onClick:()=>S(new Set),className:"text-xs text-text-muted hover:text-text px-2",children:"Clear"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ne,{tabs:Q,activeTab:o,onChange:l}),e.jsx("div",{className:"flex-1"}),o==="approvals"&&R.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fe,{size:12,className:"text-text-muted"}),e.jsxs("select",{value:$,onChange:t=>H(t.target.value),className:"text-xs bg-bg border border-border rounded px-2 py-1 outline-none focus:border-accent",children:[e.jsx("option",{value:"all",children:"All agents"}),R.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]}),p&&e.jsx(pe,{variant:"row",count:5}),u&&e.jsx("div",{className:"text-center py-8 text-error text-sm",children:u}),!p&&!u&&A.length===0&&e.jsx(ue,{icon:e.jsx(je,{size:32}),title:"Inbox empty",description:"No pending items require your attention."}),!p&&!u&&A.length>0&&e.jsx("div",{className:"space-y-2",children:A.map(t=>{const d=t.icon,i=b===t.id,k=N.has(t.id),c=t.kind==="approval"?t.data:null;return e.jsxs("div",{className:`rounded-xl border overflow-hidden transition-colors ${t.urgency==="high"?"border-error/30 bg-error/5":t.urgency==="medium"?"border-warning/20 bg-warning/[0.03]":"border-border bg-bg-secondary"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[t.kind==="approval"&&e.jsx("button",{onClick:()=>X(t.id),className:"text-text-muted hover:text-accent transition-colors",children:k?e.jsx(we,{size:16,className:"text-accent"}):e.jsx(be,{size:16})}),e.jsx(d,{size:16,className:t.iconColor}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text font-medium truncate",children:t.message}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-muted mt-0.5",children:[c&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{size:10}),c.requestedBy]}),c.thread&&c.thread.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent",children:[e.jsx(D,{size:10}),c.thread.length]}),ze(c)&&e.jsxs("span",{className:"flex items-center gap-1 text-warning",children:[e.jsx(z,{size:10}),"Snoozed"]})]}),e.jsx("span",{children:Ce(t.timestamp)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.kind==="approval"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{size:"sm",variant:"ghost",onClick:()=>K(t.data),loading:x===t.data.id,icon:e.jsx(F,{size:14}),children:"Approve"}),e.jsx(v,{size:"sm",variant:"ghost",onClick:()=>O(t.data),loading:x===t.data.id,icon:e.jsx(B,{size:14}),children:"Reject"}),e.jsxs("div",{className:"relative group",children:[e.jsx(v,{size:"sm",variant:"ghost",icon:e.jsx(z,{size:14}),children:"Snooze"}),e.jsx("div",{className:"absolute right-0 top-full mt-1 hidden group-hover:flex flex-col gap-1 bg-bg border border-border rounded-lg p-1 shadow-lg z-10",children:[15,60,240,1440].map(r=>e.jsx("button",{onClick:()=>W(t.data,r),className:"text-xs text-left px-2 py-1 rounded hover:bg-bg-tertiary whitespace-nowrap",children:r<60?`${r}m`:r<1440?`${r/60}h`:`${r/1440}d`},r))})]}),e.jsx("button",{onClick:()=>M(i?null:t.id),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted",children:i?e.jsx(ge,{size:14}):e.jsx(ye,{size:14})})]}),t.kind==="failed_run"&&e.jsx(v,{size:"sm",variant:"ghost",onClick:()=>G(t.data),loading:x===t.data.id,icon:e.jsx(me,{size:14}),children:"Retry"}),t.kind==="blocked_issue"&&e.jsx(q,{to:`/command-post/issues/${t.data.id}`,children:e.jsx(v,{size:"sm",variant:"ghost",children:"View"})}),t.kind==="error_agent"&&e.jsx(q,{to:`/command-post/agents/${t.data.id}`,children:e.jsx(v,{size:"sm",variant:"ghost",children:"View"})})]})]}),i&&c&&e.jsxs("div",{className:"px-4 pb-4 border-t border-border/50",children:[c.payload&&!!c.payload.shadowVerdict&&e.jsxs("div",{className:"mt-3 p-2 rounded-lg bg-bg-tertiary/50 text-xs",children:[e.jsx("div",{className:"font-medium text-text-muted mb-1",children:"Shadow Rehearsal"}),e.jsx("div",{className:"text-text-secondary",children:(()=>{const r=c.payload.shadowVerdict;return r?e.jsxs("div",{className:"space-y-1",children:[r.estimatedCostUsd?e.jsxs("div",{children:["Cost: $",Number(r.estimatedCostUsd).toFixed(2)]}):null,r.reversibilityScore!==void 0?e.jsxs("div",{children:["Reversibility: ",Number(r.reversibilityScore).toFixed(2)]}):null,r.breakRisks&&Array.isArray(r.breakRisks)&&r.breakRisks.length>0?e.jsxs("div",{className:"text-error",children:["Risks: ",r.breakRisks.join(", ")]}):null]}):null})()})]}),e.jsx(Ae,{approval:c,onReply:y})]})]},t.id)})})]})}export{Pe as default};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{c as v,r as n,
|
|
1
|
+
import{c as v,r as n,bi as A,bj as M,j as e,e as D,f as L,h as q,bk as _,bl as I,bm as O,bn as z}from"./index-NatBSFxj.js";import{R as b,S as G,C as H,M as F}from"./TitanCanvas-Hk49NFcA.js";import{L as B}from"./lightbulb-Bk6KlR6q.js";import"./VoiceOverlay-Dn6iaYgd.js";/**
|
|
2
2
|
* @license lucide-react v0.513.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const Q=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],U=v("share-2",Q);/**
|
|
7
7
|
* @license lucide-react v0.513.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Q=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],U=v("type",Q);function N(a){const l=Math.floor((Date.now()-new Date(a).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}const w={activity:"Activity",spotlight:"Spotlight",stats:"Stats",tips:"Tips",promo:"Promo",usecase:"Use Case",eli5:"ELI5"},x={activity:"var(--color-accent-hover)",spotlight:"var(--color-emerald)",stats:"var(--color-cyan)",tips:"#fbbf24",promo:"#f472b6",usecase:"var(--color-purple-light)",eli5:"#fb923c"};function te(){const[a,l]=n.useState(null),[k,C]=n.useState(!0),[b,i]=n.useState(null),[c,g]=n.useState(""),[y,f]=n.useState(!1),[j,m]=n.useState(null),[p,d]=n.useState(null),o=n.useCallback(async()=>{try{i(null);const t=await $();l(t)}catch(t){i(t instanceof Error?t.message:"Failed to load social state")}finally{C(!1)}},[]),h=n.useCallback(async()=>{try{const r=(await A()).recentTopics;if(r.length===0){m(null);return}const M=r.slice(0,3).map(R=>`"${R.content.split(/\s+/).slice(0,6).join(" ")}..."`).join(", ");m(`💡 Recent social posts: ${M}. Consider a follow-up on a related but fresh topic.`)}catch{m(null)}},[]);n.useEffect(()=>{o(),h()},[o,h]);const S=async()=>{if(!a)return;const t=!a.autopilot.enabled;try{await I(t),l(r=>r&&{...r,autopilot:{...r.autopilot,enabled:t}})}catch(r){i(r instanceof Error?r.message:"Toggle failed")}},T=async()=>{if(c.trim()){f(!0);try{const t=await _(c.trim());t.success?(g(""),await o(),await h()):i(t.error||t.skipped||"Post failed")}catch(t){i(t instanceof Error?t.message:"Post failed")}finally{f(!1)}}},P=async t=>{d(t);try{await O(t),await o()}catch(r){i(r instanceof Error?r.message:"Approve failed")}finally{d(null)}},E=async t=>{d(t);try{await z(t),await o()}catch(r){i(r instanceof Error?r.message:"Reject failed")}finally{d(null)}};if(k)return e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500/30 border-t-indigo-500 rounded-full animate-spin"}),e.jsx("span",{className:"ml-3 text-sm text-text-muted",children:"Loading social media…"})]});const s=a==null?void 0:a.autopilot;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-pink-500/10 border border-pink-500/20",children:e.jsx(K,{className:"h-4 w-4 text-pink-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Social Media"}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"Facebook autopilot, drafts, and post history"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-[11px] text-text-muted hover:bg-bg-tertiary transition-colors border border-border",children:[e.jsx(u,{className:"h-3 w-3"})," Refresh"]})})]}),b&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-xs text-red-300",children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),b]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Autopilot"}),e.jsx("button",{onClick:S,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${s!=null&&s.enabled?"bg-pink-500":"bg-white/10"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${s!=null&&s.enabled?"translate-x-4.5":"translate-x-1"}`})})]}),e.jsx("p",{className:`mt-1 text-sm font-semibold ${s!=null&&s.enabled?"text-pink-400":"text-text-muted"}`,children:s!=null&&s.enabled?"Enabled":"Paused"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Posts Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.postsToday)??0}),e.jsxs("p",{className:"text-[11px] text-text-muted",children:["/ ",(s==null?void 0:s.maxPostsPerDay)??6]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Replies Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.repliesToday)??0}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"/ 10"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Next Type"}),e.jsx("p",{className:"mt-1 text-sm font-semibold",style:{color:x[(s==null?void 0:s.nextContentType)||"activity"]||"#fff"},children:w[(s==null?void 0:s.nextContentType)||"activity"]||(s==null?void 0:s.nextContentType)})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-pink-400"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Compose Post"})]}),e.jsx("textarea",{value:c,onChange:t=>g(t.target.value),placeholder:"What's on your mind?",rows:3,className:"w-full rounded-lg border border-border bg-black/20 px-3 py-2 text-sm text-white placeholder:text-text-muted focus:border-pink-500/50 focus:outline-none resize-none"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:`text-[11px] ${c.length>280?"text-red-400":"text-text-muted"}`,children:[c.length," chars"]}),e.jsxs("button",{onClick:T,disabled:y||!c.trim(),className:"flex items-center gap-1.5 rounded-lg bg-pink-500/20 px-4 py-1.5 text-xs font-medium text-pink-300 hover:bg-pink-500/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors border border-pink-500/20",children:[y?e.jsx(u,{className:"h-3 w-3 animate-spin"}):e.jsx(G,{className:"h-3 w-3"}),"Post Now"]})]}),j&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-amber-500/5 border border-amber-500/10 px-3 py-2",children:[e.jsx(B,{className:"h-3.5 w-3.5 text-amber-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-[11px] text-amber-200/70 leading-relaxed",children:j})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Draft Queue"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(a==null?void 0:a.queue.length)??0," pending"]})]}),a!=null&&a.queue&&a.queue.length>0?e.jsx("div",{className:"space-y-2",children:a.queue.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-text break-words",children:t.content}),e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted",children:[t.method," · ",N(t.createdAt)," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsxs("button",{onClick:()=>P(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-emerald-500/10 px-2.5 py-1 text-[11px] text-emerald-300 hover:bg-emerald-500/20 disabled:opacity-40 transition-colors border border-emerald-500/15",children:[p===t.id?e.jsx(u,{className:"h-3 w-3 animate-spin"}):e.jsx(D,{className:"h-3 w-3"}),"Approve"]}),e.jsxs("button",{onClick:()=>E(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-red-500/10 px-2.5 py-1 text-[11px] text-red-300 hover:bg-red-500/20 disabled:opacity-40 transition-colors border border-red-500/15",children:[e.jsx(q,{className:"h-3 w-3"}),"Reject"]})]})]},t.id))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No pending drafts in the queue."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Recent Posts"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(a==null?void 0:a.recentPosts.length)??0," tracked"]})]}),a!=null&&a.recentPosts&&a.recentPosts.length>0?e.jsx("div",{className:"space-y-2",children:a.recentPosts.map((t,r)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsx("div",{className:"mt-0.5 h-2 w-2 rounded-full shrink-0",style:{backgroundColor:x[t.type]||"#64748b"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:(x[t.type]||"#64748b")+"20",color:x[t.type]||"#94a3b8"},children:w[t.type]||t.type}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[N(t.date)," ago"]})]}),e.jsx("p",{className:"text-sm text-text-secondary break-words",children:t.content||"(content not stored)"}),t.postId&&e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted font-mono",children:["ID: ",t.postId]})]})]},r))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No posts in history yet."})})]})]})}export{te as default};
|
|
11
|
+
*/const V=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],W=v("type",V);function N(r){const l=Math.floor((Date.now()-new Date(r).getTime())/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}const w={activity:"Activity",spotlight:"Spotlight",stats:"Stats",tips:"Tips",promo:"Promo",usecase:"Use Case",eli5:"ELI5"},x={activity:"var(--color-accent-hover)",spotlight:"var(--color-emerald)",stats:"var(--color-cyan)",tips:"#fbbf24",promo:"#f472b6",usecase:"var(--color-purple-light)",eli5:"#fb923c"};function te(){const[r,l]=n.useState(null),[k,C]=n.useState(!0),[u,i]=n.useState(null),[c,g]=n.useState(""),[y,f]=n.useState(!1),[j,m]=n.useState(null),[p,d]=n.useState(null),o=n.useCallback(async()=>{try{i(null);const t=await A();l(t)}catch(t){i(t instanceof Error?t.message:"Failed to load social state")}finally{C(!1)}},[]),h=n.useCallback(async()=>{try{const a=(await M()).recentTopics;if(a.length===0){m(null);return}const R=a.slice(0,3).map($=>`"${$.content.split(/\s+/).slice(0,6).join(" ")}..."`).join(", ");m(`💡 Recent social posts: ${R}. Consider a follow-up on a related but fresh topic.`)}catch{m(null)}},[]);n.useEffect(()=>{o(),h()},[o,h]);const S=async()=>{if(!r)return;const t=!r.autopilot.enabled;try{await _(t),l(a=>a&&{...a,autopilot:{...a.autopilot,enabled:t}})}catch(a){i(a instanceof Error?a.message:"Toggle failed")}},T=async()=>{if(c.trim()){f(!0);try{const t=await I(c.trim());t.success?(g(""),await o(),await h()):i(t.error||t.skipped||"Post failed")}catch(t){i(t instanceof Error?t.message:"Post failed")}finally{f(!1)}}},P=async t=>{d(t);try{await O(t),await o()}catch(a){i(a instanceof Error?a.message:"Approve failed")}finally{d(null)}},E=async t=>{d(t);try{await z(t),await o()}catch(a){i(a instanceof Error?a.message:"Reject failed")}finally{d(null)}};if(k)return e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500/30 border-t-indigo-500 rounded-full animate-spin"}),e.jsx("span",{className:"ml-3 text-sm text-text-muted",children:"Loading social media…"})]});const s=r==null?void 0:r.autopilot;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-pink-500/10 border border-pink-500/20",children:e.jsx(U,{className:"h-4 w-4 text-pink-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Social Media"}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"Facebook autopilot, drafts, and post history"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 rounded-lg bg-bg-tertiary px-3 py-1.5 text-[11px] text-text-muted hover:bg-bg-tertiary transition-colors border border-border",children:[e.jsx(b,{className:"h-3 w-3"})," Refresh"]})})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-xs text-red-300",children:[e.jsx(D,{className:"h-4 w-4 shrink-0"}),u]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Autopilot"}),e.jsx("button",{onClick:S,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${s!=null&&s.enabled?"bg-pink-500":"bg-white/10"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${s!=null&&s.enabled?"translate-x-4.5":"translate-x-1"}`})})]}),e.jsx("p",{className:`mt-1 text-sm font-semibold ${s!=null&&s.enabled?"text-pink-400":"text-text-muted"}`,children:s!=null&&s.enabled?"Enabled":"Paused"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Posts Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.postsToday)??0}),e.jsxs("p",{className:"text-[11px] text-text-muted",children:["/ ",(s==null?void 0:s.maxPostsPerDay)??6]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Replies Today"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-xl font-bold text-white",children:(s==null?void 0:s.repliesToday)??0}),e.jsx("p",{className:"text-[11px] text-text-muted",children:"/ 10"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 px-4 py-3",children:[e.jsx("p",{className:"text-[11px] text-text-muted",children:"Next Type"}),e.jsx("p",{className:"mt-1 text-sm font-semibold",style:{color:x[(s==null?void 0:s.nextContentType)||"activity"]||"#fff"},children:w[(s==null?void 0:s.nextContentType)||"activity"]||(s==null?void 0:s.nextContentType)})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-bg-tertiary/30 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-pink-400"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Compose Post"})]}),e.jsx("textarea",{value:c,onChange:t=>g(t.target.value),placeholder:"What's on your mind?",rows:3,className:"w-full rounded-lg border border-border bg-black/20 px-3 py-2 text-sm text-white placeholder:text-text-muted focus:border-pink-500/50 focus:outline-none resize-none"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:`text-[11px] ${c.length>280?"text-red-400":"text-text-muted"}`,children:[c.length," chars"]}),e.jsxs("button",{onClick:T,disabled:y||!c.trim(),className:"flex items-center gap-1.5 rounded-lg bg-pink-500/20 px-4 py-1.5 text-xs font-medium text-pink-300 hover:bg-pink-500/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors border border-pink-500/20",children:[y?e.jsx(b,{className:"h-3 w-3 animate-spin"}):e.jsx(G,{className:"h-3 w-3"}),"Post Now"]})]}),j&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-amber-500/5 border border-amber-500/10 px-3 py-2",children:[e.jsx(B,{className:"h-3.5 w-3.5 text-amber-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-[11px] text-amber-200/70 leading-relaxed",children:j})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Draft Queue"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(r==null?void 0:r.queue.length)??0," pending"]})]}),r!=null&&r.queue&&r.queue.length>0?e.jsx("div",{className:"space-y-2",children:r.queue.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-text break-words",children:t.content}),e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted",children:[t.method," · ",N(t.createdAt)," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsxs("button",{onClick:()=>P(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-emerald-500/10 px-2.5 py-1 text-[11px] text-emerald-300 hover:bg-emerald-500/20 disabled:opacity-40 transition-colors border border-emerald-500/15",children:[p===t.id?e.jsx(b,{className:"h-3 w-3 animate-spin"}):e.jsx(L,{className:"h-3 w-3"}),"Approve"]}),e.jsxs("button",{onClick:()=>E(t.id),disabled:p===t.id,className:"flex items-center gap-1 rounded-md bg-red-500/10 px-2.5 py-1 text-[11px] text-red-300 hover:bg-red-500/20 disabled:opacity-40 transition-colors border border-red-500/15",children:[e.jsx(q,{className:"h-3 w-3"}),"Reject"]})]})]},t.id))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No pending drafts in the queue."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Recent Posts"}),e.jsxs("span",{className:"text-[11px] text-text-muted ml-1",children:[(r==null?void 0:r.recentPosts.length)??0," tracked"]})]}),r!=null&&r.recentPosts&&r.recentPosts.length>0?e.jsx("div",{className:"space-y-2",children:r.recentPosts.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-bg-secondary/30 px-4 py-3",children:[e.jsx("div",{className:"mt-0.5 h-2 w-2 rounded-full shrink-0",style:{backgroundColor:x[t.type]||"#64748b"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:(x[t.type]||"#64748b")+"20",color:x[t.type]||"#94a3b8"},children:w[t.type]||t.type}),e.jsxs("span",{className:"text-[10px] text-text-muted",children:[N(t.date)," ago"]})]}),e.jsx("p",{className:"text-sm text-text-secondary break-words",children:t.content||"(content not stored)"}),t.postId&&e.jsxs("p",{className:"mt-1 text-[10px] text-text-muted font-mono",children:["ID: ",t.postId]})]})]},a))}):e.jsx("div",{className:"rounded-lg border border-border bg-bg-secondary/30 px-4 py-6 text-center",children:e.jsx("p",{className:"text-xs text-text-muted",children:"No posts in history yet."})})]})]})}export{te as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as e,e as $,ao as E,ap as D,aq as F}from"./index-NatBSFxj.js";import{P as R}from"./PageHeader-Cwn3OALc.js";import{R as O,i as K,c as W}from"./TitanCanvas-Hk49NFcA.js";import{C as _}from"./circle-check-big-WaW3U3Xl.js";import{a as G,C as H}from"./VoiceOverlay-Dn6iaYgd.js";import{E as I}from"./eye-off-DIMcxsdQ.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,C=(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)},S=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(G,{className:"h-4 w-4 text-text-muted"}):e.jsx(H,{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:[C&&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"}`})})]}),S&&e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center gap-2 text-xs text-text-muted",children:[S.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)":S.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(I,{className:"h-4 w-4"}):e.jsx(K,{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(I,{className:"h-4 w-4"}):e.jsx(K,{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(W,{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 F(t,n);const[r,i]=await Promise.all([E(),D()]);o(r),f(i);const j=((h=L.find(C=>C.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(R,{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(O,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,aV as o,j as e,aW as d}from"./index-NatBSFxj.js";import{P as m}from"./PageHeader-Cwn3OALc.js";import{R as h,c as x}from"./TitanCanvas-Hk49NFcA.js";import{T as p}from"./trash-2-C_Jsp23A.js";import"./VoiceOverlay-Dn6iaYgd.js";function v(){const[r,n]=t.useState([]),[i,c]=t.useState(!0),a=t.useCallback(async()=>{c(!0);try{const s=await o();n(s.checkpoints||[])}catch{}c(!1)},[]);t.useEffect(()=>{a()},[a]);const l=async s=>{if(confirm("Delete this checkpoint?"))try{await d(s),await a()}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:a,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:r.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:()=>l(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{v as default};
|