cf-claw 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +15 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +262 -0
- package/dist/agent.js.map +1 -0
- package/dist/agents.d.ts +51 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +478 -0
- package/dist/agents.js.map +1 -0
- package/dist/api/routes.d.ts +3 -0
- package/dist/api/routes.d.ts.map +1 -0
- package/dist/api/routes.js +491 -0
- package/dist/api/routes.js.map +1 -0
- package/dist/bot.d.ts +4 -0
- package/dist/bot.d.ts.map +1 -0
- package/dist/bot.js +295 -0
- package/dist/bot.js.map +1 -0
- package/dist/canvas.d.ts +37 -0
- package/dist/canvas.d.ts.map +1 -0
- package/dist/canvas.js +47 -0
- package/dist/canvas.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +202 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands.d.ts +6 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +384 -0
- package/dist/commands.js.map +1 -0
- package/dist/components/TaskList.d.ts +7 -0
- package/dist/components/TaskList.d.ts.map +1 -0
- package/dist/components/TaskList.js +37 -0
- package/dist/components/TaskList.js.map +1 -0
- package/dist/config/encryption.d.ts +10 -0
- package/dist/config/encryption.d.ts.map +1 -0
- package/dist/config/encryption.js +111 -0
- package/dist/config/encryption.js.map +1 -0
- package/dist/config/json-config.d.ts +114 -0
- package/dist/config/json-config.d.ts.map +1 -0
- package/dist/config/json-config.js +388 -0
- package/dist/config/json-config.js.map +1 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +137 -0
- package/dist/config.js.map +1 -0
- package/dist/context/pruning.d.ts +30 -0
- package/dist/context/pruning.d.ts.map +1 -0
- package/dist/context/pruning.js +132 -0
- package/dist/context/pruning.js.map +1 -0
- package/dist/dashboard/404/index.html +1 -0
- package/dist/dashboard/404.html +1 -0
- package/dist/dashboard/_next/static/chunks/117-c657912d4a6fa056.js +2 -0
- package/dist/dashboard/_next/static/chunks/191-a6922264096cb3ad.js +11 -0
- package/dist/dashboard/_next/static/chunks/343-71498a8257bc1e81.js +1 -0
- package/dist/dashboard/_next/static/chunks/app/_not-found/page-15cbe4395e02a084.js +1 -0
- package/dist/dashboard/_next/static/chunks/app/layout-191efbc962809bb4.js +1 -0
- package/dist/dashboard/_next/static/chunks/app/manual/page-3c401ecf89979cd7.js +1 -0
- package/dist/dashboard/_next/static/chunks/app/page-dff55e58941a3c4d.js +1 -0
- package/dist/dashboard/_next/static/chunks/fd9d1056-9583fa19bc194043.js +1 -0
- package/dist/dashboard/_next/static/chunks/framework-f66176bb897dc684.js +1 -0
- package/dist/dashboard/_next/static/chunks/main-2461f93106bcf687.js +1 -0
- package/dist/dashboard/_next/static/chunks/main-app-89f5ec28b3bb0e7f.js +1 -0
- package/dist/dashboard/_next/static/chunks/pages/_app-72b849fbd24ac258.js +1 -0
- package/dist/dashboard/_next/static/chunks/pages/_error-7ba65e1336b92748.js +1 -0
- package/dist/dashboard/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/dist/dashboard/_next/static/chunks/webpack-616e068a201ad621.js +1 -0
- package/dist/dashboard/_next/static/css/baff0f221c10680b.css +3 -0
- package/dist/dashboard/_next/static/pyqPyo6dkz4uTWdfdFAOJ/_buildManifest.js +1 -0
- package/dist/dashboard/_next/static/pyqPyo6dkz4uTWdfdFAOJ/_ssgManifest.js +1 -0
- package/dist/dashboard/index.html +1 -0
- package/dist/dashboard/index.txt +7 -0
- package/dist/dashboard/manual/index.html +1 -0
- package/dist/dashboard/manual/index.txt +7 -0
- package/dist/documents.d.ts +20 -0
- package/dist/documents.d.ts.map +1 -0
- package/dist/documents.js +227 -0
- package/dist/documents.js.map +1 -0
- package/dist/embeddings.d.ts +15 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +40 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/factory.d.ts +72 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +2010 -0
- package/dist/factory.js.map +1 -0
- package/dist/groups.d.ts +13 -0
- package/dist/groups.d.ts.map +1 -0
- package/dist/groups.js +42 -0
- package/dist/groups.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +223 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/taskStorage.d.ts +4 -0
- package/dist/lib/taskStorage.d.ts.map +1 -0
- package/dist/lib/taskStorage.js +28 -0
- package/dist/lib/taskStorage.js.map +1 -0
- package/dist/llm/anthropic.d.ts +13 -0
- package/dist/llm/anthropic.d.ts.map +1 -0
- package/dist/llm/anthropic.js +96 -0
- package/dist/llm/anthropic.js.map +1 -0
- package/dist/llm/failover.d.ts +13 -0
- package/dist/llm/failover.d.ts.map +1 -0
- package/dist/llm/failover.js +42 -0
- package/dist/llm/failover.js.map +1 -0
- package/dist/llm/google.d.ts +13 -0
- package/dist/llm/google.d.ts.map +1 -0
- package/dist/llm/google.js +112 -0
- package/dist/llm/google.js.map +1 -0
- package/dist/llm/groq.d.ts +8 -0
- package/dist/llm/groq.d.ts.map +1 -0
- package/dist/llm/groq.js +13 -0
- package/dist/llm/groq.js.map +1 -0
- package/dist/llm/index.d.ts +11 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +10 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/ollama.d.ts +9 -0
- package/dist/llm/ollama.d.ts.map +1 -0
- package/dist/llm/ollama.js +27 -0
- package/dist/llm/ollama.js.map +1 -0
- package/dist/llm/openai-compat.d.ts +17 -0
- package/dist/llm/openai-compat.d.ts.map +1 -0
- package/dist/llm/openai-compat.js +69 -0
- package/dist/llm/openai-compat.js.map +1 -0
- package/dist/llm/openrouter.d.ts +8 -0
- package/dist/llm/openrouter.d.ts.map +1 -0
- package/dist/llm/openrouter.js +20 -0
- package/dist/llm/openrouter.js.map +1 -0
- package/dist/llm/provider.d.ts +41 -0
- package/dist/llm/provider.d.ts.map +1 -0
- package/dist/llm/provider.js +2 -0
- package/dist/llm/provider.js.map +1 -0
- package/dist/llm/registry.d.ts +10 -0
- package/dist/llm/registry.d.ts.map +1 -0
- package/dist/llm/registry.js +90 -0
- package/dist/llm/registry.js.map +1 -0
- package/dist/llm/thinking.d.ts +7 -0
- package/dist/llm/thinking.d.ts.map +1 -0
- package/dist/llm/thinking.js +34 -0
- package/dist/llm/thinking.js.map +1 -0
- package/dist/llm.d.ts +17 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/llm.js +184 -0
- package/dist/llm.js.map +1 -0
- package/dist/logs.d.ts +11 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +54 -0
- package/dist/logs.js.map +1 -0
- package/dist/memory/knowledge-graph.d.ts +34 -0
- package/dist/memory/knowledge-graph.d.ts.map +1 -0
- package/dist/memory/knowledge-graph.js +137 -0
- package/dist/memory/knowledge-graph.js.map +1 -0
- package/dist/memory.d.ts +73 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +320 -0
- package/dist/memory.js.map +1 -0
- package/dist/mesh.d.ts +18 -0
- package/dist/mesh.d.ts.map +1 -0
- package/dist/mesh.js +120 -0
- package/dist/mesh.js.map +1 -0
- package/dist/paths.d.ts +11 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +51 -0
- package/dist/paths.js.map +1 -0
- package/dist/proactive/heartbeat.d.ts +4 -0
- package/dist/proactive/heartbeat.d.ts.map +1 -0
- package/dist/proactive/heartbeat.js +56 -0
- package/dist/proactive/heartbeat.js.map +1 -0
- package/dist/proactive/recap.d.ts +12 -0
- package/dist/proactive/recap.d.ts.map +1 -0
- package/dist/proactive/recap.js +90 -0
- package/dist/proactive/recap.js.map +1 -0
- package/dist/proactive/recommendations.d.ts +11 -0
- package/dist/proactive/recommendations.d.ts.map +1 -0
- package/dist/proactive/recommendations.js +92 -0
- package/dist/proactive/recommendations.js.map +1 -0
- package/dist/projects.d.ts +44 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +101 -0
- package/dist/projects.js.map +1 -0
- package/dist/scheduler/index.d.ts +17 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +116 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/sessions.d.ts +19 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +176 -0
- package/dist/sessions.js.map +1 -0
- package/dist/skills/index.d.ts +14 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +126 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/swarm.d.ts +18 -0
- package/dist/swarm.d.ts.map +1 -0
- package/dist/swarm.js +146 -0
- package/dist/swarm.js.map +1 -0
- package/dist/taskListWidget.d.ts +76 -0
- package/dist/taskListWidget.d.ts.map +1 -0
- package/dist/taskListWidget.js +312 -0
- package/dist/taskListWidget.js.map +1 -0
- package/dist/tools/browser.d.ts +5 -0
- package/dist/tools/browser.d.ts.map +1 -0
- package/dist/tools/browser.js +104 -0
- package/dist/tools/browser.js.map +1 -0
- package/dist/tools/config-tools.d.ts +4 -0
- package/dist/tools/config-tools.d.ts.map +1 -0
- package/dist/tools/config-tools.js +154 -0
- package/dist/tools/config-tools.js.map +1 -0
- package/dist/tools/files.d.ts +3 -0
- package/dist/tools/files.d.ts.map +1 -0
- package/dist/tools/files.js +208 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +1109 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/mcp-bridge.d.ts +5 -0
- package/dist/tools/mcp-bridge.d.ts.map +1 -0
- package/dist/tools/mcp-bridge.js +200 -0
- package/dist/tools/mcp-bridge.js.map +1 -0
- package/dist/tools/shell.d.ts +8 -0
- package/dist/tools/shell.d.ts.map +1 -0
- package/dist/tools/shell.js +78 -0
- package/dist/tools/shell.js.map +1 -0
- package/dist/tools/skills-manage.d.ts +25 -0
- package/dist/tools/skills-manage.d.ts.map +1 -0
- package/dist/tools/skills-manage.js +155 -0
- package/dist/tools/skills-manage.js.map +1 -0
- package/dist/tools/web-search.d.ts +4 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +60 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tts.d.ts +6 -0
- package/dist/tts.d.ts.map +1 -0
- package/dist/tts.js +42 -0
- package/dist/tts.js.map +1 -0
- package/dist/types/task.d.ts +7 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +2 -0
- package/dist/types/task.js.map +1 -0
- package/dist/typing.d.ts +18 -0
- package/dist/typing.d.ts.map +1 -0
- package/dist/typing.js +63 -0
- package/dist/typing.js.map +1 -0
- package/dist/usage.d.ts +28 -0
- package/dist/usage.d.ts.map +1 -0
- package/dist/usage.js +69 -0
- package/dist/usage.js.map +1 -0
- package/dist/voice.d.ts +6 -0
- package/dist/voice.d.ts.map +1 -0
- package/dist/voice.js +47 -0
- package/dist/voice.js.map +1 -0
- package/dist/webchat/index.d.ts +3 -0
- package/dist/webchat/index.d.ts.map +1 -0
- package/dist/webchat/index.js +3 -0
- package/dist/webchat/index.js.map +1 -0
- package/dist/webchat/public/index.html +344 -0
- package/dist/webchat/public/public/index.html +344 -0
- package/dist/webchat/public/public/task-list-widget.js +410 -0
- package/dist/webchat/public/task-list-widget.js +410 -0
- package/dist/webchat/server.d.ts +3 -0
- package/dist/webchat/server.d.ts.map +1 -0
- package/dist/webchat/server.js +80 -0
- package/dist/webchat/server.js.map +1 -0
- package/dist/webchat/ws.d.ts +4 -0
- package/dist/webchat/ws.d.ts.map +1 -0
- package/dist/webchat/ws.js +232 -0
- package/dist/webchat/ws.js.map +1 -0
- package/dist/webhooks/index.d.ts +14 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +86 -0
- package/dist/webhooks/index.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[789],{7276:function(e,t,a){Promise.resolve().then(a.bind(a,8423))},8423:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return M}});var s=a(7437),r=a(7648),n=a(407),i=a(9205);let l=(0,i.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),d=(0,i.Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var o=a(1239),c=a(2926);let m=(0,i.Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var x=a(4401),p=a(9989),h=a(1047),g=a(3417),k=a(5900),j=a(4760),u=a(1788),b=a(5805),v=a(4924),f=a(221),y=a(5252),N=a(4766),S=a(8124);function A(e){let{icon:t,title:a,children:r}=e;return(0,s.jsxs)("section",{className:"rounded-xl border border-slate-800/60 bg-[#0b1120] p-6",children:[(0,s.jsxs)("div",{className:"mb-4 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-cyan-500/10",children:(0,s.jsx)(t,{className:"h-4 w-4 text-cyan-400"})}),(0,s.jsx)("h2",{className:"text-lg font-semibold text-slate-100",children:a})]}),r]})}function w(e){let{title:t,description:a}=e;return(0,s.jsxs)("div",{className:"flex gap-3 py-2",children:[(0,s.jsx)(n.Z,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-cyan-500"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-sm font-medium text-slate-200",children:t}),(0,s.jsx)("p",{className:"mt-0.5 text-sm text-slate-400",children:a})]})]})}function C(e){let{children:t}=e;return(0,s.jsxs)("div",{className:"mt-3 flex gap-2 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3",children:[(0,s.jsx)(l,{className:"h-4 w-4 flex-shrink-0 text-amber-400"}),(0,s.jsx)("p",{className:"text-sm text-amber-200/80",children:t})]})}function M(){return(0,s.jsx)("div",{className:"min-h-screen bg-[#030712]",children:(0,s.jsxs)("div",{className:"mx-auto max-w-4xl px-6 py-8",children:[(0,s.jsxs)("header",{className:"mb-8",children:[(0,s.jsxs)(r.default,{href:"/",className:"mb-6 inline-flex items-center gap-2 rounded-lg border border-slate-700/50 bg-slate-800/40 px-4 py-2 text-sm font-medium text-slate-400 transition-colors hover:border-cyan-500/30 hover:bg-cyan-500/10 hover:text-cyan-400",children:[(0,s.jsx)(d,{className:"h-4 w-4"}),"Tillbaka till Dashboard"]}),(0,s.jsxs)("div",{className:"mt-6 flex items-center gap-4",children:[(0,s.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-cyan-500/10",children:(0,s.jsx)(o.Z,{className:"h-6 w-6 text-cyan-400",style:{filter:"drop-shadow(0 0 6px rgba(34,211,238,0.6))"}})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-slate-100",children:"CF Claw Dashboard — Manual"}),(0,s.jsx)("p",{className:"text-sm text-slate-500",children:"AgentOS Dashboard v1.0"})]})]})]}),(0,s.jsxs)("div",{className:"mb-8 rounded-xl border border-cyan-500/20 bg-cyan-500/5 p-5",children:[(0,s.jsx)("h3",{className:"mb-2 text-sm font-semibold text-cyan-400",children:"Om CF Claw Dashboard"}),(0,s.jsx)("p",{className:"text-sm leading-relaxed text-slate-300",children:"CF Claw Dashboard \xe4r webbgr\xe4nssnittet f\xf6r din AI-agentplattform. H\xe4r kan du hantera projekt, schemal\xe4gga uppgifter, chatta med agenter, \xf6vervaka minne och kunskaper, samt f\xf6lja systemets prestanda i realtid. All kommunikation sker via ett autentiserat WebSocket-anslutning mot backend."})]}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)(A,{icon:c.Z,title:"Anslutning & Autentisering",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Dashboarden ansluter automatiskt till backend-servern via WebSocket. Statusen visas i headern p\xe5 varje sida:"}),(0,s.jsxs)("div",{className:"space-y-2 text-sm text-slate-400",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-2 w-2 rounded-full bg-emerald-400"}),(0,s.jsx)("span",{className:"text-emerald-400",children:"Connected"})," — API och WebSocket \xe4r uppkopplat"]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-2 w-2 rounded-full bg-red-400"}),(0,s.jsx)("span",{className:"text-red-400",children:"Disconnected"})," — Ingen kontakt med backend"]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-2 w-2 animate-pulse rounded-full bg-amber-400"}),(0,s.jsx)("span",{className:"text-amber-400",children:"Connecting..."})," — F\xf6rs\xf6ker ansluta"]})]}),(0,s.jsxs)(C,{children:['Om du ser "Disconnected", kontrollera att backend-servern k\xf6rs och att',(0,s.jsx)("code",{className:"mx-1 rounded bg-slate-800 px-1.5 py-0.5 text-xs text-cyan-300",children:"NEXT_PUBLIC_API_BASE"}),"\xe4r korrekt inst\xe4lld i din ",(0,s.jsx)("code",{className:"mx-1 rounded bg-slate-800 px-1.5 py-0.5 text-xs text-cyan-300",children:".env.local"}),"."]})]}),(0,s.jsx)(A,{icon:m,title:"Autentisering",children:(0,s.jsxs)("p",{className:"mb-3 text-sm text-slate-400",children:["Om milj\xf6variabeln",(0,s.jsx)("code",{className:"mx-1 rounded bg-slate-800 px-1.5 py-0.5 text-xs text-cyan-300",children:"NEXT_PUBLIC_AUTH_TOKEN"}),"\xe4r satt skickas en Bearer-token med alla API-anrop och WebSocket-autentisering. Utan token k\xf6rs dashboarden i \xf6ppet l\xe4ge (endast f\xf6r utveckling)."]})}),(0,s.jsxs)(A,{icon:x.Z,title:"Platform Overview",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"\xd6versiktssidan visar systemets h\xe4lsostatus och nyckeltal vid en blink."}),(0,s.jsx)(w,{title:"Statistikkort",description:"Visar antal aktiva projekt, cron-jobb, inl\xe4rda f\xe4rdigheter och registrerade agenter."}),(0,s.jsx)(w,{title:"System Status",description:"Aktiv AI-modell, upptid, WebSocket-status och om schemal\xe4ggaren \xe4r ig\xe5ng."}),(0,s.jsx)(C,{children:"Sidan uppdateras automatiskt n\xe4r du \xf6ppnar den. Statistikkortens data h\xe4mtas fr\xe5n flera API:er parallellt."})]}),(0,s.jsxs)(A,{icon:p.Z,title:"Project Factory",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Hantera projekt med Kanban-stil uppdelning. Skapa projekt, l\xe4gg till uppgifter och flytta dem mellan kolumner."}),(0,s.jsx)(w,{title:"Projektlistning",description:"V\xe4lj bland projekt med framstegsindikatorer, team-avatars och status."}),(0,s.jsx)(w,{title:"Kanban-tavla",description:"Fyra kolumner: Backlog, Working, Review och Done. Hovra \xf6ver en uppgift f\xf6r att flytta den."}),(0,s.jsx)(w,{title:"Skapa projekt",description:'Klicka "Nytt Projekt" och ange titel, beskrivning och team.'}),(0,s.jsx)(C,{children:"Uppgifter flyttas optimistic — gr\xe4nssnittet uppdateras direkt och rullas tillbaka om API-anropet misslyckas."})]}),(0,s.jsxs)(A,{icon:h.Z,title:"Cron Scheduler",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Schemal\xe4gga \xe5terkommande uppgifter med cron-uttryck som skickar prompts till din AI-agent."}),(0,s.jsx)(w,{title:"Global start/stopp",description:"Starta eller stoppa hela schemal\xe4ggaren med en knapp."}),(0,s.jsx)(w,{title:"Skapa cron-jobb",description:"Ange namn, cron-uttryck (t.ex. 0 9 * * *) och prompt som ska k\xf6ras."}),(0,s.jsx)(w,{title:"Aktivera/inaktivera",description:"Pausa enskilda jobb utan att ta bort dem."}),(0,s.jsx)(w,{title:"N\xe4sta k\xf6rning",description:"Se n\xe4r varje jobb k\xf6rs n\xe4sta g\xe5ng."}),(0,s.jsxs)(C,{children:["Cron-uttryck f\xf6ljer standardformat: minut timme dag-m\xe5nad m\xe5nad veckodag. Exempel: ",(0,s.jsx)("code",{className:"rounded bg-slate-800 px-1.5 py-0.5 text-xs text-cyan-300",children:"0 */2 * * *"})," k\xf6r varannan timme."]})]}),(0,s.jsxs)(A,{icon:g.Z,title:"Agent Chat",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Chatta direkt med din AI-agent i realtid med str\xf6mmande svar och Markdown-rendering."}),(0,s.jsx)(w,{title:"Str\xf6mmande svar",description:"Svaren visas tecken f\xf6r tecken via WebSocket i realtid."}),(0,s.jsx)(w,{title:"Modellbyte",description:"V\xe4lj aktiv AI-modell fr\xe5n en dropdown i chatten. Modeller grupperas per leverant\xf6r."}),(0,s.jsx)(w,{title:"Markdown",description:"Assistentens svar renderas med full Markdown-st\xf6d inklusive kodblock."}),(0,s.jsx)(w,{title:"Stop generation",description:"Avbryt en p\xe5g\xe5ende generering med stopp-knappen."}),(0,s.jsx)(w,{title:"Auto-resize",description:"Textrutan v\xe4xer automatiskt. Skicka med Enter, ny rad med Shift+Enter."})]}),(0,s.jsxs)(A,{icon:k.Z,title:"Skills & Learning",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Bl\xe4ddra bland agentens inl\xe4rda f\xe4rdigheter och inbyggda core-skills."}),(0,s.jsx)(w,{title:"Learned Skills",description:"F\xe4rdigheter som agenten skapat och sparat. Klicka f\xf6r att expandera och se inneh\xe5llet."}),(0,s.jsx)(w,{title:"Core Skills",description:"Inbyggda f\xe4rdigheter fr\xe5n systemet som inte kan redigeras."})]}),(0,s.jsxs)(A,{icon:j.Z,title:"Memory & Graph",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Inspektera agentens best\xe4ndiga minne — automatiska sammanfattningar, extraherade fakta och entitetsgraf."}),(0,s.jsx)(w,{title:"Auto-Summaries",description:"Automatiskt genererade sammanfattningar av konversationer."}),(0,s.jsx)(w,{title:"Extracted Facts",description:"Fakta som agenten extraherat och kategoriserat."}),(0,s.jsx)(w,{title:"Entity Graph",description:"Visualisering av relationer mellan entiteter (subjekt — relation — objekt)."})]}),(0,s.jsxs)(A,{icon:u.Z,title:"Mesh & Swarms",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Starta multi-agent arbetsfl\xf6den. Mesh delar upp ett m\xe5l, Swarm f\xf6rdelar uppgifter till ett team."}),(0,s.jsx)(w,{title:"Mesh",description:"Ange ett m\xe5l — agenten dekomponerar det och distribuerar till flera agenter."}),(0,s.jsx)(w,{title:"Swarm",description:"Ange en uppgift och v\xe4lj team (default, research, engineering, analysis)."}),(0,s.jsx)(w,{title:"Live-output",description:"F\xf6lj arbetsfl\xf6dets framsteg i realtid med statusindikatorer."}),(0,s.jsx)(C,{children:"Krver aktiv WebSocket-anslutning. Om du ser en varning, kontrollera anslutningen i headern."})]}),(0,s.jsxs)(A,{icon:b.Z,title:"Agent Registry",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Se alla registrerade AI-agenter grupperade per team."}),(0,s.jsx)(w,{title:"Team-gruppering",description:"Agenter visas i team som content, strategy, design, development, quality, operations och support."}),(0,s.jsx)(w,{title:"Agentkort",description:"Varje agent visar namn, roll, tillg\xe4ngliga verktyg och taggar."}),(0,s.jsx)(w,{title:"Aktiv agent",description:"Den aktiva agenten markeras med en pulserande cyan-prick."})]}),(0,s.jsxs)(A,{icon:v.Z,title:"Document Store",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Bl\xe4ddra och hantera dokument med kategorifiltrering."}),(0,s.jsx)(w,{title:"Kategorifilter",description:"Filtrera p\xe5: all, general, projects, research, notes, html."}),(0,s.jsx)(w,{title:"Dokumentlista",description:'Visar filtyp, titel, storlek och datum. HTML-filer f\xe5r en "Canvas Ready"-badge.'}),(0,s.jsx)(w,{title:"\xc5tg\xe4rder",description:"Rendera (HTML), redigera eller radera dokument vid hover."})]}),(0,s.jsxs)(A,{icon:f.Z,title:"System Logs",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Realtidsloggvisning med terminalk\xe4nsla. Se allt som h\xe4nder i systemet."}),(0,s.jsx)(w,{title:"Realtidsuppdateringar",description:"Nya loggar str\xf6mmar via WebSocket (max 500 rader buffras)."}),(0,s.jsx)(w,{title:"F\xe4rgkodade k\xe4llor",description:"Agent Nudge (lila), Memory (cyan), Factory (indigo), Scheduler (amber), Core (gr\xe5)."}),(0,s.jsx)(w,{title:"Auto-scroll",description:"Loggen scrollar automatiskt till botten vid nya inl\xe4gg."})]}),(0,s.jsxs)(A,{icon:y.Z,title:"Usage & Cost",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"\xd6vervaka LLM API-anv\xe4ndning, kostnader och prestandam\xe4tetal."}),(0,s.jsx)(w,{title:"24h-statistik",description:"Totalt anrop, tokens, kostnad och genomsnittlig latens."}),(0,s.jsx)(w,{title:"Kostnad per modell",description:"Tabell med anrop, tokens och kostnad uppdelat per AI-modell."}),(0,s.jsx)(w,{title:"Senaste anrop",description:"De 10 senaste API-anropen med detaljer om modell, tokens och k\xe4lla."})]}),(0,s.jsxs)(A,{icon:N.Z,title:"Webhooks",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Skapa webhook-endpoints som triggare AI-prompts vid externa h\xe4ndelser."}),(0,s.jsx)(w,{title:"Skapa webhook",description:"Ange namn, path, hemlighet (valfritt) och prompt-mall."}),(0,s.jsx)(w,{title:"Kopiera URL",description:"Kopiera webhook-URL:en till urklipp med ett klick."}),(0,s.jsx)(w,{title:"Hantera",description:"Aktivera, inaktivera eller radera webhooks."})]}),(0,s.jsxs)(A,{icon:S.Z,title:"Sessions",children:[(0,s.jsx)("p",{className:"mb-3 text-sm text-slate-400",children:"Bl\xe4ddra bland isolerade sub-agent konversationssessioner."}),(0,s.jsx)(w,{title:"Sessionlista",description:"V\xe4nsterpanelen visar alla sessioner med ID och tidsst\xe4mpel."}),(0,s.jsx)(w,{title:"Meddelandevy",description:"V\xe4lj en session f\xf6r att se dess konversation i chat-layout."}),(0,s.jsx)(w,{title:"Rollmarkering",description:"Meddelanden f\xe4rgkodas per roll — user (cyan), assistant/system (m\xf6rk)."})]})]}),(0,s.jsxs)("footer",{className:"mt-12 border-t border-slate-800/60 pt-6 pb-12 text-center",children:[(0,s.jsx)("p",{className:"text-xs text-slate-600",children:"CF Claw AgentOS Dashboard — Manual v1.0"}),(0,s.jsxs)(r.default,{href:"/",className:"mt-3 inline-flex items-center gap-2 text-sm text-cyan-400 transition-colors hover:text-cyan-300",children:[(0,s.jsx)(d,{className:"h-4 w-4"}),"Tillbaka till Dashboard"]})]})]})})}}},function(e){e.O(0,[343,971,117,744],function(){return e(e.s=7276)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{575:function(e,s,t){Promise.resolve().then(t.bind(t,4615))},4615:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return eo}});var a=t(7437),l=t(2265),r=t(7648),n=t(4401),c=t(9989),i=t(1047),d=t(3417),o=t(5900),x=t(4760),m=t(1788),u=t(5805),h=t(4924),p=t(221),b=t(5252),g=t(4766),j=t(8124),f=t(1239),N=t(5368);let v=window.location.origin,y="".concat("https:"===window.location.protocol?"wss:":"ws:","//").concat(window.location.host),w="123hd203dj193rj13jf03f3edsf";async function k(e,s){let t={"Content-Type":"application/json",...null==s?void 0:s.headers};w&&(t.Authorization="Bearer ".concat(w));let a=await fetch("".concat(v).concat(e),{...s,headers:t});if(!a.ok)throw Error((await a.json().catch(()=>({error:a.statusText}))).error||a.statusText);return function(e,s,t){if(!0===t){let s=Object.keys(e);if(1===s.length&&Array.isArray(e[s[0]]))return e[s[0]]}else if("string"==typeof t)return e[t];else if(Array.isArray(t))return t.reduce((s,t)=>({...s,[t]:e[t]}),{});else if("function"==typeof t)return t(e,s);return e}(await a.json(),e,null==s?void 0:s.unwrap)}var S=t(2023),C=t(1723),D=t(2926),Z=t(5395),E=t(2135),T=t(875),M=t(1817),A=t(9076),L=t(9397),O=t(2489),P=t(2042),_=t(3003),R=t(9227),F=t(3276),I=t(6865);let W={planning:"bg-slate-500/10 text-slate-400 border-slate-700",running:"bg-cyan-500/10 text-cyan-400 border-cyan-900",paused:"bg-amber-500/10 text-amber-400 border-amber-900",completed:"bg-emerald-500/10 text-emerald-400 border-emerald-900",failed:"bg-red-500/10 text-red-400 border-red-900"},B=[{key:"backlog",label:"Backlog",emoji:"\uD83D\uDCCB"},{key:"in_progress",label:"Working",emoji:"⚡"},{key:"review",label:"Review",emoji:"\uD83D\uDD0D"},{key:"done",label:"Done",emoji:"✅"},{key:"human_intervention",label:"Stuck",emoji:"\uD83D\uDEA8"}],J={ideation:{label:"Ideation",emoji:"\uD83D\uDCA1",color:"bg-violet-500/10 text-violet-400 border-violet-800"},blueprint:{label:"Blueprint",emoji:"\uD83D\uDCD0",color:"bg-indigo-500/10 text-indigo-400 border-indigo-800"},design:{label:"Design",emoji:"\uD83C\uDFA8",color:"bg-pink-500/10 text-pink-400 border-pink-800"},implementation:{label:"Implementation",emoji:"\uD83D\uDD28",color:"bg-cyan-500/10 text-cyan-400 border-cyan-800"},integration:{label:"Integration",emoji:"\uD83D\uDD17",color:"bg-blue-500/10 text-blue-400 border-blue-800"},security:{label:"Security",emoji:"\uD83D\uDEE1️",color:"bg-red-500/10 text-red-400 border-red-800"},qa:{label:"QA Testing",emoji:"\uD83E\uDDEA",color:"bg-amber-500/10 text-amber-400 border-amber-800"},"code-review":{label:"Code Review",emoji:"\uD83D\uDC40",color:"bg-teal-500/10 text-teal-400 border-teal-800"},deployment:{label:"Deployment",emoji:"\uD83D\uDE80",color:"bg-emerald-500/10 text-emerald-400 border-emerald-800"},release:{label:"Release",emoji:"\uD83D\uDCE6",color:"bg-orange-500/10 text-orange-400 border-orange-800"},feedback:{label:"Feedback",emoji:"\uD83D\uDCE3",color:"bg-lime-500/10 text-lime-400 border-lime-800"}},U=["bg-cyan-600","bg-purple-600","bg-emerald-600","bg-amber-600","bg-rose-600","bg-blue-600","bg-pink-600","bg-teal-600"];function z(e){let{task:s,tasks:t,expandedTask:l,setExpandedTask:r,retryTask:n}=e;return(0,a.jsxs)("div",{className:"bg-[#0b1120] border rounded-xl p-3 transition-colors cursor-pointer ".concat("human_intervention"===s.status?"border-orange-900/50 hover:border-orange-700":"in_progress"===s.status?"border-cyan-900/50 hover:border-cyan-800":"border-slate-800 hover:border-slate-700"),children:[(0,a.jsxs)("div",{onClick:()=>r(l===s.id?null:s.id),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-slate-300 flex-1 min-w-0 truncate",children:s.title}),l===s.id?(0,a.jsx)(E.Z,{className:"w-3 h-3 text-slate-500 flex-shrink-0"}):(0,a.jsx)(T.Z,{className:"w-3 h-3 text-slate-500 flex-shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5 flex-wrap",children:[(0,a.jsxs)("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded ".concat(function(e){let s=0;for(let t=0;t<e.length;t++)s=e.charCodeAt(t)+((s<<5)-s);return U[Math.abs(s)%U.length]}(s.assignedAgent)," text-white"),children:["@",s.assignedAgent]}),s.phase&&J[s.phase]&&(0,a.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded border ".concat(J[s.phase].color),children:[J[s.phase].emoji," ",J[s.phase].label]}),s.reviewerAgent&&(0,a.jsxs)("span",{className:"text-[10px] text-slate-500",children:["→ ",s.reviewerAgent]}),s.retryCount>0&&(0,a.jsxs)("span",{className:"text-[10px] text-amber-500",children:[s.retryCount,"/",s.maxRetries]})]}),s.dependencies.length>0&&l!==s.id&&(0,a.jsxs)("p",{className:"text-[10px] text-slate-600 mt-1",children:["deps: [",s.dependencies.join(", "),"]"]}),"in_progress"===s.status&&(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[(0,a.jsx)(M.Z,{className:"w-3 h-3 text-cyan-500 animate-spin"}),(0,a.jsx)("span",{className:"text-[10px] text-cyan-500",children:"Working..."})]})]}),l===s.id&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-800 space-y-2",children:[s.description&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-slate-400 mb-1",children:"Task"}),(0,a.jsx)("p",{className:"text-[11px] text-slate-500 leading-relaxed",children:s.description})]}),s.dependencies.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-slate-400 mb-1",children:"Dependencies"}),(0,a.jsx)("p",{className:"text-[11px] text-slate-500",children:s.dependencies.map(e=>{let s=t.find(s=>s.id===e);return s?"#".concat(e," ").concat(s.title):"#".concat(e)}).join(", ")})]}),s.result&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-slate-400 mb-1",children:"Result"}),(0,a.jsx)("pre",{className:"text-[10px] text-slate-500 whitespace-pre-wrap break-words max-h-40 overflow-y-auto bg-[#030712] rounded-lg p-2 border border-slate-800",children:s.result.length>2e3?s.result.substring(0,2e3)+"...":s.result})]}),s.contextPayload&&Object.keys(s.contextPayload).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-slate-400 mb-1",children:"Context"}),(0,a.jsx)("div",{className:"space-y-1",children:Object.entries(s.contextPayload).slice(0,5).map(e=>{let[s,t]=e;return(0,a.jsxs)("div",{className:"bg-[#030712] rounded-lg p-2 border border-slate-800",children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-slate-400",children:s}),(0,a.jsx)("pre",{className:"text-[10px] text-slate-500 whitespace-pre-wrap break-words max-h-20 overflow-y-auto",children:"string"==typeof t?t.substring(0,300):JSON.stringify(t,null,2).substring(0,300)})]},s)})})]}),"human_intervention"===s.status&&(0,a.jsxs)("button",{onClick:e=>{e.stopPropagation(),n(s.id)},className:"flex items-center gap-1 mt-2 text-[10px] px-3 py-1.5 rounded-lg bg-orange-900/30 text-orange-300 hover:bg-orange-800/40 transition-colors",children:[(0,a.jsx)(A.Z,{className:"w-3 h-3"}),"Force Retry"]})]})]})}var H=t(1094),K=t(2207),q=t(8930),G=t(2451),V=t(2222),$=t(1641),Q=t(4743),X=t(7970),Y=t(1671);let ee={content:"bg-rose-500",strategy:"bg-indigo-500",design:"bg-pink-500",development:"bg-cyan-500",quality:"bg-amber-500",operations:"bg-slate-500",support:"bg-emerald-500"},es=["all","general","projects","research","notes","html"];function et(e){let{ext:s}=e;return"html"===s||".html"===s?(0,a.jsx)("svg",{className:"w-4 h-4 text-orange-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"})}):"md"===s||".md"===s?(0,a.jsx)("svg",{className:"w-4 h-4 text-cyan-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}):(0,a.jsx)("svg",{className:"w-4 h-4 text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}let ea={"Agent Nudge":"text-purple-400",Memory:"text-cyan-400",Factory:"text-indigo-400",Scheduler:"text-amber-400",Core:"text-slate-400"};var el=t(8335),er=t(8867);let en={name:"",path:"",secret:"",prompt_template:""};var ec=t(407);let ei=[{id:"overview",icon:n.Z,label:"Platform Overview"},{id:"factory",icon:c.Z,label:"Project Factory"},{id:"scheduler",icon:i.Z,label:"Cron Scheduler"},{id:"chat",icon:d.Z,label:"Agent Chat"},{id:"skills",icon:o.Z,label:"Skills & Learning"},{id:"memory",icon:x.Z,label:"Memory & Graph"},{id:"mesh",icon:m.Z,label:"Mesh & Swarms"},{id:"agents",icon:u.Z,label:"Agent Registry"},{id:"documents",icon:h.Z,label:"Document Store"},{id:"terminal",icon:p.Z,label:"System Logs"},{id:"usage",icon:b.Z,label:"Usage & Cost"},{id:"webhooks",icon:g.Z,label:"Webhooks"},{id:"sessions",icon:j.Z,label:"Sessions"}],ed={overview:function(e){var s;let{ws:t}=e,[r,d]=(0,l.useState)([]),[o,x]=(0,l.useState)(null),[m,h]=(0,l.useState)(!0);return(0,l.useEffect)(()=>{(async function(){try{var e;let[s,t,a,l,r]=await Promise.all([k("/api/projects",{unwrap:"projects"}).catch(()=>[]),k("/api/scheduler/tasks",{unwrap:"tasks"}).catch(()=>[]),k("/api/skills",{unwrap:"skills"}).catch(()=>[]),k("/api/agents").catch(()=>({agents:[],teams:[],activeAgent:null})),k("/api/status").catch(()=>null)]),n=l.agents;x(r);let o=t.filter(e=>e.enabled).length,m=n.filter(e=>e.builtIn).length;d([{icon:c.Z,value:s.length,label:"Active Projects",sub:"".concat(null!==(e=null==r?void 0:r.projectsCount)&&void 0!==e?e:s.length," total"),color:"text-indigo-400",iconBg:"bg-indigo-500/10"},{icon:i.Z,value:o,label:"Cron Jobs Active",sub:"of ".concat(t.length," total"),color:"text-emerald-400",iconBg:"bg-emerald-500/10"},{icon:S.Z,value:a.length,label:"Learned Skills",sub:"Available capabilities",color:"text-purple-400",iconBg:"bg-purple-500/10"},{icon:u.Z,value:m,label:"Built-in Agents",sub:"of ".concat(n.length," total"),color:"text-blue-400",iconBg:"bg-blue-500/10"}])}catch(e){}finally{h(!1)}})()},[]),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:m?Array.from({length:4}).map((e,s)=>(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5 animate-pulse",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-slate-800"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"h-4 bg-slate-800 rounded w-12 mb-1"}),(0,a.jsx)("div",{className:"h-3 bg-slate-800 rounded w-20"})]})]}),(0,a.jsx)("div",{className:"h-8 bg-slate-800 rounded w-16"})]},s)):r.map(e=>(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5 hover:border-slate-700 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,a.jsx)("div",{className:"".concat(e.iconBg," p-2.5 rounded-xl"),children:(0,a.jsx)(e.icon,{className:"w-5 h-5 ".concat(e.color)})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)("p",{className:"text-xs text-slate-500 truncate",children:e.sub})})]}),(0,a.jsx)("p",{className:"text-2xl font-bold ".concat(e.color),children:e.value}),(0,a.jsx)("p",{className:"text-sm text-slate-400 mt-0.5",children:e.label})]},e.label))}),(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-slate-300 mb-4 flex items-center gap-2",children:[(0,a.jsx)(n.Z,{className:"w-4 h-4 text-cyan-400"}),"System Status"]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"bg-purple-500/10 p-2 rounded-lg",children:(0,a.jsx)(f.Z,{className:"w-4 h-4 text-purple-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Active Model"}),(0,a.jsx)("p",{className:"text-sm text-slate-300 font-medium",children:null!==(s=null==o?void 0:o.activeModel)&&void 0!==s?s:"—"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"bg-cyan-500/10 p-2 rounded-lg",children:(0,a.jsx)(C.Z,{className:"w-4 h-4 text-cyan-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Uptime"}),(0,a.jsx)("p",{className:"text-sm text-slate-300 font-medium",children:(null==o?void 0:o.uptime)?function(e){let s=Math.floor(e/86400),t=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return s>0?"".concat(s,"d ").concat(t,"h ").concat(a,"m"):t>0?"".concat(t,"h ").concat(a,"m"):"".concat(a,"m")}(o.uptime):"—"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"".concat(t.connected?"bg-emerald-500/10":"bg-red-500/10"," p-2 rounded-lg"),children:t.connected?(0,a.jsx)(D.Z,{className:"w-4 h-4 text-emerald-400"}):(0,a.jsx)(Z.Z,{className:"w-4 h-4 text-red-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"WebSocket"}),(0,a.jsx)("p",{className:"text-sm font-medium ".concat(t.connected?"text-emerald-400":"text-red-400"),children:t.connected?"Connected":"Disconnected"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"bg-amber-500/10 p-2 rounded-lg",children:(0,a.jsx)(i.Z,{className:"w-4 h-4 text-amber-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Scheduler"}),(0,a.jsx)("p",{className:"text-sm font-medium ".concat((null==o?void 0:o.schedulerEnabled)?"text-emerald-400":"text-slate-500"),children:(null==o?void 0:o.schedulerEnabled)?"Enabled":"Disabled"})]})]})]})]})]})},factory:function(e){let{ws:s}=e,[t,r]=(0,l.useState)([]),[n,i]=(0,l.useState)(null),[d,o]=(0,l.useState)([]),[x,m]=(0,l.useState)(!0),[u,h]=(0,l.useState)(!1),[p,b]=(0,l.useState)(""),[g,j]=(0,l.useState)(!1),[f,N]=(0,l.useState)(""),[v,y]=(0,l.useState)(null),[w,S]=(0,l.useState)("status"),[C,D]=(0,l.useState)([]),[Z,E]=(0,l.useState)(!1),[T,U]=(0,l.useState)(!1),H=(0,l.useCallback)(async()=>{try{let e=await k("/api/factory/projects",{unwrap:!0})||[];r(e),e.length>0&&!n&&i(e[0])}catch(e){}finally{m(!1)}},[n]);(0,l.useEffect)(()=>{H()},[H]),(0,l.useEffect)(()=>{if(!n){o([]);return}k("/api/factory/projects/".concat(n.id,"/tasks"),{unwrap:!0}).then(e=>o(e||[])).catch(()=>o([]))},[n]),(0,l.useEffect)(()=>{if(!n||"running"!==n.status)return;let e=setInterval(async()=>{try{let e=await k("/api/factory/projects/".concat(n.id,"/tasks"),{unwrap:!0});o(e||[]);let s=await k("/api/factory/projects/".concat(n.id));i(s)}catch(e){}},5e3);return()=>clearInterval(e)},[null==n?void 0:n.id,null==n?void 0:n.status]);let K=(0,l.useCallback)(async()=>{if(p.trim()){j(!0),N("Fredix is analyzing requirements...");try{let e=await k("/api/factory/projects",{method:"POST",body:JSON.stringify({description:p.trim()})});r(s=>[e.project,...s]),i(e.project),o(e.tasks||[]),b(""),h(!1)}catch(e){N("Failed: ".concat(e instanceof Error?e.message:"Unknown error"))}finally{j(!1),setTimeout(()=>N(""),3e3)}}},[p]),q=(0,l.useCallback)(async e=>{await k("/api/factory/projects/".concat(e),{method:"PATCH",body:JSON.stringify({status:"paused"})}),i(s=>s&&s.id===e?{...s,status:"paused"}:s),H()},[H]),G=(0,l.useCallback)(async e=>{await k("/api/factory/projects/".concat(e),{method:"PATCH",body:JSON.stringify({status:"running"})}),i(s=>s&&s.id===e?{...s,status:"running"}:s),H()},[H]),V=(0,l.useCallback)(async e=>{try{if(await k("/api/factory/tasks/".concat(e,"/retry"),{method:"POST"}),n){let e=await k("/api/factory/projects/".concat(n.id,"/tasks"),{unwrap:!0});o(e||[])}}catch(e){}},[n]),$=(0,l.useCallback)(async(e,s)=>{try{if(await k("/api/factory/projects/".concat(e,"/restart"),{method:"POST",body:JSON.stringify({mode:s})}),H(),(null==n?void 0:n.id)===e){let s=await k("/api/factory/projects/".concat(e));i(s);let t=await k("/api/factory/projects/".concat(e,"/tasks"),{unwrap:!0});o(t||[])}}catch(e){}},[n,H]),Q=e=>e.taskCount>0?Math.round(e.completedTasks/e.taskCount*100):0;(0,l.useEffect)(()=>{k("/api/factory/profiles",{unwrap:!0}).then(e=>D((null==e?void 0:e.profiles)||[])).catch(()=>{})},[]);let X=(0,l.useCallback)(async(e,s)=>{U(!0);try{await k("/api/factory/projects/".concat(e,"/profile"),{method:"POST",body:JSON.stringify({profile:s})});let t=await k("/api/factory/projects/".concat(e));i(t);let a=await k("/api/factory/projects/".concat(e,"/tasks"),{unwrap:!0});o(a||[]),E(!1)}catch(e){}U(!1)},[]);return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-200 flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"w-5 h-5 text-cyan-400"}),"Project Factory"]}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Fredix & Stoffe decompose projects into agent tasks with dependencies"})]}),(0,a.jsxs)("button",{onClick:()=>{h(!0),b("")},className:"flex items-center gap-2 bg-cyan-600 hover:bg-cyan-700 text-white px-4 py-2 rounded-xl text-sm font-medium transition-colors",children:[(0,a.jsx)(L.Z,{className:"w-4 h-4"})," New Project"]})]}),u&&(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-slate-300",children:"New Factory Project"}),(0,a.jsx)("button",{onClick:()=>{h(!1),N("")},className:"text-slate-500 hover:text-slate-300",children:(0,a.jsx)(O.Z,{className:"w-4 h-4"})})]}),(0,a.jsx)("p",{className:"text-xs text-slate-500 mb-3",children:"Describe what you want built. Fredix (Product Manager) and Stoffe (Architect) will break it into tasks."}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("textarea",{placeholder:"e.g. Build a simple Todo Web App with add, complete, and delete functionality...",value:p,onChange:e=>b(e.target.value),rows:4,disabled:g,className:"w-full bg-[#030712] border border-slate-800 rounded-xl px-4 py-2.5 text-sm text-slate-300 placeholder:text-slate-600 focus:outline-none focus:border-cyan-800 resize-none disabled:opacity-50"}),f&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-cyan-400",children:[(0,a.jsx)(M.Z,{className:"w-3 h-3 animate-spin"}),f]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>{h(!1),N("")},className:"px-4 py-2 rounded-xl text-sm text-slate-400 hover:text-slate-300 transition-colors",children:"Cancel"}),(0,a.jsx)("button",{onClick:K,disabled:g||!p.trim(),className:"bg-cyan-600 hover:bg-cyan-700 disabled:opacity-30 text-white px-4 py-2 rounded-xl text-sm font-medium transition-colors",children:g?"Creating...":"Create Project"})]})]})]}),x?(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:Array.from({length:3}).map((e,s)=>(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5 animate-pulse",children:[(0,a.jsx)("div",{className:"h-5 bg-slate-800 rounded w-40 mb-3"}),(0,a.jsx)("div",{className:"h-3 bg-slate-800 rounded w-full mb-2"}),(0,a.jsx)("div",{className:"h-2 bg-slate-800 rounded-full w-2/3"})]},s))}):0===t.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-slate-500 gap-2",children:[(0,a.jsx)(c.Z,{className:"w-10 h-10 text-slate-700"}),(0,a.jsx)("p",{className:"text-sm",children:"No factory projects yet"}),(0,a.jsx)("p",{className:"text-xs text-slate-600",children:'Click "New Project" to describe what you want built'})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:t.map(e=>{var s;return(0,a.jsxs)("div",{onClick:()=>i(e),className:"bg-[#0b1120] border rounded-2xl p-5 cursor-pointer transition-all hover:border-slate-700 ".concat((null==n?void 0:n.id)===e.id?"border-cyan-800 ring-1 ring-cyan-800/30":"border-slate-800"),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-slate-200 truncate pr-2",children:e.title}),(0,a.jsx)("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full border whitespace-nowrap ".concat(null!==(s=W[e.status])&&void 0!==s?s:W.planning),children:e.status})]}),(0,a.jsx)("p",{className:"text-xs text-slate-500 line-clamp-2 mb-3",children:e.description}),(0,a.jsx)("div",{className:"w-full bg-slate-800 rounded-full h-1.5 mb-3",children:(0,a.jsx)("div",{className:"h-1.5 rounded-full transition-all ".concat("completed"===e.status?"bg-emerald-500":"running"===e.status?"bg-cyan-500":"paused"===e.status?"bg-amber-500":"failed"===e.status?"bg-red-500":"bg-slate-500"),style:{width:"".concat(Q(e),"%")}})}),(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:[e.completedTasks,"/",e.taskCount," tasks (",Q(e),"%)"]})]},e.id)})}),n&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-slate-300 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-cyan-400",children:"●"}),n.title]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:[Q(n),"% complete"]}),(0,a.jsxs)("button",{onClick:()=>S("status"===w?"pipeline":"status"),className:"flex items-center gap-1 text-[10px] px-2 py-1 rounded-lg bg-slate-800 text-slate-300 hover:bg-slate-700 transition-colors",children:["status"===w?(0,a.jsx)(P.Z,{className:"w-3 h-3"}):(0,a.jsx)(_.Z,{className:"w-3 h-3"}),"status"===w?"Pipeline":"Status"]}),"running"===n.status&&(0,a.jsxs)("button",{onClick:()=>q(n.id),className:"flex items-center gap-1 text-[10px] px-2 py-1 rounded-lg bg-amber-900/30 text-amber-400 hover:bg-amber-800/40 transition-colors",children:[(0,a.jsx)(R.Z,{className:"w-3 h-3"})," Pause"]}),"paused"===n.status&&(0,a.jsxs)("button",{onClick:()=>G(n.id),className:"flex items-center gap-1 text-[10px] px-2 py-1 rounded-lg bg-cyan-900/30 text-cyan-400 hover:bg-cyan-800/40 transition-colors",children:[(0,a.jsx)(F.Z,{className:"w-3 h-3"})," Resume"]}),["running","paused","failed"].includes(n.status)&&(0,a.jsxs)("button",{onClick:()=>$(n.id,"partial"),className:"flex items-center gap-1 text-[10px] px-2 py-1 rounded-lg bg-amber-900/30 text-amber-300 hover:bg-amber-800/40 transition-colors",children:[(0,a.jsx)(A.Z,{className:"w-3 h-3"})," Restart"]}),["running","paused","failed"].includes(n.status)&&(0,a.jsxs)("button",{onClick:()=>{confirm("Full restart will delete the entire workspace and reset ALL tasks. Are you sure?")&&$(n.id,"full")},className:"flex items-center gap-1 text-[10px] px-2 py-1 rounded-lg bg-red-900/30 text-red-400 hover:bg-red-800/40 transition-colors",children:[(0,a.jsx)(I.Z,{className:"w-3 h-3"})," Full Restart"]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>E(!Z),className:"flex items-center gap-1 text-[10px] px-2 py-1 rounded-lg bg-violet-900/30 text-violet-300 hover:bg-violet-800/40 transition-colors",children:[(0,a.jsx)(P.Z,{className:"w-3 h-3"})," Profile"]}),Z&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-[#0b1120] border border-slate-700 rounded-xl p-3 shadow-xl min-w-[200px]",children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-slate-400 mb-2 uppercase tracking-wider",children:"Switch Pipeline Profile"}),(0,a.jsx)("div",{className:"space-y-1",children:C.map(e=>{var s,t;return(0,a.jsxs)("button",{onClick:()=>X(n.id,e.id),disabled:T,className:"w-full text-left text-[11px] px-2 py-1.5 rounded-lg transition-colors ".concat(e.id===(null===(t=d[0])||void 0===t?void 0:null===(s=t.contextPayload)||void 0===s?void 0:s.pipeline_profile)?"bg-cyan-900/40 text-cyan-300":"text-slate-300 hover:bg-slate-800"),children:[(0,a.jsx)("span",{className:"font-medium",children:e.id}),(0,a.jsxs)("span",{className:"text-slate-500 ml-1",children:["(",e.mandatoryStages.length," stages)"]})]},e.id)})})]})]})]})]}),"status"===w?(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-3",children:B.map(e=>{let s=d.filter(s=>s.status===e.key);return(0,a.jsxs)("div",{className:"bg-[#030712] border border-slate-800 rounded-2xl p-3 min-h-[200px]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider",children:[e.emoji," ",e.label]}),(0,a.jsx)("span",{className:"text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded-full",children:s.length})]}),(0,a.jsx)("div",{className:"space-y-2",children:s.map(e=>(0,a.jsx)(z,{task:e,tasks:d,expandedTask:v,setExpandedTask:y,retryTask:V},e.id))})]},e.key)})}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("div",{className:"flex gap-3 min-w-max",children:[Object.entries(J).filter(e=>{let[s]=e;return d.some(e=>e.phase===s)}).map(e=>{let[s,t]=e,l=d.filter(e=>e.phase===s);return(0,a.jsxs)("div",{className:"bg-[#030712] border border-slate-800 rounded-2xl p-3 min-w-[220px] min-h-[200px]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider whitespace-nowrap",children:[t.emoji," ",t.label]}),(0,a.jsx)("span",{className:"text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded-full",children:l.length})]}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsx)(z,{task:e,tasks:d,expandedTask:v,setExpandedTask:y,retryTask:V},e.id))})]},s)}),d.filter(e=>e.phase&&!J[e.phase]).length>0&&(0,a.jsxs)("div",{className:"bg-[#030712] border border-slate-800 rounded-2xl p-3 min-w-[220px] min-h-[200px]",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,a.jsx)("span",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider",children:"Other"})}),(0,a.jsx)("div",{className:"space-y-2",children:d.filter(e=>e.phase&&!J[e.phase]).map(e=>(0,a.jsx)(z,{task:e,tasks:d,expandedTask:v,setExpandedTask:y,retryTask:V},e.id))})]})]})})]})]})]})},scheduler:function(e){let{ws:s}=e,[t,r]=(0,l.useState)([]),[n,c]=(0,l.useState)(!0),[d,o]=(0,l.useState)(!1),[x,m]=(0,l.useState)(!1),[u,h]=(0,l.useState)({name:"",schedule:"",prompt:""}),[p,b]=(0,l.useState)(!1),g=(0,l.useCallback)(async()=>{try{let e=await k("/api/scheduler/tasks",{unwrap:"tasks"});r(e||[])}catch(e){}finally{c(!1)}},[]);(0,l.useEffect)(()=>{g()},[g]);let j=(0,l.useCallback)(async()=>{try{d?(await k("/api/scheduler/stop",{method:"POST"}),o(!1)):(await k("/api/scheduler/start",{method:"POST"}),o(!0))}catch(e){}},[d]),f=(0,l.useCallback)(async e=>{try{await k("/api/scheduler/tasks/".concat(e.id),{method:"PATCH",body:JSON.stringify({enabled:!e.enabled})}),r(s=>s.map(s=>s.id===e.id?{...s,enabled:!s.enabled}:s))}catch(e){}},[]),N=(0,l.useCallback)(async e=>{try{await k("/api/scheduler/tasks/".concat(e),{method:"DELETE"}),r(s=>s.filter(s=>s.id!==e))}catch(e){}},[]),v=(0,l.useCallback)(async()=>{if(u.name&&u.schedule&&u.prompt){b(!0);try{let e=await k("/api/scheduler/tasks",{method:"POST",body:JSON.stringify({name:u.name,cron_expr:u.schedule,prompt:u.prompt})});r(s=>[...s,e]),h({name:"",schedule:"",prompt:""}),m(!1)}catch(e){}finally{b(!1)}}},[u]);return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-200 flex items-center gap-2",children:[(0,a.jsx)(i.Z,{className:"w-5 h-5 text-cyan-400"}),"Cron & Task Scheduler"]}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Manage scheduled tasks and automated prompts"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:j,className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-medium transition-colors ".concat(d?"bg-red-500/10 text-red-400 hover:bg-red-500/20 border border-red-900":"bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 border border-emerald-900"),children:d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(H.Z,{className:"w-4 h-4"})," Stop"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(F.Z,{className:"w-4 h-4"})," Start"]})}),(0,a.jsxs)("button",{onClick:()=>m(!0),className:"flex items-center gap-2 bg-cyan-600 hover:bg-cyan-700 text-white px-4 py-2 rounded-xl text-sm font-medium transition-colors",children:[(0,a.jsx)(L.Z,{className:"w-4 h-4"})," New Task"]})]})]}),x&&(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-slate-300",children:"New Scheduled Task"}),(0,a.jsx)("button",{onClick:()=>m(!1),className:"text-slate-500 hover:text-slate-300",children:(0,a.jsx)(O.Z,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("input",{type:"text",placeholder:"Task name",value:u.name,onChange:e=>h(s=>({...s,name:e.target.value})),className:"w-full bg-[#030712] border border-slate-800 rounded-xl px-4 py-2.5 text-sm text-slate-300 placeholder:text-slate-600 focus:outline-none focus:border-cyan-800"}),(0,a.jsx)("input",{type:"text",placeholder:"Cron schedule (e.g. */5 * * * *)",value:u.schedule,onChange:e=>h(s=>({...s,schedule:e.target.value})),className:"w-full bg-[#030712] border border-slate-800 rounded-xl px-4 py-2.5 text-sm text-slate-300 placeholder:text-slate-600 focus:outline-none focus:border-cyan-800 font-mono"}),(0,a.jsx)("textarea",{placeholder:"Prompt to execute",value:u.prompt,onChange:e=>h(s=>({...s,prompt:e.target.value})),rows:3,className:"w-full bg-[#030712] border border-slate-800 rounded-xl px-4 py-2.5 text-sm text-slate-300 placeholder:text-slate-600 focus:outline-none focus:border-cyan-800 resize-none"}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>m(!1),className:"px-4 py-2 rounded-xl text-sm text-slate-400 hover:text-slate-300 transition-colors",children:"Cancel"}),(0,a.jsx)("button",{onClick:v,disabled:p||!u.name||!u.schedule||!u.prompt,className:"bg-cyan-600 hover:bg-cyan-700 disabled:opacity-30 text-white px-4 py-2 rounded-xl text-sm font-medium transition-colors",children:p?"Creating...":"Create Task"})]})]})]}),n?(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:Array.from({length:3}).map((e,s)=>(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5 animate-pulse",children:[(0,a.jsx)("div",{className:"h-5 bg-slate-800 rounded w-32 mb-3"}),(0,a.jsx)("div",{className:"h-4 bg-slate-800 rounded w-24 mb-4"}),(0,a.jsx)("div",{className:"h-16 bg-slate-800 rounded"})]},s))}):0===t.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-slate-500 gap-2",children:[(0,a.jsx)(i.Z,{className:"w-10 h-10 text-slate-700"}),(0,a.jsx)("p",{className:"text-sm",children:"No scheduled tasks"}),(0,a.jsx)("p",{className:"text-xs text-slate-600",children:"Create a task to get started"})]}):(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:t.map(e=>{var s;return(0,a.jsxs)("div",{className:"bg-[#0b1120] border rounded-2xl p-5 group hover:border-slate-700 transition-all ".concat(e.enabled?"border-cyan-900/50":"border-slate-800"),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-slate-200 truncate",children:e.name}),(0,a.jsx)("span",{className:"inline-block mt-1 px-2 py-0.5 bg-slate-800 rounded-md text-xs font-mono text-slate-400",children:e.cron_expr})]}),(0,a.jsx)("span",{className:"w-2 h-2 rounded-full mt-1.5 flex-shrink-0 ".concat(e.enabled?"bg-cyan-400":"bg-slate-600")})]}),(0,a.jsx)("div",{className:"bg-[#030712] border border-slate-800 rounded-lg p-3 mb-3",children:(0,a.jsx)("pre",{className:"text-xs text-slate-400 whitespace-pre-wrap font-mono line-clamp-3",children:e.prompt})}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[(0,a.jsx)(C.Z,{className:"w-3 h-3"}),(0,a.jsxs)("span",{children:["Next: ",(s=e.next_run)?new Date(s).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,a.jsx)("button",{onClick:()=>f(e),className:"p-1.5 rounded-lg hover:bg-slate-800 text-slate-500 hover:text-slate-300 transition-colors",title:e.enabled?"Pause":"Resume",children:e.enabled?(0,a.jsx)(R.Z,{className:"w-3.5 h-3.5"}):(0,a.jsx)(F.Z,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{className:"p-1.5 rounded-lg hover:bg-slate-800 text-slate-500 hover:text-slate-300 transition-colors",title:"Edit",children:(0,a.jsx)(K.Z,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{onClick:()=>N(e.id),className:"p-1.5 rounded-lg hover:bg-red-500/10 text-slate-500 hover:text-red-400 transition-colors",title:"Delete",children:(0,a.jsx)(q.Z,{className:"w-3.5 h-3.5"})})]})]})]},e.id)})})]})},chat:function(e){let{ws:s}=e,[t,r]=(0,l.useState)([]),[n,c]=(0,l.useState)(""),[i,o]=(0,l.useState)([]),[x,m]=(0,l.useState)(""),[u,h]=(0,l.useState)(!1),[p,b]=(0,l.useState)(!1),[g,j]=(0,l.useState)(""),[f,N]=(0,l.useState)([]),[v,y]=(0,l.useState)(null),[w,S]=(0,l.useState)(!0),D=(0,l.useRef)(null),Z=(0,l.useRef)(null),E=(0,l.useRef)(!1),M=(0,l.useCallback)(async()=>{try{var e,s;let t=await k("/api/chat-sessions");N(null!==(e=t.sessions)&&void 0!==e?e:[]),y(null!==(s=t.activeId)&&void 0!==s?s:null)}catch(e){}},[]);(0,l.useEffect)(()=>{k("/api/models").then(e=>{var s,t;o(null!==(s=e.models)&&void 0!==s?s:[]),m(null!==(t=e.active)&&void 0!==t?t:"")}).catch(()=>{})},[]),(0,l.useEffect)(()=>{M()},[M]),(0,l.useEffect)(()=>{let e=s.on("response",e=>{j(s=>{var t;return s+(null!==(t=e.text)&&void 0!==t?t:"")}),e.done&&(r(s=>{var t,a;return[...s,{id:crypto.randomUUID(),role:"assistant",text:g+(null!==(t=e.text)&&void 0!==t?t:""),time:new Date,model:null!==(a=e.model)&&void 0!==a?a:x}]}),j(""),b(!1),E.current=!1,M())}),t=s.on("typing",()=>{b(!0)}),a=s.on("error",e=>{b(!1),j(""),r(s=>{var t;return[...s,{id:crypto.randomUUID(),role:"assistant",text:"⚠️ Error: ".concat(null!==(t=e.message)&&void 0!==t?t:"Unknown error"),time:new Date}]})});return()=>{e(),t(),a()}},[s,x,g,M]),(0,l.useEffect)(()=>{var e;null===(e=D.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[t,g,p]);let A=(0,l.useCallback)(async e=>{if(!p)try{var s;await k("/api/chat-sessions/"+e+"/switch",{method:"POST"});let t=await k("/api/chat-sessions/"+e),a=(null!==(s=t.messages)&&void 0!==s?s:[]).map((e,s)=>({id:"hist-".concat(s),role:e.role,text:e.content,time:new Date(e.timestamp)}));r(a),y(e),await M()}catch(e){}},[p,M]),O=(0,l.useCallback)(async()=>{if(!p)try{let e=await k("/api/chat-sessions/new",{method:"POST"});r([]),y(e.id),await M()}catch(e){}},[p,M]),P=(0,l.useCallback)(()=>{let e=n.trim();e&&s.connected&&(r(s=>[...s,{id:crypto.randomUUID(),role:"user",text:e,time:new Date}]),c(""),b(!0),E.current=!1,s.send({type:"message",text:e}),Z.current&&(Z.current.style.height="auto"))},[n,s]),_=(0,l.useCallback)(()=>{E.current=!0,s.send({type:"stop"}),g&&(r(e=>[...e,{id:crypto.randomUUID(),role:"assistant",text:g,time:new Date,model:x}]),j("")),b(!1)},[s,g,x]),R=(0,l.useCallback)(async e=>{try{await k("/api/models/active",{method:"POST",body:JSON.stringify({model:e})}),m(e)}catch(e){}finally{h(!1)}},[]),F=i.reduce((e,s)=>{var t;let a=null!==(t=s.provider)&&void 0!==t?t:"Other";return e[a]||(e[a]=[]),e[a].push(s),e},{});return(0,a.jsxs)("div",{className:"flex h-[calc(100vh-8rem)] gap-3",children:[w&&(0,a.jsxs)("div",{className:"w-64 shrink-0 bg-[#0b1120] border border-slate-800 rounded-2xl flex flex-col overflow-hidden",children:[(0,a.jsxs)("div",{className:"p-3 border-b border-slate-800 flex items-center justify-between shrink-0",children:[(0,a.jsx)("h4",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider",children:"Sessions"}),(0,a.jsx)("button",{onClick:O,disabled:p,className:"p-1.5 rounded-lg hover:bg-slate-800 text-cyan-400 hover:text-cyan-300 transition-colors disabled:opacity-30",title:"New chat",children:(0,a.jsx)(L.Z,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:[0===f.length&&(0,a.jsx)("p",{className:"text-xs text-slate-600 text-center py-4",children:"No sessions yet"}),f.map(e=>(0,a.jsx)("button",{onClick:()=>A(e.id),className:"w-full text-left p-2.5 rounded-xl transition-colors ".concat(v===e.id?"bg-cyan-500/10 border border-cyan-500/20":"hover:bg-slate-800/50 border border-transparent"),children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.Z,{className:"w-3.5 h-3.5 shrink-0 ".concat(v===e.id?"text-cyan-400":"text-slate-600")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-slate-300 truncate",children:e.summary||"Session #".concat(e.id)}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,a.jsxs)("span",{className:"text-[10px] text-slate-600 flex items-center gap-0.5",children:[(0,a.jsx)(C.Z,{className:"w-2.5 h-2.5"}),new Date(e.started_at).toLocaleString("sv-SE",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,a.jsxs)("span",{className:"text-[10px] text-slate-600",children:[e.message_count," msg"]})]})]})]})},e.id))]})]}),(0,a.jsxs)("div",{className:"flex flex-col flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 pb-3 border-b border-slate-800 mb-3",children:[(0,a.jsx)("button",{onClick:()=>S(!w),className:"p-1.5 rounded-lg hover:bg-slate-800 text-slate-500 hover:text-slate-300 transition-colors",title:w?"Hide sessions":"Show sessions",children:(0,a.jsx)(G.Z,{className:"w-4 h-4 transition-transform ".concat(w?"":"rotate-180")})}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>h(!u),className:"flex items-center gap-2 bg-[#0b1120] border border-slate-800 rounded-xl px-3 py-2 text-sm text-slate-300 hover:border-cyan-800 transition-colors",children:[(0,a.jsx)(V.Z,{className:"w-4 h-4 text-cyan-400"}),(0,a.jsx)("span",{className:"max-w-[200px] truncate",children:x||"Select Model"}),(0,a.jsx)(T.Z,{className:"w-3 h-3 text-slate-500"})]}),u&&(0,a.jsx)("div",{className:"absolute top-full left-0 mt-1 w-72 bg-[#0b1120] border border-slate-800 rounded-xl shadow-2xl z-50 max-h-80 overflow-y-auto",children:Object.entries(F).map(e=>{let[s,t]=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"px-3 py-2 text-xs font-semibold text-slate-500 uppercase tracking-wider",children:s}),t.map(e=>(0,a.jsx)("button",{onClick:()=>R(e.id),className:"w-full text-left px-3 py-2 text-sm hover:bg-slate-800/50 transition-colors ".concat(e.id===x?"text-cyan-400":"text-slate-300"),children:e.name},e.id))]},s)})})]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs ".concat(s.connected?"text-emerald-400":"text-red-400"),children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full ".concat(s.connected?"bg-emerald-400":"bg-red-400")}),s.connected?"Connected":"Disconnected"]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-4 pr-1 min-h-0",children:[0===t.length&&!p&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-slate-500 gap-2",children:[(0,a.jsx)(V.Z,{className:"w-12 h-12 text-slate-700"}),(0,a.jsx)("p",{className:"text-sm",children:"Start a conversation"})]}),t.map(e=>{var s;return(0,a.jsx)("div",{className:"flex ".concat("user"===e.role?"justify-end":"justify-start"),children:(0,a.jsxs)("div",{className:"max-w-[80%] ".concat("user"===e.role?"bg-cyan-600 text-white rounded-2xl rounded-br-sm px-4 py-2.5":"bg-[#030712] border border-slate-800 rounded-2xl rounded-bl-sm px-4 py-3"),children:["assistant"===e.role&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-xs text-slate-500",children:[(0,a.jsx)(V.Z,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:null!==(s=e.model)&&void 0!==s?s:"assistant"}),(0,a.jsx)("span",{children:"\xb7"}),(0,a.jsx)("span",{children:e.time.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),"user"===e.role?(0,a.jsx)("p",{className:"text-sm whitespace-pre-wrap",children:e.text}):(0,a.jsx)("div",{className:"prose prose-invert prose-sm prose-p:text-slate-300 prose-pre:bg-slate-900 prose-code:text-cyan-300 max-w-none text-slate-300 text-sm",dangerouslySetInnerHTML:{__html:(0,X.TU)(e.text)}})]})},e.id)}),p&&g&&(0,a.jsx)("div",{className:"flex justify-start",children:(0,a.jsxs)("div",{className:"max-w-[80%] bg-[#030712] border border-slate-800 rounded-2xl rounded-bl-sm px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-xs text-slate-500",children:[(0,a.jsx)(V.Z,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:x}),(0,a.jsx)("span",{className:"animate-pulse",children:"●"})]}),(0,a.jsx)("div",{className:"prose prose-invert prose-sm prose-p:text-slate-300 prose-pre:bg-slate-900 prose-code:text-cyan-300 max-w-none text-slate-300 text-sm",dangerouslySetInnerHTML:{__html:(0,X.TU)(g)}})]})}),p&&!g&&(0,a.jsx)("div",{className:"flex justify-start",children:(0,a.jsxs)("div",{className:"bg-[#030712] border border-slate-800 rounded-2xl rounded-bl-sm px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(V.Z,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:x}),(0,a.jsx)("span",{className:"animate-pulse",children:"●"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-2",children:[(0,a.jsx)("span",{className:"w-2 h-2 bg-cyan-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,a.jsx)("span",{className:"w-2 h-2 bg-cyan-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,a.jsx)("span",{className:"w-2 h-2 bg-cyan-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})]})}),(0,a.jsx)("div",{ref:D})]}),(0,a.jsx)("div",{className:"pt-3 border-t border-slate-800 mt-3",children:(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),P()},className:"flex items-end gap-2",children:[(0,a.jsx)("div",{className:"flex-1 relative",children:(0,a.jsx)("textarea",{ref:Z,value:n,onChange:e=>{c(e.target.value),e.target.style.height="auto",e.target.style.height=Math.min(e.target.scrollHeight,160)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),P())},placeholder:s.connected?"Type a message... (Enter to send, Shift+Enter for newline)":"Connecting...",disabled:!s.connected,rows:1,className:"w-full bg-[#0b1120] border border-slate-800 rounded-xl px-4 py-3 text-sm text-slate-300 placeholder:text-slate-600 focus:outline-none focus:border-cyan-800 resize-none disabled:opacity-50"})}),p?(0,a.jsx)("button",{type:"button",onClick:_,className:"bg-red-600 hover:bg-red-700 text-white p-3 rounded-xl transition-colors",children:(0,a.jsx)($.Z,{className:"w-5 h-5"})}):(0,a.jsx)("button",{type:"submit",disabled:!n.trim()||!s.connected,className:"bg-cyan-600 hover:bg-cyan-700 disabled:opacity-30 disabled:hover:bg-cyan-600 text-white p-3 rounded-xl transition-colors",children:(0,a.jsx)(Q.Z,{className:"w-5 h-5"})})]})})]})]})},skills:function(){let[e,s]=(0,l.useState)([]),[t,r]=(0,l.useState)(null);(0,l.useEffect)(()=>{k("/api/skills",{unwrap:"skills"}).then(e=>s(null!=e?e:[])).catch(()=>{})},[]);let n=e.filter(e=>e.content),c=e.filter(e=>!e.content);return(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-purple-400 mb-4",children:"Learned Skills"}),(0,a.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"Agent-created skills from data/skills/"}),(0,a.jsxs)("div",{className:"space-y-3",children:[0===n.length&&(0,a.jsx)("p",{className:"text-slate-600 text-sm",children:"No learned skills yet."}),n.map(e=>(0,a.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-hidden",children:[(0,a.jsxs)("button",{className:"w-full text-left px-4 py-3 hover:bg-slate-800/40 transition-colors flex items-start justify-between gap-3",onClick:()=>r(t===e.name?null:e.name),children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-slate-200 truncate",children:e.name}),(0,a.jsx)("div",{className:"text-xs text-slate-400 mt-1 line-clamp-2",children:e.description})]}),(0,a.jsx)("svg",{className:"w-4 h-4 text-slate-500 mt-1 shrink-0 transition-transform ".concat(t===e.name?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),t===e.name&&e.content&&(0,a.jsx)("div",{className:"border-t border-slate-800 bg-[#030712]",children:(0,a.jsx)("pre",{className:"p-4 text-xs text-slate-300 overflow-x-auto whitespace-pre-wrap font-mono leading-relaxed",children:e.content})})]},e.name))]})]}),(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-300 mb-4",children:"Core Skills"}),(0,a.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"Built-in skills from src/skills/"}),(0,a.jsxs)("div",{className:"space-y-3",children:[0===c.length&&(0,a.jsx)("p",{className:"text-slate-600 text-sm",children:"No core skills found."}),c.map(e=>(0,a.jsxs)("div",{className:"border border-slate-800 rounded-xl px-4 py-3",children:[(0,a.jsx)("div",{className:"font-medium text-slate-200",children:e.name}),(0,a.jsx)("div",{className:"text-xs text-slate-400 mt-1",children:e.description})]},e.name))]})]})]})},memory:function(){let[e,s]=(0,l.useState)([]),[t,r]=(0,l.useState)([]),[n,c]=(0,l.useState)([]);return(0,l.useEffect)(()=>{k("/api/memory/summaries",{unwrap:"summaries"}).then(e=>s(null!=e?e:[])).catch(()=>{}),k("/api/memory/facts",{unwrap:"facts"}).then(e=>r(null!=e?e:[])).catch(()=>{}),k("/api/memory/graph",{unwrap:"relations"}).then(e=>c(null!=e?e:[])).catch(()=>{})},[]),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-200 mb-4",children:"Auto-Summaries"}),(0,a.jsxs)("div",{className:"space-y-3 max-h-[600px] overflow-y-auto",children:[0===e.length&&(0,a.jsx)("p",{className:"text-slate-600 text-sm",children:"No summaries yet."}),e.map(e=>(0,a.jsxs)("div",{className:"border border-slate-800 rounded-xl px-4 py-3",children:[(0,a.jsx)("div",{className:"text-[10px] text-slate-500 mb-1",children:new Date(e.created_at).toLocaleString()}),(0,a.jsx)("p",{className:"text-sm text-slate-300 leading-relaxed",children:e.content})]},e.id))]})]}),(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-200 mb-4",children:"Extracted Facts"}),(0,a.jsxs)("div",{className:"space-y-3 max-h-[600px] overflow-y-auto",children:[0===t.length&&(0,a.jsx)("p",{className:"text-slate-600 text-sm",children:"No facts extracted yet."}),t.map(e=>(0,a.jsxs)("div",{className:"border border-slate-800 rounded-xl px-4 py-3",children:[(0,a.jsx)("p",{className:"text-sm text-slate-300 leading-relaxed",children:e.content}),(0,a.jsx)("div",{className:"text-[10px] text-slate-500 mt-2",children:e.category})]},e.id))]})]}),(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-200 mb-4",children:"Entity Graph"}),(0,a.jsxs)("div",{className:"space-y-3 max-h-[600px] overflow-y-auto",children:[0===n.length&&(0,a.jsx)("p",{className:"text-slate-600 text-sm",children:"No relations found."}),n.map(e=>(0,a.jsxs)("div",{className:"border border-slate-800 rounded-xl px-4 py-3 flex items-center gap-2 text-sm flex-wrap",children:[(0,a.jsx)("span",{className:"text-amber-400 font-medium",children:e.subject}),(0,a.jsxs)("span",{className:"text-slate-500",children:["--",e.relation,"->"]}),(0,a.jsx)("span",{className:"text-cyan-400 font-medium",children:e.object})]},e.id))]})]})]})},mesh:function(e){let{ws:s}=e,[t,r]=(0,l.useState)(""),[c,i]=(0,l.useState)(""),[d,o]=(0,l.useState)("default"),[x,h]=(0,l.useState)([]),[p,b]=(0,l.useState)(!1),g=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=s.on("mesh_progress",e=>{b(!1),h(s=>[...s,{id:"".concat(Date.now(),"-").concat(Math.random()),text:e.text||e.message||JSON.stringify(e),status:e.status||"running",timestamp:Date.now()}])}),t=s.on("response",e=>{let s=e.text||e.message||e.content||"";if(s){let e=s.toLowerCase().includes("complete")||s.toLowerCase().includes("done")||s.toLowerCase().includes("finished");e&&b(!0),h(t=>[...t,{id:"".concat(Date.now(),"-").concat(Math.random()),text:s,status:e?"done":"running",timestamp:Date.now()}])}});return()=>{e(),t()}},[s]),(0,l.useEffect)(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[x]);let j=()=>{t.trim()&&(h([]),b(!1),s.send({type:"message",text:"/mesh ".concat(t.trim())}),r(""))},f=()=>{c.trim()&&(h([]),b(!1),s.send({type:"message",text:"/swarm ".concat(c.trim())}),i(""))},N=e=>{switch(e){case"done":return(0,a.jsx)(Y.Z,{className:"w-4 h-4 text-emerald-400"});case"running":return(0,a.jsx)(n.Z,{className:"w-4 h-4 text-cyan-400 animate-pulse"});case"pending":return(0,a.jsx)(H.Z,{className:"w-4 h-4 text-slate-500"})}},v=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)(m.Z,{className:"w-5 h-5 text-cyan-400"}),(0,a.jsx)("h2",{className:"text-lg font-medium text-white",children:"Mesh & Swarm Workflows"})]}),(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"Launch multi-agent mesh or swarm workflows. Mesh decomposes a goal across agents; swarms assign tasks to a team."})]}),!s.connected&&(0,a.jsx)("div",{className:"bg-amber-400/10 border border-amber-400/30 rounded-lg px-4 py-3 text-amber-400 text-sm",children:"WebSocket not connected. Workflows require a live connection."}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 text-cyan-400"}),(0,a.jsx)("h3",{className:"text-sm font-medium text-white",children:"Run Mesh"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",placeholder:"Enter mesh goal...",value:t,onChange:e=>r(e.target.value),onKeyDown:e=>"Enter"===e.key&&j(),className:"flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-400"}),(0,a.jsx)("button",{onClick:j,disabled:!s.connected||!t.trim(),className:"px-4 py-2 bg-cyan-400 text-black rounded-lg hover:bg-cyan-300 transition-colors text-sm font-medium disabled:opacity-50",children:"Run Mesh"})]})]}),(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4 text-cyan-400"}),(0,a.jsx)("h3",{className:"text-sm font-medium text-white",children:"Run Swarm"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",placeholder:"Enter swarm task...",value:c,onChange:e=>i(e.target.value),onKeyDown:e=>"Enter"===e.key&&f(),className:"flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-400"}),(0,a.jsxs)("select",{value:d,onChange:e=>o(e.target.value),className:"bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-400",children:[(0,a.jsx)("option",{value:"default",children:"default"}),(0,a.jsx)("option",{value:"research",children:"research"}),(0,a.jsx)("option",{value:"engineering",children:"engineering"}),(0,a.jsx)("option",{value:"analysis",children:"analysis"})]}),(0,a.jsx)("button",{onClick:f,disabled:!s.connected||!c.trim(),className:"px-4 py-2 bg-cyan-400 text-black rounded-lg hover:bg-cyan-300 transition-colors text-sm font-medium disabled:opacity-50",children:"Run Swarm"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-white mb-2",children:"Live Output"}),(0,a.jsx)("div",{ref:g,className:"bg-[#0b1120] border border-slate-800 rounded-lg p-4 h-80 overflow-y-auto",children:0===x.length?(0,a.jsx)("p",{className:"text-slate-500 text-sm",children:"No workflow output yet. Start a mesh or swarm above."}):(0,a.jsxs)("div",{className:"space-y-3",children:[x.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"mt-0.5 shrink-0",children:N(e.status)}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"text-sm text-slate-300 whitespace-pre-wrap break-all",children:e.text}),(0,a.jsx)("p",{className:"text-xs text-slate-600 mt-0.5",children:v(e.timestamp)})]})]},e.id)),p&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-emerald-400 text-sm font-medium",children:[(0,a.jsx)(Y.Z,{className:"w-4 h-4"}),"Workflow complete"]})]})})]})]})},agents:function(){let[e,s]=(0,l.useState)([]),[t,r]=(0,l.useState)(null),[n,c]=(0,l.useState)([]),[i,d]=(0,l.useState)({}),[o,x]=(0,l.useState)({});(0,l.useEffect)(()=>{k("/api/agents").then(e=>{var t,a,l,n,i,o;s(null!==(t=e.agents)&&void 0!==t?t:[]),r(null!==(a=e.activeAgent)&&void 0!==a?a:null),c(null!==(l=e.availableModels)&&void 0!==l?l:[]);let x={};for(let s of null!==(n=e.agents)&&void 0!==n?n:[])x[s.id]={model:null!==(i=s.model)&&void 0!==i?i:"",fallbackModel:null!==(o=s.fallbackModel)&&void 0!==o?o:""};d(x)}).catch(()=>{})},[]);let m=(e,s,t)=>{d(a=>({...a,[e]:{...a[e],[s]:t}}))},u=async(e,t)=>{x(s=>({...s,[e]:!0}));try{let{model:a,fallbackModel:l}=i[e],r=await k("/api/agents/".concat(encodeURIComponent(t),"/model"),{method:"PATCH",body:JSON.stringify({model:a||null,fallbackModel:l||null})});s(s=>s.map(s=>s.id===e?r:s))}catch(e){console.error("Failed to save model:",e)}finally{x(s=>({...s,[e]:!1}))}},h=e=>{var s,t;let a=i[e.id];return!!a&&(a.model!==(null!==(s=e.model)&&void 0!==s?s:"")||a.fallbackModel!==(null!==(t=e.fallbackModel)&&void 0!==t?t:""))},p=e.reduce((e,s)=>{let t=s.team||"other";return e[t]||(e[t]=[]),e[t].push(s),e},{});return(0,a.jsx)("div",{className:"space-y-8",children:Object.entries(p).map(e=>{var s;let[l,r]=e;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full ".concat(null!==(s=ee[l])&&void 0!==s?s:"bg-slate-600")}),(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-200 capitalize",children:l}),(0,a.jsxs)("span",{className:"text-xs text-slate-500 ml-1",children:["(",r.length,")"]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:r.map(e=>{var s,l;let r=t===e.name,c=null!==(s=i[e.id])&&void 0!==s?s:{model:"",fallbackModel:""},d=null!==(l=o[e.id])&&void 0!==l&&l,x=h(e);return(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-5 hover:border-slate-700 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"font-medium text-slate-200 truncate",children:e.name}),r&&(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-cyan-400 animate-pulse shrink-0"})]}),e.builtIn&&(0,a.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 bg-slate-700 text-slate-400 rounded",children:"built-in"})]}),(0,a.jsx)("div",{className:"text-xs text-slate-400 mb-4 line-clamp-2",children:e.role}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-[10px] text-slate-500 mb-1",children:"Model"}),(0,a.jsxs)("select",{value:c.model,onChange:s=>m(e.id,"model",s.target.value),className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded-lg text-slate-200 focus:outline-none focus:border-cyan-500",children:[(0,a.jsx)("option",{value:"",children:"Default (global)"}),n.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-[10px] text-slate-500 mb-1",children:"Fallback"}),(0,a.jsxs)("select",{value:c.fallbackModel,onChange:s=>m(e.id,"fallbackModel",s.target.value),className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded-lg text-slate-200 focus:outline-none focus:border-cyan-500",children:[(0,a.jsx)("option",{value:"",children:"None"}),n.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]})]}),x&&(0,a.jsx)("button",{onClick:()=>u(e.id,e.name),disabled:d,className:"w-full px-3 py-1.5 text-xs bg-cyan-600 hover:bg-cyan-500 disabled:bg-slate-700 text-white rounded-lg transition-colors flex items-center justify-center gap-1",children:d?"Saving...":(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"\uD83D\uDCBE"})," Save"]})})]}),e.tools.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-3",children:e.tools.map(e=>(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] bg-slate-800 text-slate-400 rounded",children:e},e))}),e.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-2",children:e.tags.map(e=>(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] bg-cyan-400/10 text-cyan-400 rounded",children:e},e))})]},e.id)})})]},l)})})},documents:function(){let[e,s]=(0,l.useState)([]),[t,r]=(0,l.useState)("all"),[n,c]=(0,l.useState)(null);(0,l.useEffect)(()=>{k("/api/documents",{unwrap:"documents"}).then(e=>s(null!=e?e:[])).catch(()=>{})},[]);let i="all"===t?e:e.filter(e=>e.category===t);return(0,a.jsxs)("div",{className:"flex gap-6",children:[(0,a.jsx)("div",{className:"w-48 shrink-0",children:(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-4 sticky top-0",children:[(0,a.jsx)("h3",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-3",children:"Categories"}),(0,a.jsx)("div",{className:"space-y-1",children:es.map(e=>(0,a.jsx)("button",{onClick:()=>r(e),className:"w-full text-left px-3 py-1.5 rounded-lg text-sm capitalize transition-colors ".concat(t===e?"bg-cyan-400/10 text-cyan-400":"text-slate-400 hover:text-slate-300 hover:bg-slate-800/40"),children:e},e))})]})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsxs)("div",{className:"space-y-3",children:[0===i.length&&(0,a.jsx)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-8 text-center text-slate-600 text-sm",children:"No documents found."}),i.map(e=>{var s;let t="html"===e.file_ext||".html"===e.file_ext;return(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl px-5 py-4 flex items-center gap-4 hover:border-slate-700 transition-colors relative group",onMouseEnter:()=>c(e.id),onMouseLeave:()=>c(null),children:[(0,a.jsx)(et,{ext:e.file_ext}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-slate-200 truncate",children:e.title}),t&&(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] bg-cyan-400/10 text-cyan-400 rounded shrink-0",children:"Canvas Ready"})]}),(0,a.jsxs)("div",{className:"text-xs text-slate-500 mt-0.5 flex items-center gap-3",children:[(0,a.jsx)("span",{children:e.filename}),(0,a.jsx)("span",{children:(s=e.size_bytes)<1024?"".concat(s," B"):s<1048576?"".concat((s/1024).toFixed(1)," KB"):"".concat((s/1048576).toFixed(1)," MB")}),(0,a.jsx)("span",{children:new Date(e.created_at).toLocaleDateString()})]})]}),n===e.id&&(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t&&(0,a.jsx)("button",{className:"px-2.5 py-1 text-xs bg-cyan-400/10 text-cyan-400 rounded-lg hover:bg-cyan-400/20 transition-colors",children:"Render"}),(0,a.jsx)("button",{className:"px-2.5 py-1 text-xs bg-slate-800 text-slate-400 rounded-lg hover:bg-slate-700 transition-colors",children:"Edit"}),(0,a.jsx)("button",{className:"px-2.5 py-1 text-xs bg-red-400/10 text-red-400 rounded-lg hover:bg-red-400/20 transition-colors",children:"Delete"})]})]},e.id)})]})})]})},terminal:function(e){let{ws:s}=e,[t,r]=(0,l.useState)([]),n=(0,l.useRef)(null),c=(0,l.useRef)(0),i=e=>{let s=c.current++,t=null==e.id?"":String(e.id),a="string"==typeof e.time?e.time:"--:--:--",l="string"==typeof e.source?e.source:"Core";return{dedupeId:t?"log-".concat(t):void 0,time:a,source:l,msg:function(e){if("string"==typeof e)return e;if(null==e)return"";if("number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(s){return String(e)}}(e.msg),key:t?"log-".concat(t,"-").concat(s):"log-".concat(a,"-").concat(l,"-").concat(s)}};return(0,l.useEffect)(()=>{k("/api/logs",{unwrap:!0}).then(e=>{Array.isArray(e)&&r(e.map(e=>i(e)).slice(-500))}).catch(()=>{})},[]),(0,l.useEffect)(()=>s.on("log",e=>{let s=i(null!=e?e:{});r(e=>s.dedupeId&&e.some(e=>e.dedupeId===s.dedupeId)?e:[...e.slice(-499),s])}),[s]),(0,l.useEffect)(()=>{let e=n.current;e&&(e.scrollTop=e.scrollHeight)},[t]),(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl overflow-hidden flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-slate-800 bg-[#030712]",children:[(0,a.jsx)("span",{className:"w-3 h-3 rounded-full bg-red-500/80"}),(0,a.jsx)("span",{className:"w-3 h-3 rounded-full bg-amber-500/80"}),(0,a.jsx)("span",{className:"w-3 h-3 rounded-full bg-green-500/80"}),(0,a.jsx)("span",{className:"ml-3 text-xs text-slate-500 font-mono",children:"system.log"}),(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full ".concat(s.connected?"bg-green-400":"bg-red-400")}),(0,a.jsx)("span",{className:"text-[10px] text-slate-600",children:s.connected?"Live":"Disconnected"})]})]}),(0,a.jsxs)("div",{ref:n,className:"p-4 font-mono text-xs leading-relaxed overflow-y-auto max-h-[600px] min-h-[400px]",children:[0===t.length&&(0,a.jsx)("div",{className:"text-slate-600",children:"Waiting for logs..."}),t.map(e=>{var s;return(0,a.jsxs)("div",{className:"flex gap-2 py-0.5 hover:bg-slate-800/20",children:[(0,a.jsxs)("span",{className:"text-slate-600 shrink-0",children:["[",e.time,"]"]}),(0,a.jsx)("span",{className:"shrink-0 font-semibold ".concat(null!==(s=ea[e.source])&&void 0!==s?s:"text-slate-400"),children:e.source}),(0,a.jsx)("span",{className:"text-slate-300",children:e.msg})]},e.key)})]})]})},usage:function(){let[e,s]=(0,l.useState)(null),[t,r]=(0,l.useState)(!0),[c,i]=(0,l.useState)(null);if((0,l.useEffect)(()=>{r(!0),k("/api/usage").then(s).catch(e=>i(e.message)).finally(()=>r(!1))},[]),t)return(0,a.jsxs)("div",{className:"flex items-center justify-center h-64",children:[(0,a.jsx)(n.Z,{className:"w-6 h-6 text-cyan-400 animate-pulse"}),(0,a.jsx)("span",{className:"ml-2 text-slate-400",children:"Loading usage data..."})]});if(c)return(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsxs)("span",{className:"text-red-400",children:["Failed to load usage data: ",c]})});if(!e)return null;let{summary:d,recent:o}=e,x=[{label:"Total Calls (24h)",value:d.totalCalls.toLocaleString(),icon:f.Z,color:"text-emerald-400",bg:"bg-emerald-400/10"},{label:"Total Tokens (24h)",value:d.totalTokens.toLocaleString(),icon:n.Z,color:"text-blue-400",bg:"bg-blue-400/10"},{label:"Total Cost (24h)",value:"$".concat(d.totalCost.toFixed(6)),icon:b.Z,color:"text-amber-400",bg:"bg-amber-400/10"},{label:"Avg Latency (ms)",value:d.avgLatencyMs.toFixed(1),icon:C.Z,color:"text-purple-400",bg:"bg-purple-400/10"}];return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:x.map(e=>(0,a.jsx)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg ".concat(e.bg),children:(0,a.jsx)(e.icon,{className:"w-5 h-5 ".concat(e.color)})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-slate-400",children:e.label}),(0,a.jsx)("p",{className:"text-xl font-semibold text-white",children:e.value})]})]})},e.label))}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-medium text-white mb-3",children:"Cost by Model"}),(0,a.jsx)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg overflow-hidden",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,a.jsx)("th",{className:"text-left text-sm font-medium text-slate-400 px-4 py-3",children:"Model"}),(0,a.jsx)("th",{className:"text-right text-sm font-medium text-slate-400 px-4 py-3",children:"Calls"}),(0,a.jsx)("th",{className:"text-right text-sm font-medium text-slate-400 px-4 py-3",children:"Tokens"}),(0,a.jsx)("th",{className:"text-right text-sm font-medium text-slate-400 px-4 py-3",children:"Cost"})]})}),(0,a.jsxs)("tbody",{children:[d.byModel.map(e=>(0,a.jsxs)("tr",{className:"border-b border-slate-800/50 last:border-0",children:[(0,a.jsx)("td",{className:"px-4 py-3 text-sm text-white font-mono",children:e.model}),(0,a.jsx)("td",{className:"px-4 py-3 text-sm text-slate-300 text-right",children:e.calls.toLocaleString()}),(0,a.jsx)("td",{className:"px-4 py-3 text-sm text-slate-300 text-right",children:e.tokens.toLocaleString()}),(0,a.jsxs)("td",{className:"px-4 py-3 text-sm text-amber-400 text-right",children:["$",e.cost.toFixed(6)]})]},e.model)),0===d.byModel.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:4,className:"px-4 py-6 text-center text-slate-500 text-sm",children:"No usage data available"})})]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-medium text-white mb-3",children:"Recent Calls"}),(0,a.jsxs)("div",{className:"space-y-2",children:[o.slice(0,10).map((e,s)=>(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg px-4 py-3 flex flex-wrap items-center gap-x-6 gap-y-1",children:[(0,a.jsx)("span",{className:"text-sm font-mono text-cyan-400",children:e.model}),(0,a.jsxs)("span",{className:"text-sm text-slate-400",children:[e.totalTokens.toLocaleString()," tokens"]}),(0,a.jsxs)("span",{className:"text-sm text-amber-400",children:["$",e.costUsd.toFixed(6)]}),(0,a.jsxs)("span",{className:"text-sm text-slate-400",children:[e.latencyMs,"ms"]}),e.source&&(0,a.jsx)("span",{className:"text-xs text-slate-500 bg-slate-800 px-2 py-0.5 rounded",children:e.source})]},s)),0===o.length&&(0,a.jsx)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg px-4 py-6 text-center text-slate-500 text-sm",children:"No recent calls"})]})]})]})},webhooks:function(){let[e,s]=(0,l.useState)([]),[t,r]=(0,l.useState)(!0),[n,c]=(0,l.useState)(null),[i,d]=(0,l.useState)(!1),[o,x]=(0,l.useState)(en),[m,u]=(0,l.useState)(!1),[h,p]=(0,l.useState)(null),b=(0,l.useCallback)(()=>{r(!0),k("/api/webhooks",{unwrap:"webhooks"}).then(e=>s(null!=e?e:[])).catch(e=>c(e.message)).finally(()=>r(!1))},[]);(0,l.useEffect)(()=>{b()},[b]);let j=async()=>{if(o.name&&o.path&&o.prompt_template){u(!0);try{let e={name:o.name,path:o.path,prompt_template:o.prompt_template};o.secret&&(e.secret=o.secret),await k("/api/webhooks",{method:"POST",body:JSON.stringify(e)}),x(en),d(!1),b()}catch(e){c(e.message)}finally{u(!1)}}},f=async e=>{try{await k("/api/webhooks/".concat(e),{method:"DELETE"}),s(s=>s.filter(s=>s.id!==e))}catch(e){c(e.message)}},N=(e,s)=>{let t="".concat(v,"/webhook/").concat(e);navigator.clipboard.writeText(t),p(s),setTimeout(()=>p(null),2e3)};return t?(0,a.jsxs)("div",{className:"flex items-center justify-center h-64",children:[(0,a.jsx)(g.Z,{className:"w-6 h-6 text-cyan-400 animate-pulse"}),(0,a.jsx)("span",{className:"ml-2 text-slate-400",children:"Loading webhooks..."})]}):(0,a.jsxs)("div",{className:"space-y-6",children:[n&&(0,a.jsxs)("div",{className:"bg-red-400/10 border border-red-400/30 rounded-lg px-4 py-3 text-red-400 text-sm",children:[n,(0,a.jsx)("button",{className:"ml-2 underline",onClick:()=>c(null),children:"dismiss"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(g.Z,{className:"w-5 h-5 text-cyan-400"}),(0,a.jsx)("h2",{className:"text-lg font-medium text-white",children:"Webhook Endpoints"})]}),(0,a.jsxs)("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-4 py-2 bg-cyan-400/10 text-cyan-400 rounded-lg hover:bg-cyan-400/20 transition-colors text-sm font-medium",children:[(0,a.jsx)(L.Z,{className:"w-4 h-4"}),"Create Webhook"]})]}),i&&(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsx)("input",{type:"text",placeholder:"Name",value:o.name,onChange:e=>x(s=>({...s,name:e.target.value})),className:"bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-400"}),(0,a.jsx)("input",{type:"text",placeholder:"Path (e.g. my-hook)",value:o.path,onChange:e=>x(s=>({...s,path:e.target.value})),className:"bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-400"})]}),(0,a.jsx)("input",{type:"text",placeholder:"Secret (optional)",value:o.secret,onChange:e=>x(s=>({...s,secret:e.target.value})),className:"w-full bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-400"}),(0,a.jsx)("textarea",{placeholder:"Prompt template",value:o.prompt_template,onChange:e=>x(s=>({...s,prompt_template:e.target.value})),rows:4,className:"w-full bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-400 font-mono"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:j,disabled:m,className:"px-4 py-2 bg-cyan-400 text-black rounded-lg hover:bg-cyan-300 transition-colors text-sm font-medium disabled:opacity-50",children:m?"Creating...":"Create"}),(0,a.jsx)("button",{onClick:()=>{d(!1),x(en)},className:"px-4 py-2 bg-slate-800 text-slate-300 rounded-lg hover:bg-slate-700 transition-colors text-sm",children:"Cancel"})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:e.map(e=>(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-lg p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-white font-medium",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,a.jsx)(el.Z,{className:"w-3.5 h-3.5 text-slate-500"}),(0,a.jsxs)("code",{className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:[v,"/webhook/",e.path]})]})]}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full ".concat(e.enabled?"bg-emerald-400/10 text-emerald-400":"bg-slate-700 text-slate-400"),children:e.enabled?"Active":"Disabled"})]}),(0,a.jsx)("div",{className:"bg-slate-900 rounded-lg p-3",children:(0,a.jsx)("code",{className:"text-xs text-cyan-300 whitespace-pre-wrap break-all leading-relaxed",children:e.prompt_template})}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,a.jsxs)("button",{onClick:()=>N(e.path,e.id),className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-800 text-slate-300 rounded text-xs hover:bg-slate-700 transition-colors",children:[(0,a.jsx)(er.Z,{className:"w-3.5 h-3.5"}),h===e.id?"Copied!":"Copy URL"]}),(0,a.jsxs)("button",{onClick:()=>f(e.id),className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-400/10 text-red-400 rounded text-xs hover:bg-red-400/20 transition-colors",children:[(0,a.jsx)(q.Z,{className:"w-3.5 h-3.5"}),"Delete"]})]})]},e.id))}),0===e.length&&!i&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(g.Z,{className:"w-10 h-10 text-slate-600 mx-auto mb-3"}),(0,a.jsx)("p",{className:"text-slate-500 text-sm",children:"No webhooks configured. Create one to get started."})]})]})},sessions:function(e){let{ws:s}=e,[t,r]=(0,l.useState)([]),[n,c]=(0,l.useState)(null),[i,o]=(0,l.useState)([]),[x,m]=(0,l.useState)(!0);return(0,l.useEffect)(()=>{k("/api/sessions",{unwrap:"sessions"}).then(e=>r(null!=e?e:[])).catch(()=>{}).finally(()=>m(!1))},[]),(0,l.useEffect)(()=>{n&&k("/api/sessions/".concat(n),{unwrap:"messages"}).then(e=>o(null!=e?e:[])).catch(()=>{})},[n]),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-xl font-medium text-slate-200 flex items-center gap-2",children:[(0,a.jsx)(j.Z,{className:"text-cyan-400"})," Agent Sessions"]}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Isolated sub-agent sessions with their own conversation history and tool access."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"bg-[#0b1120] border border-slate-800 rounded-2xl p-4 space-y-2 max-h-[calc(100vh-16rem)] overflow-y-auto",children:[(0,a.jsxs)("h4",{className:"text-[11px] uppercase tracking-widest text-slate-400 font-bold mb-3 px-2",children:["Sessions (",t.length,")"]}),x?(0,a.jsx)("div",{className:"text-sm text-slate-500 px-2",children:"Loading..."}):0===t.length?(0,a.jsx)("div",{className:"text-sm text-slate-500 px-2",children:"No active sessions"}):t.map(e=>(0,a.jsxs)("button",{onClick:()=>c(e.id),className:"w-full text-left p-3 rounded-xl transition-colors flex items-center justify-between ".concat(n===e.id?"bg-cyan-500/10 border border-cyan-500/20":"bg-[#030712] border border-slate-800 hover:border-slate-700"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 bg-[#0b1120] rounded-lg border border-slate-800",children:(0,a.jsx)(j.Z,{size:14,className:"text-cyan-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-slate-200",children:["Session #",e.id]}),(0,a.jsxs)("div",{className:"text-[10px] text-slate-500 flex items-center gap-1",children:[(0,a.jsx)(C.Z,{size:10})," ",new Date(e.created_at).toLocaleString("sv-SE")]})]})]}),(0,a.jsx)(ec.Z,{size:16,className:"text-slate-600"})]},e.id))]}),(0,a.jsx)("div",{className:"lg:col-span-2 bg-[#0b1120] border border-slate-800 rounded-2xl overflow-hidden flex flex-col max-h-[calc(100vh-16rem)]",children:n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"p-4 border-b border-slate-800 flex items-center justify-between shrink-0",children:[(0,a.jsxs)("h4",{className:"text-sm font-medium text-slate-200 flex items-center gap-2",children:[(0,a.jsx)(d.Z,{size:14,className:"text-cyan-400"})," Session #",n]}),(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:[i.length," messages"]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[i.map(e=>(0,a.jsx)("div",{className:"flex ".concat("user"===e.role?"justify-end":"justify-start"),children:(0,a.jsxs)("div",{className:"max-w-[80%] rounded-xl px-4 py-3 text-sm ".concat("user"===e.role?"bg-cyan-600 text-white rounded-br-sm":"bg-[#030712] border border-slate-800 text-slate-300 rounded-bl-sm"),children:["user"!==e.role&&(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-cyan-500 mb-1 font-bold",children:e.role}),(0,a.jsx)("p",{className:"whitespace-pre-wrap leading-relaxed",children:e.content})]})},e.id)),0===i.length&&(0,a.jsx)("div",{className:"text-center text-slate-500 text-sm py-8",children:"No messages yet"})]})]}):(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-500 text-sm",children:"Select a session to view messages"})})]})]})}};function eo(){var e,s;let[t,n]=(0,l.useState)("overview"),[c,i]=(0,l.useState)(0),[d,o]=(0,l.useState)(0),[x,m]=(0,l.useState)("loading"),u=function(){let e=(0,l.useRef)(null),s=(0,l.useRef)(new Map),t=(0,l.useRef)(null),a=(0,l.useRef)(!1),[r,n]=(0,l.useState)(!1),c=(0,l.useCallback)(()=>{var l,r;if(!a.current||(null===(l=e.current)||void 0===l?void 0:l.readyState)===WebSocket.OPEN||(null===(r=e.current)||void 0===r?void 0:r.readyState)===WebSocket.CONNECTING)return;let i=new WebSocket("".concat(y,"/ws"));i.onopen=()=>{i.send(JSON.stringify({type:"auth",token:w}))},i.onmessage=e=>{try{let t=JSON.parse(e.data);if("auth_ok"===t.type)n(!0),i.send(JSON.stringify({type:"subscribe",channels:["logs"]}));else if("auth_error"===t.type)console.error("WS auth failed:",t.reason),n(!1);else{let e="dashboard_event"===t.type?t.event:t.type,a=s.current.get(e);if(a)for(let e of a)e(t);let l=s.current.get("*");if(l)for(let e of l)e(t)}}catch(e){}},i.onclose=()=>{e.current=null,n(!1),a.current&&(t.current=setTimeout(()=>c(),3e3))},i.onerror=()=>{i.close()},e.current=i},[]);return(0,l.useEffect)(()=>(a.current=!0,c(),()=>{var s;a.current=!1,t.current&&(clearTimeout(t.current),t.current=null),null===(s=e.current)||void 0===s||s.close(),e.current=null}),[c]),{connected:r,on:(0,l.useCallback)((e,t)=>(s.current.has(e)||s.current.set(e,new Set),s.current.get(e).add(t),()=>{var a;null===(a=s.current.get(e))||void 0===a||a.delete(t)}),[]),send:(0,l.useCallback)(s=>{var t;(null===(t=e.current)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&e.current.send(JSON.stringify(s))},[])}}();(0,l.useEffect)(()=>{k("/api/status").then(e=>{var s,t;m("online"),i(null!==(s=e.nudgeMemory)&&void 0!==s?s:0),o(null!==(t=e.nudgeSkill)&&void 0!==t?t:0)}).catch(()=>m("offline"))},[]),(0,l.useEffect)(()=>u.on("nudge",e=>{if(e.data){var s,t;i(null!==(s=e.data.memory)&&void 0!==s?s:0),o(null!==(t=e.data.skill)&&void 0!==t?t:0)}}),[u]);let h=ed[t];return(0,a.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden bg-[#030712]",children:[(0,a.jsxs)("aside",{className:"flex w-64 flex-shrink-0 flex-col border-r border-slate-800/60 bg-[#0b1120]",style:{width:256},children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 border-b border-slate-800/60 px-5 py-5",children:[(0,a.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-cyan-500/10",children:(0,a.jsx)(f.Z,{className:"h-5 w-5 text-cyan-400",style:{filter:"drop-shadow(0 0 6px rgba(34,211,238,0.6))"}})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-sm font-semibold text-slate-100",children:"CF Claw"}),(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"AgentOS Dashboard"})]})]}),(0,a.jsx)("nav",{className:"flex-1 overflow-y-auto px-3 py-3",children:(0,a.jsx)("div",{className:"space-y-0.5",children:ei.map(e=>{let s=e.icon,l=t===e.id;return(0,a.jsxs)("button",{onClick:()=>n(e.id),className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors ".concat(l?"border border-cyan-500/20 bg-cyan-500/10 text-cyan-400":"border border-transparent text-slate-400 hover:bg-slate-800/40 hover:text-slate-300"),children:[(0,a.jsx)(s,{className:"h-4 w-4 flex-shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.label})]},e.id)})})}),(0,a.jsxs)("div",{className:"border-t border-slate-800/60 p-4",children:[(0,a.jsx)("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-500",children:"Nudge Counters"}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-slate-400",children:"Memory Nudge"}),(0,a.jsxs)("span",{className:"text-xs font-mono text-cyan-400",children:[c,"/10"]})]}),(0,a.jsx)("div",{className:"h-1.5 w-full rounded-full bg-slate-800",children:(0,a.jsx)("div",{className:"h-1.5 rounded-full bg-cyan-500 transition-all duration-500",style:{width:"".concat(10*c,"%")}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-slate-400",children:"Skill Edit Nudge"}),(0,a.jsxs)("span",{className:"text-xs font-mono text-purple-400",children:[d,"/10"]})]}),(0,a.jsx)("div",{className:"h-1.5 w-full rounded-full bg-slate-800",children:(0,a.jsx)("div",{className:"h-1.5 rounded-full bg-purple-500 transition-all duration-500",style:{width:"".concat(10*d,"%")}})})]})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-slate-800/60 bg-[#0b1120] px-6 py-3",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-slate-100",children:null!==(s=null===(e=ei.find(e=>e.id===t))||void 0===e?void 0:e.label)&&void 0!==s?s:t}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"h-2 w-2 rounded-full ".concat("online"===x?"bg-emerald-400":"offline"===x?"bg-red-400":"animate-pulse bg-amber-400")}),(0,a.jsx)("span",{className:"text-xs text-slate-500",children:"online"===x?"Connected":"offline"===x?"Disconnected":"Connecting..."}),(0,a.jsx)("span",{className:"mx-1 text-slate-700",children:"|"}),(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:["WS: ",u.connected?"Live":"Closed"]})]}),(0,a.jsxs)(r.default,{href:"/manual",className:"flex items-center gap-1.5 rounded-lg border border-slate-700/50 bg-slate-800/40 px-3 py-1.5 text-xs font-medium text-slate-400 transition-colors hover:border-cyan-500/30 hover:bg-cyan-500/10 hover:text-cyan-400",children:[(0,a.jsx)(N.Z,{className:"h-3.5 w-3.5"}),"Help"]})]})]}),(0,a.jsx)("main",{className:"flex-1 overflow-y-auto p-6",children:(0,a.jsx)(h,{ws:u})})]})]})}}},function(e){e.O(0,[343,191,971,117,744],function(){return e(e.s=575)}),_N_E=e.O()}]);
|