diff --git a/backend/routers/system.py b/backend/routers/system.py index 50908ed..2654820 100644 --- a/backend/routers/system.py +++ b/backend/routers/system.py @@ -98,6 +98,10 @@ def services() -> dict: "ok": _mem0_reachable(), "scope": "user"}, {"name": "Voice (STT/TTS)", "unit": "voice-service", "url": VOICE_SERVICE_URL, "ok": _voice_reachable(), "scope": "user"}, + # ttyd hinter dem /console/-Proxy — war als einziger UI-Dienst NICHT in der Liste, + # das Konsole-Overlay schickte den User deshalb ins SSH statt zum Restart-Knopf. + {"name": "Box-Konsole (ttyd)", "unit": "box-console", "url": "/console/", + "ok": bool(a.get("box_console_reachable")), "scope": "user"}, ] return { "services": rows, diff --git a/backend/services/maintenance.py b/backend/services/maintenance.py index d3506d6..7beed07 100644 --- a/backend/services/maintenance.py +++ b/backend/services/maintenance.py @@ -19,7 +19,7 @@ from services import catalog, discover, jobengine, llamaswap, system # System-Dienste (root, via sudo -n NOPASSWD) vs. User-Dienste (systemctl --user). SYSTEM_SERVICES = {"llama-swap"} -USER_SERVICES = {"mission-control-2", "mc2-gateway", "mc2-steward", +USER_SERVICES = {"mission-control-2", "mc2-gateway", "mc2-steward", "box-console", "hermes-gateway", "hermes-builtin-ui", "mem0-service", "voice-service"} # Engine-Update: lädt den neuesten Vulkan-Build (deploy/update-engine.sh, läuft als root). diff --git a/frontend/dist/assets/AgentView-BMf46hOH.js b/frontend/dist/assets/AgentView-wFJrgQGO.js similarity index 62% rename from frontend/dist/assets/AgentView-BMf46hOH.js rename to frontend/dist/assets/AgentView-wFJrgQGO.js index a2e4a8f..0753dc5 100644 --- a/frontend/dist/assets/AgentView-BMf46hOH.js +++ b/frontend/dist/assets/AgentView-wFJrgQGO.js @@ -1,6 +1,6 @@ -import{c as E,Y as P,l as A,b as B,u as D,r as M,j as e,Z as T,e as a,$ as g,a0 as b,a1 as W,x as f,a2 as z,W as G,X as U,C as j,g as N,q as i}from"./index-D94Dzyvg.js";/** +import{c as A,Y as P,l as B,b as M,u as D,r as z,j as e,Z as T,e as a,$ as g,a0 as b,a1 as W,x as f,a2 as j,W as G,X as I,C as N,g as y,q as i}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const y=E("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),q=["chat","coding","fast","heavy"];function $(){const{data:r,error:c}=P(),{data:d}=A(),{showAlert:n,dialogElement:w}=B(),o=D(),x=c?String(c):"",[v,l]=M.useState(!1),k=(d==null?void 0:d.models)??[],m=s=>{var t;return((t=s==null?void 0:s.match(/:(\d+)/))==null?void 0:t[1])??""},u=m(r==null?void 0:r.gateway_url)||"8642",p=(r==null?void 0:r.pc_executor_url)??"",_=p.replace(/^https?:\/\//,""),S=m(p)||"7777";async function C(s){try{await N("/api/agent/brain",{method:"POST",body:JSON.stringify({model:s})}),n("Erledigt",`Hermes-Hirn zeigt jetzt auf das Alias '${s}'. Der Gateway-Dienst wurde neu gestartet.`),o.invalidateQueries({queryKey:i.agentStatus}),l(!1)}catch(t){n("Fehler",`Wechsel fehlgeschlagen: ${t.message||t}`)}}async function H(s){try{await N("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:s})}),n("Erledigt","Agent-Hirn gewechselt (warm gehalten). Gateway wurde neugestartet."),o.invalidateQueries({queryKey:i.agentStatus}),o.invalidateQueries({queryKey:i.models}),l(!1)}catch(t){n("Fehler",`Wechsel fehlgeschlagen: ${t.message||t}`)}}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",e.jsxs("code",{children:[":",u]}),") und seine eigene UI besitzt."]})]}),(r==null?void 0:r.hermes_ui_url)&&e.jsxs("a",{href:g(r.hermes_ui_url),target:"_blank",rel:"noopener",className:a("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",r.hermes_ui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[e.jsx(T,{className:"h-4 w-4"}),e.jsx("span",{children:"Hermes-GUI öffnen"})]})]}),x&&e.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",x,")."]}),r&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"mc-card p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx(b,{className:"h-4.5 w-4.5 text-primary"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Fluss"})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-stretch gap-3",children:[e.jsxs("button",{onClick:()=>r.hermes_ui_reachable&&window.open(g(r.hermes_ui_url),"_blank"),title:r.hermes_ui_reachable?"Hermes-GUI öffnen":"Desktop-Gateway offline",className:"lg:w-40 shrink-0 rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/40 transition-all cursor-pointer flex flex-col justify-center",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(W,{className:a("h-3.5 w-3.5",r.hermes_ui_reachable?"text-emerald-400":"text-amber-500")}),e.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Desktop & GUI"}),e.jsx("span",{className:a("ml-auto h-1.5 w-1.5 rounded-full animate-pulse",r.hermes_ui_reachable?"bg-emerald-500":"bg-amber-500")})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mt-0.5",children:"Hermes Desktop · Clients"})]}),e.jsx("div",{className:"hidden lg:flex items-center text-muted-foreground text-lg select-none",children:"→"}),e.jsxs("div",{className:"flex-1 flex flex-col gap-2.5",children:[e.jsxs("div",{className:"rounded-xl border border-primary/40 bg-primary/5 px-3.5 py-2.5 flex items-center gap-2",children:[e.jsx(b,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-primary",children:"Agent Gateway"}),e.jsxs("span",{className:"text-[11px] font-mono text-muted-foreground",children:[":",u]}),e.jsxs("span",{className:a("ml-auto inline-flex items-center gap-1.5 text-[10px] font-bold uppercase font-mono px-2 py-0.5 rounded-full border",r.gateway_reachable?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-400 border-red-500/20"),children:[e.jsx("span",{className:a("h-1.5 w-1.5 rounded-full",r.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-red-500")}),r.gateway_reachable?"online":"offline"]})]}),e.jsxs("div",{className:"grid gap-2.5 sm:grid-cols-3",children:[e.jsxs("button",{onClick:()=>l(!0),className:"rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/45 transition-all cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(f,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Hirn"}),e.jsx("span",{className:"ml-auto text-[9px] text-primary/70 font-bold uppercase",children:"wechseln →"})]}),e.jsx("div",{className:"text-[11px] font-mono font-medium text-foreground truncate mt-1",title:r.brain_model,children:r.brain_model||"chat"})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(z,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),e.jsxs("div",{className:"text-[10px] font-mono mt-1 flex flex-wrap gap-x-2 text-muted-foreground",children:[e.jsxs("span",{children:["Config: ",r.has_config?"✓":"—"]}),e.jsxs("span",{children:["Skills: ",r.has_skills?"✓":"—"]}),e.jsxs("span",{children:["Memory: ",r.has_memories?"✓":"—"]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(y,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"PC"}),e.jsx("span",{className:a("ml-auto h-1.5 w-1.5 rounded-full",r.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")})]}),e.jsxs("div",{className:a("text-[11px] font-mono mt-1",r.pc_executor_reachable?"text-emerald-400":"text-muted-foreground"),children:[":",S," ",r.pc_executor_reachable?"verbunden":"offline"]})]})]})]})]})]}),e.jsxs("div",{className:"mc-card p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-5 w-5 text-primary"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:a("h-2 w-2 rounded-full",r.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),e.jsx("span",{className:"text-xs font-semibold text-foreground",children:r.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["Der ",e.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",e.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:_||"deinem Windows-PC"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),e.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",e.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),e.jsx("div",{className:"space-y-3",children:r.pc_executor_reachable?e.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[e.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),e.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",e.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",e.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",e.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),e.jsxs("p",{children:["Starte ",e.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",e.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),e.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!r.gateway_reachable&&e.jsxs("div",{className:"mc-card p-6 space-y-4 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{className:"h-5 w-5 text-amber-500"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[e.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),e.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",e.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),e.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[e.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),e.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),e.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-builtin-ui"})]}),e.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",e.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),r&&v&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":"Hermes-Hirn konfigurieren",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[e.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsx("span",{children:"Hermes-Hirn konfigurieren"})]}),e.jsx("button",{onClick:()=>l(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Lane / Gateway-Alias"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:q.map(s=>{const t=r.brain_model===s;return e.jsxs("button",{onClick:()=>C(s),className:a("px-3 py-1.5 rounded-lg text-xs font-mono font-semibold border transition-all cursor-pointer flex items-center gap-1.5",t?"border-primary/40 bg-primary/10 text-primary":"border-border/30 bg-background/20 text-foreground hover:bg-accent"),children:[s,t&&e.jsx(j,{className:"h-3.5 w-3.5"})]},s)})}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:["Schlank & flexibel: das Hirn folgt dem Lane-Routing (z.B. ",e.jsx("code",{className:"text-primary",children:"chat"})," = fast↔heavy)."]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Installiertes Modell (warm gehalten)"}),e.jsx("div",{className:"space-y-1.5 max-h-56 overflow-y-auto pr-1",children:k.map(s=>{var h;const t=s.role==="hermes";return e.jsxs("button",{onClick:()=>!t&&H(s.name),disabled:t||s.incomplete,className:a("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",t?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":s.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(h=s.name.split("/").pop())==null?void 0:h.replace(/\.gguf$/i,"")}),e.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[s.capabilities.params_b?`${s.capabilities.params_b}B`:"?"," · ",s.capabilities.tools!=="no"?"Tools ✓":"ohne Tools",s.role&&` · Rolle: ${s.role}`]})]}),t?e.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[e.jsx(j,{className:"h-3.5 w-3.5"})," Aktiv"]}):e.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Warm setzen →"})]},s.name)})})]}),e.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[e.jsx("span",{children:"💡"}),e.jsxs("span",{children:["Für einen ",e.jsx("strong",{children:"Agenten"}),' sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl. Neues Modell? Erst über „Modell-Manager → Modelle finden" laden.']})]})]})}),w]})}export{$ as AgentView}; + */const w=A("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),q=["chat","coding","fast","heavy"];function $(){const{data:r,error:c}=P(),{data:d}=B(),{showAlert:n,dialogElement:v}=M(),o=D(),x=c?String(c):"",[k,l]=z.useState(!1),_=(d==null?void 0:d.models)??[],m=s=>{var t;return((t=s==null?void 0:s.match(/:(\d+)/))==null?void 0:t[1])??""},p=m(r==null?void 0:r.gateway_url)||"8642",u=(r==null?void 0:r.pc_executor_url)??"",S=u.replace(/^https?:\/\//,""),C=m(u)||"7777";async function H(s){try{await y("/api/agent/brain",{method:"POST",body:JSON.stringify({model:s})}),n("Erledigt",`Hermes-Hirn zeigt jetzt auf das Alias '${s}'. Der Gateway-Dienst wurde neu gestartet.`),o.invalidateQueries({queryKey:i.agentStatus}),l(!1)}catch(t){n("Fehler",`Wechsel fehlgeschlagen: ${t.message||t}`)}}async function E(s){try{await y("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:s})}),n("Erledigt","Agent-Hirn gewechselt (warm gehalten). Gateway wurde neugestartet."),o.invalidateQueries({queryKey:i.agentStatus}),o.invalidateQueries({queryKey:i.models}),l(!1)}catch(t){n("Fehler",`Wechsel fehlgeschlagen: ${t.message||t}`)}}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",e.jsxs("code",{children:[":",p]}),") und seine eigene UI besitzt."]})]}),(r==null?void 0:r.hermes_ui_url)&&e.jsxs("a",{href:g(r.hermes_ui_url),target:"_blank",rel:"noopener",className:a("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",r.hermes_ui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[e.jsx(T,{className:"h-4 w-4"}),e.jsx("span",{children:"Hermes-GUI öffnen"})]})]}),x&&e.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",x,")."]}),r&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"mc-card p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx(b,{className:"h-4.5 w-4.5 text-primary"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Fluss"})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-stretch gap-3",children:[e.jsxs("button",{onClick:()=>r.hermes_ui_reachable&&window.open(g(r.hermes_ui_url),"_blank"),title:r.hermes_ui_reachable?"Hermes-GUI öffnen":"Desktop-Gateway offline",className:"lg:w-40 shrink-0 rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/40 transition-all cursor-pointer flex flex-col justify-center",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(W,{className:a("h-3.5 w-3.5",r.hermes_ui_reachable?"text-emerald-400":"text-amber-500")}),e.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Desktop & GUI"}),e.jsx("span",{className:a("ml-auto h-1.5 w-1.5 rounded-full animate-pulse",r.hermes_ui_reachable?"bg-emerald-500":"bg-amber-500")})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mt-0.5",children:"Hermes Desktop · Clients"})]}),e.jsx("div",{className:"hidden lg:flex items-center text-muted-foreground text-lg select-none",children:"→"}),e.jsxs("div",{className:"flex-1 flex flex-col gap-2.5",children:[e.jsxs("div",{className:"rounded-xl border border-primary/40 bg-primary/5 px-3.5 py-2.5 flex items-center gap-2",children:[e.jsx(b,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-primary",children:"Agent Gateway"}),e.jsxs("span",{className:"text-[11px] font-mono text-muted-foreground",children:[":",p]}),e.jsxs("span",{className:a("ml-auto inline-flex items-center gap-1.5 text-[10px] font-bold uppercase font-mono px-2 py-0.5 rounded-full border",r.gateway_reachable?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-400 border-red-500/20"),children:[e.jsx("span",{className:a("h-1.5 w-1.5 rounded-full",r.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-red-500")}),r.gateway_reachable?"online":"offline"]})]}),e.jsxs("div",{className:"grid gap-2.5 sm:grid-cols-3",children:[e.jsxs("button",{onClick:()=>l(!0),className:"rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/45 transition-all cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(f,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Hirn"}),e.jsx("span",{className:"ml-auto text-[9px] text-primary/70 font-bold uppercase",children:"wechseln →"})]}),e.jsx("div",{className:"text-[11px] font-mono font-medium text-foreground truncate mt-1",title:r.brain_model,children:r.brain_model||"chat"})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(j,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),e.jsxs("div",{className:"text-[10px] font-mono mt-1 flex flex-wrap gap-x-2 text-muted-foreground",children:[e.jsxs("span",{children:["Config: ",r.has_config?"✓":"—"]}),e.jsxs("span",{children:["Skills: ",r.has_skills?"✓":"—"]}),e.jsxs("span",{children:["Memory: ",r.has_memories?"✓":"—"]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(w,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"PC"}),e.jsx("span",{className:a("ml-auto h-1.5 w-1.5 rounded-full",r.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")})]}),e.jsxs("div",{className:a("text-[11px] font-mono mt-1",r.pc_executor_reachable?"text-emerald-400":"text-muted-foreground"),children:[":",C," ",r.pc_executor_reachable?"verbunden":"offline"]})]})]})]})]})]}),e.jsxs("div",{className:"mc-card p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-5 w-5 text-primary"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:a("h-2 w-2 rounded-full",r.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),e.jsx("span",{className:"text-xs font-semibold text-foreground",children:r.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["Der ",e.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",e.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:S||"deinem Windows-PC"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),e.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",e.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),e.jsx("div",{className:"space-y-3",children:r.pc_executor_reachable?e.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[e.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),e.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",e.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",e.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",e.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),e.jsxs("p",{children:["Starte ",e.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",e.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),e.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!r.gateway_reachable&&e.jsxs("div",{className:"mc-card p-6 space-y-4 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{className:"h-5 w-5 text-amber-500"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[e.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),e.jsxs("p",{children:["Am schnellsten: In der System-Schublade unter ",e.jsx("strong",{children:"Dienste"})," den Eintrag"," ",e.jsx("strong",{children:"Hermes-Gateway"})," mit einem Klick neu starten (dort gibt es auch die Logs dazu)."]}),e.jsxs("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}})),className:"flex h-9 items-center gap-1.5 rounded-lg border border-primary/40 bg-primary/10 px-4 text-[11px] font-bold uppercase tracking-wide text-primary transition-all hover:bg-primary/20 cursor-pointer",children:[e.jsx(j,{className:"h-3.5 w-3.5"})," Dienste-Übersicht öffnen"]}),e.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",e.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),r&&k&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":"Hermes-Hirn konfigurieren",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[e.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsx("span",{children:"Hermes-Hirn konfigurieren"})]}),e.jsx("button",{onClick:()=>l(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(I,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Lane / Gateway-Alias"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:q.map(s=>{const t=r.brain_model===s;return e.jsxs("button",{onClick:()=>H(s),className:a("px-3 py-1.5 rounded-lg text-xs font-mono font-semibold border transition-all cursor-pointer flex items-center gap-1.5",t?"border-primary/40 bg-primary/10 text-primary":"border-border/30 bg-background/20 text-foreground hover:bg-accent"),children:[s,t&&e.jsx(N,{className:"h-3.5 w-3.5"})]},s)})}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:["Schlank & flexibel: das Hirn folgt dem Lane-Routing (z.B. ",e.jsx("code",{className:"text-primary",children:"chat"})," = fast↔heavy)."]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Installiertes Modell (warm gehalten)"}),e.jsx("div",{className:"space-y-1.5 max-h-56 overflow-y-auto pr-1",children:_.map(s=>{var h;const t=s.role==="hermes";return e.jsxs("button",{onClick:()=>!t&&E(s.name),disabled:t||s.incomplete,className:a("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",t?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":s.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(h=s.name.split("/").pop())==null?void 0:h.replace(/\.gguf$/i,"")}),e.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[s.capabilities.params_b?`${s.capabilities.params_b}B`:"?"," · ",s.capabilities.tools!=="no"?"Tools ✓":"ohne Tools",s.role&&` · Rolle: ${s.role}`]})]}),t?e.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[e.jsx(N,{className:"h-3.5 w-3.5"})," Aktiv"]}):e.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Warm setzen →"})]},s.name)})})]}),e.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[e.jsx("span",{children:"💡"}),e.jsxs("span",{children:["Für einen ",e.jsx("strong",{children:"Agenten"}),' sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl. Neues Modell? Erst über „Modell-Manager → Modelle finden" laden.']})]})]})}),v]})}export{$ as AgentView}; diff --git a/frontend/dist/assets/AuftragsbuchView-BL9FfDFw.js b/frontend/dist/assets/AuftragsbuchView-BL9FfDFw.js new file mode 100644 index 0000000..8dacdbd --- /dev/null +++ b/frontend/dist/assets/AuftragsbuchView-BL9FfDFw.js @@ -0,0 +1,26 @@ +import{c as I,aa as Y,ab as _,u as q,b as Q,r as u,j as e,a3 as ee,e as C,L as N,C as U,U as J,ac as te,V as O,X as z,D as M,M as R,ad as re,T as K,g as E,ae as se,q as Z}from"./index-CQgUnd1p.js";import{L as ae}from"./lightbulb-Btbex65P.js";import{S as G}from"./send-COuI40dq.js";/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ne=I("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const le=I("FileDiff",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const de=I("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ie=I("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]),oe={wartung:"Werkstatt",orchestrator:"Orchestrator",doku:"Doku",feature:"Feature"},ce={laeuft:{label:"wird eingespielt …",cls:"text-sky-300 border-sky-500/40 bg-sky-500/10",spin:!0},rollback:{label:"Rollback läuft …",cls:"text-amber-300 border-amber-500/40 bg-amber-500/10",spin:!0},eingespielt:{label:"eingespielt ✓",cls:"text-emerald-300 border-emerald-500/40 bg-emerald-500/10"},fehlgeschlagen:{label:"fehlgeschlagen",cls:"text-red-300 border-red-500/40 bg-red-500/10"},zurueckgerollt:{label:"zurückgerollt",cls:"text-amber-300 border-amber-500/40 bg-amber-500/10"},kritisch:{label:"KRITISCH — Box prüfen",cls:"text-red-200 border-red-500/60 bg-red-500/20"},abgelehnt:{label:"abgelehnt",cls:"text-muted-foreground border-border/60 bg-background/30"}};function P(t){return t?new Date(t*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}function we(){const{data:t,isLoading:s,refetch:d,isFetching:g}=Y(),{data:i}=_(),m=q(),{showAlert:h,showConfirm:b,dialogElement:S}=Q(),[w,y]=u.useState({}),p=()=>m.invalidateQueries({queryKey:Z.auftragsbuch});async function A(l,o,L,D){y(x=>({...x,[l]:!0}));try{await E(o,{method:"POST",body:JSON.stringify(L)}),D&&h("Erledigt",D),p()}catch(x){h("Das hat nicht geklappt",String((x==null?void 0:x.message)||x))}finally{y(x=>({...x,[l]:!1}))}}const k=(t==null?void 0:t.items)??[],f=(t==null?void 0:t.skill_kandidaten)??[],v=i!=null&&i.available?i.items.filter(l=>l.status==="blocked").length:0,j=k.length===0&&f.length===0&&v===0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Auftragsbuch"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was die Box gebaut oder sich ausgedacht hat — du entscheidest. Annehmen spielt es mit Fangnetz ein (Health-Check, automatischer Rollback)."})]}),e.jsxs("button",{onClick:()=>d(),className:"flex h-9 items-center gap-1.5 rounded-lg border border-border/60 bg-card/45 px-3 text-xs font-semibold text-muted-foreground hover:text-foreground hover:border-primary/40 transition-all cursor-pointer",children:[e.jsx(ee,{className:C("h-3.5 w-3.5",g&&"animate-spin")})," Aktualisieren"]})]}),t&&!t.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Das Auftragsbuch lebt auf der Box (liest die Gitea-Branches dort). Im lokalen Dev-Modus ist hier nichts zu sehen."}),s&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(N,{className:"h-4 w-4 animate-spin"})," Vorschläge werden geladen …"]}),(t==null?void 0:t.available)&&j&&e.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-emerald-500/25 bg-emerald-500/5 p-5",children:[e.jsx(U,{className:"h-5 w-5 shrink-0 text-emerald-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Nichts zu entscheiden"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keine offenen Vorschläge. Werkstatt, Orchestrator und Traum melden sich hier, sobald es etwas gibt."})]})]}),e.jsx(xe,{}),k.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs(T,{icon:de,children:["Patch-Vorschläge (",k.length,")"]}),k.map(l=>e.jsx(be,{item:l,busy:w,onAct:A,showConfirm:b},`${l.repo??"mc2"}:${l.branch}`))]}),f.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs(T,{icon:J,children:["Skill-Kandidaten aus dem Traum (",f.length,")"]}),f.map(l=>e.jsx(pe,{k:l,busy:w,onAct:A,showConfirm:b},l.file))]}),S]})}function T({icon:t,children:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(t,{className:"h-3.5 w-3.5"})," ",s]})}const ue={triage:{label:"wird ausgearbeitet …",cls:"text-violet-300 border-violet-500/40 bg-violet-500/10",spin:!0},todo:{label:"wartet",cls:"text-muted-foreground border-border/60 bg-background/30"},scheduled:{label:"geplant",cls:"text-muted-foreground border-border/60 bg-background/30"},ready:{label:"wartet",cls:"text-muted-foreground border-border/60 bg-background/30"},running:{label:"in Arbeit …",cls:"text-sky-300 border-sky-500/40 bg-sky-500/10",spin:!0},review:{label:"im Review",cls:"text-amber-300 border-amber-500/40 bg-amber-500/10"},blocked:{label:"hängt — braucht dich",cls:"text-red-300 border-red-500/40 bg-red-500/10"},done:{label:"fertig ✓",cls:"text-emerald-300 border-emerald-500/40 bg-emerald-500/10"}},he={needs_input:"Die Box hat eine Frage:",capability:"Die Box kam hier nicht weiter:",transient:"Die Aufgabe hakt:"};function xe(){var B,a;const{data:t,isLoading:s}=_(),d=q(),{showAlert:g,dialogElement:i}=Q(),[m,h]=u.useState(""),[b,S]=u.useState(!1),[w,y]=u.useState({}),[p,A]=u.useState(null),[k,f]=u.useState({}),v=(t==null?void 0:t.items)??[],j=()=>d.invalidateQueries({queryKey:Z.ideen}),l=p!==null&&(((B=t==null?void 0:t.items.find(r=>r.id===p))==null?void 0:B.status)==="triage"||((a=t==null?void 0:t.items.find(r=>r.id===p))==null?void 0:a.status)==="running"),o=te(p??"",l);async function L(){const r=m.trim();if(!(r.length<3||b)){S(!0);try{const n=r.length>160?r.slice(0,157)+"…":r;await E("/api/ideen",{method:"POST",body:JSON.stringify({titel:n,notiz:r.length>160?r:""})}),h(""),j()}catch(n){g("Das hat nicht geklappt",String((n==null?void 0:n.message)||n))}finally{S(!1)}}}async function D(r){y(n=>({...n,[r]:!0}));try{await E("/api/ideen/archivieren",{method:"POST",body:JSON.stringify({id:r})}),j()}catch(n){g("Das hat nicht geklappt",String((n==null?void 0:n.message)||n))}finally{y(n=>({...n,[r]:!1}))}}async function x(r){const n=(k[r]||"").trim();if(!(n.length<1||w["ans:"+r])){y(c=>({...c,["ans:"+r]:!0}));try{await E("/api/ideen/antwort",{method:"POST",body:JSON.stringify({id:r,antwort:n})}),f(c=>({...c,[r]:""})),j()}catch(c){g("Das hat nicht geklappt",String((c==null?void 0:c.message)||c))}finally{y(c=>({...c,["ans:"+r]:!1}))}}}return t&&!t.available?null:e.jsxs("section",{className:"space-y-3",children:[e.jsxs(T,{icon:ae,children:["Ideen-Queue",t?` — ${t.offen} offen`:""]}),e.jsxs("div",{className:"mc-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:m,onChange:r=>h(r.target.value),onKeyDown:r=>{r.key==="Enter"&&L()},placeholder:"Neue Idee — einfach hinschreiben, die Box macht den Rest",className:"h-9 min-w-0 flex-1 rounded-lg border border-border/60 bg-background/50 px-3 text-sm text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"}),e.jsxs("button",{onClick:L,disabled:b||m.trim().length<3,className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg border border-primary/40 bg-primary/10 px-3 text-[11px] font-bold uppercase tracking-wide text-primary transition-all hover:bg-primary/20 cursor-pointer disabled:opacity-50",children:[b?e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(G,{className:"h-3.5 w-3.5"})," In die Queue"]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Eine Queue, alle Türen: hier, per Telegram oder im Gespräch mit Lucy. Die Box arbeitet Ideen selbst aus und baut — Code-Ergebnisse erscheinen als Karte unter „Patch-Vorschläge“, nichts davon geht ohne deinen Klick live. Nur reine Doku-Bagatellen zieht die Box nachts selbst ein (mit Fangnetz und Meldung)."}),s&&e.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"})," Queue wird geladen …"]}),(t==null?void 0:t.fehler)&&e.jsx("p",{className:"text-xs text-amber-300",children:"Queue gerade nicht lesbar — neuer Versuch läuft."}),v.length>0&&e.jsx("ul",{className:"space-y-1.5",children:v.map(r=>{var F;const n=ue[r.status]??{label:r.status,cls:"text-muted-foreground border-border/60 bg-background/30"},c=p===r.id,$=r.status==="triage"||r.status==="running"||r.status==="done",W=r.status==="blocked",H=!!w["ans:"+r.id];return e.jsxs("li",{className:C("flex flex-col gap-2 rounded-xl border bg-background/30 px-3 py-2",W?"border-red-500/30":"border-border/40"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:C("flex shrink-0 items-center gap-1.5 rounded-lg border px-2 py-0.5 text-[10px] font-bold",n.cls),children:[n.spin&&e.jsx(N,{className:"h-3 w-3 animate-spin"}),n.label]}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground",title:r.body||r.titel,children:r.titel}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground/70",children:[e.jsx(O,{className:"h-3 w-3"}),P(r.erstellt)]}),(r.status==="done"||W)&&e.jsx("button",{disabled:!!w[r.id],onClick:()=>D(r.id),title:W?"Aufgeben und aus der Liste räumen (wandert ins Kanban-Archiv)":"Aus der Liste räumen (wandert ins Kanban-Archiv)",className:"shrink-0 rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-foreground cursor-pointer disabled:opacity-50",children:w[r.id]?e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(z,{className:"h-3.5 w-3.5"})}),$&&e.jsx("button",{onClick:()=>A(c?null:r.id),title:r.status==="done"?"Ergebnis anzeigen":"Worker-Log anzeigen",className:"shrink-0 rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-foreground cursor-pointer",children:c?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(R,{className:"h-3.5 w-3.5"})})]}),W&&e.jsxs("div",{className:"space-y-2 border-t border-red-500/20 pt-2",children:[e.jsxs("p",{className:"flex items-start gap-1.5 text-[11px] leading-relaxed text-red-200/90",children:[e.jsx(re,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-300"}),e.jsxs("span",{children:[e.jsx("b",{children:he[r.frage_kind||""]??"Die Aufgabe hängt und wartet auf dich:"})," ",r.frage?e.jsx("span",{className:"text-foreground/90",children:r.frage}):e.jsx("span",{className:"text-muted-foreground italic",children:"kein genauer Grund hinterlegt — antworte einfach mit einer Entscheidung, dann läuft sie weiter."})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:k[r.id]||"",onChange:V=>f(X=>({...X,[r.id]:V.target.value})),onKeyDown:V=>{V.key==="Enter"&&x(r.id)},placeholder:"Deine Antwort — die Box macht damit weiter",maxLength:2e3,className:"h-8 min-w-0 flex-1 rounded-lg border border-border/60 bg-background/60 px-2.5 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-red-400/50 focus:outline-none"}),e.jsxs("button",{onClick:()=>x(r.id),disabled:H||(k[r.id]||"").trim().length<1,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-emerald-500/40 bg-emerald-500/10 px-3 text-[10px] font-bold uppercase tracking-wide text-emerald-300 transition-all hover:bg-emerald-500/20 cursor-pointer disabled:opacity-50",children:[H?e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(G,{className:"h-3.5 w-3.5"})," Antworten & weiter"]})]})]}),c&&$&&r.status!=="done"&&e.jsx("div",{className:"ml-2 -mt-1",children:e.jsx("div",{className:"rounded-lg border border-border/50 bg-background/50 p-2",children:l&&o.isLoading?e.jsx("p",{className:"text-[10px] text-muted-foreground animate-pulse",children:"Log wird geladen …"}):o.error?e.jsx("p",{className:"text-[10px] text-red-400",children:"Log nicht ladbar"}):(F=o.data)!=null&&F.available&&o.data.lines.length>0?e.jsx("pre",{className:"max-h-64 overflow-auto font-mono text-[10px] leading-relaxed text-foreground/80 whitespace-pre-wrap",children:o.data.lines.join(` +`)}):e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Kein Log verfügbar"})})}),c&&r.status==="done"&&e.jsx(ge,{id:r.id})]},r.id)})}),(t==null?void 0:t.available)&&!s&&v.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Queue ist leer — wirf der Box eine Idee zu."})]}),i]})}function ge({id:t}){const[s,d]=u.useState(null),[g,i]=u.useState(!1);u.useEffect(()=>{let h=!1;return E(`/api/ideen/${t}/ergebnis`).then(b=>{h||d(b)}).catch(()=>{h||i(!0)}),()=>{h=!0}},[t]);const m=s?s.summary||s.result:"";return e.jsx("div",{className:"ml-2 -mt-1",children:e.jsxs("div",{className:"rounded-lg border border-emerald-500/25 bg-emerald-500/5 p-2.5",children:[e.jsxs("p",{className:"mb-1 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wide text-emerald-300",children:[e.jsx(ne,{className:"h-3 w-3"})," Ergebnis des Workers"]}),g?e.jsx("p",{className:"text-[10px] text-red-400",children:"Ergebnis nicht ladbar"}):s===null?e.jsx("p",{className:"text-[10px] text-muted-foreground animate-pulse",children:"Wird geladen …"}):m?e.jsx("p",{className:"max-h-64 overflow-y-auto whitespace-pre-wrap text-xs leading-relaxed text-foreground/85",children:m}):e.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Der Worker hat keine Abschluss-Zusammenfassung hinterlassen (ältere Karte oder Protokollverstoß)."})]})})}function me({item:t}){const s=t.status;if(!s)return null;const d=ce[s.state];return d?e.jsxs("span",{className:C("flex items-center gap-1.5 rounded-lg border px-2 py-0.5 text-[10px] font-bold",d.cls),title:s.detail,children:[d.spin&&e.jsx(N,{className:"h-3 w-3 animate-spin"}),d.label]}):null}function be({item:t,busy:s,onAct:d,showConfirm:g}){var D,x,B;const[i,m]=u.useState(!1),[h,b]=u.useState(null),[S,w]=u.useState(!1),[y,p]=u.useState(!1),[A,k]=u.useState(""),f=((D=t.status)==null?void 0:D.state)==="laeuft"||((x=t.status)==null?void 0:x.state)==="rollback",v=((B=t.status)==null?void 0:B.state)==="eingespielt",j=t.repo??"mc2",l=j==="lucy",o=`${j}:${t.branch}`;async function L(){const a=!i;if(m(a),a&&h===null){w(!0);try{const r=await E(`/api/auftragsbuch/diff?branch=${encodeURIComponent(t.branch)}&repo=${j}`);b(r.diff+(r.truncated?` +… (gekürzt)`:""))}catch(r){b(`(Diff nicht ladbar: ${(r==null?void 0:r.message)||r})`)}finally{w(!1)}}}return e.jsxs("div",{className:"mc-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"rounded-md border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-primary",children:oe[t.kind]??t.kind}),l&&e.jsx("span",{className:"rounded-md border border-pink-500/40 bg-pink-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-pink-300",title:"Vorschlag fürs Lucy-Repo — Annehmen baut die App am PC neu und startet sie neu, wenn sie läuft.",children:"Lucy"}),e.jsx("span",{className:"font-mono text-[11px] text-muted-foreground truncate",title:t.branch,children:t.branch}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground/70",children:[e.jsx(O,{className:"h-3 w-3"}),P(t.ts)]}),e.jsx(me,{item:t})]}),e.jsx("p",{className:"mt-1.5 text-sm font-semibold text-foreground",children:t.subject||"(ohne Titel)"}),t.body&&e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-xs leading-relaxed text-muted-foreground line-clamp-6",children:t.body}),t.empfehlung&&e.jsxs("p",{className:C("mt-1.5 flex items-start gap-1.5 rounded-lg border px-2 py-1 text-[11px]",t.empfehlung.empfehlung==="ANNEHMEN"&&"border-emerald-500/30 bg-emerald-500/5 text-emerald-300",t.empfehlung.empfehlung==="ABLEHNEN"&&"border-red-500/30 bg-red-500/5 text-red-300",t.empfehlung.empfehlung==="UNKLAR"&&"border-amber-500/30 bg-amber-500/5 text-amber-300"),title:`Nächtliches Kurz-Gutachten (${t.empfehlung.richter}) — eine Meinung, kein Muss. Die Entscheidung bleibt bei dir.`,children:[e.jsx(J,{className:"mt-0.5 h-3 w-3 shrink-0"}),e.jsxs("span",{children:[e.jsxs("b",{children:["Empfehlung: ",t.empfehlung.empfehlung==="ANNEHMEN"?"Annehmen":t.empfehlung.empfehlung==="ABLEHNEN"?"Ablehnen":"Unklar","."]})," ",t.empfehlung.satz]})]})]}),!f&&!v&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!t.verwaist&&e.jsxs("button",{disabled:!!s[o],onClick:()=>g("Vorschlag annehmen?",l?`'${t.branch}' wird im Lucy-Repo auf main gemergt, dann baut dein PC die App neu (dist) und startet Lucy neu, falls sie gerade läuft. Der PC muss dafür an sein. Schlägt Build oder Start fehl, dreht die Box den Merge automatisch zurück — die laufende Lucy bleibt die alte.`:`'${t.branch}' wird auf main gemergt und live eingespielt. Die Zentrale startet dabei kurz neu. Geht der Health-Check danach rot, rollt die Box automatisch zurück.${t.frontend_ohne_build?` + +Achtung: Enthält Frontend-Quelltext ohne gebautes Bundle — die Oberfläche bleibt alt, bis am PC gebaut wird.`:""}`,()=>d(o,"/api/auftragsbuch/annehmen",{branch:t.branch,repo:j})),className:"flex h-9 items-center gap-1.5 rounded-lg border border-emerald-500/40 bg-emerald-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-emerald-300 transition-all hover:bg-emerald-500/20 cursor-pointer disabled:opacity-50",children:[s[o]?e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(U,{className:"h-3.5 w-3.5"})," Annehmen"]}),e.jsxs("button",{disabled:!!s["ab:"+o],onClick:()=>p(a=>!a),className:"flex h-9 items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300/90 transition-all hover:bg-red-500/15 cursor-pointer disabled:opacity-50",children:[s["ab:"+o]?e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(z,{className:"h-3.5 w-3.5"})," Ablehnen"]})]})]}),y&&!f&&!v&&e.jsxs("div",{className:"space-y-2 rounded-xl border border-red-500/25 bg-red-500/5 p-3",children:[e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Der Branch '",t.branch,"' wird auf Gitea gelöscht (die Arbeit bleibt in der Historie). Sag der Box kurz ",e.jsx("b",{children:"warum"})," — dann schlägt sie dir so etwas nicht wieder vor."]}),e.jsx("input",{value:A,onChange:a=>k(a.target.value),placeholder:"Grund (optional) — z. B. „gibt es schon“ oder „will ich nicht“",maxLength:400,className:"w-full rounded-lg border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-red-400/50 focus:outline-none"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{disabled:!!s["ab:"+o],onClick:()=>{p(!1),d("ab:"+o,"/api/auftragsbuch/ablehnen",{branch:t.branch,repo:j,grund:A.trim()})},className:"flex h-8 items-center gap-1.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300 transition-all hover:bg-red-500/20 cursor-pointer disabled:opacity-50",children:[e.jsx(z,{className:"h-3.5 w-3.5"})," Wirklich ablehnen"]}),e.jsx("button",{onClick:()=>p(!1),className:"flex h-8 items-center rounded-lg border border-border/60 bg-background/40 px-3 text-[11px] font-semibold text-muted-foreground transition-all hover:text-foreground cursor-pointer",children:"Abbrechen"})]})]}),t.status&&(f||!v)&&t.status.detail&&e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.status.detail}),t.verwaist&&e.jsxs("p",{className:"rounded-lg border border-red-500/30 bg-red-500/5 px-2 py-1.5 text-[11px] text-red-300/90",children:[e.jsx("b",{children:"Kaputt aufgesetzt:"})," Dieser Branch hat keinen gemeinsamen Ursprung mit main (der Werkstatt-Worker hat nicht richtig geklont) — Annehmen ist technisch unmöglich, deshalb fehlt der Knopf. Am besten ",e.jsx("b",{children:"ablehnen mit Grund"}),"; die Idee kann danach frisch in die Queue."]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 font-mono",children:[t.ahead," Commit",t.ahead===1?"":"s"]}),t.shortstat&&e.jsx("span",{className:"rounded bg-background/40 px-1.5 py-0.5 font-mono",children:t.shortstat.trim()}),t.verwaist&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-red-500/10 px-1.5 py-0.5 text-red-300",title:"Kein gemeinsamer Vorfahre mit main — git kann diesen Branch niemals mergen.",children:[e.jsx(K,{className:"h-3 w-3"})," kein gemeinsamer Ursprung"]}),t.leer&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-amber-300",title:"Der Diff gegen main ist leer — der Branch würde nichts verändern (Inhalt schon in main oder am Repo vorbei gearbeitet).",children:[e.jsx(K,{className:"h-3 w-3"})," Diff leer — bringt nichts"]}),t.behind>0&&!t.verwaist&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-amber-300",title:"main ist seit diesem Vorschlag weitergelaufen — bei Konflikten versucht die Annahme automatisch einen Rebase.",children:[e.jsx(K,{className:"h-3 w-3"})," ",t.behind," hinter main"]}),t.frontend_ohne_build&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-amber-300",title:"Die Box kann kein Frontend bauen (kein Node) — nach dem Annehmen bleibt die Oberfläche alt, bis am PC gebaut wird.",children:[e.jsx(K,{className:"h-3 w-3"})," Frontend ohne Build"]})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[i?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(R,{className:"h-3.5 w-3.5"}),e.jsx(le,{className:"h-3.5 w-3.5"})," ",t.files.length," Datei",t.files.length===1?"":"en"," — Änderungen ansehen"]}),i&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.files.map(a=>e.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:[e.jsx("b",{className:C(a.status.startsWith("A")&&"text-emerald-400",a.status.startsWith("D")&&"text-red-400",a.status.startsWith("M")&&"text-sky-400"),children:a.status})," ",a.path]},a.path)),t.files_truncated&&e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"…"})]}),e.jsx("div",{className:"max-h-96 overflow-auto rounded-xl border border-border/50 bg-background/50 p-3",children:S?e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Diff wird geladen …"}):e.jsx("pre",{className:"text-[10px] leading-relaxed text-foreground/80 whitespace-pre",children:(h??"").split(` +`).map((a,r)=>e.jsx("span",{className:C("block",a.startsWith("+")&&!a.startsWith("+++")&&"text-emerald-300/90 bg-emerald-500/5",a.startsWith("-")&&!a.startsWith("---")&&"text-red-300/90 bg-red-500/5",(a.startsWith("@@")||a.startsWith("diff "))&&"text-sky-300/90"),children:a||" "},r))})})]})]})]})}function pe({k:t,busy:s,onAct:d,showConfirm:g}){const[i,m]=u.useState(!1);return e.jsxs("div",{className:"rounded-2xl border border-violet-500/25 bg-violet-500/[0.04] p-4 shadow-lg shadow-black/15 backdrop-blur-md space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"rounded-md border border-violet-500/30 bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-violet-300",children:"Traum-Idee"}),e.jsx("span",{className:"font-mono text-[11px] text-muted-foreground truncate",children:t.file}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground/70",children:[e.jsx(O,{className:"h-3 w-3"}),P(t.mtime)]})]}),e.jsx("p",{className:"mt-1.5 text-sm font-semibold text-foreground",children:t.title})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs("button",{disabled:!!s["sk:"+t.file],onClick:()=>g("Werkstatt beauftragen?",`Der Kandidat '${t.title}' geht als Auftrag an die Werkstatt (Orchestrator, propose-only). Das Ergebnis erscheint später als neuer Patch-Vorschlag hier im Auftragsbuch — nichts geht ungefragt live.`,()=>d("sk:"+t.file,"/api/auftragsbuch/skill/annehmen",{file:t.file},"Die Werkstatt arbeitet. Das Ergebnis taucht als neuer Vorschlag im Auftragsbuch auf (das kann einige Minuten dauern).")),className:"flex h-9 items-center gap-1.5 rounded-lg border border-violet-500/40 bg-violet-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-violet-300 transition-all hover:bg-violet-500/20 cursor-pointer disabled:opacity-50",children:[s["sk:"+t.file]?e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ie,{className:"h-3.5 w-3.5"})," Beauftragen"]}),e.jsxs("button",{disabled:!!s["skab:"+t.file],onClick:()=>g("Kandidat verwerfen?",`'${t.title}' wandert ins Archiv des Wissens-Vaults (verworfen/). Der Traum schlägt ihn nicht erneut vor.`,()=>d("skab:"+t.file,"/api/auftragsbuch/skill/ablehnen",{file:t.file})),className:"flex h-9 items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300/90 transition-all hover:bg-red-500/15 cursor-pointer disabled:opacity-50",children:[s["skab:"+t.file]?e.jsx(N,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(z,{className:"h-3.5 w-3.5"})," Verwerfen"]})]})]}),e.jsxs("button",{onClick:()=>m(h=>!h),className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[i?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(R,{className:"h-3.5 w-3.5"}),e.jsx(se,{className:"h-3.5 w-3.5"})," Vorschlag lesen"]}),i&&e.jsx("pre",{className:"max-h-72 overflow-auto rounded-xl border border-border/50 bg-background/50 p-3 text-[11px] leading-relaxed text-foreground/85 whitespace-pre-wrap",children:t.preview})]})}export{we as AuftragsbuchView}; diff --git a/frontend/dist/assets/AuftragsbuchView-DyT5H9as.js b/frontend/dist/assets/AuftragsbuchView-DyT5H9as.js deleted file mode 100644 index 0c3d730..0000000 --- a/frontend/dist/assets/AuftragsbuchView-DyT5H9as.js +++ /dev/null @@ -1,26 +0,0 @@ -import{c as I,a8 as X,u as _,b as q,r as c,j as e,a9 as Y,e as C,L as f,C as Q,U,aa as ee,ab as te,V as O,X as z,D as M,M as R,ac as re,T as K,g as S,ad as se,q as J}from"./index-D94Dzyvg.js";import{L as ae}from"./lightbulb-B-eiNc3G.js";import{S as G}from"./send-DyDlsXyV.js";/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ne=I("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const le=I("FileDiff",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const de=I("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ie=I("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]),oe={wartung:"Werkstatt",orchestrator:"Orchestrator",doku:"Doku",feature:"Feature"},ce={laeuft:{label:"wird eingespielt …",cls:"text-sky-300 border-sky-500/40 bg-sky-500/10",spin:!0},rollback:{label:"Rollback läuft …",cls:"text-amber-300 border-amber-500/40 bg-amber-500/10",spin:!0},eingespielt:{label:"eingespielt ✓",cls:"text-emerald-300 border-emerald-500/40 bg-emerald-500/10"},fehlgeschlagen:{label:"fehlgeschlagen",cls:"text-red-300 border-red-500/40 bg-red-500/10"},zurueckgerollt:{label:"zurückgerollt",cls:"text-amber-300 border-amber-500/40 bg-amber-500/10"},kritisch:{label:"KRITISCH — Box prüfen",cls:"text-red-200 border-red-500/60 bg-red-500/20"},abgelehnt:{label:"abgelehnt",cls:"text-muted-foreground border-border/60 bg-background/30"}};function P(t){return t?new Date(t*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}function we(){const{data:t,isLoading:s,refetch:d,isFetching:g}=X(),m=_(),{showAlert:h,showConfirm:u,dialogElement:j}=q(),[A,N]=c.useState({}),y=()=>m.invalidateQueries({queryKey:J.auftragsbuch});async function b(l,p,D,i){N(x=>({...x,[l]:!0}));try{await S(p,{method:"POST",body:JSON.stringify(D)}),i&&h("Erledigt",i),y()}catch(x){h("Das hat nicht geklappt",String((x==null?void 0:x.message)||x))}finally{N(x=>({...x,[l]:!1}))}}const k=(t==null?void 0:t.items)??[],w=(t==null?void 0:t.skill_kandidaten)??[],v=k.length===0&&w.length===0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Auftragsbuch"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was die Box gebaut oder sich ausgedacht hat — du entscheidest. Annehmen spielt es mit Fangnetz ein (Health-Check, automatischer Rollback)."})]}),e.jsxs("button",{onClick:()=>d(),className:"flex h-9 items-center gap-1.5 rounded-lg border border-border/60 bg-card/45 px-3 text-xs font-semibold text-muted-foreground hover:text-foreground hover:border-primary/40 transition-all cursor-pointer",children:[e.jsx(Y,{className:C("h-3.5 w-3.5",g&&"animate-spin")})," Aktualisieren"]})]}),t&&!t.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Das Auftragsbuch lebt auf der Box (liest die Gitea-Branches dort). Im lokalen Dev-Modus ist hier nichts zu sehen."}),s&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(f,{className:"h-4 w-4 animate-spin"})," Vorschläge werden geladen …"]}),(t==null?void 0:t.available)&&v&&e.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-emerald-500/25 bg-emerald-500/5 p-5",children:[e.jsx(Q,{className:"h-5 w-5 shrink-0 text-emerald-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Nichts zu entscheiden"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keine offenen Vorschläge. Werkstatt, Orchestrator und Traum melden sich hier, sobald es etwas gibt."})]})]}),e.jsx(xe,{}),k.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs(V,{icon:de,children:["Fertige Patches (",k.length,")"]}),k.map(l=>e.jsx(be,{item:l,busy:A,onAct:b,showConfirm:u},`${l.repo??"mc2"}:${l.branch}`))]}),w.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs(V,{icon:U,children:["Skill-Kandidaten aus dem Traum (",w.length,")"]}),w.map(l=>e.jsx(pe,{k:l,busy:A,onAct:b,showConfirm:u},l.file))]}),j]})}function V({icon:t,children:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(t,{className:"h-3.5 w-3.5"})," ",s]})}const ue={triage:{label:"wird ausgearbeitet …",cls:"text-violet-300 border-violet-500/40 bg-violet-500/10",spin:!0},todo:{label:"wartet",cls:"text-muted-foreground border-border/60 bg-background/30"},scheduled:{label:"geplant",cls:"text-muted-foreground border-border/60 bg-background/30"},ready:{label:"wartet",cls:"text-muted-foreground border-border/60 bg-background/30"},running:{label:"in Arbeit …",cls:"text-sky-300 border-sky-500/40 bg-sky-500/10",spin:!0},review:{label:"im Review",cls:"text-amber-300 border-amber-500/40 bg-amber-500/10"},blocked:{label:"hängt — braucht dich",cls:"text-red-300 border-red-500/40 bg-red-500/10"},done:{label:"fertig ✓",cls:"text-emerald-300 border-emerald-500/40 bg-emerald-500/10"}},he={needs_input:"Die Box hat eine Frage:",capability:"Die Box kam hier nicht weiter:",transient:"Die Aufgabe hakt:"};function xe(){var E,a;const{data:t,isLoading:s}=ee(),d=_(),{showAlert:g,dialogElement:m}=q(),[h,u]=c.useState(""),[j,A]=c.useState(!1),[N,y]=c.useState({}),[b,k]=c.useState(null),[w,v]=c.useState({}),l=(t==null?void 0:t.items)??[],p=()=>d.invalidateQueries({queryKey:J.ideen}),D=b!==null&&(((E=t==null?void 0:t.items.find(r=>r.id===b))==null?void 0:E.status)==="triage"||((a=t==null?void 0:t.items.find(r=>r.id===b))==null?void 0:a.status)==="running"),i=te(b??"",D);async function x(){const r=h.trim();if(!(r.length<3||j)){A(!0);try{const n=r.length>160?r.slice(0,157)+"…":r;await S("/api/ideen",{method:"POST",body:JSON.stringify({titel:n,notiz:r.length>160?r:""})}),u(""),p()}catch(n){g("Das hat nicht geklappt",String((n==null?void 0:n.message)||n))}finally{A(!1)}}}async function B(r){y(n=>({...n,[r]:!0}));try{await S("/api/ideen/archivieren",{method:"POST",body:JSON.stringify({id:r})}),p()}catch(n){g("Das hat nicht geklappt",String((n==null?void 0:n.message)||n))}finally{y(n=>({...n,[r]:!1}))}}async function L(r){const n=(w[r]||"").trim();if(!(n.length<1||N["ans:"+r])){y(o=>({...o,["ans:"+r]:!0}));try{await S("/api/ideen/antwort",{method:"POST",body:JSON.stringify({id:r,antwort:n})}),v(o=>({...o,[r]:""})),p()}catch(o){g("Das hat nicht geklappt",String((o==null?void 0:o.message)||o))}finally{y(o=>({...o,["ans:"+r]:!1}))}}}return t&&!t.available?null:e.jsxs("section",{className:"space-y-3",children:[e.jsxs(V,{icon:ae,children:["Ideen-Queue",t?` — ${t.offen} offen`:""]}),e.jsxs("div",{className:"mc-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:h,onChange:r=>u(r.target.value),onKeyDown:r=>{r.key==="Enter"&&x()},placeholder:"Neue Idee — einfach hinschreiben, die Box macht den Rest",className:"h-9 min-w-0 flex-1 rounded-lg border border-border/60 bg-background/50 px-3 text-sm text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"}),e.jsxs("button",{onClick:x,disabled:j||h.trim().length<3,className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg border border-primary/40 bg-primary/10 px-3 text-[11px] font-bold uppercase tracking-wide text-primary transition-all hover:bg-primary/20 cursor-pointer disabled:opacity-50",children:[j?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(G,{className:"h-3.5 w-3.5"})," In die Queue"]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Eine Queue, alle Türen: hier, per Telegram oder im Gespräch mit Lucy. Die Box arbeitet Ideen selbst aus und baut — Code-Ergebnisse erscheinen als Karte unter „Fertige Patches“, nichts davon geht ohne deinen Klick live. Nur reine Doku-Bagatellen zieht die Box nachts selbst ein (mit Fangnetz und Meldung)."}),s&&e.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"})," Queue wird geladen …"]}),(t==null?void 0:t.fehler)&&e.jsx("p",{className:"text-xs text-amber-300",children:"Queue gerade nicht lesbar — neuer Versuch läuft."}),l.length>0&&e.jsx("ul",{className:"space-y-1.5",children:l.map(r=>{var H;const n=ue[r.status]??{label:r.status,cls:"text-muted-foreground border-border/60 bg-background/30"},o=b===r.id,$=r.status==="triage"||r.status==="running"||r.status==="done",W=r.status==="blocked",F=!!N["ans:"+r.id];return e.jsxs("li",{className:C("flex flex-col gap-2 rounded-xl border bg-background/30 px-3 py-2",W?"border-red-500/30":"border-border/40"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:C("flex shrink-0 items-center gap-1.5 rounded-lg border px-2 py-0.5 text-[10px] font-bold",n.cls),children:[n.spin&&e.jsx(f,{className:"h-3 w-3 animate-spin"}),n.label]}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground",title:r.body||r.titel,children:r.titel}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground/70",children:[e.jsx(O,{className:"h-3 w-3"}),P(r.erstellt)]}),(r.status==="done"||W)&&e.jsx("button",{disabled:!!N[r.id],onClick:()=>B(r.id),title:W?"Aufgeben und aus der Liste räumen (wandert ins Kanban-Archiv)":"Aus der Liste räumen (wandert ins Kanban-Archiv)",className:"shrink-0 rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-foreground cursor-pointer disabled:opacity-50",children:N[r.id]?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(z,{className:"h-3.5 w-3.5"})}),$&&e.jsx("button",{onClick:()=>k(o?null:r.id),title:r.status==="done"?"Ergebnis anzeigen":"Worker-Log anzeigen",className:"shrink-0 rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-foreground cursor-pointer",children:o?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(R,{className:"h-3.5 w-3.5"})})]}),W&&e.jsxs("div",{className:"space-y-2 border-t border-red-500/20 pt-2",children:[e.jsxs("p",{className:"flex items-start gap-1.5 text-[11px] leading-relaxed text-red-200/90",children:[e.jsx(re,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-300"}),e.jsxs("span",{children:[e.jsx("b",{children:he[r.frage_kind||""]??"Die Aufgabe hängt und wartet auf dich:"})," ",r.frage?e.jsx("span",{className:"text-foreground/90",children:r.frage}):e.jsx("span",{className:"text-muted-foreground italic",children:"kein genauer Grund hinterlegt — antworte einfach mit einer Entscheidung, dann läuft sie weiter."})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:w[r.id]||"",onChange:T=>v(Z=>({...Z,[r.id]:T.target.value})),onKeyDown:T=>{T.key==="Enter"&&L(r.id)},placeholder:"Deine Antwort — die Box macht damit weiter",maxLength:2e3,className:"h-8 min-w-0 flex-1 rounded-lg border border-border/60 bg-background/60 px-2.5 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-red-400/50 focus:outline-none"}),e.jsxs("button",{onClick:()=>L(r.id),disabled:F||(w[r.id]||"").trim().length<1,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-emerald-500/40 bg-emerald-500/10 px-3 text-[10px] font-bold uppercase tracking-wide text-emerald-300 transition-all hover:bg-emerald-500/20 cursor-pointer disabled:opacity-50",children:[F?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(G,{className:"h-3.5 w-3.5"})," Antworten & weiter"]})]})]}),o&&$&&r.status!=="done"&&e.jsx("div",{className:"ml-2 -mt-1",children:e.jsx("div",{className:"rounded-lg border border-border/50 bg-background/50 p-2",children:D&&i.isLoading?e.jsx("p",{className:"text-[10px] text-muted-foreground animate-pulse",children:"Log wird geladen …"}):i.error?e.jsx("p",{className:"text-[10px] text-red-400",children:"Log nicht ladbar"}):(H=i.data)!=null&&H.available&&i.data.lines.length>0?e.jsx("pre",{className:"max-h-64 overflow-auto font-mono text-[10px] leading-relaxed text-foreground/80 whitespace-pre-wrap",children:i.data.lines.join(` -`)}):e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Kein Log verfügbar"})})}),o&&r.status==="done"&&e.jsx(ge,{id:r.id})]},r.id)})}),(t==null?void 0:t.available)&&!s&&l.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Queue ist leer — wirf der Box eine Idee zu."})]}),m]})}function ge({id:t}){const[s,d]=c.useState(null),[g,m]=c.useState(!1);c.useEffect(()=>{let u=!1;return S(`/api/ideen/${t}/ergebnis`).then(j=>{u||d(j)}).catch(()=>{u||m(!0)}),()=>{u=!0}},[t]);const h=s?s.summary||s.result:"";return e.jsx("div",{className:"ml-2 -mt-1",children:e.jsxs("div",{className:"rounded-lg border border-emerald-500/25 bg-emerald-500/5 p-2.5",children:[e.jsxs("p",{className:"mb-1 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wide text-emerald-300",children:[e.jsx(ne,{className:"h-3 w-3"})," Ergebnis des Workers"]}),g?e.jsx("p",{className:"text-[10px] text-red-400",children:"Ergebnis nicht ladbar"}):s===null?e.jsx("p",{className:"text-[10px] text-muted-foreground animate-pulse",children:"Wird geladen …"}):h?e.jsx("p",{className:"max-h-64 overflow-y-auto whitespace-pre-wrap text-xs leading-relaxed text-foreground/85",children:h}):e.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Der Worker hat keine Abschluss-Zusammenfassung hinterlassen (ältere Karte oder Protokollverstoß)."})]})})}function me({item:t}){const s=t.status;if(!s)return null;const d=ce[s.state];return d?e.jsxs("span",{className:C("flex items-center gap-1.5 rounded-lg border px-2 py-0.5 text-[10px] font-bold",d.cls),title:s.detail,children:[d.spin&&e.jsx(f,{className:"h-3 w-3 animate-spin"}),d.label]}):null}function be({item:t,busy:s,onAct:d,showConfirm:g}){var B,L,E;const[m,h]=c.useState(!1),[u,j]=c.useState(null),[A,N]=c.useState(!1),[y,b]=c.useState(!1),[k,w]=c.useState(""),v=((B=t.status)==null?void 0:B.state)==="laeuft"||((L=t.status)==null?void 0:L.state)==="rollback",l=((E=t.status)==null?void 0:E.state)==="eingespielt",p=t.repo??"mc2",D=p==="lucy",i=`${p}:${t.branch}`;async function x(){const a=!m;if(h(a),a&&u===null){N(!0);try{const r=await S(`/api/auftragsbuch/diff?branch=${encodeURIComponent(t.branch)}&repo=${p}`);j(r.diff+(r.truncated?` -… (gekürzt)`:""))}catch(r){j(`(Diff nicht ladbar: ${(r==null?void 0:r.message)||r})`)}finally{N(!1)}}}return e.jsxs("div",{className:"mc-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"rounded-md border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-primary",children:oe[t.kind]??t.kind}),D&&e.jsx("span",{className:"rounded-md border border-pink-500/40 bg-pink-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-pink-300",title:"Vorschlag fürs Lucy-Repo — Annehmen baut die App am PC neu und startet sie neu, wenn sie läuft.",children:"Lucy"}),e.jsx("span",{className:"font-mono text-[11px] text-muted-foreground truncate",title:t.branch,children:t.branch}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground/70",children:[e.jsx(O,{className:"h-3 w-3"}),P(t.ts)]}),e.jsx(me,{item:t})]}),e.jsx("p",{className:"mt-1.5 text-sm font-semibold text-foreground",children:t.subject||"(ohne Titel)"}),t.body&&e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-xs leading-relaxed text-muted-foreground line-clamp-6",children:t.body}),t.empfehlung&&e.jsxs("p",{className:C("mt-1.5 flex items-start gap-1.5 rounded-lg border px-2 py-1 text-[11px]",t.empfehlung.empfehlung==="ANNEHMEN"&&"border-emerald-500/30 bg-emerald-500/5 text-emerald-300",t.empfehlung.empfehlung==="ABLEHNEN"&&"border-red-500/30 bg-red-500/5 text-red-300",t.empfehlung.empfehlung==="UNKLAR"&&"border-amber-500/30 bg-amber-500/5 text-amber-300"),title:`Nächtliches Kurz-Gutachten (${t.empfehlung.richter}) — eine Meinung, kein Muss. Die Entscheidung bleibt bei dir.`,children:[e.jsx(U,{className:"mt-0.5 h-3 w-3 shrink-0"}),e.jsxs("span",{children:[e.jsxs("b",{children:["Empfehlung: ",t.empfehlung.empfehlung==="ANNEHMEN"?"Annehmen":t.empfehlung.empfehlung==="ABLEHNEN"?"Ablehnen":"Unklar","."]})," ",t.empfehlung.satz]})]})]}),!v&&!l&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!t.verwaist&&e.jsxs("button",{disabled:!!s[i],onClick:()=>g("Vorschlag annehmen?",D?`'${t.branch}' wird im Lucy-Repo auf main gemergt, dann baut dein PC die App neu (dist) und startet Lucy neu, falls sie gerade läuft. Der PC muss dafür an sein. Schlägt Build oder Start fehl, dreht die Box den Merge automatisch zurück — die laufende Lucy bleibt die alte.`:`'${t.branch}' wird auf main gemergt und live eingespielt. Die Zentrale startet dabei kurz neu. Geht der Health-Check danach rot, rollt die Box automatisch zurück.${t.frontend_ohne_build?` - -Achtung: Enthält Frontend-Quelltext ohne gebautes Bundle — die Oberfläche bleibt alt, bis am PC gebaut wird.`:""}`,()=>d(i,"/api/auftragsbuch/annehmen",{branch:t.branch,repo:p})),className:"flex h-9 items-center gap-1.5 rounded-lg border border-emerald-500/40 bg-emerald-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-emerald-300 transition-all hover:bg-emerald-500/20 cursor-pointer disabled:opacity-50",children:[s[i]?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Q,{className:"h-3.5 w-3.5"})," Annehmen"]}),e.jsxs("button",{disabled:!!s["ab:"+i],onClick:()=>b(a=>!a),className:"flex h-9 items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300/90 transition-all hover:bg-red-500/15 cursor-pointer disabled:opacity-50",children:[s["ab:"+i]?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(z,{className:"h-3.5 w-3.5"})," Ablehnen"]})]})]}),y&&!v&&!l&&e.jsxs("div",{className:"space-y-2 rounded-xl border border-red-500/25 bg-red-500/5 p-3",children:[e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Der Branch '",t.branch,"' wird auf Gitea gelöscht (die Arbeit bleibt in der Historie). Sag der Box kurz ",e.jsx("b",{children:"warum"})," — dann schlägt sie dir so etwas nicht wieder vor."]}),e.jsx("input",{value:k,onChange:a=>w(a.target.value),placeholder:"Grund (optional) — z. B. „gibt es schon“ oder „will ich nicht“",maxLength:400,className:"w-full rounded-lg border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-red-400/50 focus:outline-none"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{disabled:!!s["ab:"+i],onClick:()=>{b(!1),d("ab:"+i,"/api/auftragsbuch/ablehnen",{branch:t.branch,repo:p,grund:k.trim()})},className:"flex h-8 items-center gap-1.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300 transition-all hover:bg-red-500/20 cursor-pointer disabled:opacity-50",children:[e.jsx(z,{className:"h-3.5 w-3.5"})," Wirklich ablehnen"]}),e.jsx("button",{onClick:()=>b(!1),className:"flex h-8 items-center rounded-lg border border-border/60 bg-background/40 px-3 text-[11px] font-semibold text-muted-foreground transition-all hover:text-foreground cursor-pointer",children:"Abbrechen"})]})]}),t.status&&(v||!l)&&t.status.detail&&e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.status.detail}),t.verwaist&&e.jsxs("p",{className:"rounded-lg border border-red-500/30 bg-red-500/5 px-2 py-1.5 text-[11px] text-red-300/90",children:[e.jsx("b",{children:"Kaputt aufgesetzt:"})," Dieser Branch hat keinen gemeinsamen Ursprung mit main (der Werkstatt-Worker hat nicht richtig geklont) — Annehmen ist technisch unmöglich, deshalb fehlt der Knopf. Am besten ",e.jsx("b",{children:"ablehnen mit Grund"}),"; die Idee kann danach frisch in die Queue."]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 font-mono",children:[t.ahead," Commit",t.ahead===1?"":"s"]}),t.shortstat&&e.jsx("span",{className:"rounded bg-background/40 px-1.5 py-0.5 font-mono",children:t.shortstat.trim()}),t.verwaist&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-red-500/10 px-1.5 py-0.5 text-red-300",title:"Kein gemeinsamer Vorfahre mit main — git kann diesen Branch niemals mergen.",children:[e.jsx(K,{className:"h-3 w-3"})," kein gemeinsamer Ursprung"]}),t.leer&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-amber-300",title:"Der Diff gegen main ist leer — der Branch würde nichts verändern (Inhalt schon in main oder am Repo vorbei gearbeitet).",children:[e.jsx(K,{className:"h-3 w-3"})," Diff leer — bringt nichts"]}),t.behind>0&&!t.verwaist&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-amber-300",title:"main ist seit diesem Vorschlag weitergelaufen — bei Konflikten versucht die Annahme automatisch einen Rebase.",children:[e.jsx(K,{className:"h-3 w-3"})," ",t.behind," hinter main"]}),t.frontend_ohne_build&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-amber-300",title:"Die Box kann kein Frontend bauen (kein Node) — nach dem Annehmen bleibt die Oberfläche alt, bis am PC gebaut wird.",children:[e.jsx(K,{className:"h-3 w-3"})," Frontend ohne Build"]})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[m?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(R,{className:"h-3.5 w-3.5"}),e.jsx(le,{className:"h-3.5 w-3.5"})," ",t.files.length," Datei",t.files.length===1?"":"en"," — Änderungen ansehen"]}),m&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.files.map(a=>e.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:[e.jsx("b",{className:C(a.status.startsWith("A")&&"text-emerald-400",a.status.startsWith("D")&&"text-red-400",a.status.startsWith("M")&&"text-sky-400"),children:a.status})," ",a.path]},a.path)),t.files_truncated&&e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"…"})]}),e.jsx("div",{className:"max-h-96 overflow-auto rounded-xl border border-border/50 bg-background/50 p-3",children:A?e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Diff wird geladen …"}):e.jsx("pre",{className:"text-[10px] leading-relaxed text-foreground/80 whitespace-pre",children:(u??"").split(` -`).map((a,r)=>e.jsx("span",{className:C("block",a.startsWith("+")&&!a.startsWith("+++")&&"text-emerald-300/90 bg-emerald-500/5",a.startsWith("-")&&!a.startsWith("---")&&"text-red-300/90 bg-red-500/5",(a.startsWith("@@")||a.startsWith("diff "))&&"text-sky-300/90"),children:a||" "},r))})})]})]})]})}function pe({k:t,busy:s,onAct:d,showConfirm:g}){const[m,h]=c.useState(!1);return e.jsxs("div",{className:"rounded-2xl border border-violet-500/25 bg-violet-500/[0.04] p-4 shadow-lg shadow-black/15 backdrop-blur-md space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"rounded-md border border-violet-500/30 bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-violet-300",children:"Traum-Idee"}),e.jsx("span",{className:"font-mono text-[11px] text-muted-foreground truncate",children:t.file}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground/70",children:[e.jsx(O,{className:"h-3 w-3"}),P(t.mtime)]})]}),e.jsx("p",{className:"mt-1.5 text-sm font-semibold text-foreground",children:t.title})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs("button",{disabled:!!s["sk:"+t.file],onClick:()=>g("Werkstatt beauftragen?",`Der Kandidat '${t.title}' geht als Auftrag an die Werkstatt (Orchestrator, propose-only). Das Ergebnis erscheint später als neuer Patch-Vorschlag hier im Auftragsbuch — nichts geht ungefragt live.`,()=>d("sk:"+t.file,"/api/auftragsbuch/skill/annehmen",{file:t.file},"Die Werkstatt arbeitet. Das Ergebnis taucht als neuer Vorschlag im Auftragsbuch auf (das kann einige Minuten dauern).")),className:"flex h-9 items-center gap-1.5 rounded-lg border border-violet-500/40 bg-violet-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-violet-300 transition-all hover:bg-violet-500/20 cursor-pointer disabled:opacity-50",children:[s["sk:"+t.file]?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ie,{className:"h-3.5 w-3.5"})," Beauftragen"]}),e.jsxs("button",{disabled:!!s["skab:"+t.file],onClick:()=>g("Kandidat verwerfen?",`'${t.title}' wandert ins Archiv des Wissens-Vaults (verworfen/). Der Traum schlägt ihn nicht erneut vor.`,()=>d("skab:"+t.file,"/api/auftragsbuch/skill/ablehnen",{file:t.file})),className:"flex h-9 items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300/90 transition-all hover:bg-red-500/15 cursor-pointer disabled:opacity-50",children:[s["skab:"+t.file]?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(z,{className:"h-3.5 w-3.5"})," Verwerfen"]})]})]}),e.jsxs("button",{onClick:()=>h(u=>!u),className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[m?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(R,{className:"h-3.5 w-3.5"}),e.jsx(se,{className:"h-3.5 w-3.5"})," Vorschlag lesen"]}),m&&e.jsx("pre",{className:"max-h-72 overflow-auto rounded-xl border border-border/50 bg-background/50 p-3 text-[11px] leading-relaxed text-foreground/85 whitespace-pre-wrap",children:t.preview})]})}export{we as AuftragsbuchView}; diff --git a/frontend/dist/assets/ChronikView-D1lzXDtv.js b/frontend/dist/assets/ChronikView-B7R_z6Jw.js similarity index 97% rename from frontend/dist/assets/ChronikView-D1lzXDtv.js rename to frontend/dist/assets/ChronikView-B7R_z6Jw.js index 6b40d89..d634b4c 100644 --- a/frontend/dist/assets/ChronikView-D1lzXDtv.js +++ b/frontend/dist/assets/ChronikView-B7R_z6Jw.js @@ -1,4 +1,4 @@ -import{c as m,ae as S,r as c,j as e,af as z,L as g,U as M,ag as C,ad as D,ah as A,ai as B,aj as Z,e as E,ak as L,u as R,b as q,g as k,q as T}from"./index-D94Dzyvg.js";import{R as j}from"./rotate-ccw--ed6DlAf.js";/** +import{c as m,af as S,r as c,j as e,ag as z,L as g,U as M,ah as C,ae as D,ai as A,aj as B,ak as Z,e as E,al as L,u as R,b as q,g as k,q as T}from"./index-CQgUnd1p.js";import{R as j}from"./rotate-ccw-ChVZWN8g.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/ConnectView-DzOsZPw7.js b/frontend/dist/assets/ConnectView-3IcUm9UA.js similarity index 98% rename from frontend/dist/assets/ConnectView-DzOsZPw7.js rename to frontend/dist/assets/ConnectView-3IcUm9UA.js index d95244c..c084ee7 100644 --- a/frontend/dist/assets/ConnectView-DzOsZPw7.js +++ b/frontend/dist/assets/ConnectView-3IcUm9UA.js @@ -1,4 +1,4 @@ -import{c as v,r as c,I as D,J as I,j as e,K as h,x as B,B as H,D as z,M as E,e as M,L as T,N as F,C as K}from"./index-D94Dzyvg.js";import{F as O}from"./folder-open-DzbxkBSk.js";import{C as R}from"./circle-x-C6D3ABCj.js";import{C as V}from"./copy-Dy-OlKte.js";/** +import{c as v,r as c,I as D,J as I,j as e,K as h,x as B,B as H,D as z,M as E,e as M,L as T,N as F,C as K}from"./index-CQgUnd1p.js";import{F as O}from"./folder-open-vcdogQ3l.js";import{C as R}from"./circle-x-DKuGYlQP.js";import{C as V}from"./copy-hJYMa3at.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/EigenlebenView-99dmmNcA.js b/frontend/dist/assets/EigenlebenView-99dmmNcA.js deleted file mode 100644 index 5279824..0000000 --- a/frontend/dist/assets/EigenlebenView-99dmmNcA.js +++ /dev/null @@ -1,6 +0,0 @@ -import{c as h,al as b,r as o,j as e,L as g,am as f,a2 as j,U as k,e as i,D as N,M as v,N as w,g as y}from"./index-D94Dzyvg.js";import{B as z}from"./book-open-Cc6Rq6Ws.js";import{C as S}from"./circle-x-C6D3ABCj.js";/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u=h("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),D={selbst:{icon:k,cls:"text-emerald-300 bg-emerald-500/10 border-emerald-500/30",erklaerung:"Diese Skills hat sich die Box selbst geschrieben — niemand hat sie ihr installiert."},repo:{icon:j,cls:"text-primary bg-primary/10 border-primary/25",erklaerung:"Von uns gebaut und über das Repo installiert (deploy/skills)."},bundled:{icon:f,cls:"text-muted-foreground bg-background/40 border-border/50",erklaerung:"Kamen mit Hermes mit — Standard-Ausstattung."}};function C(t){if(!t)return"—";const n=new Date(t);return isNaN(n.getTime())?"—":n.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"2-digit"})}function I(){const{data:t,isLoading:n}=b(),d=o.useMemo(()=>{const s=[];for(const r of(t==null?void 0:t.skills)??[]){const a=s[s.length-1];a&&a.herkunft===r.herkunft?a.skills.push(r):s.push({herkunft:r.herkunft,label:r.herkunft_label,skills:[r]})}return s},[t]);return e.jsxs("div",{className:"space-y-7",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Skills"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Die Fähigkeiten deiner Box — mit Herkunft, Nutzung und ob der Agent sie gerade laden kann (aktiv/inaktiv). Das ist derselbe Skill-Satz, mit dem Lucy spricht und die Nacht-Worker arbeiten. Darunter: was aus den Vorschlägen der Box wurde."})]}),n&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(g,{className:"h-4 w-4 animate-spin"})," Wird geladen …"]}),t&&!t.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Die Skills liegen auf der Box (~/.hermes/skills) — im lokalen Dev-Modus nicht verfügbar."}),(t==null?void 0:t.available)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[e.jsx(c,{label:"Skills gesamt",wert:t.skills.length}),e.jsx(c,{label:"davon selbst erstellt",wert:t.selbst_erstellt,betone:!0}),e.jsx(c,{label:"Vorschläge angenommen",wert:t.bilanz.angenommen}),e.jsx(c,{label:"Vorschläge abgelehnt",wert:t.bilanz.abgelehnt})]}),d.map(s=>{const r=D[s.herkunft],a=r.icon;return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:i("inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] font-bold",r.cls),children:[e.jsx(a,{className:"h-3.5 w-3.5"})," ",s.label," · ",s.skills.length]}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70",children:r.erklaerung})]}),e.jsx("div",{className:"grid gap-2 md:grid-cols-2",children:s.skills.map(l=>e.jsx(B,{skill:l},l.id))})]},s.herkunft)}),e.jsx(L,{eintraege:t.bilanz.eintraege})]})]})}function c({label:t,wert:n,betone:d}){return e.jsxs("div",{className:i("rounded-xl border p-3",d?"border-emerald-500/30 bg-emerald-500/5":"border-border/50 bg-card/40"),children:[e.jsx("p",{className:i("font-space text-xl font-bold",d?"text-emerald-300":"text-foreground"),children:n}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:t})]})}function B({skill:t}){const[n,d]=o.useState(!1),[s,r]=o.useState(null),[a,l]=o.useState(!1);async function x(){const m=!n;if(d(m),m&&s===null&&!a){l(!0);try{const p=await y(`/api/eigenleben/skill/${encodeURIComponent(t.id)}`);r(p.text)}catch{r("(Konnte den Skill-Text nicht laden.)")}finally{l(!1)}}}return e.jsxs("div",{className:"rounded-xl border border-border/50 bg-card/40 p-3 backdrop-blur-sm",children:[e.jsxs("button",{onClick:x,className:"flex w-full items-start gap-2 text-left cursor-pointer",children:[n?e.jsx(N,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(v,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:t.name}),t.aktiv===!0&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[9px] font-bold text-emerald-300",title:"Der Agent kann diesen Skill laden und nutzen.",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400"})," aktiv"]}),t.aktiv===!1&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-zinc-500/10 px-1.5 py-0.5 text-[9px] font-bold text-zinc-400",title:"Der Agent kann diesen Skill gerade NICHT laden — Plattform passt nicht (z. B. Apple-Skills auf Linux), Voraussetzungen fehlen oder per Config abgeschaltet.",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-zinc-500"})," inaktiv"]}),t.kategorie&&e.jsx("span",{className:"rounded bg-background/60 px-1.5 py-0.5 text-[9px] font-semibold text-muted-foreground/80",children:t.kategorie}),t.genutzt>0&&e.jsxs("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[9px] font-bold text-primary",title:`zuletzt: ${C(t.zuletzt_genutzt)}`,children:[t.genutzt,"× genutzt"]}),t.status!=="active"&&e.jsx("span",{className:"rounded bg-amber-500/10 px-1.5 py-0.5 text-[9px] font-bold text-amber-300",children:t.status})]}),e.jsx("p",{className:i("mt-1 text-xs leading-relaxed text-foreground/75",!n&&"line-clamp-2"),children:t.beschreibung||"(keine Beschreibung im Skill hinterlegt)"})]})]}),n&&e.jsxs("div",{className:"mt-2 border-t border-border/40 pt-2",children:[e.jsxs("p",{className:"mb-1.5 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:[e.jsx(z,{className:"h-3 w-3"})," So funktioniert er (SKILL.md)",t.autor?` · Autor: ${t.autor}`:""]}),a?e.jsx(g,{className:"h-4 w-4 animate-spin text-muted-foreground"}):e.jsx("pre",{className:"max-h-80 overflow-y-auto whitespace-pre-wrap rounded-lg bg-background/50 p-2.5 font-mono text-[10.5px] leading-relaxed text-foreground/80 scrollbar-thin",children:s??""})]})]})}function L({eintraege:t}){const[n,d]=o.useState(!1),s=n?t:t.slice(0,12);return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(u,{className:"h-3.5 w-3.5"})," Vorschlags-Bilanz — was die Box vorschlug und was daraus wurde"]}),t.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-6 text-center text-xs text-muted-foreground",children:"Noch keine Vorschläge verbucht. Sobald die Box etwas vorschlägt und du klickst, steht die Entscheidung hier."}),e.jsx("div",{className:"space-y-2",children:s.map((r,a)=>{const l=r.art==="angenommen",x=l?w:r.art==="abgelehnt"?S:u;return e.jsxs("div",{className:"flex items-start gap-2.5 rounded-xl border border-border/50 bg-card/40 p-3",children:[e.jsx(x,{className:i("mt-0.5 h-4 w-4 shrink-0",l?"text-emerald-400":r.art==="abgelehnt"?"text-red-400":"text-amber-300")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-semibold text-foreground",children:r.titel}),e.jsx("span",{className:i("rounded px-1.5 py-0.5 text-[9px] font-bold uppercase",l?"bg-emerald-500/10 text-emerald-300":r.art==="abgelehnt"?"bg-red-500/10 text-red-300":"bg-amber-500/10 text-amber-300"),children:r.art}),e.jsx("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground/60",children:r.ts?new Date(r.ts*1e3).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"}):""})]}),r.detail&&e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-foreground/70",children:r.detail})]})]},`${r.titel}-${r.ts}-${a}`)})}),!n&&t.length>12&&e.jsxs("button",{onClick:()=>d(!0),className:"text-[11px] text-muted-foreground underline hover:text-foreground cursor-pointer",children:["Alle ",t.length," Einträge anzeigen"]})]})}export{I as EigenlebenView}; diff --git a/frontend/dist/assets/EigenlebenView-BYo9hkxa.js b/frontend/dist/assets/EigenlebenView-BYo9hkxa.js new file mode 100644 index 0000000..251fbad --- /dev/null +++ b/frontend/dist/assets/EigenlebenView-BYo9hkxa.js @@ -0,0 +1,6 @@ +import{c as h,am as b,r as i,j as e,L as g,an as f,a2 as j,U as k,e as o,D as N,M as v,N as w,g as y}from"./index-CQgUnd1p.js";import{B as S}from"./book-open-BFFOe9re.js";import{C as z}from"./circle-x-DKuGYlQP.js";/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u=h("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),D={selbst:{icon:k,cls:"text-emerald-300 bg-emerald-500/10 border-emerald-500/30",erklaerung:"Diese Skills hat sich die Box selbst geschrieben — niemand hat sie ihr installiert."},repo:{icon:j,cls:"text-primary bg-primary/10 border-primary/25",erklaerung:"Von uns gebaut und über das Repo installiert (deploy/skills)."},bundled:{icon:f,cls:"text-muted-foreground bg-background/40 border-border/50",erklaerung:"Kamen mit Hermes mit — Standard-Ausstattung."}},C={disabled:"abgeschaltet",deprecated:"veraltet",broken:"defekt",error:"Fehler"};function B(t){if(!t)return"—";const n=new Date(t);return isNaN(n.getTime())?"—":n.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"2-digit"})}function T(){const{data:t,isLoading:n}=b(),d=i.useMemo(()=>{const s=[];for(const r of(t==null?void 0:t.skills)??[]){const a=s[s.length-1];a&&a.herkunft===r.herkunft?a.skills.push(r):s.push({herkunft:r.herkunft,label:r.herkunft_label,skills:[r]})}return s},[t]);return e.jsxs("div",{className:"space-y-7",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Skills"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Die Fähigkeiten deiner Box — mit Herkunft, Nutzung und ob der Agent sie gerade laden kann (aktiv/inaktiv). Das ist derselbe Skill-Satz, mit dem Lucy spricht und die Nacht-Worker arbeiten. Darunter: was aus den Vorschlägen der Box wurde."})]}),n&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(g,{className:"h-4 w-4 animate-spin"})," Wird geladen …"]}),t&&!t.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Die Skills liegen auf der Box (~/.hermes/skills) — im lokalen Dev-Modus nicht verfügbar."}),(t==null?void 0:t.available)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[e.jsx(c,{label:"Skills gesamt",wert:t.skills.length}),e.jsx(c,{label:"davon selbst erstellt",wert:t.selbst_erstellt,betone:!0}),e.jsx(c,{label:"Vorschläge angenommen",wert:t.bilanz.angenommen}),e.jsx(c,{label:"Vorschläge abgelehnt",wert:t.bilanz.abgelehnt})]}),d.map(s=>{const r=D[s.herkunft],a=r.icon;return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:o("inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] font-bold",r.cls),children:[e.jsx(a,{className:"h-3.5 w-3.5"})," ",s.label," · ",s.skills.length]}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70",children:r.erklaerung})]}),e.jsx("div",{className:"grid gap-2 md:grid-cols-2",children:s.skills.map(l=>e.jsx(L,{skill:l},l.id))})]},s.herkunft)}),e.jsx(A,{eintraege:t.bilanz.eintraege})]})]})}function c({label:t,wert:n,betone:d}){return e.jsxs("div",{className:o("rounded-xl border p-3",d?"border-emerald-500/30 bg-emerald-500/5":"border-border/50 bg-card/40"),children:[e.jsx("p",{className:o("font-space text-xl font-bold",d?"text-emerald-300":"text-foreground"),children:n}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:t})]})}function L({skill:t}){const[n,d]=i.useState(!1),[s,r]=i.useState(null),[a,l]=i.useState(!1);async function x(){const m=!n;if(d(m),m&&s===null&&!a){l(!0);try{const p=await y(`/api/eigenleben/skill/${encodeURIComponent(t.id)}`);r(p.text)}catch{r("(Konnte den Skill-Text nicht laden.)")}finally{l(!1)}}}return e.jsxs("div",{className:"rounded-xl border border-border/50 bg-card/40 p-3 backdrop-blur-sm",children:[e.jsxs("button",{onClick:x,className:"flex w-full items-start gap-2 text-left cursor-pointer",children:[n?e.jsx(N,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(v,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:t.name}),t.aktiv===!0&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[9px] font-bold text-emerald-300",title:"Der Agent kann diesen Skill laden und nutzen.",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400"})," aktiv"]}),t.aktiv===!1&&e.jsxs("span",{className:"flex items-center gap-1 rounded bg-zinc-500/10 px-1.5 py-0.5 text-[9px] font-bold text-zinc-400",title:"Der Agent kann diesen Skill gerade NICHT laden — Plattform passt nicht (z. B. Apple-Skills auf Linux), Voraussetzungen fehlen oder per Config abgeschaltet.",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-zinc-500"})," inaktiv"]}),t.kategorie&&e.jsx("span",{className:"rounded bg-background/60 px-1.5 py-0.5 text-[9px] font-semibold text-muted-foreground/80",children:t.kategorie}),t.genutzt>0&&e.jsxs("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[9px] font-bold text-primary",title:`zuletzt: ${B(t.zuletzt_genutzt)}`,children:[t.genutzt,"× genutzt"]}),t.status!=="active"&&e.jsx("span",{className:"rounded bg-amber-500/10 px-1.5 py-0.5 text-[9px] font-bold text-amber-300",children:C[t.status]??t.status})]}),e.jsx("p",{className:o("mt-1 text-xs leading-relaxed text-foreground/75",!n&&"line-clamp-2"),children:t.beschreibung||"(keine Beschreibung im Skill hinterlegt)"})]})]}),n&&e.jsxs("div",{className:"mt-2 border-t border-border/40 pt-2",children:[e.jsxs("p",{className:"mb-1.5 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:[e.jsx(S,{className:"h-3 w-3"})," So funktioniert er (SKILL.md)",t.autor?` · Autor: ${t.autor}`:""]}),a?e.jsx(g,{className:"h-4 w-4 animate-spin text-muted-foreground"}):e.jsx("pre",{className:"max-h-80 overflow-y-auto whitespace-pre-wrap rounded-lg bg-background/50 p-2.5 font-mono text-[10.5px] leading-relaxed text-foreground/80 scrollbar-thin",children:s??""})]})]})}function A({eintraege:t}){const[n,d]=i.useState(!1),s=n?t:t.slice(0,12);return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(u,{className:"h-3.5 w-3.5"})," Vorschlags-Bilanz — was die Box vorschlug und was daraus wurde"]}),t.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-6 text-center text-xs text-muted-foreground",children:"Noch keine Vorschläge verbucht. Sobald die Box etwas vorschlägt und du klickst, steht die Entscheidung hier."}),e.jsx("div",{className:"space-y-2",children:s.map((r,a)=>{const l=r.art==="angenommen",x=l?w:r.art==="abgelehnt"?z:u;return e.jsxs("div",{className:"flex items-start gap-2.5 rounded-xl border border-border/50 bg-card/40 p-3",children:[e.jsx(x,{className:o("mt-0.5 h-4 w-4 shrink-0",l?"text-emerald-400":r.art==="abgelehnt"?"text-red-400":"text-amber-300")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-semibold text-foreground",children:r.titel}),e.jsx("span",{className:o("rounded px-1.5 py-0.5 text-[9px] font-bold uppercase",l?"bg-emerald-500/10 text-emerald-300":r.art==="abgelehnt"?"bg-red-500/10 text-red-300":"bg-amber-500/10 text-amber-300"),children:r.art}),e.jsx("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground/60",children:r.ts?new Date(r.ts*1e3).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"}):""})]}),r.detail&&e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-foreground/70",children:r.detail})]})]},`${r.titel}-${r.ts}-${a}`)})}),!n&&t.length>12&&e.jsxs("button",{onClick:()=>d(!0),className:"text-[11px] text-muted-foreground underline hover:text-foreground cursor-pointer",children:["Alle ",t.length," Einträge anzeigen"]})]})}export{T as EigenlebenView}; diff --git a/frontend/dist/assets/GraphView-DKQq2qmv.js b/frontend/dist/assets/GraphView-BOVrShvN.js similarity index 99% rename from frontend/dist/assets/GraphView-DKQq2qmv.js rename to frontend/dist/assets/GraphView-BOVrShvN.js index 0495178..a17481e 100644 --- a/frontend/dist/assets/GraphView-DKQq2qmv.js +++ b/frontend/dist/assets/GraphView-BOVrShvN.js @@ -1,4 +1,4 @@ -import{aq as Lt,r as V,ar as Zi,as as Gn,at as Vn,au as Ki,av as Qi,aw as Wn,ax as Bn,ay as Ji,j as lt,a9 as to}from"./index-D94Dzyvg.js";function eo(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var Xn=180/Math.PI,un={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vr(e,n,r,i,o,a){var s,u,f;return(s=Math.sqrt(e*e+n*n))&&(e/=s,n/=s),(f=e*r+n*i)&&(r-=e*f,i-=n*f),(u=Math.sqrt(r*r+i*i))&&(r/=u,i/=u,f/=u),e*i180?c+=360:c-l>180&&(l+=360),d.push({i:h.push(o(h)+"rotate(",null,i)-2,x:Lt(l,c)})):c&&h.push(o(h)+"rotate("+c+i)}function u(l,c,h,d){l!==c?d.push({i:h.push(o(h)+"skewX(",null,i)-2,x:Lt(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,p,y){if(l!==h||c!==d){var v=p.push(o(p)+"scale(",null,",",null,")");y.push({i:v-4,x:Lt(l,h)},{i:v-2,x:Lt(c,d)})}else(h!==1||d!==1)&&p.push(o(p)+"scale("+h+","+d+")")}return function(l,c){var h=[],d=[];return l=e(l),c=e(c),a(l.translateX,l.translateY,c.translateX,c.translateY,h,d),s(l.rotate,c.rotate,h,d),u(l.skewX,c.skewX,h,d),f(l.scaleX,l.scaleY,c.scaleX,c.scaleY,h,d),l=c=null,function(p){for(var y=-1,v=d.length,_;++ye.length)&&(n=e.length);for(var r=0,i=new Array(n);r180?c+=360:c-l>180&&(l+=360),d.push({i:h.push(o(h)+"rotate(",null,i)-2,x:Lt(l,c)})):c&&h.push(o(h)+"rotate("+c+i)}function u(l,c,h,d){l!==c?d.push({i:h.push(o(h)+"skewX(",null,i)-2,x:Lt(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,p,y){if(l!==h||c!==d){var v=p.push(o(p)+"scale(",null,",",null,")");y.push({i:v-4,x:Lt(l,h)},{i:v-2,x:Lt(c,d)})}else(h!==1||d!==1)&&p.push(o(p)+"scale("+h+","+d+")")}return function(l,c){var h=[],d=[];return l=e(l),c=e(c),a(l.translateX,l.translateY,c.translateX,c.translateY,h,d),s(l.rotate,c.rotate,h,d),u(l.skewX,c.skewX,h,d),f(l.scaleX,l.scaleY,c.scaleX,c.scaleY,h,d),l=c=null,function(p){for(var y=-1,v=d.length,_;++ye.length)&&(n=e.length);for(var r=0,i=new Array(n);ra,methodNames:i=[],initPropNames:o=[]}={}){return V.forwardRef((a,s)=>{const u=V.useRef(),f=V.useMemo(()=>{const h=Object.fromEntries(o.filter(d=>a.hasOwnProperty(d)).map(d=>[d,a[d]]));return e(h)},[]);Kn(()=>{f(r(u.current))},V.useLayoutEffect),Kn(()=>f._destructor instanceof Function?f._destructor:void 0);const l=V.useCallback((h,...d)=>f[h]instanceof Function?f[h](...d):void 0,[f]),c=V.useRef({});return Object.keys(xo(a,[...i,...o])).filter(h=>c.current[h]!==a[h]).forEach(h=>l(h,a[h])),c.current=a,V.useImperativeHandle(s,()=>Object.fromEntries(i.map(h=>[h,(...d)=>l(h,...d)])),[l]),Zi.createElement(n,{ref:u})})}function Kn(e,n=V.useEffect){const r=V.useRef(),i=V.useRef(!1),o=V.useRef(!1),[a,s]=V.useState(0);i.current&&(o.current=!0),n(()=>(i.current||(r.current=e(),i.current=!0),s(u=>u+1),()=>{o.current&&(r.current&&r.current(),r.current=void 0,i.current=!1,o.current=!1)}),[])}var fn="http://www.w3.org/1999/xhtml";const Qn={svg:"http://www.w3.org/2000/svg",xhtml:fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qe(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Qn.hasOwnProperty(n)?{space:Qn[n],local:e}:e}function ko(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===fn&&n.documentElement.namespaceURI===fn?n.createElement(e):n.createElementNS(r,e)}}function Co(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xr(e){var n=qe(e);return(n.local?Co:ko)(n)}function Ao(){}function An(e){return e==null?Ao:function(){return this.querySelector(e)}}function So(e){typeof e!="function"&&(e=An(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o=T&&(T=w+1);!(b=_[T])&&++T=0;)(s=i[o])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function Ko(e){e||(e=Qo);function n(h,d){return h&&d?e(h.__data__,d.__data__):!h-!d}for(var r=this._groups,i=r.length,o=new Array(i),a=0;an?1:e>=n?0:NaN}function Jo(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ta(){return Array.from(this)}function ea(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?ha:typeof n=="function"?pa:da)(e,n,r??"")):Bt(this.node(),e)}function Bt(e,n){return e.style.getPropertyValue(n)||Jr(e).getComputedStyle(e,null).getPropertyValue(n)}function ya(e){return function(){delete this[e]}}function _a(e,n){return function(){this[e]=n}}function va(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function ma(e,n){return arguments.length>1?this.each((n==null?ya:typeof n=="function"?va:_a)(e,n)):this.node()[e]}function ti(e){return e.trim().split(/^|\s+/)}function Sn(e){return e.classList||new ei(e)}function ei(e){this._node=e,this._names=ti(e.getAttribute("class")||"")}ei.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ni(e,n){for(var r=Sn(e),i=-1,o=n.length;++i=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function Ba(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,a;r{}};function ve(){for(var e=0,n=arguments.length,r={},i;e=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Ae.prototype=ve.prototype={constructor:Ae,on:function(e,n){var r=this._,i=rs(e+"",r),o,a=-1,s=i.length;if(arguments.length<2){for(;++a0)for(var r=new Array(o),i=0,o,a;i()=>e;function cn(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:a,x:s,y:u,dx:f,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}cn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function as(e){return!e.ctrlKey&&!e.button}function ss(){return this.parentNode}function us(e,n){return n??{x:e.x,y:e.y}}function ls(){return navigator.maxTouchPoints||"ontouchstart"in this}function fs(){var e=as,n=ss,r=us,i=ls,o={},a=ve("start","drag","end"),s=0,u,f,l,c,h=0;function d(x){x.on("mousedown.drag",p).filter(i).on("touchstart.drag",_).on("touchmove.drag",g,os).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,b){if(!(c||!e.call(this,x,b))){var C=T(this,n.call(this,x,b),x,b,"mouse");C&&(pt(x.view).on("mousemove.drag",y,pe).on("mouseup.drag",v,pe),ai(x.view),Ze(x),l=!1,u=x.clientX,f=x.clientY,C("start",x))}}function y(x){if(Wt(x),!l){var b=x.clientX-u,C=x.clientY-f;l=b*b+C*C>h}o.mouse("drag",x)}function v(x){pt(x.view).on("mousemove.drag mouseup.drag",null),si(x.view,l),Wt(x),o.mouse("end",x)}function _(x,b){if(e.call(this,x,b)){var C=x.changedTouches,S=n.call(this,x,b),M=C.length,N,P;for(N=0;N=0&&e._call.call(void 0,n),e=e._next;--Xt}function tr(){Ht=(Re=ge.now())+Ge,Xt=ae=0;try{hs()}finally{Xt=0,ps(),Ht=0}}function ds(){var e=ge.now(),n=e-Re;n>ui&&(Ge-=n,Re=e)}function ps(){for(var e,n=ze,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:ze=r);se=e,hn(i)}function hn(e){if(!Xt){ae&&(ae=clearTimeout(ae));var n=e-Ht;n>24?(e<1/0&&(ae=setTimeout(tr,e-ge.now()-Ge)),Qt&&(Qt=clearInterval(Qt))):(Qt||(Re=ge.now(),Qt=setInterval(ds,ui)),Xt=1,li(tr))}}function er(e,n,r){var i=new Ne;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var gs=ve("start","end","cancel","interrupt"),ys=[],fi=0,nr=1,dn=2,Se=3,rr=4,pn=5,Te=6;function Ve(e,n,r,i,o,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;_s(e,r,{name:n,index:i,group:o,on:gs,tween:ys,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:fi})}function Pn(e,n){var r=vt(e,n);if(r.state>fi)throw new Error("too late; already scheduled");return r}function Ct(e,n){var r=vt(e,n);if(r.state>Se)throw new Error("too late; already running");return r}function vt(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function _s(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=Mn(a,0,r.time);function a(l){r.state=nr,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var c,h,d,p;if(r.state!==nr)return f();for(c in i)if(p=i[c],p.name===r.name){if(p.state===Se)return er(s);p.state===rr?(p.state=Te,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[c]):+cdn&&i.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function Bs(e,n,r){var i,o,a=Ws(n)?Pn:Ct;return function(){var s=a(this,e),u=s.on;u!==i&&(o=(i=u).copy()).on(n,r),s.on=o}}function Xs(e,n){var r=this._id;return arguments.length<2?vt(this.node(),r).on.on(e):this.each(Bs(r,e,n))}function Ys(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function Zs(){return this.on("end.remove",Ys(this._id))}function Ks(e){var n=this._name,r=this._id;typeof e!="function"&&(e=An(e));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s()=>e;function wu(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Et(e,n,r){this.k=e,this.x=n,this.y=r}Et.prototype={constructor:Et,scale:function(e){return e===1?this:new Et(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Et(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var En=new Et(1,0,0);mt.prototype=Et.prototype;function mt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return En;return e.__zoom}function Ke(e){e.stopImmediatePropagation()}function Jt(e){e.preventDefault(),e.stopImmediatePropagation()}function ku(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Cu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ir(){return this.__zoom||En}function Au(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Su(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tu(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],a=e.invertY(n[0][1])-r[0][1],s=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}function Mu(){var e=ku,n=Cu,r=Tu,i=Au,o=Su,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],u=250,f=lo,l=ve("start","zoom","end"),c,h,d,p=500,y=150,v=0,_=10;function g(A){A.property("__zoom",ir).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",R).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(A,I,E,k){var O=A.selection?A.selection():A;O.property("__zoom",ir),A!==O?b(A,I,E,k):O.interrupt().each(function(){C(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},g.scaleBy=function(A,I,E,k){g.scaleTo(A,function(){var O=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return O*j},E,k)},g.scaleTo=function(A,I,E,k){g.transform(A,function(){var O=n.apply(this,arguments),j=this.__zoom,$=E==null?x(O):typeof E=="function"?E.apply(this,arguments):E,U=j.invert($),F=typeof I=="function"?I.apply(this,arguments):I;return r(T(w(j,F),$,U),O,s)},E,k)},g.translateBy=function(A,I,E,k){g.transform(A,function(){return r(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof E=="function"?E.apply(this,arguments):E),n.apply(this,arguments),s)},null,k)},g.translateTo=function(A,I,E,k,O){g.transform(A,function(){var j=n.apply(this,arguments),$=this.__zoom,U=k==null?x(j):typeof k=="function"?k.apply(this,arguments):k;return r(En.translate(U[0],U[1]).scale($.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof E=="function"?-E.apply(this,arguments):-E),j,s)},k,O)};function w(A,I){return I=Math.max(a[0],Math.min(a[1],I)),I===A.k?A:new Et(I,A.x,A.y)}function T(A,I,E){var k=I[0]-E[0]*A.k,O=I[1]-E[1]*A.k;return k===A.x&&O===A.y?A:new Et(A.k,k,O)}function x(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function b(A,I,E,k){A.on("start.zoom",function(){C(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(k).end()}).tween("zoom",function(){var O=this,j=arguments,$=C(O,j).event(k),U=n.apply(O,j),F=E==null?x(U):typeof E=="function"?E.apply(O,j):E,q=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),G=O.__zoom,B=typeof I=="function"?I.apply(O,j):I,J=f(G.invert(F).concat(q/G.k),B.invert(F).concat(q/B.k));return function(Y){if(Y===1)Y=B;else{var at=J(Y),tt=q/at[2];Y=new Et(tt,F[0]-at[0]*tt,F[1]-at[1]*tt)}$.zoom(null,Y)}})}function C(A,I,E){return!E&&A.__zooming||new S(A,I)}function S(A,I){this.that=A,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(A,I),this.taps=0}S.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,I){return this.mouse&&A!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var I=pt(this.that).datum();l.call(A,this.that,new wu(A,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:l}),I)}};function M(A,...I){if(!e.apply(this,arguments))return;var E=C(this,I).event(A),k=this.__zoom,O=Math.max(a[0],Math.min(a[1],k.k*Math.pow(2,i.apply(this,arguments)))),j=bt(A);if(E.wheel)(E.mouse[0][0]!==j[0]||E.mouse[0][1]!==j[1])&&(E.mouse[1]=k.invert(E.mouse[0]=j)),clearTimeout(E.wheel);else{if(k.k===O)return;E.mouse=[j,k.invert(j)],Me(this),E.start()}Jt(A),E.wheel=setTimeout($,y),E.zoom("mouse",r(T(w(k,O),E.mouse[0],E.mouse[1]),E.extent,s));function $(){E.wheel=null,E.end()}}function N(A,...I){if(d||!e.apply(this,arguments))return;var E=A.currentTarget,k=C(this,I,!0).event(A),O=pt(A.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",q,!0),j=bt(A,E),$=A.clientX,U=A.clientY;ai(A.view),Ke(A),k.mouse=[j,this.__zoom.invert(j)],Me(this),k.start();function F(G){if(Jt(G),!k.moved){var B=G.clientX-$,J=G.clientY-U;k.moved=B*B+J*J>v}k.event(G).zoom("mouse",r(T(k.that.__zoom,k.mouse[0]=bt(G,E),k.mouse[1]),k.extent,s))}function q(G){O.on("mousemove.zoom mouseup.zoom",null),si(G.view,k.moved),Jt(G),k.event(G).end()}}function P(A,...I){if(e.apply(this,arguments)){var E=this.__zoom,k=bt(A.changedTouches?A.changedTouches[0]:A,this),O=E.invert(k),j=E.k*(A.shiftKey?.5:2),$=r(T(w(E,j),k,O),n.apply(this,I),s);Jt(A),u>0?pt(this).transition().duration(u).call(b,$,k,A):pt(this).call(g.transform,$,k,A)}}function R(A,...I){if(e.apply(this,arguments)){var E=A.touches,k=E.length,O=C(this,I,A.changedTouches.length===k).event(A),j,$,U,F;for(Ke(A),$=0;$=n||S<0||h&&M>=a}function g(){var C=Qe();if(_(C))return w(C);u=setTimeout(g,v(C))}function w(C){return u=void 0,d&&i?p(C):(i=o=void 0,s)}function T(){u!==void 0&&clearTimeout(u),l=0,i=f=o=u=void 0}function x(){return u===void 0?s:w(Qe())}function b(){var C=Qe(),S=_(C);if(i=arguments,o=this,f=C,S){if(u===void 0)return y(f);if(h)return clearTimeout(u),u=setTimeout(g,n),p(f)}return u===void 0&&(u=setTimeout(g,n)),s}return b.cancel=T,b.flush=x,b}var tl="Expected a function";function el(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(tl);return De(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),yi(e,n,{leading:i,maxWait:n,trailing:o})}var Ut=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Ut.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Ut.Bounce.In(e*2)*.5:Ut.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),ue=function(){return performance.now()},_i=(function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(n){this._tweens[n.getId()]=n,this._tweensAddedDuringUpdate[n.getId()]=n},e.prototype.remove=function(n){delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]},e.prototype.update=function(n,r){n===void 0&&(n=ue()),r===void 0&&(r=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o1?a(e[r],e[r-1],r-i):a(e[o],e[o+1>r?r:o+1],i-o)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},vi=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),yn=new _i,ur=(function(){function e(n,r){r===void 0&&(r=yn),this._object=n,this._group=r,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ut.Linear.None,this._interpolationFunction=gn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=vi.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=ue()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var a in this._valuesEnd)o[a]=this._valuesEnd[a];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,o,a){for(var s in i){var u=n[s],f=Array.isArray(u),l=f?"array":typeof u,c=!f&&Array.isArray(i[s]);if(!(l==="undefined"||l==="function")){if(c){var h=i[s];if(h.length===0)continue;for(var d=[u],p=0,y=h.length;p"u"||a)&&(r[s]=u),f||(r[s]*=1),c?o[s]=i[s].slice().reverse():o[s]=r[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(n){return n===void 0&&(n=ue()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this._group&&this._group.remove(this),this)},e.prototype.resume=function(n){return n===void 0&&(n=ue()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;ns)return!1;r&&this.start(n,!0)}if(this._goToEnd=!1,nl)return 1;var _=Math.trunc(u/f),g=u-_*f,w=Math.min(g/i._duration,1);return w===0&&u===i._duration?1:w},h=c(),d=this._easingFunction(h);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),this._duration===0||u>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((u-this._duration)/f)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=f*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var y=0,v=this._chainedTweens.length;ye.length)&&(n=e.length);for(var r=0,i=Array(n);r=0,a=!r&&o&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return H(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(bl,arguments)},brighten:function(){return this._applyModification(xl,arguments)},darken:function(){return this._applyModification(wl,arguments)},desaturate:function(){return this._applyModification(_l,arguments)},saturate:function(){return this._applyModification(vl,arguments)},greyscale:function(){return this._applyModification(ml,arguments)},spin:function(){return this._applyModification(kl,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(Sl,arguments)},complement:function(){return this._applyCombination(Cl,arguments)},monochromatic:function(){return this._applyCombination(Tl,arguments)},splitcomplement:function(){return this._applyCombination(Al,arguments)},triad:function(){return this._applyCombination(pr,[3])},tetrad:function(){return this._applyCombination(pr,[4])}};H.fromRatio=function(e,n){if(je(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=le(e[i]));e=r}return H(e,n)};function hl(e){var n={r:0,g:0,b:0},r=1,i=null,o=null,a=null,s=!1,u=!1;return typeof e=="string"&&(e=zl(e)),je(e)=="object"&&(Tt(e.r)&&Tt(e.g)&&Tt(e.b)?(n=dl(e.r,e.g,e.b),s=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Tt(e.h)&&Tt(e.s)&&Tt(e.v)?(i=le(e.s),o=le(e.v),n=gl(e.h,i,o),s=!0,u="hsv"):Tt(e.h)&&Tt(e.s)&&Tt(e.l)&&(i=le(e.s),a=le(e.l),n=pl(e.h,i,a),s=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=mi(r),{ok:s,format:e.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function dl(e,n,r){return{r:K(e,255)*255,g:K(n,255)*255,b:K(r,255)*255}}function fr(e,n,r){e=K(e,255),n=K(n,255),r=K(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=(i+o)/2;if(i==o)a=s=0;else{var f=i-o;switch(s=u>.5?f/(2-i-o):f/(i+o),i){case e:a=(n-r)/f+(n1&&(h-=1),h<1/6?l+(c-l)*6*h:h<1/2?c:h<2/3?l+(c-l)*(2/3-h)*6:l}if(n===0)i=o=a=r;else{var u=r<.5?r*(1+n):r+n-r*n,f=2*r-u;i=s(f,u,e+1/3),o=s(f,u,e),a=s(f,u,e-1/3)}return{r:i*255,g:o*255,b:a*255}}function cr(e,n,r){e=K(e,255),n=K(n,255),r=K(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=i,f=i-o;if(s=i===0?0:f/i,i==o)a=0;else{switch(i){case e:a=(n-r)/f+(n>1)+720)%360;--n;)i.h=(i.h+o)%360,a.push(H(i));return a}function Tl(e,n){n=n||6;for(var r=H(e).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/n;n--;)s.push(H({h:i,s:o,v:a})),a=(a+u)%1;return s}H.mix=function(e,n,r){r=r===0?0:r||50;var i=H(e).toRgb(),o=H(n).toRgb(),a=r/100,s={r:(o.r-i.r)*a+i.r,g:(o.g-i.g)*a+i.g,b:(o.b-i.b)*a+i.b,a:(o.a-i.a)*a+i.a};return H(s)};H.readability=function(e,n){var r=H(e),i=H(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};H.isReadable=function(e,n,r){var i=H.readability(e,n),o,a;switch(a=!1,o=Rl(r),o.level+o.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};H.mostReadable=function(e,n,r){var i=null,o=0,a,s,u,f;r=r||{},s=r.includeFallbackColors,u=r.level,f=r.size;for(var l=0;lo&&(o=a,i=H(n[l]));return H.isReadable(e,i,{level:u,size:f})||!s?i:(r.includeFallbackColors=!1,H.mostReadable(e,["#fff","#000"],r))};var _n=H.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Ml=H.hexNames=Pl(_n);function Pl(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function mi(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function K(e,n){Ol(e)&&(e="100%");var r=El(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function We(e){return Math.min(1,Math.max(0,e))}function ft(e){return parseInt(e,16)}function Ol(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function El(e){return typeof e=="string"&&e.indexOf("%")!=-1}function _t(e){return e.length==1?"0"+e:""+e}function le(e){return e<=1&&(e=e*100+"%"),e}function bi(e){return Math.round(parseFloat(e)*255).toString(16)}function gr(e){return ft(e)/255}var yt=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Tt(e){return!!yt.CSS_UNIT.exec(e)}function zl(e){e=e.replace(fl,"").replace(cl,"").toLowerCase();var n=!1;if(_n[e])e=_n[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=yt.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=yt.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=yt.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=yt.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=yt.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=yt.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=yt.hex8.exec(e))?{r:ft(r[1]),g:ft(r[2]),b:ft(r[3]),a:gr(r[4]),format:n?"name":"hex8"}:(r=yt.hex6.exec(e))?{r:ft(r[1]),g:ft(r[2]),b:ft(r[3]),format:n?"name":"hex"}:(r=yt.hex4.exec(e))?{r:ft(r[1]+""+r[1]),g:ft(r[2]+""+r[2]),b:ft(r[3]+""+r[3]),a:gr(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=yt.hex3.exec(e))?{r:ft(r[1]+""+r[1]),g:ft(r[2]+""+r[2]),b:ft(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function Rl(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function vn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);ri.map(i=>d[i]); +var je=Object.defineProperty;var ke=(d,i,c)=>i in d?je(d,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[i]=c;var J=(d,i,c)=>ke(d,typeof i!="symbol"?i+"":i,c);import{c as h,r as s,j as e,u as ve,b as Ne,O as W,Q as Se,C as X,R as Ce,S as Ee,P as Me,U as O,e as x,V as ze,W as De,X as Z,A as Y,_ as Oe,g as j}from"./index-CQgUnd1p.js";import{C as ee}from"./copy-hJYMa3at.js";import{S as _e}from"./send-COuI40dq.js";import{B as Ge}from"./book-open-BFFOe9re.js";/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Te=h("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fe=h("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ae=h("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ie=h("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Le=h("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const re=h("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pe=h("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);class te extends s.Component{constructor(){super(...arguments);J(this,"state",{error:null})}static getDerivedStateFromError(c){return{error:c}}render(){return this.state.error?e.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[e.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),e.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const se=s.lazy(()=>Oe(()=>import("./GraphView-BOVrShvN.js"),__vite__mapDeps([0,1,2])).then(d=>({default:d.GraphView}))),k=["identity","knowledge","rules","events"],v=new Set(["auto","agent","hermes"]),N={identity:{label:"Identität",icon:Pe,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:De,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:Le,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:ze,bg:"bg-amber-500/10",text:"text-amber-400"}},ne={label:"Gedächtnis",icon:Ge,text:"text-muted-foreground"},Re={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},_={identity:"#00f5ff",knowledge:"#3b82f6",rules:"#d946ef",events:"#fbbf24"},ae=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: +1) wer ich bin und woran ich gerade arbeite, +2) wie ich angesprochen werden möchte, +3) meine bevorzugten Tools, Sprachen und Arbeitsweise, +4) wichtige Regeln/Konventionen, die du beachten sollst, +5) meine Infrastruktur (Server, Dienste – ohne Geheimnisse). +Frag immer nur eine sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function Qe(){var U;const[d,i]=s.useState(""),[c,oe]=s.useState(""),[S,G]=s.useState(""),[T,le]=s.useState("knowledge"),[de,F]=s.useState(!1),[A,I]=s.useState(!1),[C,ie]=s.useState("liste"),[ce,w]=s.useState(!1),[p,g]=s.useState(null),[m,L]=s.useState(!1),[P,ue]=s.useState(()=>typeof window<"u"&&window.matchMedia("(min-width: 1024px)").matches);s.useEffect(()=>{const r=window.matchMedia("(min-width: 1024px)"),t=n=>ue(n.matches);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},[]);const R=ve(),{showAlert:f,showConfirm:V,dialogElement:xe}=Ne(),{data:u=[]}=W({}),{data:y=[],error:$}=W({q:c,category:d}),{data:b}=Se(!0),q=$?String($):"";s.useEffect(()=>{if(!m)return;const r=t=>{t.key==="Escape"&&L(!1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[m]);const E=()=>{R.invalidateQueries({queryKey:["memory"]}),R.invalidateQueries({queryKey:["memory-graph"]})},M=s.useMemo(()=>{const r=u.length,t=u.filter(n=>v.has(n.source)).length;return{total:r,auto:t,manual:r-t,cats:new Set(u.map(n=>n.category)).size}},[u]),me=u.length===0,z=s.useDeferredValue(c),K=s.useMemo(()=>{const r=b??{nodes:[],edges:[]};if(!z.trim())return r;const t=z.toLowerCase(),n=r.nodes.filter(a=>a.content.toLowerCase().includes(t)),l=new Set(n.map(a=>a.id));return{nodes:n,edges:r.edges.filter(a=>l.has(a.source)&&l.has(a.target))}},[b,z]),ge=s.useMemo(()=>{const r={};return y.forEach(t=>{var n;(r[n=t.category]??(r[n]=[])).push(t)}),r},[y]),he=s.useMemo(()=>y.filter(r=>!k.includes(r.category)),[y]);async function pe(){S.trim()&&(await j("/api/memory",{method:"POST",body:JSON.stringify({content:S,category:T,source:"ui"})}),G(""),w(!1),E())}function H(r){V("Eintrag löschen?","Diesen Gedächtnis-Eintrag dauerhaft entfernen?",async()=>{try{await j(`/api/memory/${r}`,{method:"DELETE"}),E()}catch(t){f("Fehler",`Löschen fehlgeschlagen: ${t.message||t}`)}})}async function D(){try{await navigator.clipboard.writeText(ae),I(!0),setTimeout(()=>I(!1),1800)}catch{f("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function be(){D(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"konsole"}}))}async function fe(){F(!0);try{const r=await j("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(r.duplicate_count===0){f("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}const t=l=>l.length>90?l.slice(0,90)+"…":l,n=r.groups.slice(0,5).map(l=>`✓ bleibt: „${t(l.keep.content)}" +✗ weg: ${l.remove.map(a=>`„${t(a.content)}"`).join(", ")}`).join(` + +`)+(r.groups.length>5?` + +… und ${r.groups.length-5} weitere Gruppe(n).`:"");V("Deduplizierung bestätigen",`${r.duplicate_count} Dublette(n) in ${r.groups.length} Gruppe(n) gefunden: + +${n} + +Zusammenführen?`,async()=>{try{await j("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),E()}catch(l){f("Fehler",`Fehler beim Löschen: ${l.message}`)}})}catch(r){f("Fehler",`Fehler bei der Deduplizierung: ${r.message}`)}finally{F(!1)}}const o=s.useMemo(()=>u.find(r=>r.id===p),[u,p]),Q=s.useMemo(()=>{if(!o||!b)return[];const r=new Set([...b.edges.filter(t=>t.source===o.id).map(t=>t.target),...b.edges.filter(t=>t.target===o.id).map(t=>t.source)]);return u.filter(t=>r.has(t.id))},[o,b,u]);return e.jsxs("div",{className:"space-y-6",children:[me?e.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[e.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:e.jsx(Ae,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),e.jsxs("div",{className:"w-full max-w-lg text-left",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),e.jsx("button",{onClick:D,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:A?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"h-3 w-3"})," Kopieren"]})})]}),e.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:ae})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[e.jsxs("button",{onClick:be,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[e.jsx(Ce,{className:"h-4 w-4"})," Im Terminal starten"]}),e.jsxs("button",{onClick:D,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[A?e.jsx(X,{className:"h-4 w-4 text-emerald-400"}):e.jsx(ee,{className:"h-4 w-4"})," Prompt kopieren"]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[e.jsx(_e,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",e.jsx("button",{onClick:()=>w(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):e.jsxs("div",{className:x("bg-[#030712] overflow-hidden transition-all duration-300 ease-in-out",m?"fixed inset-0 z-50 w-screen h-screen":"relative w-full h-[calc(100vh-8.5rem)] min-h-[620px] rounded-2xl border border-border/60 flex flex-col lg:block"),children:[P&&e.jsx("div",{className:"absolute inset-0 z-0 hidden lg:block",children:e.jsx(te,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:e.jsx(se,{data:K,selectedNodeId:p,onNodeSelect:g})})})}),e.jsxs("div",{className:x("z-10 flex flex-col transition-all duration-300",m?"lg:absolute lg:left-6 lg:top-6 lg:bottom-6 lg:w-96 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-3rem)]":"lg:absolute lg:left-4 lg:top-4 lg:bottom-4 lg:w-96 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-2rem)]","w-full h-full p-4 flex-1 lg:flex-none",C==="graph"&&"hidden lg:flex"),children:[e.jsxs("div",{className:"space-y-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed mt-0.5",children:"IDEs & Gateway lesen und lernen hier per MCP."})]}),e.jsx("button",{onClick:()=>L(!m),className:"p-1.5 rounded-lg border border-border/40 bg-card/45 hover:border-primary/50 text-muted-foreground hover:text-foreground transition-all cursor-pointer hidden lg:block",title:m?"Vollbild verlassen (Esc)":"In Vollbild maximieren",children:m?e.jsx(Ie,{className:"h-4 w-4"}):e.jsx(Fe,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"text-[9px] font-semibold bg-primary/10 text-primary border border-primary/20 px-2 py-0.5 rounded-md",children:[M.total," Fakten"]}),e.jsxs("span",{className:"text-[9px] font-semibold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-2 py-0.5 rounded-md",children:[M.auto," auto"]}),e.jsxs("span",{className:"text-[9px] font-semibold bg-card/60 text-muted-foreground border border-border/40 px-2 py-0.5 rounded-md",children:[M.cats," Kat."]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 w-full",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("input",{value:c,onChange:r=>oe(r.target.value),"aria-label":"Gedächtnis durchsuchen",type:"search",placeholder:"Semantisch suchen…",className:"w-full h-8 pl-8 pr-3 rounded-lg border border-border/50 bg-background/40 text-[11px] outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),e.jsx(Ee,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("button",{onClick:()=>w(r=>!r),title:"Eintrag hinzufügen",className:"h-8 w-8 shrink-0 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center justify-center cursor-pointer shadow-md shadow-primary/10",children:e.jsx(Me,{className:"h-4 w-4"})}),e.jsx("button",{onClick:fe,disabled:de,title:"Deduplizieren",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card/45 hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",children:e.jsx(O,{className:"h-3.5 w-3.5 text-primary"})}),e.jsx("div",{className:"flex items-center gap-1 p-0.5 bg-card/30 border border-border/40 rounded-lg lg:hidden",children:[["liste",Te],["graph",re]].map(([r,t])=>e.jsx("button",{onClick:()=>ie(r),className:x("flex h-7 w-7 items-center justify-center rounded-md transition-all cursor-pointer",C===r?"bg-primary text-primary-foreground":"text-muted-foreground"),children:e.jsx(t,{className:"h-3.5 w-3.5"})},r))})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-0.5 bg-card/30 border border-border/40 rounded-lg w-full overflow-x-auto shrink-0 scrollbar-none",children:[e.jsx("button",{onClick:()=>i(""),className:x("h-6 px-2 rounded-md text-[9px] font-semibold uppercase tracking-wider transition-all cursor-pointer shrink-0",d?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),k.map(r=>{const t=N[r]||ne;return e.jsx("button",{onClick:()=>i(r),className:x("h-6 px-2 rounded-md text-[9px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 shrink-0",d===r?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:t.label},r)})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 scrollbar-thin space-y-4",children:[ce&&e.jsxs("div",{className:"rounded-xl border border-border/50 bg-background/50 p-3 space-y-2 shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Neuer Eintrag"}),e.jsx("button",{onClick:()=>w(!1),className:"text-muted-foreground hover:text-foreground",children:e.jsx(Z,{className:"h-3.5 w-3.5"})})]}),e.jsx("textarea",{value:S,onChange:r=>G(r.target.value),rows:2,placeholder:"Vorliebe, Regel oder Fakt…",className:"w-full resize-none rounded-lg border border-border/50 bg-background/30 p-2 text-[11px] outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("select",{value:T,onChange:r=>le(r.target.value),className:"h-7 rounded-md border border-border/50 bg-background/50 px-1 text-[10px] outline-none text-foreground cursor-pointer",children:k.map(r=>{var t;return e.jsx("option",{value:r,className:"bg-popover text-foreground",children:((t=N[r])==null?void 0:t.label)||r},r)})}),e.jsx("button",{onClick:pe,className:"h-7 px-2.5 rounded-md bg-primary text-primary-foreground text-[10px] font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Speichern"})]})]}),q&&e.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3 text-[10px] text-red-400",children:["Fehler: ",q]}),y.length===0?e.jsx("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/60 rounded-xl p-8 text-center bg-card/10",children:"Keine Einträge gefunden."}):e.jsx("div",{className:"space-y-4",children:[...k,"__other"].map(r=>{const t=r==="__other"?he:ge[r]||[];if(!t.length)return null;const n=N[r]||ne,l=n.icon;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-0.5",children:[e.jsx(l,{className:x("h-3 w-3",n.text)}),e.jsx("span",{className:x("text-[9px] font-bold uppercase tracking-wider",n.text),children:n.label}),e.jsx("span",{className:"text-[9px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1",children:t.length})]}),e.jsx("div",{className:"space-y-1.5",children:t.map(a=>{const ye=v.has(a.source),B=p===a.id;return e.jsxs("div",{onClick:()=>g(B?null:a.id),className:x("flex items-start justify-between gap-3 p-2.5 rounded-lg border border-l-4 transition-all group cursor-pointer text-left",B?"bg-primary/10 border-primary shadow-md":"bg-card/45 border-border/40 hover:bg-card/75",Re[a.category]||"border-l-muted"),children:[e.jsx("span",{className:"text-[11px] text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:a.content}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 self-center",children:[ye&&e.jsx("span",{title:"Auto gelernt",children:e.jsx(O,{className:"h-2.5 w-2.5 text-emerald-400"})}),e.jsx("button",{onClick:we=>{we.stopPropagation(),H(a.id),p===a.id&&g(null)},className:"h-5 w-5 rounded-md flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:e.jsx(Y,{className:"h-3.5 w-3.5"})})]})]},a.id)})})]},r)})})]})]}),!P&&C==="graph"&&e.jsx("div",{className:"w-full h-[500px] relative lg:hidden",children:e.jsx(te,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"h-full rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:e.jsx(se,{data:K,selectedNodeId:p,onNodeSelect:g})})})}),o&&e.jsxs("div",{className:x("z-10 flex flex-col transition-all duration-300",m?"lg:absolute lg:right-6 lg:top-6 lg:bottom-6 lg:w-80 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-3rem)]":"lg:absolute lg:right-4 lg:top-4 lg:bottom-4 lg:w-80 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-2rem)]","w-full p-4 border-t border-border/60 bg-card/45 shrink-0 flex flex-col"),children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 shrink-0",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:_[o.category]}}),e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider",style:{color:_[o.category]},children:((U=N[o.category])==null?void 0:U.label)??o.category}),e.jsxs("span",{className:`ml-auto text-[9px] font-mono flex items-center gap-1 ${v.has(o.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[v.has(o.source)&&e.jsx(O,{className:"h-2.5 w-2.5"}),o.source]}),e.jsx("button",{onClick:()=>g(null),className:"text-muted-foreground hover:text-foreground ml-1.5 cursor-pointer",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto pr-1 scrollbar-thin text-xs text-foreground leading-relaxed mb-4 break-words whitespace-pre-wrap text-left",children:o.content}),e.jsxs("div",{className:"mt-auto shrink-0 space-y-3 pt-3 border-t border-border/30",children:[e.jsxs("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/70 flex items-center gap-1",children:[e.jsx(re,{className:"h-2.5 w-2.5"})," verwandte Fakten"]}),e.jsx("div",{className:"flex flex-col gap-1 max-h-40 overflow-y-auto scrollbar-none text-left",children:Q.length?Q.map(r=>e.jsxs("button",{onClick:()=>g(r.id),className:"flex items-center gap-2 text-[10px] text-muted-foreground hover:text-foreground text-left transition-colors cursor-pointer py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:_[r.category]}}),e.jsx("span",{className:"truncate",children:r.content})]},r.id)):e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"—"})}),e.jsxs("button",{onClick:()=>{H(o.id),g(null)},className:"flex w-full items-center justify-center gap-1.5 text-[10px] font-bold text-red-400 border border-red-500/20 rounded-lg py-2 hover:bg-red-500/5 transition-all cursor-pointer",children:[e.jsx(Y,{className:"h-3.5 w-3.5"})," Eintrag vergessen"]})]})]})]}),xe]})}export{Qe as MemoryView}; diff --git a/frontend/dist/assets/MemoryView-Cyd_8ZK-.js b/frontend/dist/assets/MemoryView-Cyd_8ZK-.js deleted file mode 100644 index 6ab0347..0000000 --- a/frontend/dist/assets/MemoryView-Cyd_8ZK-.js +++ /dev/null @@ -1,52 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphView-DKQq2qmv.js","assets/index-D94Dzyvg.js","assets/index-BH760w1h.css"])))=>i.map(i=>d[i]); -var ke=Object.defineProperty;var ve=(d,i,c)=>i in d?ke(d,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[i]=c;var Q=(d,i,c)=>ve(d,typeof i!="symbol"?i+"":i,c);import{c as h,r as s,j as e,u as Ne,b as Se,O as W,Q as Ce,C as J,R as Ee,S as Me,P as ze,U as _,e as x,V as _e,W as Ae,X,A as Z,_ as Oe,g as j}from"./index-D94Dzyvg.js";import{C as Y}from"./copy-Dy-OlKte.js";import{S as Te}from"./send-DyDlsXyV.js";import{B as De}from"./book-open-Cc6Rq6Ws.js";/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ge=h("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Le=h("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fe=h("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ie=h("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pe=h("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ee=h("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Re=h("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);class re extends s.Component{constructor(){super(...arguments);Q(this,"state",{error:null})}static getDerivedStateFromError(c){return{error:c}}render(){return this.state.error?e.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[e.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),e.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const te=s.lazy(()=>Oe(()=>import("./GraphView-DKQq2qmv.js"),__vite__mapDeps([0,1,2])).then(d=>({default:d.GraphView}))),k=["identity","knowledge","rules","events"],se=new Set(["auto","agent","hermes"]),A={identity:{label:"Identität",icon:Re,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Ae,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:Pe,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:_e,bg:"bg-amber-500/10",text:"text-amber-400"}},ne={label:"Gedächtnis",icon:De,text:"text-muted-foreground"},Ve={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},ae=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: -1) wer ich bin und woran ich gerade arbeite, -2) wie ich angesprochen werden möchte, -3) meine bevorzugten Tools, Sprachen und Arbeitsweise, -4) wichtige Regeln/Konventionen, die du beachten sollst, -5) meine Infrastruktur (Server, Dienste – ohne Geheimnisse). -Frag immer nur eine sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function Be(){const[d,i]=s.useState(""),[c,oe]=s.useState(""),[v,O]=s.useState(""),[T,le]=s.useState("knowledge"),[de,D]=s.useState(!1),[G,L]=s.useState(!1),[N,ie]=s.useState("liste"),[ce,w]=s.useState(!1),[p,g]=s.useState(null),[m,F]=s.useState(!1),[I,ue]=s.useState(()=>typeof window<"u"&&window.matchMedia("(min-width: 1024px)").matches);s.useEffect(()=>{const r=window.matchMedia("(min-width: 1024px)"),t=n=>ue(n.matches);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},[]);const P=Ne(),{showAlert:f,showConfirm:R,dialogElement:xe}=Se(),{data:u=[]}=W({}),{data:y=[],error:V}=W({q:c,category:d}),{data:b}=Ce(!0),$=V?String(V):"";s.useEffect(()=>{if(!m)return;const r=t=>{t.key==="Escape"&&F(!1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[m]);const S=()=>{P.invalidateQueries({queryKey:["memory"]}),P.invalidateQueries({queryKey:["memory-graph"]})},C=s.useMemo(()=>{const r=u.length,t=u.filter(n=>se.has(n.source)).length;return{total:r,auto:t,manual:r-t,cats:new Set(u.map(n=>n.category)).size}},[u]),me=u.length===0,E=s.useDeferredValue(c),q=s.useMemo(()=>{const r=b??{nodes:[],edges:[]};if(!E.trim())return r;const t=E.toLowerCase(),n=r.nodes.filter(a=>a.content.toLowerCase().includes(t)),l=new Set(n.map(a=>a.id));return{nodes:n,edges:r.edges.filter(a=>l.has(a.source)&&l.has(a.target))}},[b,E]),ge=s.useMemo(()=>{const r={};return y.forEach(t=>{var n;(r[n=t.category]??(r[n]=[])).push(t)}),r},[y]),he=s.useMemo(()=>y.filter(r=>!k.includes(r.category)),[y]);async function pe(){v.trim()&&(await j("/api/memory",{method:"POST",body:JSON.stringify({content:v,category:T,source:"ui"})}),O(""),w(!1),S())}function K(r){R("Eintrag löschen?","Diesen Gedächtnis-Eintrag dauerhaft entfernen?",async()=>{try{await j(`/api/memory/${r}`,{method:"DELETE"}),S()}catch(t){f("Fehler",`Löschen fehlgeschlagen: ${t.message||t}`)}})}async function M(){try{await navigator.clipboard.writeText(ae),L(!0),setTimeout(()=>L(!1),1800)}catch{f("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function be(){M(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function fe(){D(!0);try{const r=await j("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(r.duplicate_count===0){f("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}const t=l=>l.length>90?l.slice(0,90)+"…":l,n=r.groups.slice(0,5).map(l=>`✓ bleibt: „${t(l.keep.content)}" -✗ weg: ${l.remove.map(a=>`„${t(a.content)}"`).join(", ")}`).join(` - -`)+(r.groups.length>5?` - -… und ${r.groups.length-5} weitere Gruppe(n).`:"");R("Deduplizierung bestätigen",`${r.duplicate_count} Dublette(n) in ${r.groups.length} Gruppe(n) gefunden: - -${n} - -Zusammenführen?`,async()=>{try{await j("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),S()}catch(l){f("Fehler",`Fehler beim Löschen: ${l.message}`)}})}catch(r){f("Fehler",`Fehler bei der Deduplizierung: ${r.message}`)}finally{D(!1)}}const o=s.useMemo(()=>u.find(r=>r.id===p),[u,p]),H=s.useMemo(()=>{if(!o||!b)return[];const r=new Set([...b.edges.filter(t=>t.source===o.id).map(t=>t.target),...b.edges.filter(t=>t.target===o.id).map(t=>t.source)]);return u.filter(t=>r.has(t.id))},[o,b,u]),z={identity:"#00f5ff",knowledge:"#3b82f6",rules:"#d946ef",events:"#fbbf24"},ye={identity:"Identität",knowledge:"Wissen",rules:"Regeln",events:"Ereignisse"},U=new Set(["auto","agent","hermes"]);return e.jsxs("div",{className:"space-y-6",children:[me?e.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[e.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:e.jsx(Fe,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),e.jsxs("div",{className:"w-full max-w-lg text-left",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),e.jsx("button",{onClick:M,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:G?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"h-3 w-3"})," Kopieren"]})})]}),e.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:ae})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[e.jsxs("button",{onClick:be,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[e.jsx(Ee,{className:"h-4 w-4"})," Im Terminal starten"]}),e.jsxs("button",{onClick:M,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[G?e.jsx(J,{className:"h-4 w-4 text-emerald-400"}):e.jsx(Y,{className:"h-4 w-4"})," Prompt kopieren"]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[e.jsx(Te,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",e.jsx("button",{onClick:()=>w(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):e.jsxs("div",{className:x("bg-[#030712] overflow-hidden transition-all duration-300 ease-in-out",m?"fixed inset-0 z-50 w-screen h-screen":"relative w-full h-[calc(100vh-8.5rem)] min-h-[620px] rounded-2xl border border-border/60 flex flex-col lg:block"),children:[I&&e.jsx("div",{className:"absolute inset-0 z-0 hidden lg:block",children:e.jsx(re,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:e.jsx(te,{data:q,selectedNodeId:p,onNodeSelect:g})})})}),e.jsxs("div",{className:x("z-10 flex flex-col transition-all duration-300",m?"lg:absolute lg:left-6 lg:top-6 lg:bottom-6 lg:w-96 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-3rem)]":"lg:absolute lg:left-4 lg:top-4 lg:bottom-4 lg:w-96 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-2rem)]","w-full h-full p-4 flex-1 lg:flex-none",N==="graph"&&"hidden lg:flex"),children:[e.jsxs("div",{className:"space-y-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed mt-0.5",children:"IDEs & Gateway lesen und lernen hier per MCP."})]}),e.jsx("button",{onClick:()=>F(!m),className:"p-1.5 rounded-lg border border-border/40 bg-card/45 hover:border-primary/50 text-muted-foreground hover:text-foreground transition-all cursor-pointer hidden lg:block",title:m?"Vollbild verlassen (Esc)":"In Vollbild maximieren",children:m?e.jsx(Ie,{className:"h-4 w-4"}):e.jsx(Le,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"text-[9px] font-semibold bg-primary/10 text-primary border border-primary/20 px-2 py-0.5 rounded-md",children:[C.total," Fakten"]}),e.jsxs("span",{className:"text-[9px] font-semibold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-2 py-0.5 rounded-md",children:[C.auto," auto"]}),e.jsxs("span",{className:"text-[9px] font-semibold bg-card/60 text-muted-foreground border border-border/40 px-2 py-0.5 rounded-md",children:[C.cats," Kat."]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 w-full",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("input",{value:c,onChange:r=>oe(r.target.value),"aria-label":"Gedächtnis durchsuchen",type:"search",placeholder:"Semantisch suchen…",className:"w-full h-8 pl-8 pr-3 rounded-lg border border-border/50 bg-background/40 text-[11px] outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),e.jsx(Me,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("button",{onClick:()=>w(r=>!r),title:"Eintrag hinzufügen",className:"h-8 w-8 shrink-0 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center justify-center cursor-pointer shadow-md shadow-primary/10",children:e.jsx(ze,{className:"h-4 w-4"})}),e.jsx("button",{onClick:fe,disabled:de,title:"Deduplizieren",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card/45 hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",children:e.jsx(_,{className:"h-3.5 w-3.5 text-primary"})}),e.jsx("div",{className:"flex items-center gap-1 p-0.5 bg-card/30 border border-border/40 rounded-lg lg:hidden",children:[["liste",Ge],["graph",ee]].map(([r,t])=>e.jsx("button",{onClick:()=>ie(r),className:x("flex h-7 w-7 items-center justify-center rounded-md transition-all cursor-pointer",N===r?"bg-primary text-primary-foreground":"text-muted-foreground"),children:e.jsx(t,{className:"h-3.5 w-3.5"})},r))})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-0.5 bg-card/30 border border-border/40 rounded-lg w-full overflow-x-auto shrink-0 scrollbar-none",children:[e.jsx("button",{onClick:()=>i(""),className:x("h-6 px-2 rounded-md text-[9px] font-semibold uppercase tracking-wider transition-all cursor-pointer shrink-0",d?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),k.map(r=>{const t=A[r]||ne;return e.jsx("button",{onClick:()=>i(r),className:x("h-6 px-2 rounded-md text-[9px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 shrink-0",d===r?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:t.label},r)})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 scrollbar-thin space-y-4",children:[ce&&e.jsxs("div",{className:"rounded-xl border border-border/50 bg-background/50 p-3 space-y-2 shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Neuer Eintrag"}),e.jsx("button",{onClick:()=>w(!1),className:"text-muted-foreground hover:text-foreground",children:e.jsx(X,{className:"h-3.5 w-3.5"})})]}),e.jsx("textarea",{value:v,onChange:r=>O(r.target.value),rows:2,placeholder:"Vorliebe, Regel oder Fakt…",className:"w-full resize-none rounded-lg border border-border/50 bg-background/30 p-2 text-[11px] outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("select",{value:T,onChange:r=>le(r.target.value),className:"h-7 rounded-md border border-border/50 bg-background/50 px-1 text-[10px] outline-none text-foreground cursor-pointer",children:k.map(r=>{var t;return e.jsx("option",{value:r,className:"bg-popover text-foreground",children:((t=A[r])==null?void 0:t.label)||r},r)})}),e.jsx("button",{onClick:pe,className:"h-7 px-2.5 rounded-md bg-primary text-primary-foreground text-[10px] font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Speichern"})]})]}),$&&e.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3 text-[10px] text-red-400",children:["Fehler: ",$]}),y.length===0?e.jsx("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/60 rounded-xl p-8 text-center bg-card/10",children:"Keine Einträge gefunden."}):e.jsx("div",{className:"space-y-4",children:[...k,"__other"].map(r=>{const t=r==="__other"?he:ge[r]||[];if(!t.length)return null;const n=A[r]||ne,l=n.icon;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-0.5",children:[e.jsx(l,{className:x("h-3 w-3",n.text)}),e.jsx("span",{className:x("text-[9px] font-bold uppercase tracking-wider",n.text),children:n.label}),e.jsx("span",{className:"text-[9px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1",children:t.length})]}),e.jsx("div",{className:"space-y-1.5",children:t.map(a=>{const we=se.has(a.source),B=p===a.id;return e.jsxs("div",{onClick:()=>g(B?null:a.id),className:x("flex items-start justify-between gap-3 p-2.5 rounded-lg border border-l-4 transition-all group cursor-pointer text-left",B?"bg-primary/10 border-primary shadow-md":"bg-card/45 border-border/40 hover:bg-card/75",Ve[a.category]||"border-l-muted"),children:[e.jsx("span",{className:"text-[11px] text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:a.content}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 self-center",children:[we&&e.jsx("span",{title:"Auto gelernt",children:e.jsx(_,{className:"h-2.5 w-2.5 text-emerald-400"})}),e.jsx("button",{onClick:je=>{je.stopPropagation(),K(a.id),p===a.id&&g(null)},className:"h-5 w-5 rounded-md flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:e.jsx(Z,{className:"h-3.5 w-3.5"})})]})]},a.id)})})]},r)})})]})]}),!I&&N==="graph"&&e.jsx("div",{className:"w-full h-[500px] relative lg:hidden",children:e.jsx(re,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"h-full rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:e.jsx(te,{data:q,selectedNodeId:p,onNodeSelect:g})})})}),o&&e.jsxs("div",{className:x("z-10 flex flex-col transition-all duration-300",m?"lg:absolute lg:right-6 lg:top-6 lg:bottom-6 lg:w-80 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-3rem)]":"lg:absolute lg:right-4 lg:top-4 lg:bottom-4 lg:w-80 lg:rounded-xl lg:border lg:border-border/40 lg:bg-background/65 lg:backdrop-blur-md lg:p-4 lg:shadow-2xl lg:shadow-black/50 lg:h-[calc(100%-2rem)]","w-full p-4 border-t border-border/60 bg-card/45 shrink-0 flex flex-col"),children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 shrink-0",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:z[o.category]}}),e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider",style:{color:z[o.category]},children:ye[o.category]||o.category}),e.jsxs("span",{className:`ml-auto text-[9px] font-mono flex items-center gap-1 ${U.has(o.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[U.has(o.source)&&e.jsx(_,{className:"h-2.5 w-2.5"}),o.source]}),e.jsx("button",{onClick:()=>g(null),className:"text-muted-foreground hover:text-foreground ml-1.5 cursor-pointer",children:e.jsx(X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto pr-1 scrollbar-thin text-xs text-foreground leading-relaxed mb-4 break-words whitespace-pre-wrap text-left",children:o.content}),e.jsxs("div",{className:"mt-auto shrink-0 space-y-3 pt-3 border-t border-border/30",children:[e.jsxs("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/70 flex items-center gap-1",children:[e.jsx(ee,{className:"h-2.5 w-2.5"})," verwandte Fakten"]}),e.jsx("div",{className:"flex flex-col gap-1 max-h-40 overflow-y-auto scrollbar-none text-left",children:H.length?H.map(r=>e.jsxs("button",{onClick:()=>g(r.id),className:"flex items-center gap-2 text-[10px] text-muted-foreground hover:text-foreground text-left transition-colors cursor-pointer py-0.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:z[r.category]}}),e.jsx("span",{className:"truncate",children:r.content})]},r.id)):e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"—"})}),e.jsxs("button",{onClick:()=>{K(o.id),g(null)},className:"flex w-full items-center justify-center gap-1.5 text-[10px] font-bold text-red-400 border border-red-500/20 rounded-lg py-2 hover:bg-red-500/5 transition-all cursor-pointer",children:[e.jsx(Z,{className:"h-3.5 w-3.5"})," Eintrag vergessen"]})]})]})]}),xe]})}export{Be as MemoryView}; diff --git a/frontend/dist/assets/ModelsView-COEb2NnV.js b/frontend/dist/assets/ModelsView-DJY7Fh_a.js similarity index 84% rename from frontend/dist/assets/ModelsView-COEb2NnV.js rename to frontend/dist/assets/ModelsView-DJY7Fh_a.js index d07e9b8..93aa3ec 100644 --- a/frontend/dist/assets/ModelsView-COEb2NnV.js +++ b/frontend/dist/assets/ModelsView-DJY7Fh_a.js @@ -1,4 +1,4 @@ -import{c as q,u as oe,a as Fe,b as ge,j as e,f as ue,d as Re,e as w,g as K,q as P,h as Ie,r as N,C as Y,L as Oe,i as Pe,B as le,k as Te,E as Be,l as de,m as $e,n as Ge,o as He,p as ee,X as pe,P as Qe,H as fe,T as re,s as Ue,t as Ve,v as V,w as We,S as ye,x as Ze,y as Je,z as Xe,A as Ye,D as De,F as et,G as tt}from"./index-D94Dzyvg.js";import{R as rt}from"./rotate-ccw--ed6DlAf.js";import{C as he,Z as ie,L as st,a as nt,b as at}from"./zap-Ds7DtEXe.js";/** +import{c as q,u as oe,a as Fe,b as ge,j as e,f as ue,d as Re,e as w,g as K,q as P,h as Ie,r as N,C as Y,L as Oe,i as Pe,B as le,k as Te,E as Be,l as de,m as $e,n as Ge,o as He,p as ee,X as pe,P as Qe,H as fe,T as re,s as Ue,t as Ve,v as V,w as We,S as ye,x as Ze,y as Je,z as Xe,A as Ye,D as De,F as et,G as tt}from"./index-CQgUnd1p.js";import{R as rt}from"./rotate-ccw-ChVZWN8g.js";import{C as he,Z as ie,L as st,a as nt,b as at}from"./zap-Df-ORHkh.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -73,6 +73,6 @@ import{c as q,u as oe,a as Fe,b as ge,j as e,f as ue,d as Re,e as w,g as K,q as * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gt=q("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);function ft(){const t=oe(),{data:r=[]}=Fe(),{showAlert:h,dialogElement:a}=ge();async function m(d){try{await K(`/api/jobs/${d}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:P.jobs})}catch(M){h("Fehler",M.message)}}const S=r.filter(d=>d.state==="running"||d.state==="queued"),v=r.filter(d=>d.state!=="running"&&d.state!=="queued").slice(-3);return S.length===0&&v.length===0?null:e.jsxs("div",{className:"space-y-3 mc-card p-4",children:[e.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),S.map(d=>e.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:d.label}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-muted-foreground font-mono",children:[d.progress??0,"% • ",ue(d.done_bytes),"/",ue(d.total_bytes),d.eta_s?` • ETA ${Re(d.eta_s)}`:""]}),e.jsx("button",{onClick:()=>m(d.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),e.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${d.progress??0}%`}})})]},d.id)),v.map(d=>e.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[e.jsx("span",{className:"truncate",children:d.label}),e.jsx("span",{className:w("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",d.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:d.state})]},d.id)),a]})}const yt=["fast","heavy","heavy_chars"],jt=["coder_lite","coder","coding_escalate_chars"];function vt(){const t=oe(),{data:r,isLoading:h}=Ie(),[a,m]=N.useState(null),[S,v]=N.useState(!1),[d,M]=N.useState(""),[g,z]=N.useState(0);if(N.useEffect(()=>{r!=null&&r.policy&&!a&&m({...r.policy})},[r,a]),h||!r||!a)return e.jsx("div",{className:"mc-card p-5 text-xs text-muted-foreground",children:"Lade Routing-Policy…"});const x=s=>r.fields.find(o=>o.key===s),f=Object.keys(a).some(s=>a[s]!==r.policy[s]),b=(s,o)=>{m(c=>c&&{...c,[s]:o}),M("")},i=s=>b(s,r.defaults[s]);async function L(){if(!a)return;const s={};for(const o of Object.keys(a))a[o]!==r.policy[o]&&(s[o]=a[o]);if(Object.keys(s).length!==0){v(!0),M("");try{const{policy:o}=await Pe(s);m({...o}),t.invalidateQueries({queryKey:P.routingPolicy}),t.invalidateQueries({queryKey:P.routing}),z(Date.now()),setTimeout(()=>z(0),2e3)}catch(o){M(o.message||String(o))}finally{v(!1)}}}function B({k:s}){const o=x(s),c=a[s],$=a[s]===r.defaults[s];return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground",children:o.label}),!$&&e.jsxs("button",{onClick:()=>i(s),className:"flex items-center gap-0.5 text-[9px] text-muted-foreground/60 hover:text-foreground transition-colors cursor-pointer",title:`Auf Default zurücksetzen (${String(r.defaults[s])||"leer"})`,children:[e.jsx(rt,{className:"h-2.5 w-2.5"})," Default"]})]}),o.type==="bool"?e.jsxs("button",{onClick:()=>b(s,!c),className:w("flex h-8 w-full items-center justify-between rounded-lg border px-3 text-[11px] font-semibold transition-all cursor-pointer",c?"border-emerald-500/40 bg-emerald-500/10 text-emerald-300":"border-border/40 bg-background/40 text-muted-foreground"),children:[e.jsx("span",{children:c?"An":"Aus"}),e.jsx("span",{className:w("h-3.5 w-3.5 rounded-full transition-colors",c?"bg-emerald-400":"bg-muted-foreground/40")})]}):o.type==="int"?e.jsx("input",{type:"number",value:c,min:o.min,max:o.max,"aria-label":o.label,onChange:A=>b(s,Number(A.target.value)),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"}):e.jsx("input",{type:"text",value:c,"aria-label":o.label,spellCheck:!1,placeholder:s==="coder_lite"?"(leer = aus)":"",onChange:A=>b(s,A.target.value),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"})]})}return e.jsxs("div",{className:"mc-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ht,{className:"h-4.5 w-4.5 text-primary"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lane-Routing & Policy"}),e.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-300 border border-emerald-500/20",children:"hot-reload"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d&&e.jsx("span",{className:"text-[10px] text-red-400 max-w-[280px] truncate",title:d,children:d}),g>0&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-emerald-400",children:[e.jsx(Y,{className:"h-3.5 w-3.5"})," gespeichert"]}),e.jsxs("button",{onClick:L,disabled:!f||S,className:w("h-8 px-4 rounded-lg text-[10px] font-bold uppercase tracking-wide transition-all flex items-center gap-1.5",f&&!S?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer shadow-md shadow-primary/10":"bg-background/40 text-muted-foreground/50 border border-border/40 cursor-not-allowed"),children:[S?e.jsx(Oe,{className:"h-3.5 w-3.5 animate-spin"}):null,"Speichern"]})]})]}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/70 leading-relaxed -mt-1",children:["Welches echte Modell hinter den virtuellen Lanes ",e.jsx("code",{className:"text-cyan-300",children:"chat"})," und"," ",e.jsx("code",{className:"text-cyan-300",children:"coding"})," steckt. Änderungen greifen sofort (kein Neustart). Die Keyword-Heuristiken bleiben im Code."]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[e.jsx(mt,{className:"h-4 w-4 text-teal-400"}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"chat"}),e.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(= auto)"})]}),yt.map(s=>e.jsx(B,{k:s},s))]}),e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[e.jsx(dt,{className:"h-4 w-4 text-indigo-400"}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"coding"}),e.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(agentisch → immer Coder)"})]}),jt.map(s=>e.jsx(B,{k:s},s))]})]}),e.jsx("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4",children:e.jsx("div",{className:"max-w-xs",children:e.jsx(B,{k:"fast_no_think"})})})]})}const je=[{role:"hermes",label:"Lucys Hirn",short:"Hirn",icon:le,desc:"Lucys Alltags-Verstand — denkt und redet mit dir. Immer bereit.",tone:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25",protected:!0},{role:"embed",label:"Lucys Gedächtnis",short:"Gedächtnis",icon:Te,desc:"Merkt sich Wichtiges und findet es später wieder.",tone:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",protected:!0},{role:"reranker",label:"Gedächtnis-Sortierer",short:"Sortierer",icon:xt,desc:"Ordnet gefundene Erinnerungen nach echter Relevanz — die Feinsortierung hinter dem Gedächtnis.",tone:"bg-lime-500/15 text-lime-400 border-lime-500/25"},{role:"vision",label:"Lucys Augen",short:"Augen",icon:Be,desc:"Sieht Bilder und Screenshots und beschreibt, was drauf ist.",tone:"bg-pink-500/15 text-pink-400 border-pink-500/25"},{role:"heavy",label:"Großes Hirn",short:"Groß",icon:lt,desc:"Das schwere Geschütz — wird für besonders knifflige Fragen dazugeholt.",tone:"bg-amber-500/15 text-amber-400 border-amber-500/25"},{role:"coder-lite",label:"Programmierer (schnell)",short:"Code schnell",icon:he,desc:"Schnelles Programmieren im Alltag.",tone:"bg-violet-500/15 text-violet-400 border-violet-500/25"},{role:"coder",label:"Programmierer (gründlich)",short:"Code gründlich",icon:he,desc:"Schreibt und prüft Code besonders sorgfältig — für schwere Coding-Aufgaben.",tone:"bg-fuchsia-500/15 text-fuchsia-400 border-fuchsia-500/25"},{role:"scout",label:"Späher",short:"Späher",icon:gt,desc:"Schneller erster Blick und grobe Einschätzung.",tone:"bg-teal-500/15 text-teal-400 border-teal-500/25"},{role:"kritiker",label:"Kritiker",short:"Kritiker",icon:Ee,desc:"Die unbestechliche Zweitmeinung — prüft Behauptungen und Patches (anderer Hersteller als das Hirn).",tone:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25"}];je.map(t=>t.role);const Ne=Object.fromEntries(je.map(t=>[t.role,t])),ke=t=>({role:t||"?",label:t||"unbekannt",short:t||"?",icon:le,desc:"Rolle ohne hinterlegten Klartext-Namen.",tone:"bg-slate-500/15 text-slate-300 border-slate-500/25"}),Nt={fast:"hermes",coder_lite:"coder-lite"};function F(t){return t&&(Ne[t]||Ne[Nt[t]])||ke(t)}function be({role:t,dense:r=!1,className:h}){const a=F(t),m=a.icon;return e.jsxs("span",{className:w("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold border tracking-wide",a.tone,h),title:`${a.desc} (${a.role})`,children:[e.jsx(m,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),r?a.short:a.label]})}function kt({fit:t}){const r={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return e.jsxs("span",{className:w("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",r),children:[t.text," • ",t.req_gb," GB RAM"]})}function Ke(t){const r=t.toLowerCase();return r.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:r.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:r.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:r.includes("mistral")||r.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:r.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:r.includes("hermes")||r.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:r.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function wt(){var te,H,G;const t=oe(),{data:r}=de(),{data:h}=$e(),{data:a}=Ge(),{data:m}=He(),{showAlert:S,dialogElement:v}=ge(),[d,M]=N.useState(!1),[g,z]=N.useState(!1),x=(r==null?void 0:r.models)??[],f=(r==null?void 0:r.running)??[],b=(te=h==null?void 0:h.groups)==null?void 0:te.brains,i=(b==null?void 0:b.members)??[],L=p=>x.find(_=>_.name===p),B=p=>{var _;return((_=p.split("/").pop())==null?void 0:_.replace(/\.gguf$/i,""))||p},s=i.map(L).filter(Boolean),o=1024**3,c=m==null?void 0:m.budget,$=s.reduce((p,_)=>p+(_.size_bytes||0),0)/o,A=((H=a==null?void 0:a.gpu)==null?void 0:H.gtt_total)||((G=a==null?void 0:a.gpu)==null?void 0:G.vram_total)||0,C=(c==null?void 0:c.gtt_gb)||(A?A/o:0),k=(c==null?void 0:c.warm_projected_gb)??$,R=C>0?Math.min(100,k/C*100):0,E=x.filter(p=>!i.includes(p.name)&&!p.incomplete);async function I(p){z(!0);try{await Ue("brains",p,(b==null?void 0:b.swap)??!1,(b==null?void 0:b.persist)??!0),t.invalidateQueries({queryKey:P.groups}),t.invalidateQueries({queryKey:P.models}),t.invalidateQueries({queryKey:P.hermesBrain})}catch(_){S("Fehler",`Immer-bereit-Set konnte nicht geändert werden: ${(_==null?void 0:_.message)||_}`)}finally{z(!1)}}function T(p){const _=L(p);if(_&&F(_.role).protected){S("Geschützt",`„${F(_.role).label}" ist lebenswichtig und bleibt immer bereit.`);return}I(i.filter(Q=>Q!==p))}function W(p){M(!1),I([...i,p])}return b?e.jsxs("div",{className:"mc-card p-5 space-y-4",children:[e.jsx(we,{}),e.jsxs("div",{className:"space-y-1.5",children:[s.length===0&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Noch keine Modelle im Set."}),s.map(p=>{const _=f.includes(p.name),Q=F(p.role).protected;return e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:w("h-2 w-2 shrink-0 rounded-full ring-2 ring-black/40",_?"bg-emerald-500 animate-pulse":"bg-muted-foreground/40"),title:_?"Gerade warm (bereit)":"Reserviert — lädt bei Bedarf sofort"}),p.role&&e.jsx(be,{role:p.role,dense:!0,className:"shrink-0"}),e.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",title:p.name,children:B(p.name)}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:ee(p.size_bytes)})]}),Q?e.jsx("span",{className:"shrink-0 text-[10px] font-semibold text-muted-foreground",title:"Lebenswichtig — bleibt immer im Set.",children:"🔒"}):e.jsx("button",{onClick:()=>T(p.name),disabled:g,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground transition-colors hover:bg-red-500/5 hover:text-red-400 cursor-pointer disabled:opacity-50",title:"Aus dem Immer-bereit-Set nehmen (lädt dann nur noch bei Bedarf)",children:e.jsx(pe,{className:"h-3.5 w-3.5"})})]},p.name)})]}),e.jsxs("button",{onClick:()=>M(!0),disabled:g||E.length===0,className:"flex h-8 w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border/50 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground transition-colors hover:border-primary/40 hover:text-primary cursor-pointer disabled:opacity-50",children:[e.jsx(Qe,{className:"h-3.5 w-3.5"})," Modell dauerhaft bereithalten"]}),e.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",title:"Modellgewichte + KV-Cache, berechnet aus den echten Architektur-Daten jedes Modells (Layer × KV-Köpfe × Kontext) und seiner KV-Quantisierung. So viel legt llama.cpp beim Laden wirklich für den eingestellten Kontext an — kein Aufschlag mehr.",children:[e.jsx(fe,{className:"h-3.5 w-3.5"})," Reserviert fürs Set"]}),e.jsxs("span",{className:"font-mono font-bold text-foreground",children:[k.toFixed(1),C>0?` / ${C.toFixed(0)}`:""," GB"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:e.jsx("div",{className:w("h-full rounded-full transition-all duration-500",R>=85?"bg-red-500":R>=65?"bg-amber-500":"bg-teal-500"),style:{width:`${R}%`}})}),c&&!c.fits&&e.jsxs("p",{className:"mt-2 flex items-start gap-1.5 text-[11px] text-amber-400",children:[e.jsx(re,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:["Zusammen mit dem größten Gelegenheits-Modell (~",c.largest_ondemand_gb," GB) wird der Speicher knapp. Das Set bleibt dabei immer geladen — wird es wirklich eng, schlägt das Laden des großen Modells fehl (es wartet dann, statt das Set zu verdrängen)."]})]}),c&&c.fits&&e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-emerald-400",children:[e.jsx(Y,{className:"h-3.5 w-3.5 shrink-0"})," Passt auch neben dem größten Gelegenheits-Modell — nichts wird verdrängt."]})]}),d&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":"Modell zum Immer-bereit-Set hinzufügen",children:e.jsxs("div",{className:"w-full max-w-md space-y-3 rounded-2xl border border-border/80 bg-card p-6 shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:"Dauerhaft bereithalten"}),e.jsx("button",{onClick:()=>M(!1),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer",children:e.jsx(pe,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Wähle ein Modell, das ohne Ladezeit bereitstehen soll:"}),e.jsx("div",{className:"max-h-60 space-y-1.5 overflow-y-auto pr-1",children:E.map(p=>e.jsxs("button",{onClick:()=>W(p.name),className:"flex w-full items-center justify-between gap-2 rounded-lg border border-border/30 bg-background/20 px-3 py-2.5 text-left transition-colors hover:bg-accent cursor-pointer",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p.role&&e.jsx(be,{role:p.role,dense:!0,className:"shrink-0"}),e.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",children:B(p.name)})]}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:ee(p.size_bytes)})]},p.name))})]})}),v]}):e.jsxs("div",{className:"mc-card p-5",children:[e.jsx(we,{}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Es gibt noch kein Immer-bereit-Set. Es entsteht automatisch, sobald Lucys Hirn zugewiesen ist."}),v]})}function we(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-4.5 w-4.5 text-primary"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold uppercase tracking-wide text-foreground",children:"Immer-bereit-Set"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Diese Modelle hält Lucy immer bereit — sie antworten ohne Ladezeit."})]})]})}function J({children:t,tone:r="muted"}){const h={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return e.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${h[r]}`,children:t})}function St({caps:t}){return t?e.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&e.jsx(J,{children:"💻 Code"}),t.vision&&e.jsx(J,{children:"👁 Bild"}),t.reasoning&&e.jsx(J,{children:"🧠 Reason"}),t.moe&&e.jsxs(J,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&e.jsx(J,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&e.jsx(J,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&e.jsx(J,{children:"🔢 Embed"})]}):null}function Mt({model:t,onClose:r,onChanged:h}){var L,B;const{data:a,isLoading:m}=Ve(t.gguf_path),[S,v]=N.useState(null),[d,M]=N.useState(""),g=a==null?void 0:a.target_vocab,z=(a==null?void 0:a.drafts)??[],x=z.filter(s=>s.compatible===!0),f=t.spec_draft_model;async function b(s){v(s??"__clear__"),M("");try{await K(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:s})}),h(),r()}catch(o){M(String((o==null?void 0:o.message)||o)),v(null)}}const i=s=>{var o;return s?`${s.pre??"?"} · ${((o=s.n_vocab)==null?void 0:o.toLocaleString())??"?"} Tokens`:"—"};return e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[e.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[e.jsx(ie,{className:"h-4 w-4"})," Speculative Draft"]}),e.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(pe,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',e.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),e.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:(L=t.name.split("/").pop())==null?void 0:L.replace(/\.gguf$/i,"")}),e.jsxs("span",{className:"text-foreground",children:["Vocab: ",i(g)]})]}),t.spec_active&&f&&e.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[e.jsx(Y,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",f]}),e.jsx("button",{onClick:()=>b(null),disabled:S!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(a!=null&&a.target_exists)&&e.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[e.jsx(re,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),e.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:m?e.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):z.length===0?e.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",e.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):z.map(s=>{var $,A;const o=s.filename===f,c=s.compatible===!0;return e.jsxs("div",{className:w("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",c?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",o&&"border-primary/40 bg-primary/10"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate flex items-center gap-1.5",children:[s.filename,s.mtp&&e.jsx("span",{className:"shrink-0 rounded bg-indigo-500/15 px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-wider text-indigo-400 border border-indigo-500/25",title:"MTP-Kopf (Multi-Token-Prediction) — by-construction vocab-identisch, höchste Akzeptanzrate",children:"MTP"})]}),e.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[ee(s.size_bytes)," · Vocab: ",i(s.vocab)]})]}),c?o?e.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[e.jsx(Y,{className:"h-3.5 w-3.5"})," Aktiv"]}):e.jsx("button",{onClick:()=>b(s.path),disabled:S!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):e.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:s.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${($=s.vocab)==null?void 0:$.pre}/${(A=s.vocab)==null?void 0:A.n_vocab} ≠ Modell ${g==null?void 0:g.pre}/${g==null?void 0:g.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[e.jsx(re,{className:"h-3.5 w-3.5"})," ",s.compatible===!1?"Vocab ≠":"n/a"]})]},s.path)})}),!m&&(a==null?void 0:a.target_exists)&&z.length>0&&x.length===0&&e.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",e.jsx("span",{className:"font-mono",children:g==null?void 0:g.pre}),", n_vocab=",e.jsx("span",{className:"font-mono",children:(B=g==null?void 0:g.n_vocab)==null?void 0:B.toLocaleString()}),")."]}),d&&e.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:d})]})})}const Se={hermes:{bar:"bg-indigo-500",dot:"bg-indigo-500",text:"text-indigo-400"},embed:{bar:"bg-emerald-500",dot:"bg-emerald-500",text:"text-emerald-400"},vision:{bar:"bg-pink-500",dot:"bg-pink-500",text:"text-pink-400"},heavy:{bar:"bg-amber-500",dot:"bg-amber-500",text:"text-amber-400"},"coder-lite":{bar:"bg-violet-500",dot:"bg-violet-500",text:"text-violet-400"},coder:{bar:"bg-fuchsia-500",dot:"bg-fuchsia-500",text:"text-fuchsia-400"},scout:{bar:"bg-teal-500",dot:"bg-teal-500",text:"text-teal-400"},kritiker:{bar:"bg-cyan-500",dot:"bg-cyan-500",text:"text-cyan-400"},reranker:{bar:"bg-lime-500",dot:"bg-lime-500",text:"text-lime-400"}},Ct={fast:"hermes",coder_lite:"coder-lite"},Me={bar:"bg-slate-400",dot:"bg-slate-400",text:"text-slate-300"};function ae(t){return t&&(Se[t]||Se[Ct[t]])||Me}const Ce=1024**3,_e=t=>{var r;return((r=t.split("/").pop())==null?void 0:r.replace(/\.gguf$/i,""))??t};function _t({running:t,capacityBytes:r,realUsedBytes:h,selected:a,onSelect:m}){const S=r>2*Ce?r:124*Ce,v=t.reduce((x,f)=>x+(f.size_bytes||0),0),d=Math.max(0,h-v),M=Math.max(0,S-Math.max(v,h)),g=M/S*100,z=d/S*100;return e.jsxs("div",{className:"mc-card p-5",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Modell-Speicher (GPU-Pool)"}),e.jsxs("div",{className:"font-space text-xl font-bold tracking-tight text-foreground",children:[V(S)," GB ",e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"gesamt"})]})]})]}),e.jsxs("div",{className:"text-right text-[11px] font-mono text-muted-foreground",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-bold text-foreground",children:[V(v)," GB"]})," Modell-Gewichte"]}),d>0&&e.jsxs("div",{children:[V(d)," GB KV-Cache & Betrieb"]}),e.jsxs("div",{className:"text-emerald-400",children:[V(M)," GB frei"]})]})]}),e.jsx("div",{className:"flex h-12 w-full overflow-hidden rounded-xl border border-border/40 bg-background/50 p-1",children:t.length===0?e.jsx("div",{className:"flex w-full items-center justify-center text-[11px] italic text-muted-foreground/60",children:"Kein Modell geladen — Auto-Swap holt bei Anfrage automatisch das passende."}):e.jsxs(e.Fragment,{children:[t.map(x=>{const f=(x.size_bytes||0)/S*100,b=ae(x.role),i=a===x.name;return e.jsxs("button",{onClick:()=>m==null?void 0:m(x.name),style:{width:`${f}%`},title:`${F(x.role).label} · ${_e(x.name)} · ${ee(x.size_bytes)}`,className:w("group flex h-full min-w-[2.5rem] shrink-0 flex-col justify-center gap-0.5 rounded-lg px-2 text-left text-white transition-all",b.bar,i?"ring-2 ring-white/70":"opacity-90 hover:opacity-100"),children:[e.jsx("span",{className:"truncate font-space text-[10px] font-bold leading-tight tracking-wide",children:F(x.role).short}),e.jsx("span",{className:"truncate font-mono text-[9px] leading-tight opacity-85",children:ee(x.size_bytes)})]},x.name)}),z>1.5&&e.jsx("div",{style:{width:`${z}%`},className:"flex h-full min-w-[2rem] items-center justify-center rounded-lg border border-dashed border-border/60 bg-background/40 text-[9px] font-mono text-muted-foreground/70",title:`${V(d)} GB KV-Cache & Betrieb (reale Belegung über den Modell-Gewichten)`,children:"KV"}),g>1.5&&e.jsx("div",{style:{width:`${g}%`},className:"flex h-full min-w-[2rem] items-center justify-center rounded-lg text-[9px] font-mono text-muted-foreground/50",title:`${V(M)} GB frei`,children:"frei"})]})}),t.length>0&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1.5",children:[t.map(x=>{const f=ae(x.role);return e.jsxs("button",{onClick:()=>m==null?void 0:m(x.name),className:"flex items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx("span",{className:w("h-2.5 w-2.5 rounded-sm",f.dot)}),e.jsx("span",{className:w("font-semibold",f.text),children:F(x.role).short}),e.jsx("span",{className:"font-mono text-muted-foreground/70",children:_e(x.name)})]},x.name)}),d>0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60",title:"Reale Belegung über den Modell-Gewichten (Kontext-Speicher der laufenden Modelle)",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-dashed border-border/60 bg-background/40"})," KV-Cache & Betrieb · ",V(d)," GB"]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-border/50 bg-background/50"})," frei · ",V(M)," GB"]})]})]})}const Le=1024**3,X=t=>{var r;return((r=t.split("/").pop())==null?void 0:r.replace(/\.gguf$/i,""))??t};function Lt(){var n,y,D,U;const t=oe(),{data:r,isLoading:h,error:a}=de(),{data:m}=Ge(),{data:S}=$e(),{showAlert:v,showConfirm:d,showPrompt:M,dialogElement:g}=ge(),z=We(),x=(r==null?void 0:r.models)??[],f=(r==null?void 0:r.running)??[],b=l=>!!F(l).protected,i=(n=S==null?void 0:S.groups)==null?void 0:n.brains,L=(i==null?void 0:i.members)??[],B=l=>L.includes(l),[s,o]=N.useState(null),[c,$]=N.useState(""),[A,C]=N.useState("all"),[k,R]=N.useState(null),E=()=>{t.invalidateQueries({queryKey:P.models}),t.invalidateQueries({queryKey:P.routing}),t.invalidateQueries({queryKey:P.groups})},I=x.filter(l=>f.includes(l.name)),T=((y=m==null?void 0:m.gpu)==null?void 0:y.gtt_total)||((D=m==null?void 0:m.gpu)==null?void 0:D.vram_total)||0,W=((U=m==null?void 0:m.gpu)==null?void 0:U.gtt_used)||0,te=T>2*Le?T:124*Le,H=N.useMemo(()=>{const l=c.trim().toLowerCase();return x.filter(u=>A==="in_use"?!!u.role||f.includes(u.name):!0).filter(u=>l?u.name.toLowerCase().includes(l):!0).sort((u,j)=>{const O=f.includes(u.name)?0:1,Z=f.includes(j.name)?0:1;return O!==Z?O-Z:X(u.name).localeCompare(X(j.name))})},[x,f,A,c]),G=x.find(l=>l.name===s)??null;async function p(l){try{await K(`/api/models/${encodeURIComponent(l)}/load`,{method:"POST"}),E()}catch(u){v("Fehler",`Laden fehlgeschlagen: ${u.message||u}`)}}async function _(l){const u=L.some(j=>f.includes(j));if(i&&u&&!B(l)){const j=L.filter(O=>f.includes(O)).map(X).join(", ");d("Verdrängt das Hirn?",`„${X(l)}" ist nicht ko-resident. Beim Laden wirft es das warme Hirn (${j}) raus — Lucy verliert Hirn bzw. Augen. + */const gt=q("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);function ft(){const t=oe(),{data:r=[]}=Fe(),{showAlert:h,dialogElement:a}=ge();async function m(d){try{await K(`/api/jobs/${d}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:P.jobs})}catch(S){h("Fehler",S.message)}}const M=r.filter(d=>d.state==="running"||d.state==="queued"),v=r.filter(d=>d.state!=="running"&&d.state!=="queued").slice(-3);return M.length===0&&v.length===0?null:e.jsxs("div",{className:"space-y-3 mc-card p-4",children:[e.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),M.map(d=>e.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:d.label}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-muted-foreground font-mono",children:[d.progress??0,"% • ",ue(d.done_bytes),"/",ue(d.total_bytes),d.eta_s?` • ETA ${Re(d.eta_s)}`:""]}),e.jsx("button",{onClick:()=>m(d.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),e.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${d.progress??0}%`}})})]},d.id)),v.map(d=>e.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[e.jsx("span",{className:"truncate",children:d.label}),e.jsx("span",{className:w("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",d.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:d.state})]},d.id)),a]})}const yt=["fast","heavy","heavy_chars"],jt=["coder_lite","coder","coding_escalate_chars"];function vt(){const t=oe(),{data:r,isLoading:h}=Ie(),[a,m]=N.useState(null),[M,v]=N.useState(!1),[d,S]=N.useState(""),[g,z]=N.useState(0);if(N.useEffect(()=>{r!=null&&r.policy&&!a&&m({...r.policy})},[r,a]),h||!r||!a)return e.jsx("div",{className:"mc-card p-5 text-xs text-muted-foreground",children:"Lade Routing-Policy…"});const x=s=>r.fields.find(o=>o.key===s),f=Object.keys(a).some(s=>a[s]!==r.policy[s]),b=(s,o)=>{m(i=>i&&{...i,[s]:o}),S("")},c=s=>b(s,r.defaults[s]);async function L(){if(!a)return;const s={};for(const o of Object.keys(a))a[o]!==r.policy[o]&&(s[o]=a[o]);if(Object.keys(s).length!==0){v(!0),S("");try{const{policy:o}=await Pe(s);m({...o}),t.invalidateQueries({queryKey:P.routingPolicy}),t.invalidateQueries({queryKey:P.routing}),z(Date.now()),setTimeout(()=>z(0),2e3)}catch(o){S(o.message||String(o))}finally{v(!1)}}}function B({k:s}){const o=x(s),i=a[s],$=a[s]===r.defaults[s];return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground",children:o.label}),!$&&e.jsxs("button",{onClick:()=>c(s),className:"flex items-center gap-0.5 text-[9px] text-muted-foreground/60 hover:text-foreground transition-colors cursor-pointer",title:`Auf Default zurücksetzen (${String(r.defaults[s])||"leer"})`,children:[e.jsx(rt,{className:"h-2.5 w-2.5"})," Default"]})]}),o.type==="bool"?e.jsxs("button",{onClick:()=>b(s,!i),className:w("flex h-8 w-full items-center justify-between rounded-lg border px-3 text-[11px] font-semibold transition-all cursor-pointer",i?"border-emerald-500/40 bg-emerald-500/10 text-emerald-300":"border-border/40 bg-background/40 text-muted-foreground"),children:[e.jsx("span",{children:i?"An":"Aus"}),e.jsx("span",{className:w("h-3.5 w-3.5 rounded-full transition-colors",i?"bg-emerald-400":"bg-muted-foreground/40")})]}):o.type==="int"?e.jsx("input",{type:"number",value:i,min:o.min,max:o.max,"aria-label":o.label,onChange:A=>b(s,Number(A.target.value)),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"}):e.jsx("input",{type:"text",value:i,"aria-label":o.label,spellCheck:!1,placeholder:s==="coder_lite"?"(leer = aus)":"",onChange:A=>b(s,A.target.value),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"})]})}return e.jsxs("div",{className:"mc-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ht,{className:"h-4.5 w-4.5 text-primary"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lane-Routing & Policy"}),e.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-300 border border-emerald-500/20",children:"hot-reload"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d&&e.jsx("span",{className:"text-[10px] text-red-400 max-w-[280px] truncate",title:d,children:d}),g>0&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-emerald-400",children:[e.jsx(Y,{className:"h-3.5 w-3.5"})," gespeichert"]}),e.jsxs("button",{onClick:L,disabled:!f||M,className:w("h-8 px-4 rounded-lg text-[10px] font-bold uppercase tracking-wide transition-all flex items-center gap-1.5",f&&!M?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer shadow-md shadow-primary/10":"bg-background/40 text-muted-foreground/50 border border-border/40 cursor-not-allowed"),children:[M?e.jsx(Oe,{className:"h-3.5 w-3.5 animate-spin"}):null,"Speichern"]})]})]}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/70 leading-relaxed -mt-1",children:["Welches echte Modell hinter den virtuellen Lanes ",e.jsx("code",{className:"text-cyan-300",children:"chat"})," und"," ",e.jsx("code",{className:"text-cyan-300",children:"coding"})," steckt. Änderungen greifen sofort (kein Neustart). Die Keyword-Heuristiken bleiben im Code."]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[e.jsx(mt,{className:"h-4 w-4 text-teal-400"}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"chat"}),e.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(= auto)"})]}),yt.map(s=>e.jsx(B,{k:s},s))]}),e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[e.jsx(dt,{className:"h-4 w-4 text-indigo-400"}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"coding"}),e.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(agentisch → immer Coder)"})]}),jt.map(s=>e.jsx(B,{k:s},s))]})]}),e.jsx("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4",children:e.jsx("div",{className:"max-w-xs",children:e.jsx(B,{k:"fast_no_think"})})})]})}const je=[{role:"hermes",label:"Lucys Hirn",short:"Hirn",icon:le,desc:"Lucys Alltags-Verstand — denkt und redet mit dir. Immer bereit.",tone:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25",protected:!0},{role:"embed",label:"Lucys Gedächtnis",short:"Gedächtnis",icon:Te,desc:"Merkt sich Wichtiges und findet es später wieder.",tone:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",protected:!0},{role:"reranker",label:"Gedächtnis-Sortierer",short:"Sortierer",icon:xt,desc:"Ordnet gefundene Erinnerungen nach echter Relevanz — die Feinsortierung hinter dem Gedächtnis.",tone:"bg-lime-500/15 text-lime-400 border-lime-500/25"},{role:"vision",label:"Lucys Augen",short:"Augen",icon:Be,desc:"Sieht Bilder und Screenshots und beschreibt, was drauf ist.",tone:"bg-pink-500/15 text-pink-400 border-pink-500/25"},{role:"heavy",label:"Großes Hirn",short:"Groß",icon:lt,desc:"Das schwere Geschütz — wird für besonders knifflige Fragen dazugeholt.",tone:"bg-amber-500/15 text-amber-400 border-amber-500/25"},{role:"coder-lite",label:"Programmierer (schnell)",short:"Code schnell",icon:he,desc:"Schnelles Programmieren im Alltag.",tone:"bg-violet-500/15 text-violet-400 border-violet-500/25"},{role:"coder",label:"Programmierer (gründlich)",short:"Code gründlich",icon:he,desc:"Schreibt und prüft Code besonders sorgfältig — für schwere Coding-Aufgaben.",tone:"bg-fuchsia-500/15 text-fuchsia-400 border-fuchsia-500/25"},{role:"scout",label:"Späher",short:"Späher",icon:gt,desc:"Schneller erster Blick und grobe Einschätzung.",tone:"bg-teal-500/15 text-teal-400 border-teal-500/25"},{role:"kritiker",label:"Kritiker",short:"Kritiker",icon:Ee,desc:"Die unbestechliche Zweitmeinung — prüft Behauptungen und Patches (anderer Hersteller als das Hirn).",tone:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25"}];je.map(t=>t.role);const Ne=Object.fromEntries(je.map(t=>[t.role,t])),ke=t=>({role:t||"?",label:t||"unbekannt",short:t||"?",icon:le,desc:"Rolle ohne hinterlegten Klartext-Namen.",tone:"bg-slate-500/15 text-slate-300 border-slate-500/25"}),Nt={fast:"hermes",coder_lite:"coder-lite"};function F(t){return t&&(Ne[t]||Ne[Nt[t]])||ke(t)}function be({role:t,dense:r=!1,className:h}){const a=F(t),m=a.icon;return e.jsxs("span",{className:w("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold border tracking-wide",a.tone,h),title:`${a.desc} (${a.role})`,children:[e.jsx(m,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),r?a.short:a.label]})}function kt({fit:t}){const r={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return e.jsxs("span",{className:w("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",r),children:[t.text," • ",t.req_gb," GB RAM"]})}function Ke(t){const r=t.toLowerCase();return r.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:r.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:r.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:r.includes("mistral")||r.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:r.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:r.includes("hermes")||r.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:r.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function wt(){var te,H,G;const t=oe(),{data:r}=de(),{data:h}=$e(),{data:a}=Ge(),{data:m}=He(),{showAlert:M,dialogElement:v}=ge(),[d,S]=N.useState(!1),[g,z]=N.useState(!1),x=(r==null?void 0:r.models)??[],f=(r==null?void 0:r.running)??[],b=(te=h==null?void 0:h.groups)==null?void 0:te.brains,c=(b==null?void 0:b.members)??[],L=p=>x.find(_=>_.name===p),B=p=>{var _;return((_=p.split("/").pop())==null?void 0:_.replace(/\.gguf$/i,""))||p},s=c.map(L).filter(Boolean),o=1024**3,i=m==null?void 0:m.budget,$=s.reduce((p,_)=>p+(_.size_bytes||0),0)/o,A=((H=a==null?void 0:a.gpu)==null?void 0:H.gtt_total)||((G=a==null?void 0:a.gpu)==null?void 0:G.vram_total)||0,C=(i==null?void 0:i.gtt_gb)||(A?A/o:0),k=(i==null?void 0:i.warm_projected_gb)??$,R=C>0?Math.min(100,k/C*100):0,E=x.filter(p=>!c.includes(p.name)&&!p.incomplete);async function I(p){z(!0);try{await Ue("brains",p,(b==null?void 0:b.swap)??!1,(b==null?void 0:b.persist)??!0),t.invalidateQueries({queryKey:P.groups}),t.invalidateQueries({queryKey:P.models}),t.invalidateQueries({queryKey:P.hermesBrain})}catch(_){M("Fehler",`Immer-bereit-Set konnte nicht geändert werden: ${(_==null?void 0:_.message)||_}`)}finally{z(!1)}}function T(p){const _=L(p);if(_&&F(_.role).protected){M("Geschützt",`„${F(_.role).label}" ist lebenswichtig und bleibt immer bereit.`);return}I(c.filter(Q=>Q!==p))}function W(p){S(!1),I([...c,p])}return b?e.jsxs("div",{className:"mc-card p-5 space-y-4",children:[e.jsx(we,{}),e.jsxs("div",{className:"space-y-1.5",children:[s.length===0&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Noch keine Modelle im Set."}),s.map(p=>{const _=f.includes(p.name),Q=F(p.role).protected;return e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:w("h-2 w-2 shrink-0 rounded-full ring-2 ring-black/40",_?"bg-emerald-500 animate-pulse":"bg-muted-foreground/40"),title:_?"Gerade warm (bereit)":"Reserviert — lädt bei Bedarf sofort"}),p.role&&e.jsx(be,{role:p.role,dense:!0,className:"shrink-0"}),e.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",title:p.name,children:B(p.name)}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:ee(p.size_bytes)})]}),Q?e.jsx("span",{className:"shrink-0 text-[10px] font-semibold text-muted-foreground",title:"Lebenswichtig — bleibt immer im Set.",children:"🔒"}):e.jsx("button",{onClick:()=>T(p.name),disabled:g,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground transition-colors hover:bg-red-500/5 hover:text-red-400 cursor-pointer disabled:opacity-50",title:"Aus dem Immer-bereit-Set nehmen (lädt dann nur noch bei Bedarf)",children:e.jsx(pe,{className:"h-3.5 w-3.5"})})]},p.name)})]}),e.jsxs("button",{onClick:()=>S(!0),disabled:g||E.length===0,className:"flex h-8 w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border/50 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground transition-colors hover:border-primary/40 hover:text-primary cursor-pointer disabled:opacity-50",children:[e.jsx(Qe,{className:"h-3.5 w-3.5"})," Modell dauerhaft bereithalten"]}),e.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",title:"Modellgewichte + KV-Cache, berechnet aus den echten Architektur-Daten jedes Modells (Layer × KV-Köpfe × Kontext) und seiner KV-Quantisierung. So viel legt llama.cpp beim Laden wirklich für den eingestellten Kontext an — kein Aufschlag mehr.",children:[e.jsx(fe,{className:"h-3.5 w-3.5"})," Reserviert fürs Set"]}),e.jsxs("span",{className:"font-mono font-bold text-foreground",children:[k.toFixed(1),C>0?` / ${C.toFixed(0)}`:""," GB"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:e.jsx("div",{className:w("h-full rounded-full transition-all duration-500",R>=85?"bg-red-500":R>=65?"bg-amber-500":"bg-teal-500"),style:{width:`${R}%`}})}),i&&!i.fits&&e.jsxs("p",{className:"mt-2 flex items-start gap-1.5 text-[11px] text-amber-400",children:[e.jsx(re,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:["Zusammen mit dem größten Gelegenheits-Modell (~",i.largest_ondemand_gb," GB) wird der Speicher knapp. Das Set bleibt dabei immer geladen — wird es wirklich eng, schlägt das Laden des großen Modells fehl (es wartet dann, statt das Set zu verdrängen)."]})]}),i&&i.fits&&e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-emerald-400",children:[e.jsx(Y,{className:"h-3.5 w-3.5 shrink-0"})," Passt auch neben dem größten Gelegenheits-Modell — nichts wird verdrängt."]})]}),d&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":"Modell zum Immer-bereit-Set hinzufügen",children:e.jsxs("div",{className:"w-full max-w-md space-y-3 rounded-2xl border border-border/80 bg-card p-6 shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:"Dauerhaft bereithalten"}),e.jsx("button",{onClick:()=>S(!1),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer",children:e.jsx(pe,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Wähle ein Modell, das ohne Ladezeit bereitstehen soll:"}),e.jsx("div",{className:"max-h-60 space-y-1.5 overflow-y-auto pr-1",children:E.map(p=>e.jsxs("button",{onClick:()=>W(p.name),className:"flex w-full items-center justify-between gap-2 rounded-lg border border-border/30 bg-background/20 px-3 py-2.5 text-left transition-colors hover:bg-accent cursor-pointer",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p.role&&e.jsx(be,{role:p.role,dense:!0,className:"shrink-0"}),e.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",children:B(p.name)})]}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:ee(p.size_bytes)})]},p.name))})]})}),v]}):e.jsxs("div",{className:"mc-card p-5",children:[e.jsx(we,{}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Es gibt noch kein Immer-bereit-Set. Es entsteht automatisch, sobald Lucys Hirn zugewiesen ist."}),v]})}function we(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-4.5 w-4.5 text-primary"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold uppercase tracking-wide text-foreground",children:"Immer-bereit-Set"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Diese Modelle hält Lucy immer bereit — sie antworten ohne Ladezeit."})]})]})}function J({children:t,tone:r="muted"}){const h={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return e.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${h[r]}`,children:t})}function Mt({caps:t}){return t?e.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&e.jsx(J,{children:"💻 Code"}),t.vision&&e.jsx(J,{children:"👁 Bild"}),t.reasoning&&e.jsx(J,{children:"🧠 Reason"}),t.moe&&e.jsxs(J,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&e.jsx(J,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&e.jsx(J,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&e.jsx(J,{children:"🔢 Embed"})]}):null}function St({model:t,onClose:r,onChanged:h}){var L,B;const{data:a,isLoading:m}=Ve(t.gguf_path),[M,v]=N.useState(null),[d,S]=N.useState(""),g=a==null?void 0:a.target_vocab,z=(a==null?void 0:a.drafts)??[],x=z.filter(s=>s.compatible===!0),f=t.spec_draft_model;async function b(s){v(s??"__clear__"),S("");try{await K(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:s})}),h(),r()}catch(o){S(String((o==null?void 0:o.message)||o)),v(null)}}const c=s=>{var o;return s?`${s.pre??"?"} · ${((o=s.n_vocab)==null?void 0:o.toLocaleString())??"?"} Tokens`:"—"};return e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[e.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[e.jsx(ie,{className:"h-4 w-4"})," Speculative Draft"]}),e.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(pe,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',e.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),e.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:(L=t.name.split("/").pop())==null?void 0:L.replace(/\.gguf$/i,"")}),e.jsxs("span",{className:"text-foreground",children:["Vocab: ",c(g)]})]}),t.spec_active&&f&&e.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[e.jsx(Y,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",f]}),e.jsx("button",{onClick:()=>b(null),disabled:M!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(a!=null&&a.target_exists)&&e.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[e.jsx(re,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),e.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:m?e.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):z.length===0?e.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",e.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):z.map(s=>{var $,A;const o=s.filename===f,i=s.compatible===!0;return e.jsxs("div",{className:w("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",i?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",o&&"border-primary/40 bg-primary/10"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate flex items-center gap-1.5",children:[s.filename,s.mtp&&e.jsx("span",{className:"shrink-0 rounded bg-indigo-500/15 px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-wider text-indigo-400 border border-indigo-500/25",title:"MTP-Kopf (Multi-Token-Prediction) — by-construction vocab-identisch, höchste Akzeptanzrate",children:"MTP"})]}),e.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[ee(s.size_bytes)," · Vocab: ",c(s.vocab)]})]}),i?o?e.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[e.jsx(Y,{className:"h-3.5 w-3.5"})," Aktiv"]}):e.jsx("button",{onClick:()=>b(s.path),disabled:M!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):e.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:s.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${($=s.vocab)==null?void 0:$.pre}/${(A=s.vocab)==null?void 0:A.n_vocab} ≠ Modell ${g==null?void 0:g.pre}/${g==null?void 0:g.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[e.jsx(re,{className:"h-3.5 w-3.5"})," ",s.compatible===!1?"Vocab ≠":"n/a"]})]},s.path)})}),!m&&(a==null?void 0:a.target_exists)&&z.length>0&&x.length===0&&e.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",e.jsx("span",{className:"font-mono",children:g==null?void 0:g.pre}),", n_vocab=",e.jsx("span",{className:"font-mono",children:(B=g==null?void 0:g.n_vocab)==null?void 0:B.toLocaleString()}),")."]}),d&&e.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:d})]})})}const Me={hermes:{bar:"bg-indigo-500",dot:"bg-indigo-500",text:"text-indigo-400"},embed:{bar:"bg-emerald-500",dot:"bg-emerald-500",text:"text-emerald-400"},vision:{bar:"bg-pink-500",dot:"bg-pink-500",text:"text-pink-400"},heavy:{bar:"bg-amber-500",dot:"bg-amber-500",text:"text-amber-400"},"coder-lite":{bar:"bg-violet-500",dot:"bg-violet-500",text:"text-violet-400"},coder:{bar:"bg-fuchsia-500",dot:"bg-fuchsia-500",text:"text-fuchsia-400"},scout:{bar:"bg-teal-500",dot:"bg-teal-500",text:"text-teal-400"},kritiker:{bar:"bg-cyan-500",dot:"bg-cyan-500",text:"text-cyan-400"},reranker:{bar:"bg-lime-500",dot:"bg-lime-500",text:"text-lime-400"}},Ct={fast:"hermes",coder_lite:"coder-lite"},Se={bar:"bg-slate-400",dot:"bg-slate-400",text:"text-slate-300"};function ae(t){return t&&(Me[t]||Me[Ct[t]])||Se}const Ce=1024**3,_e=t=>{var r;return((r=t.split("/").pop())==null?void 0:r.replace(/\.gguf$/i,""))??t};function _t({running:t,capacityBytes:r,realUsedBytes:h,selected:a,onSelect:m}){const M=r>2*Ce?r:124*Ce,v=t.reduce((x,f)=>x+(f.size_bytes||0),0),d=Math.max(0,h-v),S=Math.max(0,M-Math.max(v,h)),g=S/M*100,z=d/M*100;return e.jsxs("div",{className:"mc-card p-5",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Modell-Speicher (GPU-Pool)"}),e.jsxs("div",{className:"font-space text-xl font-bold tracking-tight text-foreground",children:[V(M)," GB ",e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"gesamt"})]})]})]}),e.jsxs("div",{className:"text-right text-[11px] font-mono text-muted-foreground",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-bold text-foreground",children:[V(v)," GB"]})," Modell-Gewichte"]}),d>0&&e.jsxs("div",{children:[V(d)," GB KV-Cache & Betrieb"]}),e.jsxs("div",{className:"text-emerald-400",children:[V(S)," GB frei"]})]})]}),e.jsx("div",{className:"flex h-12 w-full overflow-hidden rounded-xl border border-border/40 bg-background/50 p-1",children:t.length===0?e.jsx("div",{className:"flex w-full items-center justify-center text-[11px] italic text-muted-foreground/60",children:"Kein Modell geladen — Auto-Swap holt bei Anfrage automatisch das passende."}):e.jsxs(e.Fragment,{children:[t.map(x=>{const f=(x.size_bytes||0)/M*100,b=ae(x.role),c=a===x.name;return e.jsxs("button",{onClick:()=>m==null?void 0:m(x.name),style:{width:`${f}%`},title:`${F(x.role).label} · ${_e(x.name)} · ${ee(x.size_bytes)}`,className:w("group flex h-full min-w-[2.5rem] shrink-0 flex-col justify-center gap-0.5 rounded-lg px-2 text-left text-white transition-all",b.bar,c?"ring-2 ring-white/70":"opacity-90 hover:opacity-100"),children:[e.jsx("span",{className:"truncate font-space text-[10px] font-bold leading-tight tracking-wide",children:F(x.role).short}),e.jsx("span",{className:"truncate font-mono text-[9px] leading-tight opacity-85",children:ee(x.size_bytes)})]},x.name)}),z>1.5&&e.jsx("div",{style:{width:`${z}%`},className:"flex h-full min-w-[2rem] items-center justify-center rounded-lg border border-dashed border-border/60 bg-background/40 text-[9px] font-mono text-muted-foreground/70",title:`${V(d)} GB KV-Cache & Betrieb (reale Belegung über den Modell-Gewichten)`,children:"KV"}),g>1.5&&e.jsx("div",{style:{width:`${g}%`},className:"flex h-full min-w-[2rem] items-center justify-center rounded-lg text-[9px] font-mono text-muted-foreground/50",title:`${V(S)} GB frei`,children:"frei"})]})}),t.length>0&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1.5",children:[t.map(x=>{const f=ae(x.role);return e.jsxs("button",{onClick:()=>m==null?void 0:m(x.name),className:"flex items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx("span",{className:w("h-2.5 w-2.5 rounded-sm",f.dot)}),e.jsx("span",{className:w("font-semibold",f.text),children:F(x.role).short}),e.jsx("span",{className:"font-mono text-muted-foreground/70",children:_e(x.name)})]},x.name)}),d>0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60",title:"Reale Belegung über den Modell-Gewichten (Kontext-Speicher der laufenden Modelle)",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-dashed border-border/60 bg-background/40"})," KV-Cache & Betrieb · ",V(d)," GB"]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-border/50 bg-background/50"})," frei · ",V(S)," GB"]})]})]})}const Le=1024**3,X=t=>{var r;return((r=t.split("/").pop())==null?void 0:r.replace(/\.gguf$/i,""))??t};function Lt(){var n,y,D,U;const t=oe(),{data:r,isLoading:h,error:a}=de(),{data:m}=Ge(),{data:M}=$e(),{showAlert:v,showConfirm:d,showPrompt:S,dialogElement:g}=ge(),z=We(),x=(r==null?void 0:r.models)??[],f=(r==null?void 0:r.running)??[],b=l=>!!F(l).protected,c=(n=M==null?void 0:M.groups)==null?void 0:n.brains,L=(c==null?void 0:c.members)??[],B=l=>L.includes(l),[s,o]=N.useState(null),[i,$]=N.useState(""),[A,C]=N.useState("all"),[k,R]=N.useState(null),E=()=>{t.invalidateQueries({queryKey:P.models}),t.invalidateQueries({queryKey:P.routing}),t.invalidateQueries({queryKey:P.groups})},I=x.filter(l=>f.includes(l.name)),T=((y=m==null?void 0:m.gpu)==null?void 0:y.gtt_total)||((D=m==null?void 0:m.gpu)==null?void 0:D.vram_total)||0,W=((U=m==null?void 0:m.gpu)==null?void 0:U.gtt_used)||0,te=T>2*Le?T:124*Le,H=N.useMemo(()=>{const l=i.trim().toLowerCase();return x.filter(u=>A==="in_use"?!!u.role||f.includes(u.name):!0).filter(u=>l?u.name.toLowerCase().includes(l):!0).sort((u,j)=>{const O=f.includes(u.name)?0:1,Z=f.includes(j.name)?0:1;return O!==Z?O-Z:X(u.name).localeCompare(X(j.name))})},[x,f,A,i]),G=x.find(l=>l.name===s)??null;async function p(l){try{await K(`/api/models/${encodeURIComponent(l)}/load`,{method:"POST"}),E()}catch(u){v("Fehler",`Laden fehlgeschlagen: ${u.message||u}`)}}async function _(l){const u=L.some(j=>f.includes(j));if(c&&u&&!B(l)){const j=L.filter(O=>f.includes(O)).map(X).join(", ");d("Verdrängt das Hirn?",`„${X(l)}" ist nicht ko-resident. Beim Laden wirft es das warme Hirn (${j}) raus — Lucy verliert Hirn bzw. Augen. -Trotzdem exklusiv laden?`,()=>p(l));return}p(l)}async function Q(l){const u=x.find(j=>j.name===l);if(u&&b(u.role)){v("Geschützt",`„${F(u.role).label}" ist lebenswichtig und bleibt geladen.`);return}try{await K(`/api/models/${encodeURIComponent(l)}/unload`,{method:"POST"}),E()}catch(j){v("Fehler",`Entladen fehlgeschlagen: ${j.message||j}`)}}async function ce(l,u){try{const j=await K(`/api/models/${encodeURIComponent(u)}/role`,{method:"POST",body:JSON.stringify({role:l||null})});E(),j!=null&&j.warning&&v("Rolle gesetzt — Hinweis",j.warning)}catch(j){v("Fehler",`Rolle zuweisen fehlgeschlagen: ${j.message||j}`)}}async function xe(l,u){let j=null;try{j=await K(`/api/models/${encodeURIComponent(l)}/ctx/auto`)}catch{}const O=j?`Optimal für dein Setup: ${(j.ctx/1024).toFixed(0)}k (${j.ctx}). »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";M("Kontextlänge anpassen",O,String(u||32768),async Z=>{if(Z)try{await K(`/api/models/${encodeURIComponent(l)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Z,10)})}),E()}catch(ve){v("Fehler",`Kontext setzen fehlgeschlagen: ${ve.message||ve}`)}},void 0,j?{autoValue:String(j.ctx),autoLabel:`Auto (${(j.ctx/1024).toFixed(0)}k)`}:void 0)}async function me(l){const u=x.find(j=>j.name===l);if(u&&b(u.role)){v("Geschützt",`„${F(u.role).label}" kann nicht gelöscht werden. Weise die Rolle zuerst einem anderen Modell zu.`);return}d("Modell löschen?",`„${X(l)}" und alle GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await K(`/api/models/${encodeURIComponent(l)}`,{method:"DELETE"}),s===l&&o(null),E()}catch(j){v("Fehler",`Löschen fehlgeschlagen: ${j.message||j}`)}})}return h?e.jsx("div",{className:"py-16 text-center text-xs text-muted-foreground",children:"Werkbank wird geladen …"}):a?e.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",String(a),")."]}):e.jsxs("div",{className:"space-y-5",children:[e.jsx(_t,{running:I,capacityBytes:te,realUsedBytes:W,selected:s,onSelect:o}),e.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)]",children:[e.jsxs("div",{className:"mc-card p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ye,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),e.jsx("input",{value:c,onChange:l=>$(l.target.value),placeholder:"Modell suchen …",className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 pl-8 pr-2 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"})]}),e.jsx("div",{className:"flex rounded-lg border border-border/40 bg-background/30 p-0.5",children:["all","in_use"].map(l=>e.jsx("button",{onClick:()=>C(l),className:w("rounded-md px-2 py-1 text-[9px] font-bold uppercase transition-all cursor-pointer",A===l?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:l==="all"?"Alle":"In Benutzung"},l))})]}),e.jsx("div",{className:"max-h-[60vh] space-y-1.5 overflow-y-auto scrollbar-thin pr-1",children:H.length===0?e.jsx("div",{className:"rounded-xl border border-dashed border-border/50 p-8 text-center text-xs text-muted-foreground",children:"Keine Modelle."}):H.map(l=>{const u=f.includes(l.name),j=s===l.name,O=Ke(l.name),Z=ae(l.role);return e.jsxs("button",{onClick:()=>o(l.name),className:w("flex w-full items-center gap-2.5 rounded-xl border p-2.5 text-left transition-all cursor-pointer",j?"border-primary/60 bg-primary/10":"border-border/40 bg-background/20 hover:border-primary/30 hover:bg-background/40"),children:[e.jsx("span",{className:w("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border text-[10px] font-bold",O.color),children:O.initial}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-mono text-xs font-semibold text-foreground",children:X(l.name)}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[l.role&&e.jsx("span",{className:w("h-2 w-2 rounded-sm",Z.dot)}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:l.role?F(l.role).short:"keine Rolle"}),e.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:["· ",ee(l.size_bytes)]})]})]}),u?e.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[9px] font-bold uppercase text-emerald-400",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]}):l.incomplete?e.jsx("span",{className:"shrink-0 text-[9px] font-bold uppercase text-amber-400",children:"⚠ fehlt"}):e.jsx("span",{className:"shrink-0 text-[9px] font-semibold uppercase text-muted-foreground/50",children:"bereit"})]},l.name)})})]}),e.jsx("div",{className:"mc-card p-5",children:G?e.jsx(zt,{m:G,warm:f.includes(G.name),expert:z,protectedRole:b(G.role),coresident:B(G.name),onLoad:()=>_(G.name),onUnload:()=>Q(G.name),onRole:l=>ce(l,G.name),onCtx:()=>xe(G.name,G.ctx),onSpec:()=>R(G),onDelete:()=>me(G.name)}):e.jsxs("div",{className:"flex h-full min-h-[16rem] flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[e.jsx(Ze,{className:"h-8 w-8 opacity-40"}),e.jsx("p",{className:"text-sm font-semibold",children:"Links ein Modell wählen"}),e.jsx("p",{className:"text-xs",children:"Dann verwaltest du es hier — laden, Rolle, Kontext, löschen."})]})})]}),k&&e.jsx(Mt,{model:k,onClose:()=>R(null),onChanged:E}),g]})}function zt({m:t,warm:r,expert:h,protectedRole:a,coresident:m,onLoad:S,onUnload:v,onRole:d,onCtx:M,onSpec:g,onDelete:z}){const x=Ke(t.name),f=r&&a;return e.jsxs("div",{className:"flex h-full flex-col gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:w("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border text-sm font-bold",x.color),children:x.initial}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"break-all font-mono text-sm font-bold text-foreground",children:X(t.name)}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[t.role?e.jsx(be,{role:t.role}):e.jsx("span",{className:"rounded border border-dashed border-border/50 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"keine Rolle"}),a&&e.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 text-[10px] text-muted-foreground",title:"Lebenswichtig — geschützt",children:[e.jsx(st,{className:"mr-0.5 inline h-3 w-3"}),"geschützt"]}),m&&e.jsxs("span",{className:"rounded border border-fuchsia-500/30 bg-fuchsia-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase text-fuchsia-300",children:[e.jsx(le,{className:"mr-0.5 inline h-3 w-3"}),"Ko-resident"]}),r&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold uppercase text-emerald-400",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]})]})]})]}),e.jsxs("button",{onClick:r?v:S,disabled:t.incomplete&&!r||f,className:w("flex h-11 w-full items-center justify-center gap-2 rounded-xl border text-sm font-bold transition-all cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",r?"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20":"border-primary/40 bg-primary/10 text-primary hover:bg-primary/20"),title:f?`„${F(t.role).label}" bleibt geladen (geschützt).`:void 0,children:[r?e.jsx(pt,{className:"h-4 w-4"}):e.jsx(Je,{className:"h-4 w-4"}),f?"🔒 bleibt geladen":r?"Entladen":"Ins Warm-Set laden"]}),e.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[e.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Rolle"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(ze,{active:!t.role,onClick:()=>d(""),dot:"bg-slate-400",label:"keine"}),je.map(b=>e.jsx(ze,{active:t.role===b.role,onClick:()=>d(b.role),dot:ae(b.role).dot,label:b.short},b.role))]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(At,{icon:fe,label:"Größe",value:ee(t.size_bytes)}),e.jsxs("button",{onClick:M,className:"group flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5 text-left transition-colors hover:border-primary/40 cursor-pointer",children:[e.jsx(ut,{className:"h-4 w-4 text-primary/80"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:"Kontext · ändern"}),e.jsx("div",{className:"font-semibold text-foreground",children:Xe(t.ctx)})]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Beschleuniger"}),h&&e.jsxs("button",{onClick:g,className:w("flex h-6 items-center gap-1 rounded-lg border px-2 text-[9px] font-bold uppercase transition-colors cursor-pointer",t.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":t.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),children:[e.jsx(ie,{className:"h-3 w-3"})," Spec"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.spec_active&&e.jsx(se,{tone:"emerald",label:"Spec-Decoding aktiv"}),!t.spec_active&&t.spec_draft_model&&e.jsx(se,{tone:"amber",label:"Spec inaktiv"}),t.prompt_cache&&e.jsx(se,{tone:"cyan",label:"Prompt-Cache"}),t.parallel_slots>1&&e.jsx(se,{tone:"violet",label:`${t.parallel_slots} Slots`}),!t.spec_active&&!t.spec_draft_model&&!t.prompt_cache&&t.parallel_slots<=1&&e.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"keine aktiv"})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(St,{caps:t.capabilities})}),e.jsxs("button",{onClick:z,disabled:a,className:w("mt-auto flex h-9 items-center justify-center gap-1.5 rounded-lg border text-xs font-semibold transition-colors",a?"cursor-not-allowed border-border/30 text-muted-foreground/40":"border-red-500/30 text-red-400 hover:bg-red-500/10 cursor-pointer"),children:[e.jsx(Ye,{className:"h-3.5 w-3.5"})," ",a?"geschützt — nicht löschbar":"Modell löschen"]})]})}function ze({active:t,onClick:r,dot:h,label:a}){return e.jsxs("button",{onClick:r,className:w("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[10px] font-semibold transition-all cursor-pointer",t?"border-primary/60 bg-primary/15 text-foreground":"border-border/40 bg-background/20 text-muted-foreground hover:border-primary/30"),children:[e.jsx("span",{className:w("h-2 w-2 rounded-sm",h)}),a,t&&e.jsx(Y,{className:"h-3 w-3 text-primary"})]})}function At({icon:t,label:r,value:h}){return e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5",children:[e.jsx(t,{className:"h-4 w-4 text-primary/80"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:r}),e.jsx("div",{className:"font-semibold text-foreground",children:h})]})]})}function se({tone:t,label:r}){const h={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20",cyan:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",violet:"bg-violet-500/10 text-violet-400 border-violet-500/20"}[t];return e.jsx("span",{className:w("rounded border px-1.5 py-0.5 text-[10px] font-semibold",h),children:r})}const Bt=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],$t=["fast","heavy","coder","vision","hermes","scout"],Gt=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function Ae(t){return Gt.format(t)}function Dt(){const{data:t}=de(),r=(t==null?void 0:t.models)??[],[h,a]=N.useState(""),[m,S]=N.useState([]),[v,d]=N.useState(!1),[M,g]=N.useState(""),[z,x]=N.useState("popular"),[f,b]=N.useState(""),[i,L]=N.useState(null),[B,s]=N.useState([]),[o,c]=N.useState("Q4_K_M"),[$,A]=N.useState(""),[C,k]=N.useState(null),[R,E]=N.useState(!1),[I,T]=N.useState({});async function W(n){d(!0),g("");try{const y=await K(`/api/hf/search?q=${encodeURIComponent(n)}`);S(y.results),y.results.length||g("Keine Ergebnisse.")}catch(y){g(`Suche fehlgeschlagen: ${y}`)}finally{d(!1)}}N.useEffect(()=>{W("")},[]);function te(n){x(n.key),a(""),W(n.q)}function H(){x(""),W(h)}async function G(n,y,D){E(!1);try{const U=await K(`/api/fit?params_b=0&quant=${encodeURIComponent(y)}&ctx=8192&name=${encodeURIComponent(n)}&role=${encodeURIComponent(D)}`);k(U)}catch{k(null)}}async function p(n){if(i===n){L(null);return}L(n),s([]),k(null),A(""),E(!1),g("Analysiere Repository…");try{const y=await K(`/api/hf/quants?repo=${encodeURIComponent(n)}`);s(y.quants);const D=y.quants.includes("Q4_K_M")?"Q4_K_M":y.quants[0]||"Q4_K_M";c(D),g(y.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),y.quants.length&&G(y.repo,D,"")}catch(y){g(`Fehler: ${y}`)}}function _(){const n=f.trim();n&&(S(y=>y.some(D=>D.repo===n)?y:[{repo:n,downloads:0,likes:0},...y]),b(""),p(n))}const Q=$?r.find(n=>(n.role||"").toLowerCase()===$):void 0;async function ce(n){if((C==null?void 0:C.fit.level)==="too_tight"&&!R){E(!0);return}T(y=>({...y,[n]:"Starte…"}));try{await K("/api/models/install",{method:"POST",body:JSON.stringify({repo:n,quant:o,role:$||void 0,jinja:!0})}),T(y=>({...y,[n]:"Download läuft"})),E(!1)}catch{T(D=>({...D,[n]:"Fehler"}))}}const xe=n=>{var D;const y=((D=n.split("/").pop())==null?void 0:D.toLowerCase().replace(/-gguf$/i,""))||"";return y.length>3&&r.some(U=>U.name.toLowerCase().includes(y))},me=n=>n==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":n==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ye,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx("input",{value:h,onChange:n=>a(n.target.value),onKeyDown:n=>n.key==="Enter"&&H(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),e.jsx("button",{onClick:H,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Bt.map(n=>e.jsxs("button",{onClick:()=>te(n),className:w("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",z===n.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[n.key==="popular"&&e.jsx(it,{className:"h-3 w-3"}),n.label]},n.key))}),v?e.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):e.jsxs("div",{className:"space-y-2",children:[m.map(n=>{const y=i===n.repo,D=xe(n.repo),U=n.repo.includes("/")?n.repo.split("/")[0]:"—",l=n.repo.split("/").pop();return e.jsxs("div",{className:w("mc-card-sm",y?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[e.jsxs("button",{onClick:()=>p(n.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:n.repo,children:l}),D&&e.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[e.jsx(Y,{className:"h-2.5 w-2.5"})," installiert"]})]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[e.jsx("span",{children:U}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"})," ",Ae(n.downloads)]}),n.likes>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ct,{className:"h-3 w-3"})," ",Ae(n.likes)]})]})]}),y?e.jsx(qe,{className:"h-4 w-4 text-muted-foreground shrink-0"}):e.jsx(De,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),y&&e.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:B.length===0?e.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:M||"Lade Quants…"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),e.jsx("select",{value:o,onChange:u=>{c(u.target.value),G(n.repo,u.target.value,$)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:B.map(u=>e.jsx("option",{value:u,className:"bg-popover text-foreground",children:u},u))}),e.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),e.jsxs("select",{value:$,onChange:u=>{A(u.target.value),G(n.repo,o,u.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[e.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),$t.map(u=>e.jsx("option",{value:u,className:"bg-popover text-foreground",children:u},u))]}),e.jsx("button",{onClick:()=>ce(n.repo),disabled:!!I[n.repo]&&I[n.repo]==="Download läuft",className:w("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",R?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:I[n.repo]?I[n.repo]:R?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),C&&e.jsxs("div",{className:w("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",me(C.fit.level)),children:[e.jsx("span",{className:"font-bold uppercase tracking-wide",children:C.fit.text}),e.jsxs("span",{className:"font-mono opacity-90",children:["~",C.params_b,"B · ~",C.fit.req_gb," GB / ",C.sys_ram_gb," GB · ~",C.fit.tps," t/s"]}),C.fit.level!=="too_tight"?e.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(C.assigned_ctx/1024).toFixed(0),"k"]}):e.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),Q&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-400",children:[e.jsx(re,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),e.jsxs("span",{children:["Rolle ",e.jsxs("strong",{children:["„",$,'"']})," hält aktuell ",e.jsx("strong",{children:Q.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},n.repo)}),!m.length&&!v&&e.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:M||"Keine Ergebnisse."})]}),e.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),e.jsx("input",{value:f,onChange:n=>b(n.target.value),onKeyDown:n=>n.key==="Enter"&&_(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground font-mono"}),e.jsx("button",{onClick:_,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Laden"})]})]})}const qt={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:ie},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:le},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:he},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Be},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:ot},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:nt},kritiker:{title:"Kritisches Prüf-Hirn",desc:"Schärfer Blick für Fehler, Schwachstellen und Sicherheitslücken — denkt skeptisch, bevor du deployst.",icon:Ee},reranker:{title:"Gedächtnis-Sortierer",desc:"Sortiert und gewichtet gespeicherte Fakten nach Relevanz — damit die richtige Info sofort da ist.",icon:ye}};function Et(){const{data:t,isLoading:r,error:h}=et(),{data:a}=de(),{data:m}=tt(),S=(a==null?void 0:a.models)??[],v=h?String(h):"",[d,M]=N.useState({}),[g,z]=N.useState({}),[x,f]=N.useState("recommended");async function b(i,L,B,s){M(o=>({...o,[i]:"Starte..."}));try{await K("/api/models/install",{method:"POST",body:JSON.stringify({repo:i,role:L,quant:B,jinja:s})}),M(o=>({...o,[i]:"Download läuft"}))}catch{M(c=>({...c,[i]:"Fehler"}))}}return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex mc-card-sm p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([i,L])=>e.jsx("button",{onClick:()=>f(i),className:w("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",x===i?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:L},i))}),x==="browse"?e.jsx(Dt,{}):r?e.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):v||!t?e.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",v,")."]}):e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[e.jsxs("div",{children:["Modell-Registry geladen für ",e.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(bt,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),e.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(i=>{const L=qt[i.role]||{title:i.title||i.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:at},B=L.icon,s=S.find(k=>k.role===i.role||(k.aliases||[]).includes(i.role)),o=m==null?void 0:m.model_list.find(k=>k.role===i.role),c=i.models.find(k=>k.repo===i.recommended)||i.models[0];if(!c)return null;const $=d[c.repo],A=i.models.filter(k=>k.repo!==i.recommended),C=!!g[i.role];return e.jsxs("div",{className:w("mc-card p-5 flex flex-col justify-between gap-5",s?"border-border/60":"border-primary/20 shadow-primary/5"),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:e.jsx(B,{className:"h-5.5 w-5.5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:L.title}),e.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",i.role]})]})]}),s?e.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):e.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:L.desc}),e.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:s?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),e.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:s.name,children:s.name.split("/").pop()}),e.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[e.jsxs("span",{children:["Größe: ",ue(s.size_bytes||0)]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Quant: ",s.quant||"GGUF"]})]})]}):e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),e.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:c.name,children:c.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{children:["Ersteller: ",c.author]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Quant: ",c.quant]})]}),e.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:e.jsx(kt,{fit:c.fit})})]})}),e.jsx("div",{className:"pt-1",children:s?o?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),e.jsxs("span",{children:["Bessere Version in der Registry: ",o.repo.split("/").pop()]})]}),e.jsxs("button",{onClick:()=>b(o.repo,i.role,c.quant||"Q4_K_M",c.caps.tools!=="no"),disabled:!!d[o.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[e.jsx(ne,{className:"h-3.5 w-3.5"}),d[o.repo]||"Auf neue Version aktualisieren"]})]}):e.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[e.jsx(Y,{className:"h-4 w-4"})," Auf neuestem Stand"]}):e.jsxs("button",{onClick:()=>b(c.repo,i.role,c.quant||"Q4_K_M",c.caps.tools!=="no"),disabled:!!$,className:w("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",$?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[e.jsx(ne,{className:"h-3.5 w-3.5"}),$||"Optimales Modell einsetzen"]})})]}),A.length>0&&e.jsxs("div",{className:"border-t border-border/20 pt-3",children:[e.jsxs("button",{onClick:()=>z(k=>({...k,[i.role]:!C})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[C?e.jsx(qe,{className:"h-3 w-3"}):e.jsx(De,{className:"h-3 w-3"}),e.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",A.length,")"]})]}),C&&e.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:A.map(k=>e.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:k.name,children:k.name}),e.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[e.jsxs("span",{children:["Quant: ",k.quant]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:k.fit.text})]})]}),e.jsx("button",{onClick:()=>b(k.repo,i.role,k.quant||"Q4_K_M",k.caps.tools!=="no"),disabled:!!d[k.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:d[k.repo]||"Installieren"})]},k.repo))})]})]},i.role)})})]})]})}const Kt=[{id:"werkbank",label:"Werkbank"},{id:"routing",label:"Routing & Warm-Set"},{id:"discover",label:"Modelle finden"}];function Ot(){const[t,r]=N.useState("werkbank");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Modelle verwalten, das Lane-Routing einstellen und Neues von HuggingFace holen."})]}),e.jsx("div",{className:"flex mc-card-sm p-1 self-start",children:Kt.map(h=>e.jsx("button",{onClick:()=>r(h.id),className:w("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===h.id?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:h.label},h.id))})]}),e.jsx(ft,{}),e.jsxs("div",{className:"transition-all duration-300",children:[t==="werkbank"&&e.jsx(Lt,{}),t==="routing"&&e.jsxs("div",{className:"space-y-5",children:[e.jsx(vt,{}),e.jsx(wt,{})]}),t==="discover"&&e.jsx(Et,{})]})]})}export{Ot as ModelsView}; +Trotzdem exklusiv laden?`,()=>p(l));return}p(l)}async function Q(l){const u=x.find(j=>j.name===l);if(u&&b(u.role)){v("Geschützt",`„${F(u.role).label}" ist lebenswichtig und bleibt geladen.`);return}try{await K(`/api/models/${encodeURIComponent(l)}/unload`,{method:"POST"}),E()}catch(j){v("Fehler",`Entladen fehlgeschlagen: ${j.message||j}`)}}async function ce(l,u){try{const j=await K(`/api/models/${encodeURIComponent(u)}/role`,{method:"POST",body:JSON.stringify({role:l||null})});E(),j!=null&&j.warning&&v("Rolle gesetzt — Hinweis",j.warning)}catch(j){v("Fehler",`Rolle zuweisen fehlgeschlagen: ${j.message||j}`)}}async function xe(l,u){let j=null;try{j=await K(`/api/models/${encodeURIComponent(l)}/ctx/auto`)}catch{}const O=j?`Optimal für dein Setup: ${(j.ctx/1024).toFixed(0)}k (${j.ctx}). »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";S("Kontextlänge anpassen",O,String(u||32768),async Z=>{if(Z)try{await K(`/api/models/${encodeURIComponent(l)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Z,10)})}),E()}catch(ve){v("Fehler",`Kontext setzen fehlgeschlagen: ${ve.message||ve}`)}},void 0,j?{autoValue:String(j.ctx),autoLabel:`Auto (${(j.ctx/1024).toFixed(0)}k)`}:void 0)}async function me(l){const u=x.find(j=>j.name===l);if(u&&b(u.role)){v("Geschützt",`„${F(u.role).label}" kann nicht gelöscht werden. Weise die Rolle zuerst einem anderen Modell zu.`);return}d("Modell löschen?",`„${X(l)}" und alle GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await K(`/api/models/${encodeURIComponent(l)}`,{method:"DELETE"}),s===l&&o(null),E()}catch(j){v("Fehler",`Löschen fehlgeschlagen: ${j.message||j}`)}})}return h?e.jsx("div",{className:"py-16 text-center text-xs text-muted-foreground",children:"Werkbank wird geladen …"}):a?e.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",String(a),")."]}):e.jsxs("div",{className:"space-y-5",children:[e.jsx(_t,{running:I,capacityBytes:te,realUsedBytes:W,selected:s,onSelect:o}),e.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)]",children:[e.jsxs("div",{className:"mc-card p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ye,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),e.jsx("input",{value:i,onChange:l=>$(l.target.value),placeholder:"Modell suchen …",className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 pl-8 pr-2 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"})]}),e.jsx("div",{className:"flex rounded-lg border border-border/40 bg-background/30 p-0.5",children:["all","in_use"].map(l=>e.jsx("button",{onClick:()=>C(l),className:w("rounded-md px-2 py-1 text-[9px] font-bold uppercase transition-all cursor-pointer",A===l?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:l==="all"?"Alle":"In Benutzung"},l))})]}),e.jsx("div",{className:"max-h-[60vh] space-y-1.5 overflow-y-auto scrollbar-thin pr-1",children:H.length===0?e.jsx("div",{className:"rounded-xl border border-dashed border-border/50 p-8 text-center text-xs text-muted-foreground",children:"Keine Modelle."}):H.map(l=>{const u=f.includes(l.name),j=s===l.name,O=Ke(l.name),Z=ae(l.role);return e.jsxs("button",{onClick:()=>o(l.name),className:w("flex w-full items-center gap-2.5 rounded-xl border p-2.5 text-left transition-all cursor-pointer",j?"border-primary/60 bg-primary/10":"border-border/40 bg-background/20 hover:border-primary/30 hover:bg-background/40"),children:[e.jsx("span",{className:w("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border text-[10px] font-bold",O.color),children:O.initial}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-mono text-xs font-semibold text-foreground",children:X(l.name)}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[l.role&&e.jsx("span",{className:w("h-2 w-2 rounded-sm",Z.dot)}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:l.role?F(l.role).short:"keine Rolle"}),e.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:["· ",ee(l.size_bytes)]})]})]}),u?e.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[9px] font-bold uppercase text-emerald-400",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]}):l.incomplete?e.jsx("span",{className:"shrink-0 text-[9px] font-bold uppercase text-amber-400",children:"⚠ fehlt"}):e.jsx("span",{className:"shrink-0 text-[9px] font-semibold uppercase text-muted-foreground/50",children:"bereit"})]},l.name)})})]}),e.jsx("div",{className:"mc-card p-5",children:G?e.jsx(zt,{m:G,warm:f.includes(G.name),expert:z,protectedRole:b(G.role),coresident:B(G.name),onLoad:()=>_(G.name),onUnload:()=>Q(G.name),onRole:l=>ce(l,G.name),onCtx:()=>xe(G.name,G.ctx),onSpec:()=>R(G),onDelete:()=>me(G.name)}):e.jsxs("div",{className:"flex h-full min-h-[16rem] flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[e.jsx(Ze,{className:"h-8 w-8 opacity-40"}),e.jsx("p",{className:"text-sm font-semibold",children:"Links ein Modell wählen"}),e.jsx("p",{className:"text-xs",children:"Dann verwaltest du es hier — laden, Rolle, Kontext, löschen."})]})})]}),k&&e.jsx(St,{model:k,onClose:()=>R(null),onChanged:E}),g]})}function zt({m:t,warm:r,expert:h,protectedRole:a,coresident:m,onLoad:M,onUnload:v,onRole:d,onCtx:S,onSpec:g,onDelete:z}){const x=Ke(t.name),f=r&&a;return e.jsxs("div",{className:"flex h-full flex-col gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:w("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border text-sm font-bold",x.color),children:x.initial}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"break-all font-mono text-sm font-bold text-foreground",children:X(t.name)}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[t.role?e.jsx(be,{role:t.role}):e.jsx("span",{className:"rounded border border-dashed border-border/50 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"keine Rolle"}),a&&e.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 text-[10px] text-muted-foreground",title:"Lebenswichtig — geschützt",children:[e.jsx(st,{className:"mr-0.5 inline h-3 w-3"}),"geschützt"]}),m&&e.jsxs("span",{className:"rounded border border-fuchsia-500/30 bg-fuchsia-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase text-fuchsia-300",children:[e.jsx(le,{className:"mr-0.5 inline h-3 w-3"}),"Ko-resident"]}),r&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold uppercase text-emerald-400",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]})]})]})]}),e.jsxs("button",{onClick:r?v:M,disabled:t.incomplete&&!r||f,className:w("flex h-11 w-full items-center justify-center gap-2 rounded-xl border text-sm font-bold transition-all cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",r?"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20":"border-primary/40 bg-primary/10 text-primary hover:bg-primary/20"),title:f?`„${F(t.role).label}" bleibt geladen (geschützt).`:void 0,children:[r?e.jsx(pt,{className:"h-4 w-4"}):e.jsx(Je,{className:"h-4 w-4"}),f?"🔒 bleibt geladen":r?"Entladen":"Ins Warm-Set laden"]}),e.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[e.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Rolle"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(ze,{active:!t.role,onClick:()=>d(""),dot:"bg-slate-400",label:"keine"}),je.map(b=>e.jsx(ze,{active:t.role===b.role,onClick:()=>d(b.role),dot:ae(b.role).dot,label:b.short},b.role))]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(At,{icon:fe,label:"Größe",value:ee(t.size_bytes)}),e.jsxs("button",{onClick:S,className:"group flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5 text-left transition-colors hover:border-primary/40 cursor-pointer",children:[e.jsx(ut,{className:"h-4 w-4 text-primary/80"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:"Kontext · ändern"}),e.jsx("div",{className:"font-semibold text-foreground",children:Xe(t.ctx)})]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Beschleuniger"}),h&&e.jsxs("button",{onClick:g,className:w("flex h-6 items-center gap-1 rounded-lg border px-2 text-[9px] font-bold uppercase transition-colors cursor-pointer",t.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":t.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),children:[e.jsx(ie,{className:"h-3 w-3"})," Spec"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.spec_active&&e.jsx(se,{tone:"emerald",label:"Spec-Decoding aktiv"}),!t.spec_active&&t.spec_draft_model&&e.jsx(se,{tone:"amber",label:"Spec inaktiv"}),t.prompt_cache&&e.jsx(se,{tone:"cyan",label:"Prompt-Cache"}),t.parallel_slots>1&&e.jsx(se,{tone:"violet",label:`${t.parallel_slots} Slots`}),!t.spec_active&&!t.spec_draft_model&&!t.prompt_cache&&t.parallel_slots<=1&&e.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"keine aktiv"})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(Mt,{caps:t.capabilities})}),e.jsxs("button",{onClick:z,disabled:a,className:w("mt-auto flex h-9 items-center justify-center gap-1.5 rounded-lg border text-xs font-semibold transition-colors",a?"cursor-not-allowed border-border/30 text-muted-foreground/40":"border-red-500/30 text-red-400 hover:bg-red-500/10 cursor-pointer"),children:[e.jsx(Ye,{className:"h-3.5 w-3.5"})," ",a?"geschützt — nicht löschbar":"Modell löschen"]})]})}function ze({active:t,onClick:r,dot:h,label:a}){return e.jsxs("button",{onClick:r,className:w("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[10px] font-semibold transition-all cursor-pointer",t?"border-primary/60 bg-primary/15 text-foreground":"border-border/40 bg-background/20 text-muted-foreground hover:border-primary/30"),children:[e.jsx("span",{className:w("h-2 w-2 rounded-sm",h)}),a,t&&e.jsx(Y,{className:"h-3 w-3 text-primary"})]})}function At({icon:t,label:r,value:h}){return e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5",children:[e.jsx(t,{className:"h-4 w-4 text-primary/80"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:r}),e.jsx("div",{className:"font-semibold text-foreground",children:h})]})]})}function se({tone:t,label:r}){const h={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20",cyan:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",violet:"bg-violet-500/10 text-violet-400 border-violet-500/20"}[t];return e.jsx("span",{className:w("rounded border px-1.5 py-0.5 text-[10px] font-semibold",h),children:r})}const Bt=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],$t=["fast","heavy","coder","vision","hermes","scout"],Gt=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function Ae(t){return Gt.format(t)}function Dt(){const{data:t}=de(),r=(t==null?void 0:t.models)??[],[h,a]=N.useState(""),[m,M]=N.useState([]),[v,d]=N.useState(!1),[S,g]=N.useState(""),[z,x]=N.useState("popular"),[f,b]=N.useState(""),[c,L]=N.useState(null),[B,s]=N.useState([]),[o,i]=N.useState("Q4_K_M"),[$,A]=N.useState(""),[C,k]=N.useState(null),[R,E]=N.useState(!1),[I,T]=N.useState({});async function W(n){d(!0),g("");try{const y=await K(`/api/hf/search?q=${encodeURIComponent(n)}`);M(y.results),y.results.length||g("Keine Ergebnisse.")}catch(y){g(`Suche fehlgeschlagen: ${y}`)}finally{d(!1)}}N.useEffect(()=>{W("")},[]);function te(n){x(n.key),a(""),W(n.q)}function H(){x(""),W(h)}async function G(n,y,D){E(!1);try{const U=await K(`/api/fit?params_b=0&quant=${encodeURIComponent(y)}&ctx=8192&name=${encodeURIComponent(n)}&role=${encodeURIComponent(D)}`);k(U)}catch{k(null)}}async function p(n){if(c===n){L(null);return}L(n),s([]),k(null),A(""),E(!1),g("Analysiere Repository…");try{const y=await K(`/api/hf/quants?repo=${encodeURIComponent(n)}`);s(y.quants);const D=y.quants.includes("Q4_K_M")?"Q4_K_M":y.quants[0]||"Q4_K_M";i(D),g(y.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),y.quants.length&&G(y.repo,D,"")}catch(y){g(`Fehler: ${y}`)}}function _(){const n=f.trim();n&&(M(y=>y.some(D=>D.repo===n)?y:[{repo:n,downloads:0,likes:0},...y]),b(""),p(n))}const Q=$?r.find(n=>(n.role||"").toLowerCase()===$):void 0;async function ce(n){if((C==null?void 0:C.fit.level)==="too_tight"&&!R){E(!0);return}T(y=>({...y,[n]:"Starte…"}));try{await K("/api/models/install",{method:"POST",body:JSON.stringify({repo:n,quant:o,role:$||void 0,jinja:!0})}),T(y=>({...y,[n]:"Download läuft"})),E(!1)}catch{T(D=>({...D,[n]:"Fehler"}))}}const xe=n=>{var D;const y=((D=n.split("/").pop())==null?void 0:D.toLowerCase().replace(/-gguf$/i,""))||"";return y.length>3&&r.some(U=>U.name.toLowerCase().includes(y))},me=n=>n==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":n==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ye,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx("input",{value:h,onChange:n=>a(n.target.value),onKeyDown:n=>n.key==="Enter"&&H(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),e.jsx("button",{onClick:H,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Bt.map(n=>e.jsxs("button",{onClick:()=>te(n),className:w("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",z===n.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[n.key==="popular"&&e.jsx(it,{className:"h-3 w-3"}),n.label]},n.key))}),v?e.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):e.jsxs("div",{className:"space-y-2",children:[m.map(n=>{const y=c===n.repo,D=xe(n.repo),U=n.repo.includes("/")?n.repo.split("/")[0]:"—",l=n.repo.split("/").pop();return e.jsxs("div",{className:w("mc-card-sm",y?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[e.jsxs("button",{onClick:()=>p(n.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:n.repo,children:l}),D&&e.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[e.jsx(Y,{className:"h-2.5 w-2.5"})," installiert"]})]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[e.jsx("span",{children:U}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"})," ",Ae(n.downloads)]}),n.likes>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ct,{className:"h-3 w-3"})," ",Ae(n.likes)]})]})]}),y?e.jsx(qe,{className:"h-4 w-4 text-muted-foreground shrink-0"}):e.jsx(De,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),y&&e.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:B.length===0?e.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:S||"Lade Quants…"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),e.jsx("select",{value:o,onChange:u=>{i(u.target.value),G(n.repo,u.target.value,$)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:B.map(u=>e.jsx("option",{value:u,className:"bg-popover text-foreground",children:u},u))}),e.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),e.jsxs("select",{value:$,onChange:u=>{A(u.target.value),G(n.repo,o,u.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[e.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),$t.map(u=>e.jsx("option",{value:u,className:"bg-popover text-foreground",children:u},u))]}),e.jsx("button",{onClick:()=>ce(n.repo),disabled:!!I[n.repo]&&I[n.repo]==="Download läuft",className:w("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",R?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:I[n.repo]?I[n.repo]:R?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),C&&e.jsxs("div",{className:w("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",me(C.fit.level)),children:[e.jsx("span",{className:"font-bold uppercase tracking-wide",children:C.fit.text}),e.jsxs("span",{className:"font-mono opacity-90",children:["~",C.params_b,"B · ~",C.fit.req_gb," GB / ",C.sys_ram_gb," GB · ~",C.fit.tps," t/s"]}),C.fit.level!=="too_tight"?e.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(C.assigned_ctx/1024).toFixed(0),"k"]}):e.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),Q&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-400",children:[e.jsx(re,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),e.jsxs("span",{children:["Rolle ",e.jsxs("strong",{children:["„",$,'"']})," hält aktuell ",e.jsx("strong",{children:Q.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},n.repo)}),!m.length&&!v&&e.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:S||"Keine Ergebnisse."})]}),e.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),e.jsx("input",{value:f,onChange:n=>b(n.target.value),onKeyDown:n=>n.key==="Enter"&&_(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground font-mono"}),e.jsx("button",{onClick:_,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Laden"})]})]})}const qt={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:ie},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:le},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:he},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Be},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:ot},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:nt},kritiker:{title:"Kritisches Prüf-Hirn",desc:"Schärfer Blick für Fehler, Schwachstellen und Sicherheitslücken — denkt skeptisch, bevor du deployst.",icon:Ee},reranker:{title:"Gedächtnis-Sortierer",desc:"Sortiert und gewichtet gespeicherte Fakten nach Relevanz — damit die richtige Info sofort da ist.",icon:ye}};function Et(){const{data:t,isLoading:r,error:h}=et(),{data:a}=de(),{data:m}=tt(),M=(a==null?void 0:a.models)??[],v=h?String(h):"",[d,S]=N.useState({}),[g,z]=N.useState({}),[x,f]=N.useState("recommended");async function b(c,L,B,s){S(o=>({...o,[c]:"Starte..."}));try{await K("/api/models/install",{method:"POST",body:JSON.stringify({repo:c,role:L,quant:B,jinja:s})}),S(o=>({...o,[c]:"Download läuft"}))}catch{S(i=>({...i,[c]:"Fehler"}))}}return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex mc-card-sm p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([c,L])=>e.jsx("button",{onClick:()=>f(c),className:w("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",x===c?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:L},c))}),x==="browse"?e.jsx(Dt,{}):r?e.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):v||!t?e.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",v,")."]}):e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[e.jsxs("div",{children:["Modell-Registry geladen für ",e.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(bt,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),e.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(c=>{const L=qt[c.role]||{title:c.title||c.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:at},B=L.icon,s=M.find(k=>k.role===c.role||(k.aliases||[]).includes(c.role)),o=m==null?void 0:m.model_list.find(k=>k.role===c.role),i=c.models.find(k=>k.repo===c.recommended)||c.models[0];if(!i)return null;const $=d[i.repo],A=c.models.filter(k=>k.repo!==c.recommended),C=!!g[c.role];return e.jsxs("div",{className:w("mc-card p-5 flex flex-col justify-between gap-5",s?"border-border/60":"border-primary/20 shadow-primary/5"),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:e.jsx(B,{className:"h-5.5 w-5.5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:L.title}),e.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",c.role]})]})]}),s?e.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):e.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:L.desc}),e.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:s?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),e.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:s.name,children:s.name.split("/").pop()}),e.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[e.jsxs("span",{children:["Größe: ",ue(s.size_bytes||0)]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Quant: ",s.quant||"GGUF"]})]})]}):e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),e.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:i.name,children:i.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{children:["Ersteller: ",i.author]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Quant: ",i.quant]})]}),e.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:e.jsx(kt,{fit:i.fit})})]})}),e.jsx("div",{className:"pt-1",children:s?o?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),e.jsxs("span",{children:["Bessere Version in der Registry: ",o.repo.split("/").pop()]})]}),e.jsxs("button",{onClick:()=>b(o.repo,c.role,o.repo===i.repo&&i.quant||"Q4_K_M",i.caps.tools!=="no"),disabled:!!d[o.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[e.jsx(ne,{className:"h-3.5 w-3.5"}),d[o.repo]||"Auf neue Version aktualisieren"]})]}):e.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[e.jsx(Y,{className:"h-4 w-4"})," Auf neuestem Stand"]}):e.jsxs("button",{onClick:()=>b(i.repo,c.role,i.quant||"Q4_K_M",i.caps.tools!=="no"),disabled:!!$,className:w("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",$?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[e.jsx(ne,{className:"h-3.5 w-3.5"}),$||"Optimales Modell einsetzen"]})})]}),A.length>0&&e.jsxs("div",{className:"border-t border-border/20 pt-3",children:[e.jsxs("button",{onClick:()=>z(k=>({...k,[c.role]:!C})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[C?e.jsx(qe,{className:"h-3 w-3"}):e.jsx(De,{className:"h-3 w-3"}),e.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",A.length,")"]})]}),C&&e.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:A.map(k=>e.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:k.name,children:k.name}),e.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[e.jsxs("span",{children:["Quant: ",k.quant]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:k.fit.text})]})]}),e.jsx("button",{onClick:()=>b(k.repo,c.role,k.quant||"Q4_K_M",k.caps.tools!=="no"),disabled:!!d[k.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:d[k.repo]||"Installieren"})]},k.repo))})]})]},c.role)})})]})]})}const Kt=[{id:"werkbank",label:"Werkbank"},{id:"routing",label:"Routing & Warm-Set"},{id:"discover",label:"Modelle finden"}];function Ot(){const[t,r]=N.useState("werkbank");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Modelle verwalten, das Lane-Routing einstellen und Neues von HuggingFace holen."})]}),e.jsx("div",{className:"flex mc-card-sm p-1 self-start",children:Kt.map(h=>e.jsx("button",{onClick:()=>r(h.id),className:w("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===h.id?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:h.label},h.id))})]}),e.jsx(ft,{}),e.jsxs("div",{className:"transition-all duration-300",children:[t==="werkbank"&&e.jsx(Lt,{}),t==="routing"&&e.jsxs("div",{className:"space-y-5",children:[e.jsx(vt,{}),e.jsx(wt,{})]}),t==="discover"&&e.jsx(Et,{})]})]})}export{Ot as ModelsView}; diff --git a/frontend/dist/assets/WissenView-B4HDo3yS.js b/frontend/dist/assets/WissenView-BXuHzW6u.js similarity index 97% rename from frontend/dist/assets/WissenView-B4HDo3yS.js rename to frontend/dist/assets/WissenView-BXuHzW6u.js index 0080f11..ffc664f 100644 --- a/frontend/dist/assets/WissenView-B4HDo3yS.js +++ b/frontend/dist/assets/WissenView-BXuHzW6u.js @@ -1,4 +1,4 @@ -import{an as y,r as x,g as L,j as e,L as v,S,ao as W,U as C,e as w,ap as E}from"./index-D94Dzyvg.js";import{F as M}from"./folder-open-DzbxkBSk.js";const D={"":"Allgemein",traeume:"Träume",muster:"Muster","skill-kandidaten":"Skill-Kandidaten","skill-kandidaten/beauftragt":"Skill-Kandidaten · beauftragt","skill-kandidaten/verworfen":"Skill-Kandidaten · verworfen"};function T(){const{data:o,isLoading:h}=y(),[l,f]=x.useState(null),[d,r]=x.useState(null),[u,i]=x.useState(!1),[a,p]=x.useState(""),t=x.useMemo(()=>(o==null?void 0:o.files)??[],[o]),m=x.useMemo(()=>{const s=new Map;for(const n of t)s.set(n.name.toLowerCase(),n.path);return s},[t]),g=x.useMemo(()=>{if(!a.trim())return t;const s=a.toLowerCase();return t.filter(n=>n.title.toLowerCase().includes(s)||n.path.toLowerCase().includes(s))},[t,a]),b=x.useMemo(()=>{const s=[];for(const n of g){const c=s.find(k=>k.dir===n.dir);c?c.files.push(n):s.push({dir:n.dir,files:[n]})}return s.sort((n,c)=>n.dir===""?-1:c.dir===""?1:n.dir.localeCompare(c.dir))},[g]);x.useEffect(()=>{if(!l&&t.length){const s=t.find(n=>n.path.toLowerCase()==="index.md");f((s==null?void 0:s.path)??t[0].path)}},[t,l]),x.useEffect(()=>{l&&(i(!0),L(`/api/wissen/datei?pfad=${encodeURIComponent(l)}`).then(r).catch(()=>r({path:l,content:"*(Notiz nicht ladbar)*",mtime:0})).finally(()=>i(!1)))},[l]);const j=s=>{const n=m.get(s.toLowerCase());n&&f(n)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Wissen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was sich die Box nachts erschließt — Traum-Notizen, Muster und Skill-Ideen aus dem Wissens-Vault, verlinkt wie ein Wiki."})]}),o&&!o.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Der Wissens-Vault liegt auf der Box (~/wissens-vault) — im lokalen Dev-Modus nicht verfügbar."}),h&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Vault wird geladen …"]}),(o==null?void 0:o.available)&&t.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 text-center text-xs text-muted-foreground",children:"Noch keine Notizen. Der nächtliche Traum (03:15) legt sie an — morgen früh steht hier die erste."}),t.length>0&&e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row",children:[e.jsxs("aside",{className:"w-full shrink-0 space-y-3 lg:w-72",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{value:a,onChange:s=>p(s.target.value),type:"search",placeholder:"Notizen durchsuchen…","aria-label":"Notizen durchsuchen",className:"h-9 w-full rounded-lg border border-border/60 bg-card/45 pl-8 pr-3 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary/50"}),e.jsx(S,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("div",{className:"max-h-[70vh] space-y-3 overflow-y-auto pr-1 scrollbar-thin",children:b.map(({dir:s,files:n})=>e.jsxs("div",{children:[e.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(M,{className:"h-3 w-3"})," ",D[s]??s]}),e.jsx("div",{className:"space-y-0.5",children:n.map(c=>e.jsxs("button",{onClick:()=>f(c.path),className:w("flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs transition-all cursor-pointer",l===c.path?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(W,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",title:c.title,children:c.name}),c.neu&&e.jsxs("span",{className:"ml-auto flex items-center gap-0.5 rounded bg-violet-500/15 px-1 py-0.5 text-[8px] font-bold uppercase text-violet-300",children:[e.jsx(C,{className:"h-2.5 w-2.5"}),"neu"]})]},c.path))})]},s||"__root"))})]}),e.jsx("div",{className:"min-w-0 flex-1 mc-card p-5",children:u?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Notiz wird geladen …"]}):d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between border-b border-border/40 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[e.jsx(E,{className:"h-3.5 w-3.5"})," ",d.path]}),d.mtime>0&&e.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Stand ",new Date(d.mtime*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),e.jsx(z,{text:d.content,onWikiLink:j,known:m})]}):null})]})]})}function z({text:o,onWikiLink:h,known:l}){const f=o.split(` +import{ao as y,r as x,g as L,j as e,L as v,S,ap as W,U as C,e as w,aq as E}from"./index-CQgUnd1p.js";import{F as M}from"./folder-open-vcdogQ3l.js";const D={"":"Allgemein",traeume:"Träume",muster:"Muster","skill-kandidaten":"Skill-Kandidaten","skill-kandidaten/beauftragt":"Skill-Kandidaten · beauftragt","skill-kandidaten/verworfen":"Skill-Kandidaten · verworfen"};function T(){const{data:o,isLoading:h}=y(),[l,f]=x.useState(null),[d,r]=x.useState(null),[u,i]=x.useState(!1),[a,p]=x.useState(""),t=x.useMemo(()=>(o==null?void 0:o.files)??[],[o]),m=x.useMemo(()=>{const s=new Map;for(const n of t)s.set(n.name.toLowerCase(),n.path);return s},[t]),g=x.useMemo(()=>{if(!a.trim())return t;const s=a.toLowerCase();return t.filter(n=>n.title.toLowerCase().includes(s)||n.path.toLowerCase().includes(s))},[t,a]),b=x.useMemo(()=>{const s=[];for(const n of g){const c=s.find(k=>k.dir===n.dir);c?c.files.push(n):s.push({dir:n.dir,files:[n]})}return s.sort((n,c)=>n.dir===""?-1:c.dir===""?1:n.dir.localeCompare(c.dir))},[g]);x.useEffect(()=>{if(!l&&t.length){const s=t.find(n=>n.path.toLowerCase()==="index.md");f((s==null?void 0:s.path)??t[0].path)}},[t,l]),x.useEffect(()=>{l&&(i(!0),L(`/api/wissen/datei?pfad=${encodeURIComponent(l)}`).then(r).catch(()=>r({path:l,content:"*(Notiz nicht ladbar)*",mtime:0})).finally(()=>i(!1)))},[l]);const j=s=>{const n=m.get(s.toLowerCase());n&&f(n)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Wissen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was sich die Box nachts erschließt — Traum-Notizen, Muster und Skill-Ideen aus dem Wissens-Vault, verlinkt wie ein Wiki."})]}),o&&!o.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Der Wissens-Vault liegt auf der Box (~/wissens-vault) — im lokalen Dev-Modus nicht verfügbar."}),h&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Vault wird geladen …"]}),(o==null?void 0:o.available)&&t.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 text-center text-xs text-muted-foreground",children:"Noch keine Notizen. Der nächtliche Traum (03:15) legt sie an — morgen früh steht hier die erste."}),t.length>0&&e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row",children:[e.jsxs("aside",{className:"w-full shrink-0 space-y-3 lg:w-72",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{value:a,onChange:s=>p(s.target.value),type:"search",placeholder:"Notizen durchsuchen…","aria-label":"Notizen durchsuchen",className:"h-9 w-full rounded-lg border border-border/60 bg-card/45 pl-8 pr-3 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary/50"}),e.jsx(S,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("div",{className:"max-h-[70vh] space-y-3 overflow-y-auto pr-1 scrollbar-thin",children:b.map(({dir:s,files:n})=>e.jsxs("div",{children:[e.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(M,{className:"h-3 w-3"})," ",D[s]??s]}),e.jsx("div",{className:"space-y-0.5",children:n.map(c=>e.jsxs("button",{onClick:()=>f(c.path),className:w("flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs transition-all cursor-pointer",l===c.path?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(W,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",title:c.title,children:c.name}),c.neu&&e.jsxs("span",{className:"ml-auto flex items-center gap-0.5 rounded bg-violet-500/15 px-1 py-0.5 text-[8px] font-bold uppercase text-violet-300",children:[e.jsx(C,{className:"h-2.5 w-2.5"}),"neu"]})]},c.path))})]},s||"__root"))})]}),e.jsx("div",{className:"min-w-0 flex-1 mc-card p-5",children:u?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Notiz wird geladen …"]}):d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between border-b border-border/40 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[e.jsx(E,{className:"h-3.5 w-3.5"})," ",d.path]}),d.mtime>0&&e.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["Stand ",new Date(d.mtime*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),e.jsx(z,{text:d.content,onWikiLink:j,known:m})]}):null})]})]})}function z({text:o,onWikiLink:h,known:l}){const f=o.split(` `),d=[];let r=[],u=null;const i=a=>{r.length&&(d.push(e.jsx("ul",{className:"mb-3 ml-4 list-disc space-y-1",children:r},a)),r=[])};return f.forEach((a,p)=>{const t=`l${p}`;if(u!==null){a.trimEnd()==="```"?(d.push(e.jsx("pre",{className:"mb-3 overflow-x-auto rounded-xl border border-border/50 bg-background/50 p-3 font-mono text-[11px] leading-relaxed text-foreground/85",children:u.join(` `)},t)),u=null):u.push(a);return}if(a.trimStart().startsWith("```")){i(t),u=[];return}const m=a.trimEnd();if(!m.trim()){i(t);return}const g=m.match(/^(#{1,4})\s+(.*)$/);if(g){i(t);const j=g[1].length,s=j===1?"text-lg font-bold mt-1 mb-3":j===2?"text-base font-bold mt-4 mb-2":"text-sm font-bold mt-3 mb-1.5";d.push(e.jsx("p",{className:w(s,"font-space text-foreground"),children:N(g[2],h,l,t)},t));return}const b=m.match(/^\s*[-*•]\s+(.*)$/);if(b){r.push(e.jsx("li",{className:"text-xs leading-relaxed text-foreground/85",children:N(b[1],h,l,t)},t));return}i(t),d.push(e.jsx("p",{className:"mb-2 text-xs leading-relaxed text-foreground/85",children:N(m,h,l,t)},t))}),i("end"),u!==null&&d.push(e.jsx("pre",{className:"mb-3 overflow-x-auto rounded-xl border border-border/50 bg-background/50 p-3 font-mono text-[11px]",children:u.join(` `)},"code-end")),e.jsx("div",{className:"max-w-3xl",children:d})}function N(o,h,l,f){return o.split(/(\[\[[^\]]+\]\]|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g).map((r,u)=>{const i=`${f}-${u}`,a=r.match(/^\[\[([^\]|]+)(?:\|([^\]]+))?\]\]$/);if(a){const p=a[1].trim(),t=(a[2]??a[1]).trim();return l.has(p.toLowerCase())?e.jsx("button",{onClick:()=>h(p),className:"rounded bg-primary/10 px-1 text-primary underline decoration-primary/40 underline-offset-2 hover:bg-primary/20 cursor-pointer",children:t},i):e.jsx("span",{className:"rounded bg-background/40 px-1 text-muted-foreground",title:"Notiz existiert (noch) nicht",children:t},i)}return r.startsWith("**")&&r.endsWith("**")?e.jsx("b",{className:"font-semibold text-foreground",children:r.slice(2,-2)},i):r.startsWith("*")&&r.endsWith("*")&&r.length>2?e.jsx("i",{children:r.slice(1,-1)},i):r.startsWith("`")&&r.endsWith("`")?e.jsx("code",{className:"rounded bg-background/50 px-1 font-mono text-[11px] text-teal-300",children:r.slice(1,-1)},i):e.jsx("span",{children:r},i)})}export{T as WissenView}; diff --git a/frontend/dist/assets/book-open-Cc6Rq6Ws.js b/frontend/dist/assets/book-open-BFFOe9re.js similarity index 90% rename from frontend/dist/assets/book-open-Cc6Rq6Ws.js rename to frontend/dist/assets/book-open-BFFOe9re.js index d002bd0..cac1ed8 100644 --- a/frontend/dist/assets/book-open-Cc6Rq6Ws.js +++ b/frontend/dist/assets/book-open-BFFOe9re.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-D94Dzyvg.js";/** +import{c as a}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/circle-x-C6D3ABCj.js b/frontend/dist/assets/circle-x-DKuGYlQP.js similarity index 89% rename from frontend/dist/assets/circle-x-C6D3ABCj.js rename to frontend/dist/assets/circle-x-DKuGYlQP.js index cb87a69..dfdc945 100644 --- a/frontend/dist/assets/circle-x-C6D3ABCj.js +++ b/frontend/dist/assets/circle-x-DKuGYlQP.js @@ -1,4 +1,4 @@ -import{c}from"./index-D94Dzyvg.js";/** +import{c}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/copy-Dy-OlKte.js b/frontend/dist/assets/copy-hJYMa3at.js similarity index 90% rename from frontend/dist/assets/copy-Dy-OlKte.js rename to frontend/dist/assets/copy-hJYMa3at.js index 17bb2bf..b3d79ee 100644 --- a/frontend/dist/assets/copy-Dy-OlKte.js +++ b/frontend/dist/assets/copy-hJYMa3at.js @@ -1,4 +1,4 @@ -import{c}from"./index-D94Dzyvg.js";/** +import{c}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/folder-open-DzbxkBSk.js b/frontend/dist/assets/folder-open-vcdogQ3l.js similarity index 90% rename from frontend/dist/assets/folder-open-DzbxkBSk.js rename to frontend/dist/assets/folder-open-vcdogQ3l.js index 5357d24..2e0c90a 100644 --- a/frontend/dist/assets/folder-open-DzbxkBSk.js +++ b/frontend/dist/assets/folder-open-vcdogQ3l.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-D94Dzyvg.js";/** +import{c as a}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/index-D94Dzyvg.js b/frontend/dist/assets/index-CQgUnd1p.js similarity index 97% rename from frontend/dist/assets/index-D94Dzyvg.js rename to frontend/dist/assets/index-CQgUnd1p.js index 9872499..7802a70 100644 --- a/frontend/dist/assets/index-D94Dzyvg.js +++ b/frontend/dist/assets/index-CQgUnd1p.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsView-COEb2NnV.js","assets/rotate-ccw--ed6DlAf.js","assets/zap-Ds7DtEXe.js","assets/ConnectView-DzOsZPw7.js","assets/folder-open-DzbxkBSk.js","assets/circle-x-C6D3ABCj.js","assets/copy-Dy-OlKte.js","assets/MemoryView-Cyd_8ZK-.js","assets/send-DyDlsXyV.js","assets/book-open-Cc6Rq6Ws.js","assets/GuideView-BDQwdFFW.js","assets/lightbulb-B-eiNc3G.js","assets/AuftragsbuchView-DyT5H9as.js","assets/ChronikView-D1lzXDtv.js","assets/EigenlebenView-99dmmNcA.js","assets/WissenView-B4HDo3yS.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsView-DJY7Fh_a.js","assets/rotate-ccw-ChVZWN8g.js","assets/zap-Df-ORHkh.js","assets/ConnectView-3IcUm9UA.js","assets/folder-open-vcdogQ3l.js","assets/circle-x-DKuGYlQP.js","assets/copy-hJYMa3at.js","assets/MemoryView-BlWBcP2e.js","assets/send-COuI40dq.js","assets/book-open-BFFOe9re.js","assets/GuideView-CSDxY6O5.js","assets/lightbulb-Btbex65P.js","assets/AuftragsbuchView-BL9FfDFw.js","assets/ChronikView-B7R_z6Jw.js","assets/EigenlebenView-BYo9hkxa.js","assets/WissenView-BXuHzW6u.js"])))=>i.map(i=>d[i]); var KI=Object.defineProperty;var b1=e=>{throw TypeError(e)};var VI=(e,t,r)=>t in e?KI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ws=(e,t,r)=>VI(e,typeof t!="symbol"?t+"":t,r),ym=(e,t,r)=>t.has(e)||b1("Cannot "+r);var $=(e,t,r)=>(ym(e,t,"read from private field"),r?r.call(e):t.get(e)),je=(e,t,r)=>t.has(e)?b1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),pe=(e,t,r,n)=>(ym(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ze=(e,t,r)=>(ym(e,t,"access private method"),r);var qc=(e,t,r,n)=>({set _(i){pe(e,t,i,r)},get _(){return $(e,t,n)}});function qI(e,t){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();function My(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gm={exports:{}},Ss={},xm={exports:{}},Le={};/** * @license React * react.production.min.js @@ -458,4 +458,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OY(e,t){if(e){if(typeof e=="string")return uP(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?uP(e,t):void 0}}function uP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{if(n!=null){var s=n.getBoundingClientRect(),u=s.width/n.offsetWidth;Fe(u)&&u!==o&&e(e4(u))}},[n,e,o]),i}function cP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function NY(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r(WW(),null);function Af(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var FY=g.forwardRef((e,t)=>{var r,n,i=g.useRef(null),o=g.useState({containerWidth:Af((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Af((n=e.style)===null||n===void 0?void 0:n.height)}),s=Pf(o,2),u=s[0],d=s[1],f=g.useCallback((m,y)=>{d(b=>{var E=Math.round(m),S=Math.round(y);return b.containerWidth===E&&b.containerHeight===S?b:{containerWidth:E,containerHeight:S}})},[]),h=g.useCallback(m=>{if(typeof t=="function"&&t(m),i.current!=null&&(i.current.disconnect(),i.current=null),m!=null&&typeof ResizeObserver<"u"){var y=m.getBoundingClientRect(),b=y.width,E=y.height;f(b,E);var S=P=>{var j=P[0];if(j!=null){var _=j.contentRect,O=_.width,N=_.height;f(O,N)}},k=new ResizeObserver(S);k.observe(m),i.current=k}},[t,f]);return g.useEffect(()=>()=>{var m=i.current;m!=null&&m.disconnect()},[f]),g.createElement(g.Fragment,null,g.createElement(Au,{width:u.containerWidth,height:u.containerHeight}),g.createElement("div",Zi({ref:h},e)))}),BY=g.forwardRef((e,t)=>{var r=e.width,n=e.height,i=g.useState({containerWidth:Af(r),containerHeight:Af(n)}),o=Pf(i,2),s=o[0],u=o[1],d=g.useCallback((h,m)=>{u(y=>{var b=Math.round(h),E=Math.round(m);return y.containerWidth===b&&y.containerHeight===E?y:{containerWidth:b,containerHeight:E}})},[]),f=g.useCallback(h=>{if(typeof t=="function"&&t(h),h!=null){var m=h.getBoundingClientRect(),y=m.width,b=m.height;d(y,b)}},[t,d]);return g.createElement(g.Fragment,null,g.createElement(Au,{width:s.containerWidth,height:s.containerHeight}),g.createElement("div",Zi({ref:f},e)))}),UY=g.forwardRef((e,t)=>{var r=e.width,n=e.height;return g.createElement(g.Fragment,null,g.createElement(Au,{width:r,height:n}),g.createElement("div",Zi({ref:t},e)))}),WY=g.forwardRef((e,t)=>{var r=e.width,n=e.height;return typeof r=="string"||typeof n=="string"?g.createElement(BY,Zi({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?g.createElement(UY,Zi({},e,{width:r,height:n,ref:t})):g.createElement(g.Fragment,null,g.createElement(Au,{width:r,height:n}),g.createElement("div",Zi({ref:t},e)))});function HY(e){return e?FY:WY}var KY=g.forwardRef((e,t)=>{var r=e.children,n=e.className,i=e.height,o=e.onClick,s=e.onContextMenu,u=e.onDoubleClick,d=e.onMouseDown,f=e.onMouseEnter,h=e.onMouseLeave,m=e.onMouseMove,y=e.onMouseUp,b=e.onTouchEnd,E=e.onTouchMove,S=e.onTouchStart,k=e.style,P=e.width,j=e.responsive,_=e.dispatchTouchEvents,O=_===void 0?!0:_,N=g.useRef(null),C=xt(),R=g.useState(null),z=Pf(R,2),F=z[0],V=z[1],Q=g.useState(null),B=Pf(Q,2),ue=B[0],G=B[1],le=_Y(),fe=dg(),de=(fe==null?void 0:fe.width)>0?fe.width:P,Y=(fe==null?void 0:fe.height)>0?fe.height:i,ae=g.useCallback(Pe=>{le(Pe),typeof t=="function"&&t(Pe),V(Pe),G(Pe),Pe!=null&&(N.current=Pe)},[le,t,V,G]),X=g.useCallback(Pe=>{C(M_(Pe)),C(Rr({handler:o,reactEvent:Pe}))},[C,o]),M=g.useCallback(Pe=>{C(jy(Pe)),C(Rr({handler:f,reactEvent:Pe}))},[C,f]),T=g.useCallback(Pe=>{C(xj()),C(Rr({handler:h,reactEvent:Pe}))},[C,h]),Z=g.useCallback(Pe=>{C(jy(Pe)),C(Rr({handler:m,reactEvent:Pe}))},[C,m]),se=g.useCallback(()=>{C(z_())},[C]),te=g.useCallback(()=>{C(F_())},[C]),ce=g.useCallback(Pe=>{C(L_(Pe.key))},[C]),ye=g.useCallback(Pe=>{C(Rr({handler:s,reactEvent:Pe}))},[C,s]),_e=g.useCallback(Pe=>{C(Rr({handler:u,reactEvent:Pe}))},[C,u]),J=g.useCallback(Pe=>{C(Rr({handler:d,reactEvent:Pe}))},[C,d]),we=g.useCallback(Pe=>{C(Rr({handler:y,reactEvent:Pe}))},[C,y]),Ae=g.useCallback(Pe=>{C(Rr({handler:S,reactEvent:Pe}))},[C,S]),ne=g.useCallback(Pe=>{O&&C(W_(Pe)),C(Rr({handler:E,reactEvent:Pe}))},[C,O,E]),lt=g.useCallback(Pe=>{C(Rr({handler:b,reactEvent:Pe}))},[C,b]),$e=HY(j);return g.createElement(Bj.Provider,{value:F},g.createElement(a5.Provider,{value:ue},g.createElement($e,{width:de??(k==null?void 0:k.width),height:Y??(k==null?void 0:k.height),className:Qe("recharts-wrapper",n),style:NY({position:"relative",cursor:"default",width:de,height:Y},k),onClick:X,onContextMenu:ye,onDoubleClick:_e,onFocus:se,onBlur:te,onKeyDown:ce,onMouseDown:J,onMouseEnter:M,onMouseLeave:T,onMouseMove:Z,onMouseUp:we,onTouchEnd:lt,onTouchMove:ne,onTouchStart:Ae,ref:ae},g.createElement(zY,null),r)))}),VY=["width","height","responsive","children","className","style","compact","title","desc"];function qY(e,t){if(e==null)return{};var r,n,i=GY(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n{var r=e.width,n=e.height,i=e.responsive,o=e.children,s=e.className,u=e.style,d=e.compact,f=e.title,h=e.desc,m=qY(e,VY),y=on(m);return d?g.createElement(g.Fragment,null,g.createElement(Au,{width:r,height:n}),g.createElement(sP,{otherAttributes:y,title:f,desc:h},o)):g.createElement(KY,{className:s,style:u,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},g.createElement(sP,{otherAttributes:y,title:f,desc:h,ref:t},g.createElement(YV,null,o)))});function _y(){return _y=Object.assign?Object.assign.bind():function(e){for(var t=1;tg.createElement(rQ,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:nQ,tooltipPayloadSearcher:OW,categoricalChartProps:e,ref:t}));const aQ="rgba(130,130,150,0.14)",hP="rgba(130,130,150,0.85)";function oQ(e){if(e<=0)return 10;const t=Math.pow(10,Math.floor(Math.log10(e))),r=e/t;return(r<=1?1:r<=2?2:r<=5?5:10)*t}function q_(e,t){return`${t==="%"?Math.round(e):e>=1e3?`${(e/1e3).toFixed(1)}k`:Math.round(e).toString()}${t}`}function lQ({active:e,payload:t,unit:r}){return!e||!(t!=null&&t.length)?null:x.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:x.jsx("div",{className:"space-y-1",children:t.map(n=>x.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[x.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:n.color}}),x.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:n.name}),x.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:q_(n.value,r)})]},n.dataKey))})})}function G_({data:e,series:t,unit:r="%",yMode:n="percent",height:i=176}){const o=e.reduce((u,d)=>t.reduce((f,h)=>Math.max(f,Number(d[h.key])||0),u),0),s=n==="percent"?Math.min(100,Math.max(25,Math.ceil(o*1.2/25)*25)):Math.max(oQ(o*1.15),10);return x.jsx("div",{style:{height:i},className:"w-full",children:x.jsx(X4,{width:"100%",height:"100%",children:x.jsxs(iQ,{data:e,margin:{top:8,right:6,bottom:0,left:-12},children:[x.jsx("defs",{children:t.map(u=>x.jsxs("linearGradient",{id:`grad-${u.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[x.jsx("stop",{offset:"0%",stopColor:u.color,stopOpacity:.22}),x.jsx("stop",{offset:"100%",stopColor:u.color,stopOpacity:0})]},u.key))}),x.jsx(g_,{vertical:!1,stroke:aQ}),x.jsx(N_,{dataKey:"t",hide:!0}),x.jsx(I_,{domain:[0,s],ticks:[0,s/2,s],tickFormatter:u=>q_(u,r),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:hP}}),x.jsx(rH,{content:x.jsx(lQ,{unit:r}),cursor:{stroke:hP,strokeOpacity:.4,strokeDasharray:"3 3"}}),t.map(u=>x.jsx(j_,{type:"monotone",dataKey:u.key,name:u.label,stroke:u.color,strokeWidth:2,fill:`url(#grad-${u.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},u.key))]})})})}const sQ=[{key:"cpu",label:"CPU",color:"#2dd4bf"},{key:"ram",label:"RAM",color:"#38bdf8"},{key:"gpu",label:"GPU",color:"#a78bfa"},{key:"disk",label:"Disk",color:"#fbbf24"}];function uQ(){var s,u,d,f;const{sys:e,hist:t}=G3(),r=!!(e!=null&&e.gpu&&e.gpu.busy_percent!=null&&e.gpu.gtt_used!=null&&e.gpu.gtt_total!=null),n=sQ.filter(h=>h.key!=="gpu"||r),i={cpu:(s=e==null?void 0:e.cpu)==null?void 0:s.percent,ram:(u=e==null?void 0:e.ram)==null?void 0:u.percent,gpu:r?e.gpu.busy_percent:null,disk:(d=e==null?void 0:e.disk)==null?void 0:d.percent},o={cpu:(f=e==null?void 0:e.cpu)!=null&&f.cores?`${e.cpu.cores} Cores`:"",ram:e?`${No(e.ram.used)}/${No(e.ram.total)} GB`:"",gpu:r?`${No(e.gpu.gtt_used)}/${No(e.gpu.gtt_total)} GB`:"",disk:e!=null&&e.disk?`${No(e.disk.used)}/${No(e.disk.total)} GB`:""};return x.jsxs("div",{className:"flex flex-col justify-between mc-card p-5",children:[x.jsxs("div",{children:[x.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[x.jsx(UP,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),x.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[x.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),e?x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:n.map(h=>x.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[x.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:h.color}}),x.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:h.label}),x.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[h.key]??0),"%"]}),o[h.key]&&x.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:o[h.key]})]},h.key))}),x.jsx(G_,{data:t,series:n,unit:"%",yMode:"percent",height:176})]}):x.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(e==null?void 0:e.temp)&&(e.temp.cpu||e.temp.gpu)&&x.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[e.temp.cpu!=null&&x.jsxs("span",{children:["CPU Temp: ",e.temp.cpu," °C"]}),e.temp.gpu!=null&&x.jsxs("span",{children:["GPU Temp: ",e.temp.gpu," °C"]})]})]})}const pP=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function cQ(){const{data:e}=TA(),t=B3(),r=t[t.length-1],n=r?Math.round(r.prompt+r.completion):0;return x.jsxs("div",{className:"mc-card p-5",children:[x.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[x.jsxs("div",{children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(VM,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),x.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[x.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),e&&x.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[x.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:n.toLocaleString("de-DE")}),x.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),e&&x.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[x.jsxs("div",{children:[e.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",x.jsxs("span",{className:"text-emerald-400/90",children:[e.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),x.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",e.prompt_tokens.toLocaleString("de-DE")," · Output ",e.completion_tokens.toLocaleString("de-DE")]})]})]}),x.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:pP.map(i=>x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),x.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),x.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((r==null?void 0:r[i.key])??0)})]},i.key))})]}),e?x.jsx(G_,{data:t,series:pP,unit:" tok/s",yMode:"auto",height:150}):x.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),x.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}const Sl=[{key:"stt_ms",label:"STT",color:"#f59e0b"},{key:"vision_ms",label:"Sehen",color:"#a78bfa"},{key:"hirn_ms",label:"Hirn",color:"#2dd4bf"},{key:"gen_ms",label:"Antwort",color:"#60a5fa"}],ja=e=>e==null?"–":`${(e/1e3).toLocaleString("de-DE",{minimumFractionDigits:1,maximumFractionDigits:1})} s`;function dQ(e){const t=Math.max(0,Date.now()/1e3-e);return t<60?`vor ${Math.round(t)} s`:t<3600?`vor ${Math.round(t/60)} min`:`vor ${Math.round(t/3600)} h`}function Ny(e){return Sl.reduce((t,r)=>t+(e[r.key]??0),0)}function fQ(e){let t=null;for(const r of Sl){const n=e[r.key];n!=null&&(t==null||n>t.ms)&&(t={label:r.label,color:r.color,ms:n})}return t}function hQ({t:e,scale:t}){const r=Sl.map(n=>`${n.label} ${ja(e[n.key])}`).join(" · ")+(e.mem0_ms!=null?` (davon Mem0 ${ja(e.mem0_ms)})`:"");return x.jsxs("div",{className:"flex items-center gap-2.5",children:[x.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[10px] text-muted-foreground/60",children:dQ(e.ts)}),x.jsxs("div",{className:"relative h-4 flex-1 overflow-hidden rounded-sm bg-muted/25",title:r,children:[x.jsx("div",{className:"absolute inset-0 flex",children:Sl.map(n=>{const i=e[n.key];return!i||i<=0?null:x.jsx("div",{style:{width:`${i/t*100}%`,background:n.color},className:"h-full first:rounded-l-sm"},n.key)})}),e.error&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-rose-500/15 text-[10px] font-semibold text-rose-300",children:"Fehler"})]}),x.jsx("span",{className:"w-12 shrink-0 text-right font-mono text-[11px] font-semibold tabular-nums text-foreground",children:e.error?"–":ja(Ny(e))})]})}function pQ(){const{data:e}=E3(12),t=e??[],r=Math.max(1,...t.map(o=>Ny(o))),n=t[0],i=n?fQ(n):null;return x.jsxs("div",{className:"mc-card p-5",children:[x.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[x.jsxs("div",{children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(oT,{className:"h-4.5 w-4.5 text-primary"}),x.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Latenz je Turn"}),x.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[x.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),n?x.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[x.jsx("span",{className:`font-space text-3xl font-bold tracking-tight tabular-nums ${n.error?"text-rose-400":"text-foreground"}`,children:n.error?"Fehler":ja(Ny(n))}),x.jsxs("span",{className:"text-xs text-muted-foreground",children:["letzter Turn",!n.error&&i&&x.jsxs(x.Fragment,{children:[" · Täter: ",x.jsx("span",{style:{color:i.color},className:"font-semibold",children:i.label})," ",ja(i.ms)]})]})]}):x.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Noch kein Voice-Turn aufgezeichnet."}),n&&!n.error&&x.jsxs("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground/70",children:[Sl.filter(o=>n[o.key]!=null).map(o=>`${o.label} ${ja(n[o.key])}`).join(" · "),n.mem0_ms!=null&&x.jsxs("span",{className:"text-muted-foreground/50",children:[" · davon Mem0 ",ja(n.mem0_ms)]})]})]}),x.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1 pt-1",children:Sl.map(o=>x.jsxs("div",{className:"flex items-center gap-1.5",children:[x.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:o.color}}),x.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:o.label})]},o.key))})]}),t.length>0?x.jsx("div",{className:"space-y-1.5",children:t.map(o=>x.jsx(hQ,{t:o,scale:r},o.id))}):x.jsx("div",{className:"flex h-[120px] items-center justify-center px-6 text-center text-xs text-muted-foreground",children:"Sprich einmal mit Lucy — dann erscheint hier der Zeit-Wasserfall pro Turn, damit man den einen Hänger sofort sieht."}),x.jsx("div",{className:"mt-3 border-t border-border/30 pt-2 text-[10px] leading-relaxed text-muted-foreground/70",children:'„Hirn" = Zeit bis zum ersten Wort (Agent + Mem0-Suche + Modell); Tool-Runden stecken in „Antwort". Reine Telegram-Turns laufen an MC2 vorbei und erscheinen hier nicht.'})]})}const Of=e=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:e}}));function mQ({onNavigate:e}){var de,Y,ae,X;const{data:t}=MA(),{data:r}=Qy(),{data:n}=DA(),{data:i}=C3(),{data:o}=A3(),{data:s}=O3(),{data:u}=x3(),{data:d}=b3(),f=W3(),{showAlert:h,dialogElement:m}=Yy(),y=xu(),[b,E]=g.useState({});async function S(M,T){E(Z=>({...Z,[M]:!0}));try{if(T.kind==="loadModel")await Me(`/api/models/${encodeURIComponent(T.model)}/load`,{method:"POST"});else{const Z=await Me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:T.service})});Z.ok||h("Reparatur nicht ganz geklappt",(Z.err||"Unbekannter Fehler")+(T.needsSudo?` -Tipp: Dafür wird evtl. das Box-Passwort gebraucht (oben rechts hinterlegen).`:""))}y.invalidateQueries({queryKey:De.health}),y.invalidateQueries({queryKey:De.services}),y.invalidateQueries({queryKey:De.models})}catch(Z){h("Reparatur fehlgeschlagen",String((Z==null?void 0:Z.message)||Z))}finally{E(Z=>({...Z,[M]:!1}))}}const k=((de=t==null?void 0:t.running)==null?void 0:de.length)??0,P=(r==null?void 0:r.services.filter(M=>M.ok).length)??0,j=(r==null?void 0:r.services.length)??0,_=j-P,O=(i==null?void 0:i.length)??0,N=(n?(n.os>0?1:0)+(n.engine>0?1:0)+(n.swap>0?1:0)+(n.models>0?1:0):0)+(((Y=n==null?void 0:n.components)==null?void 0:Y.filter(M=>M.update===!0).length)??0),C=u!=null&&u.available?u.open_count:0,R=d!=null&&d.available?d.items.filter(M=>M.status==="blocked").length:0,z=s?[s.gateway,s.memory,s.desktop_gateway]:[],F=z.filter(M=>M==null?void 0:M.ok).length,V=s?s.gateway.ok?s.memory.ok?s.desktop_gateway.ok?"":"Desktop-Gateway":"Gedächtnis-Leitung":"Modell-Leitung":"",Q=(ae=t==null?void 0:t.models)==null?void 0:ae.find(M=>M.role==="hermes"),B=Q!=null&&Q.name?(X=Q.name.split("/").pop())==null?void 0:X.replace(/\.gguf$/i,""):"",ue=i?i.filter(M=>["auto","agent","hermes"].includes(M.source)).length:0,G=r==null?void 0:r.services.filter(M=>!M.ok).map(M=>M.name).join(", "),le=n?[n.os>0&&"OS",n.engine>0&&"Engine",n.swap>0&&"Swap",n.models>0&&"Modelle"].filter(Boolean):[],fe=le.length>0?le.join(" + "):"";return x.jsxs("div",{className:"space-y-6",children:[x.jsxs("div",{children:[x.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Cockpit"}),x.jsx("p",{className:"text-sm text-muted-foreground",children:"Deine Box auf einen Blick — Details hinter jeder Kachel."})]}),x.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 items-start",children:[x.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[x.jsx(vQ,{verdict:f.verdict,memory:f.memory,warns:f.warns,problems:f.problems}),x.jsx(V3,{}),x.jsxs("section",{children:[x.jsx(xd,{children:"Leistung"}),x.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[x.jsx(uQ,{}),x.jsx(cQ,{})]}),x.jsx("div",{className:"mt-4",children:x.jsx(pQ,{})})]}),x.jsxs("section",{children:[x.jsx(xd,{children:"Bereiche"}),x.jsxs("div",{className:"grid gap-4 grid-cols-2 md:grid-cols-3",children:[x.jsx(Io,{icon:Fy,title:"Auftragsbuch",value:u!=null&&u.available?C:"—",unit:C===1?"Vorschlag":"Vorschläge",tone:u?R>0||C>0?"warn":"ok":"loading",hint:R>0?`${R} Karte${R===1?"":"n"} wartet auf deine Antwort`:C>0?`${C} offene Patches`:"Keine ausstehenden Vorschläge",onClick:()=>e("auftraege")}),x.jsx(Io,{icon:FP,title:"Modelle",value:k,unit:"warm",tone:k>0?"ok":"muted",hint:B?`Hirn: ${B}`:"Kein Hermes-Modell geladen",onClick:()=>e("models")}),x.jsx(Io,{icon:zy,title:"Gedächtnis",value:i?O:"…",unit:"Notizen",tone:i?"ok":"loading",hint:i?`${O} Fakten (${ue} auto gelernt)`:"Gedächtnis-Pool laden...",onClick:()=>e("memory")}),x.jsx(Io,{icon:Nf,title:"Dienste",value:r?`${P}/${j}`:"…",unit:"laufen",tone:r?_>0?"warn":"ok":"loading",hint:G?`Ausfall: ${G}`:"Alle Dienste online",onClick:()=>Of("maintenance")}),x.jsx(Io,{icon:Uy,title:"Updates",value:n?N>0?N:"0":"…",unit:N>0?"bereit":"aktuell",tone:n?N>0?"warn":"ok":"loading",hint:N>0?`Verfügbar: ${fe}`:"Alles auf dem neuesten Stand",onClick:()=>Of("maintenance")}),x.jsx(Io,{icon:By,title:"Verbinden",value:s?`${F}/${z.length}`:"…",unit:"Leitungen",tone:s?F===z.length?"ok":"warn":"loading",hint:V?`Gestört: ${V}`:"Hermes Desktop & IDEs bereit",onClick:()=>e("connect")})]})]})]}),x.jsxs("div",{className:"space-y-6",children:[x.jsx(yQ,{problems:f.problems,pendingCount:N,openAuftraege:C,blockedIdeen:R,busy:b,onRepair:S,onNavigate:e}),x.jsxs("section",{children:[x.jsx(xd,{children:"Anstehendes"}),x.jsx(q3,{})]}),x.jsxs("section",{children:[x.jsx(xd,{children:"Werkzeuge & Diagnose"}),x.jsx(gQ,{agent:o,svcErrors:_,onNavigate:e})]})]})]}),m]})}function xd({children:e}){return x.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:e})}function vQ({verdict:e,memory:t,warns:r,problems:n}){const i=r.length?`${r[0].label}: ${r[0].detail}${r.length>1?` (+${r.length-1} weitere)`:""}`:t.status==="full"?t.text:"Nichts Schlimmes — nur ein Hinweis.",o=n.length?`${n[0].label}: ${n[0].detail}${n.length>1?` (+${n.length-1} weitere)`:""}`:"Ein wichtiger Dienst hakt.",s={loading:{ring:"border-border/60 bg-card/45",icon:_f,iconCls:"text-muted-foreground animate-spin",title:"Box wird geprüft …",sub:"Einen Moment."},gut:{ring:"border-emerald-500/40 bg-emerald-500/5",icon:uT,iconCls:"text-emerald-400",title:"Box gesund",sub:"Alle wichtigen Dienste laufen."},warn:{ring:"border-amber-500/40 bg-amber-500/5",icon:Gs,iconCls:"text-amber-400",title:"Kleinigkeit an der Box",sub:i},problem:{ring:"border-red-500/50 bg-red-500/5",icon:Gs,iconCls:"text-red-400",title:"Box braucht Hilfe",sub:o}}[e],u=s.icon,d={ok:"text-emerald-400",warn:"text-amber-400",full:"text-red-400",unknown:"text-muted-foreground"}[t.status],f={ok:"bg-emerald-500",warn:"bg-amber-500",full:"bg-red-500",unknown:"bg-muted-foreground/40"}[t.status];return x.jsxs("div",{className:Re("flex flex-col gap-4 rounded-2xl border p-5 shadow-lg shadow-black/15 backdrop-blur-md transition-colors sm:flex-row sm:items-center sm:justify-between h-full",s.ring),children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-border/40 bg-background/30",children:x.jsx(u,{className:Re("h-6 w-6",s.iconCls)})}),x.jsxs("div",{className:"min-w-0",children:[x.jsx("h2",{className:"text-base font-bold tracking-tight text-foreground",children:s.title}),x.jsx("p",{className:"text-xs text-muted-foreground",children:s.sub})]})]}),x.jsxs("div",{className:"w-full max-w-[16rem] rounded-xl border border-border/30 bg-background/20 p-3",children:[x.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",children:[x.jsx(sT,{className:"h-3.5 w-3.5"})," Speicher"]}),x.jsx("span",{className:Re("font-mono font-bold",d),children:t.status==="unknown"?"—":`${t.usedGb.toFixed(1)} / ${t.totalGb.toFixed(1)} GB`})]}),x.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:x.jsx("div",{className:Re("h-full rounded-full transition-all duration-500",f),style:{width:`${t.pct}%`}})})]})]})}function yQ({problems:e,pendingCount:t,openAuftraege:r,blockedIdeen:n,busy:i,onRepair:o,onNavigate:s}){const u=t>0,d=r>0,f=n>0,h=e.length===0&&!u&&!d&&!f;return x.jsx("div",{className:"h-full flex flex-col justify-between",children:h?x.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-emerald-500/25 bg-emerald-500/5 p-4 h-full",children:[x.jsx(XM,{className:"h-5 w-5 shrink-0 text-emerald-400"}),x.jsxs("div",{children:[x.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Nichts zu tun"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Alles läuft. Du musst gerade nichts abnicken."})]})]}):x.jsxs("div",{className:"space-y-2 h-full flex flex-col justify-center",children:[e.map(m=>x.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-2xl border border-red-500/25 bg-red-500/5 p-4",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3 w-full",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-red-500/30 bg-background/30 text-red-300",children:x.jsx(m.icon,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:"text-sm font-bold text-foreground",children:m.label}),x.jsx("p",{className:"truncate text-xs text-muted-foreground",children:m.detail})]})]}),m.repair&&x.jsxs("button",{onClick:()=>m.repair&&o(m.id,m.repair),disabled:!!i[m.id],className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300 transition-all hover:bg-red-500/20 cursor-pointer disabled:opacity-60 w-full sm:w-auto justify-center",children:[i[m.id]?x.jsx(_f,{className:"h-3.5 w-3.5 animate-spin"}):x.jsx(PT,{className:"h-3.5 w-3.5"}),m.repair.label]})]},m.id)),f&&x.jsxs("button",{onClick:()=>s("auftraege"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-red-500/30 bg-red-500/5 p-4 text-left transition-all hover:bg-red-500/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-red-500/30 bg-background/30 text-red-300",children:x.jsx(BP,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[n," Karte",n===1?"":"n"," braucht deine Antwort"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Die Box hängt an einer Frage und wartet auf dich."})]})]}),x.jsx(Ko,{className:"h-4 w-4 shrink-0 text-red-300/70"})]}),d&&x.jsxs("button",{onClick:()=>s("auftraege"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-primary/30 bg-primary/5 p-4 text-left transition-all hover:bg-primary/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-primary/30 bg-background/30 text-primary",children:x.jsx(Fy,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[r," Vorschl",r===1?"ag":"äge"," im Auftragsbuch"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Annehmen oder ablehnen."})]})]}),x.jsx(Ko,{className:"h-4 w-4 shrink-0 text-primary/70"})]}),u&&x.jsxs("button",{onClick:()=>Of("maintenance"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-left transition-all hover:bg-amber-500/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-amber-500/30 bg-background/30 text-amber-300",children:x.jsx(Uy,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[t," Update",t===1?"":"s"," bereit"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Ansehen und entscheiden."})]})]}),x.jsx(Ko,{className:"h-4 w-4 shrink-0 text-amber-300/70"})]})]})})}function gQ({agent:e,svcErrors:t,onNavigate:r}){const n=[{label:"Hermes Agent",status:e?e.gateway_reachable?"Bereit":"Offline":"…",tone:e?e.gateway_reachable?"ok":"alert":"loading",action:()=>r("agent")},{label:"Direkte Box-Shell (SSH)",status:e?e.box_console_reachable?"Bereit":"Offline":"…",tone:e?e.box_console_reachable?"ok":"warn":"loading",action:()=>r("konsole")},{label:"Systemlogs & Diagnose",status:t>0?`${t} Fehler`:"Keine Fehler",tone:t>0?"alert":"ok",action:()=>Of("logs")},{label:"Interaktives Terminal",status:"Öffnen",tone:"muted",action:()=>r("konsole")},{label:"Wissens-Vault",status:"Öffnen",tone:"muted",action:()=>r("wissen")},{label:"Chronik & Zeitmaschine",status:"Öffnen",tone:"muted",action:()=>r("chronik")}];return x.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/30 p-4 space-y-3 shadow-sm",children:x.jsx("div",{className:"divide-y divide-border/20",children:n.map((i,o)=>{const s={loading:"bg-muted-foreground/45 animate-pulse",ok:"bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.4)]",warn:"bg-amber-500 shadow-[0_0_8px_rgba(245,158,11,0.4)]",alert:"bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.4)]",muted:"bg-muted-foreground/30"}[i.tone];return x.jsxs("button",{onClick:i.action,className:"w-full py-2.5 px-1.5 flex items-center justify-between text-left hover:bg-card/45 rounded-lg transition-all group cursor-pointer text-xs",children:[x.jsx("span",{className:"text-muted-foreground group-hover:text-foreground transition-colors font-medium",children:i.label}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:Re("text-[10px] font-semibold font-mono",i.tone==="ok"?"text-emerald-400":i.tone==="warn"?"text-amber-400":i.tone==="alert"?"text-red-400":"text-muted-foreground/60"),children:i.status}),x.jsx("span",{className:Re("h-1.5 w-1.5 rounded-full",s)})]})]},o)})})})}const xQ=g.lazy(()=>In(()=>import("./ModelsView-COEb2NnV.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ModelsView}))),bQ=g.lazy(()=>In(()=>import("./ConnectView-DzOsZPw7.js"),__vite__mapDeps([3,4,5,6])).then(e=>({default:e.ConnectView}))),wQ=g.lazy(()=>In(()=>import("./MemoryView-Cyd_8ZK-.js"),__vite__mapDeps([7,6,8,9])).then(e=>({default:e.MemoryView}))),SQ=g.lazy(()=>In(()=>import("./AgentView-BMf46hOH.js"),[]).then(e=>({default:e.AgentView}))),kQ=g.lazy(()=>In(()=>import("./KonsoleView-DRRRIoE2.js"),[]).then(e=>({default:e.KonsoleView}))),EQ=g.lazy(()=>In(()=>import("./GuideView-BDQwdFFW.js"),__vite__mapDeps([10,9,2,11])).then(e=>({default:e.GuideView}))),PQ=g.lazy(()=>In(()=>import("./AuftragsbuchView-DyT5H9as.js"),__vite__mapDeps([12,11,8])).then(e=>({default:e.AuftragsbuchView}))),AQ=g.lazy(()=>In(()=>import("./ChronikView-D1lzXDtv.js"),__vite__mapDeps([13,1])).then(e=>({default:e.ChronikView}))),OQ=g.lazy(()=>In(()=>import("./EigenlebenView-99dmmNcA.js"),__vite__mapDeps([14,9,5])).then(e=>({default:e.EigenlebenView}))),CQ=g.lazy(()=>In(()=>import("./WissenView-B4HDo3yS.js"),__vite__mapDeps([15,4])).then(e=>({default:e.WissenView})));function jQ(){return x.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:x.jsx(_f,{className:"h-5 w-5 animate-spin","aria-label":"Lädt …"})})}const _Q=/Mac|iPhone|iPad/.test(navigator.platform);function NQ(){U3(),g3();const[e,t]=g.useState(()=>{const S=window.location.hash.slice(1);return qo.some(k=>k.id===S)?S:"dashboard"}),r=g.useCallback(S=>{window.location.hash.slice(1)===S?t(S):window.location.hash=S},[]),[n,i]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[o,s]=g.useState(!1),[u,d]=g.useState(!1),[f,h]=g.useState("maintenance"),{data:m,isError:y}=IA(),{data:b}=$f();g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const S=k=>{var j;h(((j=k.detail)==null?void 0:j.tab)||"maintenance"),d(!0)};return window.addEventListener("open-system-drawer",S),()=>window.removeEventListener("open-system-drawer",S)},[]),g.useEffect(()=>{const S=k=>{var j;const P=(j=k.detail)==null?void 0:j.view;P&&r(P)};return window.addEventListener("mc-navigate",S),()=>window.removeEventListener("mc-navigate",S)},[r]),g.useEffect(()=>{const S=()=>{const k=window.location.hash.slice(1);qo.some(P=>P.id===k)&&t(k)};return window.addEventListener("hashchange",S),()=>window.removeEventListener("hashchange",S)},[]),g.useEffect(()=>{s(!1)},[e]);const E=qo.find(S=>S.id===e);return x.jsxs("div",{className:"flex h-full relative",children:[x.jsx("div",{className:"fixed inset-0 -z-50 pointer-events-none",style:{backgroundColor:"hsl(224,30%,6%)",backgroundImage:["radial-gradient(45% 40% at 12% 8%, hsl(172 72% 50% / 0.10), transparent 70%)","radial-gradient(50% 45% at 88% 92%, hsl(270 70% 60% / 0.10), transparent 70%)","radial-gradient(40% 35% at 75% 30%, hsl(239 70% 62% / 0.07), transparent 70%)"].join(", ")}}),x.jsx(MR,{onNavigate:r}),x.jsx($3,{open:u,onClose:()=>d(!1),defaultTab:f}),x.jsx("aside",{className:Re("hidden md:flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:x.jsx(mP,{collapsed:n,onToggleCollapse:()=>{i(S=>{const k=!S;return localStorage.setItem("mc_sidebar_collapsed",k.toString()),k})},view:e,health:m,backendDown:y,sysStatus:b})}),x.jsxs("div",{className:Re("md:hidden fixed inset-0 z-50 transition-opacity duration-200",o?"opacity-100":"pointer-events-none opacity-0"),"aria-hidden":!o,children:[x.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:()=>s(!1)}),x.jsx("aside",{className:Re("absolute inset-y-0 left-0 flex w-72 max-w-[85vw] flex-col border-r border-border/40 bg-[hsl(224,28%,8%)] transition-transform duration-300 ease-in-out",o?"translate-x-0":"-translate-x-full"),children:x.jsx(mP,{collapsed:!1,onClose:()=>s(!1),view:e,health:m,backendDown:y,sysStatus:b})})]}),x.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[x.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between gap-3 border-b border-border/40 px-4 md:px-6 bg-card/20 backdrop-blur-sm",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[x.jsx("button",{onClick:()=>s(!0),className:"md:hidden p-1.5 -ml-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation öffnen",children:x.jsx(pT,{className:"h-5 w-5","aria-hidden":"true"})}),x.jsx("div",{className:"truncate text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:E.hint})]}),x.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[x.jsx(m3,{}),x.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"hidden sm:flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),x.jsxs("button",{onClick:()=>{const S=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(S)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[x.jsx(nT,{className:"h-3.5 w-3.5"}),x.jsx("span",{className:"hidden sm:inline",children:"Suchen"}),x.jsx("kbd",{className:"hidden sm:inline rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:_Q?"⌘K":"Strg+K"})]})]})]}),x.jsx("main",{className:"flex-1 overflow-y-auto p-4 md:p-6 scrollbar-thin",children:x.jsxs(g.Suspense,{fallback:x.jsx(jQ,{}),children:[e==="dashboard"&&x.jsx(mQ,{onNavigate:S=>r(S)}),e==="auftraege"&&x.jsx(PQ,{}),e==="models"&&x.jsx(xQ,{}),e==="connect"&&x.jsx(bQ,{}),e==="memory"&&x.jsx(wQ,{}),e==="wissen"&&x.jsx(CQ,{}),e==="chronik"&&x.jsx(AQ,{}),e==="eigenleben"&&x.jsx(OQ,{}),e==="agent"&&x.jsx(SQ,{}),e==="konsole"&&x.jsx(kQ,{}),e==="guide"&&x.jsx(EQ,{})]})})]})]})}function mP({collapsed:e,onToggleCollapse:t,onClose:r,view:n,health:i,backendDown:o,sysStatus:s}){var u,d,f,h,m;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:Re("flex items-center py-4 border-b border-border/40 shrink-0",e?"flex-col gap-3 px-2":"justify-between px-5"),children:[x.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[x.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!e&&x.jsxs("div",{className:"leading-tight",children:[x.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),x.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),t&&x.jsx("button",{onClick:t,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":e?"Seitenleiste ausklappen":"Seitenleiste einklappen",title:e?"Maximieren":"Minimieren",children:e?x.jsx(Ko,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(JM,{className:"h-4 w-4","aria-hidden":"true"})}),r&&x.jsx("button",{onClick:r,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation schließen",children:x.jsx(bu,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:(()=>{let y=null;return qo.map(b=>{const E=b.group!==y;return y=b.group,x.jsxs("div",{className:"space-y-1",children:[E&&(e?y!==qo[0].group&&x.jsx("div",{className:"my-3 border-t border-border/30"}):x.jsx("div",{className:"mt-5 mb-1.5 px-3 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/40 first:mt-0 select-none",children:b.group})),x.jsxs("a",{href:`#${b.id}`,onClick:r,"aria-current":n===b.id?"page":void 0,className:Re("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",e?"justify-center p-2.5":"gap-3 px-3 py-2",n===b.id?e?"nav-active-collapsed":"nav-active":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:e?b.label:void 0,"aria-label":e?b.label:void 0,children:[x.jsx(b.icon,{className:"h-4.5 w-4.5 shrink-0","aria-hidden":"true"}),!e&&x.jsx("span",{className:"truncate",children:b.label})]})]},b.id)})})()}),x.jsx("div",{className:Re("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",e?"px-2 text-center":"px-5"),children:e?x.jsx("div",{className:"flex justify-center",children:x.jsx("span",{className:Re("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",o||!i?"bg-red-500":i.engine_reachable?i.brain&&!i.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500"),title:o?"Zentrale antwortet nicht — Anzeigen evtl. veraltet":i?i.engine_reachable?i.brain&&!i.brain.ready?`Hirn offline (${i.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):x.jsxs("div",{className:"space-y-2 text-left",children:[o?x.jsxs("span",{className:"flex items-center gap-2 text-red-400",children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500 animate-pulse"}),x.jsx("span",{className:"truncate",children:"Zentrale antwortet nicht"})]}):i?x.jsxs(x.Fragment,{children:[x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:Re("h-2 w-2 rounded-full animate-pulse",i.engine_reachable?"bg-emerald-500":"bg-amber-500")}),x.jsxs("span",{className:"truncate",children:["Engine ",i.engine_reachable?"online":"offline"]})]}),i.brain&&!i.brain.ready&&x.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${i.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),x.jsxs("span",{className:"truncate",children:["Hirn offline",i.brain.model?` (${i.brain.model})`:""]})]})]}):x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",x.jsx("span",{className:"truncate",children:"Backend offline"})]}),(s==null?void 0:s.versions)&&x.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[x.jsxs("div",{className:"truncate",title:s.versions.mc2?`${s.versions.mc2.branch}-${s.versions.mc2.hash}${s.versions.mc2.dirty?"*":""} (${s.versions.mc2.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"MC2:"})," ",s.versions.mc2?`${s.versions.mc2.hash}${s.versions.mc2.dirty?"*":""}`:"—"]}),x.jsxs("div",{className:"truncate",title:((u=s.versions.engine)==null?void 0:u.type)==="git"?`${s.versions.engine.branch}-${s.versions.engine.hash}${s.versions.engine.dirty?"*":""} (${s.versions.engine.date})`:((d=s.versions.engine)==null?void 0:d.version_text)||"unbekannt",children:[x.jsx("strong",{children:"Engine:"})," ",((f=s.versions.engine)==null?void 0:f.type)==="git"?`${s.versions.engine.hash}${s.versions.engine.dirty?"*":""}`:((m=(h=s.versions.engine)==null?void 0:h.version_text)==null?void 0:m.split(" ").pop())||"—"]}),x.jsxs("div",{className:"truncate",title:s.versions.hermes_agent?`${s.versions.hermes_agent.branch}-${s.versions.hermes_agent.hash}${s.versions.hermes_agent.dirty?"*":""} (${s.versions.hermes_agent.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"Hermes Agent:"})," ",s.versions.hermes_agent?`${s.versions.hermes_agent.hash}${s.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]})}class IQ extends Ty.Component{constructor(){super(...arguments);ws(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,n){console.error("Unbehandelter UI-Fehler:",r,n.componentStack)}render(){return this.state.error?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-neutral-950 text-neutral-200 p-8",children:x.jsxs("div",{className:"max-w-lg space-y-4 text-center",children:[x.jsx("div",{className:"text-2xl",children:"Da ist etwas schiefgelaufen."}),x.jsx("div",{className:"text-sm text-neutral-400 break-all",children:this.state.error.message}),x.jsx("button",{className:"px-4 py-2 rounded-lg bg-neutral-800 hover:bg-neutral-700 border border-neutral-700",onClick:()=>window.location.reload(),children:"Neu laden"})]})}):this.props.children}}const MQ=new CM({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});rM.createRoot(document.getElementById("root")).render(x.jsx(Ty.StrictMode,{children:x.jsx(IQ,{children:x.jsx(jM,{client:MQ,children:x.jsx(NQ,{})})})}));export{DQ as $,ET as A,zy as B,XM as C,ZM as D,Ov as E,KQ as F,DA as G,sT as H,qQ as I,O3 as J,B1 as K,_f as L,Ko as M,eT as N,C3 as O,H1 as P,BQ as Q,kT as R,xT as S,Gs as T,HP as U,tT as V,Wy as W,bu as X,A3 as Y,iT as Z,In as _,P3 as a,jf as a0,VM as a1,PT as a2,ST as a3,Nf as a4,FP as a5,By as a6,oT as a7,x3 as a8,Vo as a9,b3 as aa,LQ as ab,BP as ac,Fy as ad,w3 as ae,cT as af,qM as ag,vT as ah,Uy as ai,uT as aj,S3 as ak,FQ as al,W1 as am,zQ as an,aT as ao,hT as ap,lf as aq,Ty as ar,su as as,Sk as at,M8 as au,Ng as av,hk as aw,fk as ax,My as ay,Yy as b,ke as c,YQ as d,Re as e,Mm as f,Me as g,WQ as h,$Q as i,x as j,GM as k,MA as l,UQ as m,$f as n,HQ as o,GQ as p,De as q,g as r,RQ as s,VQ as t,xu as u,No as v,RR as w,UP as x,yT as y,QQ as z}; +Tipp: Dafür wird evtl. das Box-Passwort gebraucht (oben rechts hinterlegen).`:""))}y.invalidateQueries({queryKey:De.health}),y.invalidateQueries({queryKey:De.services}),y.invalidateQueries({queryKey:De.models})}catch(Z){h("Reparatur fehlgeschlagen",String((Z==null?void 0:Z.message)||Z))}finally{E(Z=>({...Z,[M]:!1}))}}const k=((de=t==null?void 0:t.running)==null?void 0:de.length)??0,P=(r==null?void 0:r.services.filter(M=>M.ok).length)??0,j=(r==null?void 0:r.services.length)??0,_=j-P,O=(i==null?void 0:i.length)??0,N=(n?(n.os>0?1:0)+(n.engine>0?1:0)+(n.swap>0?1:0)+(n.models>0?1:0):0)+(((Y=n==null?void 0:n.components)==null?void 0:Y.filter(M=>M.update===!0).length)??0),C=u!=null&&u.available?u.open_count:0,R=d!=null&&d.available?d.items.filter(M=>M.status==="blocked").length:0,z=s?[s.gateway,s.memory,s.desktop_gateway]:[],F=z.filter(M=>M==null?void 0:M.ok).length,V=s?s.gateway.ok?s.memory.ok?s.desktop_gateway.ok?"":"Desktop-Gateway":"Gedächtnis-Leitung":"Modell-Leitung":"",Q=(ae=t==null?void 0:t.models)==null?void 0:ae.find(M=>M.role==="hermes"),B=Q!=null&&Q.name?(X=Q.name.split("/").pop())==null?void 0:X.replace(/\.gguf$/i,""):"",ue=i?i.filter(M=>["auto","agent","hermes"].includes(M.source)).length:0,G=r==null?void 0:r.services.filter(M=>!M.ok).map(M=>M.name).join(", "),le=n?[n.os>0&&"OS",n.engine>0&&"Engine",n.swap>0&&"Swap",n.models>0&&"Modelle"].filter(Boolean):[],fe=le.length>0?le.join(" + "):"";return x.jsxs("div",{className:"space-y-6",children:[x.jsxs("div",{children:[x.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Cockpit"}),x.jsx("p",{className:"text-sm text-muted-foreground",children:"Deine Box auf einen Blick — Details hinter jeder Kachel."})]}),x.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 items-start",children:[x.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[x.jsx(vQ,{verdict:f.verdict,memory:f.memory,warns:f.warns,problems:f.problems}),x.jsx(V3,{}),x.jsxs("section",{children:[x.jsx(xd,{children:"Leistung"}),x.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[x.jsx(uQ,{}),x.jsx(cQ,{})]}),x.jsx("div",{className:"mt-4",children:x.jsx(pQ,{})})]}),x.jsxs("section",{children:[x.jsx(xd,{children:"Bereiche"}),x.jsxs("div",{className:"grid gap-4 grid-cols-2 md:grid-cols-3",children:[x.jsx(Io,{icon:Fy,title:"Auftragsbuch",value:u!=null&&u.available?C:"—",unit:C===1?"Vorschlag":"Vorschläge",tone:u?R>0||C>0?"warn":"ok":"loading",hint:R>0?`${R} Karte${R===1?"":"n"} wartet auf deine Antwort`:C>0?`${C} offene Patches`:"Keine ausstehenden Vorschläge",onClick:()=>e("auftraege")}),x.jsx(Io,{icon:FP,title:"Modelle",value:k,unit:"warm",tone:k>0?"ok":"muted",hint:B?`Hirn: ${B}`:"Kein Hermes-Modell geladen",onClick:()=>e("models")}),x.jsx(Io,{icon:zy,title:"Gedächtnis",value:i?O:"…",unit:"Notizen",tone:i?"ok":"loading",hint:i?`${O} Fakten (${ue} auto gelernt)`:"Gedächtnis-Pool laden...",onClick:()=>e("memory")}),x.jsx(Io,{icon:Nf,title:"Dienste",value:r?`${P}/${j}`:"…",unit:"laufen",tone:r?_>0?"warn":"ok":"loading",hint:G?`Ausfall: ${G}`:"Alle Dienste online",onClick:()=>Of("maintenance")}),x.jsx(Io,{icon:Uy,title:"Updates",value:n?N>0?N:"0":"…",unit:N>0?"bereit":"aktuell",tone:n?N>0?"warn":"ok":"loading",hint:N>0?`Verfügbar: ${fe}`:"Alles auf dem neuesten Stand",onClick:()=>Of("maintenance")}),x.jsx(Io,{icon:By,title:"Verbinden",value:s?`${F}/${z.length}`:"…",unit:"Leitungen",tone:s?F===z.length?"ok":"warn":"loading",hint:V?`Gestört: ${V}`:"Hermes Desktop & IDEs bereit",onClick:()=>e("connect")})]})]})]}),x.jsxs("div",{className:"space-y-6",children:[x.jsx(yQ,{problems:f.problems,pendingCount:N,openAuftraege:C,blockedIdeen:R,busy:b,onRepair:S,onNavigate:e}),x.jsxs("section",{children:[x.jsx(xd,{children:"Anstehendes"}),x.jsx(q3,{})]}),x.jsxs("section",{children:[x.jsx(xd,{children:"Werkzeuge & Diagnose"}),x.jsx(gQ,{agent:o,svcErrors:_,onNavigate:e})]})]})]}),m]})}function xd({children:e}){return x.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:e})}function vQ({verdict:e,memory:t,warns:r,problems:n}){const i=r.length?`${r[0].label}: ${r[0].detail}${r.length>1?` (+${r.length-1} weitere)`:""}`:t.status==="full"?t.text:"Nichts Schlimmes — nur ein Hinweis.",o=n.length?`${n[0].label}: ${n[0].detail}${n.length>1?` (+${n.length-1} weitere)`:""}`:"Ein wichtiger Dienst hakt.",s={loading:{ring:"border-border/60 bg-card/45",icon:_f,iconCls:"text-muted-foreground animate-spin",title:"Box wird geprüft …",sub:"Einen Moment."},gut:{ring:"border-emerald-500/40 bg-emerald-500/5",icon:uT,iconCls:"text-emerald-400",title:"Box gesund",sub:"Alle wichtigen Dienste laufen."},warn:{ring:"border-amber-500/40 bg-amber-500/5",icon:Gs,iconCls:"text-amber-400",title:"Kleinigkeit an der Box",sub:i},problem:{ring:"border-red-500/50 bg-red-500/5",icon:Gs,iconCls:"text-red-400",title:"Box braucht Hilfe",sub:o}}[e],u=s.icon,d={ok:"text-emerald-400",warn:"text-amber-400",full:"text-red-400",unknown:"text-muted-foreground"}[t.status],f={ok:"bg-emerald-500",warn:"bg-amber-500",full:"bg-red-500",unknown:"bg-muted-foreground/40"}[t.status];return x.jsxs("div",{className:Re("flex flex-col gap-4 rounded-2xl border p-5 shadow-lg shadow-black/15 backdrop-blur-md transition-colors sm:flex-row sm:items-center sm:justify-between h-full",s.ring),children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-border/40 bg-background/30",children:x.jsx(u,{className:Re("h-6 w-6",s.iconCls)})}),x.jsxs("div",{className:"min-w-0",children:[x.jsx("h2",{className:"text-base font-bold tracking-tight text-foreground",children:s.title}),x.jsx("p",{className:"text-xs text-muted-foreground",children:s.sub})]})]}),x.jsxs("div",{className:"w-full max-w-[16rem] rounded-xl border border-border/30 bg-background/20 p-3",children:[x.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[11px]",children:[x.jsxs("span",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-wider text-muted-foreground",children:[x.jsx(sT,{className:"h-3.5 w-3.5"})," Speicher"]}),x.jsx("span",{className:Re("font-mono font-bold",d),children:t.status==="unknown"?"—":`${t.usedGb.toFixed(1)} / ${t.totalGb.toFixed(1)} GB`})]}),x.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full border border-border/30 bg-background/50",children:x.jsx("div",{className:Re("h-full rounded-full transition-all duration-500",f),style:{width:`${t.pct}%`}})})]})]})}function yQ({problems:e,pendingCount:t,openAuftraege:r,blockedIdeen:n,busy:i,onRepair:o,onNavigate:s}){const u=t>0,d=r>0,f=n>0,h=e.length===0&&!u&&!d&&!f;return x.jsx("div",{className:"h-full flex flex-col justify-between",children:h?x.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-emerald-500/25 bg-emerald-500/5 p-4 h-full",children:[x.jsx(XM,{className:"h-5 w-5 shrink-0 text-emerald-400"}),x.jsxs("div",{children:[x.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Nichts zu tun"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Alles läuft. Du musst gerade nichts abnicken."})]})]}):x.jsxs("div",{className:"space-y-2 h-full flex flex-col justify-center",children:[e.map(m=>x.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-2xl border border-red-500/25 bg-red-500/5 p-4",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3 w-full",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-red-500/30 bg-background/30 text-red-300",children:x.jsx(m.icon,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:"text-sm font-bold text-foreground",children:m.label}),x.jsx("p",{className:"truncate text-xs text-muted-foreground",children:m.detail})]})]}),m.repair&&x.jsxs("button",{onClick:()=>m.repair&&o(m.id,m.repair),disabled:!!i[m.id],className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 text-[11px] font-bold uppercase tracking-wide text-red-300 transition-all hover:bg-red-500/20 cursor-pointer disabled:opacity-60 w-full sm:w-auto justify-center",children:[i[m.id]?x.jsx(_f,{className:"h-3.5 w-3.5 animate-spin"}):x.jsx(PT,{className:"h-3.5 w-3.5"}),m.repair.label]})]},m.id)),f&&x.jsxs("button",{onClick:()=>s("auftraege"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-red-500/30 bg-red-500/5 p-4 text-left transition-all hover:bg-red-500/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-red-500/30 bg-background/30 text-red-300",children:x.jsx(BP,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[n," Karte",n===1?"":"n"," braucht deine Antwort"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Die Box hängt an einer Frage und wartet auf dich."})]})]}),x.jsx(Ko,{className:"h-4 w-4 shrink-0 text-red-300/70"})]}),d&&x.jsxs("button",{onClick:()=>s("auftraege"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-primary/30 bg-primary/5 p-4 text-left transition-all hover:bg-primary/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-primary/30 bg-background/30 text-primary",children:x.jsx(Fy,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[r," Vorschl",r===1?"ag":"äge"," im Auftragsbuch"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Annehmen oder ablehnen."})]})]}),x.jsx(Ko,{className:"h-4 w-4 shrink-0 text-primary/70"})]}),u&&x.jsxs("button",{onClick:()=>Of("maintenance"),className:"flex w-full items-center justify-between gap-3 rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-left transition-all hover:bg-amber-500/10 cursor-pointer",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-amber-500/30 bg-background/30 text-amber-300",children:x.jsx(Uy,{className:"h-4.5 w-4.5"})}),x.jsxs("div",{children:[x.jsxs("p",{className:"text-sm font-bold text-foreground",children:[t," Update",t===1?"":"s"," bereit"]}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Ansehen und entscheiden."})]})]}),x.jsx(Ko,{className:"h-4 w-4 shrink-0 text-amber-300/70"})]})]})})}function gQ({agent:e,svcErrors:t,onNavigate:r}){const n=[{label:"Hermes Agent",status:e?e.gateway_reachable?"Bereit":"Offline":"…",tone:e?e.gateway_reachable?"ok":"alert":"loading",action:()=>r("agent")},{label:"Konsole (Box-Shell)",status:e?e.box_console_reachable?"Bereit":"Offline":"…",tone:e?e.box_console_reachable?"ok":"warn":"loading",action:()=>r("konsole")},{label:"Systemlogs & Diagnose",status:t>0?`${t} Fehler`:"Keine Fehler",tone:t>0?"alert":"ok",action:()=>Of("logs")},{label:"Wissens-Vault",status:"Öffnen",tone:"muted",action:()=>r("wissen")},{label:"Chronik & Zeitmaschine",status:"Öffnen",tone:"muted",action:()=>r("chronik")}];return x.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/30 p-4 space-y-3 shadow-sm",children:x.jsx("div",{className:"divide-y divide-border/20",children:n.map((i,o)=>{const s={loading:"bg-muted-foreground/45 animate-pulse",ok:"bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.4)]",warn:"bg-amber-500 shadow-[0_0_8px_rgba(245,158,11,0.4)]",alert:"bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.4)]",muted:"bg-muted-foreground/30"}[i.tone];return x.jsxs("button",{onClick:i.action,className:"w-full py-2.5 px-1.5 flex items-center justify-between text-left hover:bg-card/45 rounded-lg transition-all group cursor-pointer text-xs",children:[x.jsx("span",{className:"text-muted-foreground group-hover:text-foreground transition-colors font-medium",children:i.label}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:Re("text-[10px] font-semibold font-mono",i.tone==="ok"?"text-emerald-400":i.tone==="warn"?"text-amber-400":i.tone==="alert"?"text-red-400":"text-muted-foreground/60"),children:i.status}),x.jsx("span",{className:Re("h-1.5 w-1.5 rounded-full",s)})]})]},o)})})})}const xQ=g.lazy(()=>In(()=>import("./ModelsView-DJY7Fh_a.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ModelsView}))),bQ=g.lazy(()=>In(()=>import("./ConnectView-3IcUm9UA.js"),__vite__mapDeps([3,4,5,6])).then(e=>({default:e.ConnectView}))),wQ=g.lazy(()=>In(()=>import("./MemoryView-BlWBcP2e.js"),__vite__mapDeps([7,6,8,9])).then(e=>({default:e.MemoryView}))),SQ=g.lazy(()=>In(()=>import("./AgentView-wFJrgQGO.js"),[]).then(e=>({default:e.AgentView}))),kQ=g.lazy(()=>In(()=>import("./KonsoleView-Bu2aIhkH.js"),[]).then(e=>({default:e.KonsoleView}))),EQ=g.lazy(()=>In(()=>import("./GuideView-CSDxY6O5.js"),__vite__mapDeps([10,9,2,11])).then(e=>({default:e.GuideView}))),PQ=g.lazy(()=>In(()=>import("./AuftragsbuchView-BL9FfDFw.js"),__vite__mapDeps([12,11,8])).then(e=>({default:e.AuftragsbuchView}))),AQ=g.lazy(()=>In(()=>import("./ChronikView-B7R_z6Jw.js"),__vite__mapDeps([13,1])).then(e=>({default:e.ChronikView}))),OQ=g.lazy(()=>In(()=>import("./EigenlebenView-BYo9hkxa.js"),__vite__mapDeps([14,9,5])).then(e=>({default:e.EigenlebenView}))),CQ=g.lazy(()=>In(()=>import("./WissenView-BXuHzW6u.js"),__vite__mapDeps([15,4])).then(e=>({default:e.WissenView})));function jQ(){return x.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:x.jsx(_f,{className:"h-5 w-5 animate-spin","aria-label":"Lädt …"})})}const _Q=/Mac|iPhone|iPad/.test(navigator.platform);function NQ(){U3(),g3();const[e,t]=g.useState(()=>{const S=window.location.hash.slice(1);return qo.some(k=>k.id===S)?S:"dashboard"}),r=g.useCallback(S=>{window.location.hash.slice(1)===S?t(S):window.location.hash=S},[]),[n,i]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[o,s]=g.useState(!1),[u,d]=g.useState(!1),[f,h]=g.useState("maintenance"),{data:m,isError:y}=IA(),{data:b}=$f();g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const S=k=>{var j;h(((j=k.detail)==null?void 0:j.tab)||"maintenance"),d(!0)};return window.addEventListener("open-system-drawer",S),()=>window.removeEventListener("open-system-drawer",S)},[]),g.useEffect(()=>{const S=k=>{var j;const P=(j=k.detail)==null?void 0:j.view;P&&r(P)};return window.addEventListener("mc-navigate",S),()=>window.removeEventListener("mc-navigate",S)},[r]),g.useEffect(()=>{const S=()=>{const k=window.location.hash.slice(1);qo.some(P=>P.id===k)&&t(k)};return window.addEventListener("hashchange",S),()=>window.removeEventListener("hashchange",S)},[]),g.useEffect(()=>{s(!1)},[e]);const E=qo.find(S=>S.id===e);return x.jsxs("div",{className:"flex h-full relative",children:[x.jsx("div",{className:"fixed inset-0 -z-50 pointer-events-none",style:{backgroundColor:"hsl(224,30%,6%)",backgroundImage:["radial-gradient(45% 40% at 12% 8%, hsl(172 72% 50% / 0.10), transparent 70%)","radial-gradient(50% 45% at 88% 92%, hsl(270 70% 60% / 0.10), transparent 70%)","radial-gradient(40% 35% at 75% 30%, hsl(239 70% 62% / 0.07), transparent 70%)"].join(", ")}}),x.jsx(MR,{onNavigate:r}),x.jsx($3,{open:u,onClose:()=>d(!1),defaultTab:f}),x.jsx("aside",{className:Re("hidden md:flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:x.jsx(mP,{collapsed:n,onToggleCollapse:()=>{i(S=>{const k=!S;return localStorage.setItem("mc_sidebar_collapsed",k.toString()),k})},view:e,health:m,backendDown:y,sysStatus:b})}),x.jsxs("div",{className:Re("md:hidden fixed inset-0 z-50 transition-opacity duration-200",o?"opacity-100":"pointer-events-none opacity-0"),"aria-hidden":!o,children:[x.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:()=>s(!1)}),x.jsx("aside",{className:Re("absolute inset-y-0 left-0 flex w-72 max-w-[85vw] flex-col border-r border-border/40 bg-[hsl(224,28%,8%)] transition-transform duration-300 ease-in-out",o?"translate-x-0":"-translate-x-full"),children:x.jsx(mP,{collapsed:!1,onClose:()=>s(!1),view:e,health:m,backendDown:y,sysStatus:b})})]}),x.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[x.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between gap-3 border-b border-border/40 px-4 md:px-6 bg-card/20 backdrop-blur-sm",children:[x.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[x.jsx("button",{onClick:()=>s(!0),className:"md:hidden p-1.5 -ml-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation öffnen",children:x.jsx(pT,{className:"h-5 w-5","aria-hidden":"true"})}),x.jsx("div",{className:"truncate text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:E.hint})]}),x.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[x.jsx(m3,{}),x.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"hidden sm:flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),x.jsxs("button",{onClick:()=>{const S=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(S)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[x.jsx(nT,{className:"h-3.5 w-3.5"}),x.jsx("span",{className:"hidden sm:inline",children:"Suchen"}),x.jsx("kbd",{className:"hidden sm:inline rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:_Q?"⌘K":"Strg+K"})]})]})]}),x.jsx("main",{className:"flex-1 overflow-y-auto p-4 md:p-6 scrollbar-thin",children:x.jsxs(g.Suspense,{fallback:x.jsx(jQ,{}),children:[e==="dashboard"&&x.jsx(mQ,{onNavigate:S=>r(S)}),e==="auftraege"&&x.jsx(PQ,{}),e==="models"&&x.jsx(xQ,{}),e==="connect"&&x.jsx(bQ,{}),e==="memory"&&x.jsx(wQ,{}),e==="wissen"&&x.jsx(CQ,{}),e==="chronik"&&x.jsx(AQ,{}),e==="eigenleben"&&x.jsx(OQ,{}),e==="agent"&&x.jsx(SQ,{}),e==="konsole"&&x.jsx(kQ,{}),e==="guide"&&x.jsx(EQ,{})]})})]})]})}function mP({collapsed:e,onToggleCollapse:t,onClose:r,view:n,health:i,backendDown:o,sysStatus:s}){var u,d,f,h,m;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:Re("flex items-center py-4 border-b border-border/40 shrink-0",e?"flex-col gap-3 px-2":"justify-between px-5"),children:[x.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[x.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!e&&x.jsxs("div",{className:"leading-tight",children:[x.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),x.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),t&&x.jsx("button",{onClick:t,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":e?"Seitenleiste ausklappen":"Seitenleiste einklappen",title:e?"Maximieren":"Minimieren",children:e?x.jsx(Ko,{className:"h-4 w-4","aria-hidden":"true"}):x.jsx(JM,{className:"h-4 w-4","aria-hidden":"true"})}),r&&x.jsx("button",{onClick:r,className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":"Navigation schließen",children:x.jsx(bu,{className:"h-4 w-4","aria-hidden":"true"})})]}),x.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:(()=>{let y=null;return qo.map(b=>{const E=b.group!==y;return y=b.group,x.jsxs("div",{className:"space-y-1",children:[E&&(e?y!==qo[0].group&&x.jsx("div",{className:"my-3 border-t border-border/30"}):x.jsx("div",{className:"mt-5 mb-1.5 px-3 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/40 first:mt-0 select-none",children:b.group})),x.jsxs("a",{href:`#${b.id}`,onClick:r,"aria-current":n===b.id?"page":void 0,className:Re("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",e?"justify-center p-2.5":"gap-3 px-3 py-2",n===b.id?e?"nav-active-collapsed":"nav-active":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:e?b.label:void 0,"aria-label":e?b.label:void 0,children:[x.jsx(b.icon,{className:"h-4.5 w-4.5 shrink-0","aria-hidden":"true"}),!e&&x.jsx("span",{className:"truncate",children:b.label})]})]},b.id)})})()}),x.jsx("div",{className:Re("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",e?"px-2 text-center":"px-5"),children:e?x.jsx("div",{className:"flex justify-center",children:x.jsx("span",{className:Re("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",o||!i?"bg-red-500":i.engine_reachable?i.brain&&!i.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500"),title:o?"Zentrale antwortet nicht — Anzeigen evtl. veraltet":i?i.engine_reachable?i.brain&&!i.brain.ready?`Hirn offline (${i.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):x.jsxs("div",{className:"space-y-2 text-left",children:[o?x.jsxs("span",{className:"flex items-center gap-2 text-red-400",children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500 animate-pulse"}),x.jsx("span",{className:"truncate",children:"Zentrale antwortet nicht"})]}):i?x.jsxs(x.Fragment,{children:[x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:Re("h-2 w-2 rounded-full animate-pulse",i.engine_reachable?"bg-emerald-500":"bg-amber-500")}),x.jsxs("span",{className:"truncate",children:["Engine ",i.engine_reachable?"online":"offline"]})]}),i.brain&&!i.brain.ready&&x.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${i.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),x.jsxs("span",{className:"truncate",children:["Hirn offline",i.brain.model?` (${i.brain.model})`:""]})]})]}):x.jsxs("span",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",x.jsx("span",{className:"truncate",children:"Backend offline"})]}),(s==null?void 0:s.versions)&&x.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[x.jsxs("div",{className:"truncate",title:s.versions.mc2?`${s.versions.mc2.branch}-${s.versions.mc2.hash}${s.versions.mc2.dirty?"*":""} (${s.versions.mc2.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"MC2:"})," ",s.versions.mc2?`${s.versions.mc2.hash}${s.versions.mc2.dirty?"*":""}`:"—"]}),x.jsxs("div",{className:"truncate",title:((u=s.versions.engine)==null?void 0:u.type)==="git"?`${s.versions.engine.branch}-${s.versions.engine.hash}${s.versions.engine.dirty?"*":""} (${s.versions.engine.date})`:((d=s.versions.engine)==null?void 0:d.version_text)||"unbekannt",children:[x.jsx("strong",{children:"Engine:"})," ",((f=s.versions.engine)==null?void 0:f.type)==="git"?`${s.versions.engine.hash}${s.versions.engine.dirty?"*":""}`:((m=(h=s.versions.engine)==null?void 0:h.version_text)==null?void 0:m.split(" ").pop())||"—"]}),x.jsxs("div",{className:"truncate",title:s.versions.hermes_agent?`${s.versions.hermes_agent.branch}-${s.versions.hermes_agent.hash}${s.versions.hermes_agent.dirty?"*":""} (${s.versions.hermes_agent.date})`:"nicht gefunden",children:[x.jsx("strong",{children:"Hermes Agent:"})," ",s.versions.hermes_agent?`${s.versions.hermes_agent.hash}${s.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]})}class IQ extends Ty.Component{constructor(){super(...arguments);ws(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,n){console.error("Unbehandelter UI-Fehler:",r,n.componentStack)}render(){return this.state.error?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-neutral-950 text-neutral-200 p-8",children:x.jsxs("div",{className:"max-w-lg space-y-4 text-center",children:[x.jsx("div",{className:"text-2xl",children:"Da ist etwas schiefgelaufen."}),x.jsx("div",{className:"text-sm text-neutral-400 break-all",children:this.state.error.message}),x.jsx("button",{className:"px-4 py-2 rounded-lg bg-neutral-800 hover:bg-neutral-700 border border-neutral-700",onClick:()=>window.location.reload(),children:"Neu laden"})]})}):this.props.children}}const MQ=new CM({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});rM.createRoot(document.getElementById("root")).render(x.jsx(Ty.StrictMode,{children:x.jsx(IQ,{children:x.jsx(jM,{client:MQ,children:x.jsx(NQ,{})})})}));export{DQ as $,ET as A,zy as B,XM as C,ZM as D,Ov as E,KQ as F,DA as G,sT as H,qQ as I,O3 as J,B1 as K,_f as L,Ko as M,eT as N,C3 as O,H1 as P,BQ as Q,kT as R,xT as S,Gs as T,HP as U,tT as V,Wy as W,bu as X,A3 as Y,iT as Z,In as _,P3 as a,jf as a0,VM as a1,PT as a2,Vo as a3,ST as a4,As as a5,Nf as a6,FP as a7,By as a8,oT as a9,x3 as aa,b3 as ab,LQ as ac,BP as ad,Fy as ae,w3 as af,cT as ag,qM as ah,vT as ai,Uy as aj,uT as ak,S3 as al,FQ as am,W1 as an,zQ as ao,aT as ap,hT as aq,lf as ar,Ty as as,su as at,Sk as au,M8 as av,Ng as aw,hk as ax,fk as ay,My as az,Yy as b,ke as c,YQ as d,Re as e,Mm as f,Me as g,WQ as h,$Q as i,x as j,GM as k,MA as l,UQ as m,$f as n,HQ as o,GQ as p,De as q,g as r,RQ as s,VQ as t,xu as u,No as v,RR as w,UP as x,yT as y,QQ as z}; diff --git a/frontend/dist/assets/lightbulb-B-eiNc3G.js b/frontend/dist/assets/lightbulb-Btbex65P.js similarity index 90% rename from frontend/dist/assets/lightbulb-B-eiNc3G.js rename to frontend/dist/assets/lightbulb-Btbex65P.js index 247acea..2a06710 100644 --- a/frontend/dist/assets/lightbulb-B-eiNc3G.js +++ b/frontend/dist/assets/lightbulb-Btbex65P.js @@ -1,4 +1,4 @@ -import{c as t}from"./index-D94Dzyvg.js";/** +import{c as t}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/rotate-ccw--ed6DlAf.js b/frontend/dist/assets/rotate-ccw-ChVZWN8g.js similarity index 88% rename from frontend/dist/assets/rotate-ccw--ed6DlAf.js rename to frontend/dist/assets/rotate-ccw-ChVZWN8g.js index c9aad36..469773d 100644 --- a/frontend/dist/assets/rotate-ccw--ed6DlAf.js +++ b/frontend/dist/assets/rotate-ccw-ChVZWN8g.js @@ -1,4 +1,4 @@ -import{c as t}from"./index-D94Dzyvg.js";/** +import{c as t}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/send-DyDlsXyV.js b/frontend/dist/assets/send-COuI40dq.js similarity index 90% rename from frontend/dist/assets/send-DyDlsXyV.js rename to frontend/dist/assets/send-COuI40dq.js index f68766f..01bb21c 100644 --- a/frontend/dist/assets/send-DyDlsXyV.js +++ b/frontend/dist/assets/send-COuI40dq.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-D94Dzyvg.js";/** +import{c as a}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/zap-Ds7DtEXe.js b/frontend/dist/assets/zap-Df-ORHkh.js similarity index 97% rename from frontend/dist/assets/zap-Ds7DtEXe.js rename to frontend/dist/assets/zap-Df-ORHkh.js index f74c212..e118109 100644 --- a/frontend/dist/assets/zap-Ds7DtEXe.js +++ b/frontend/dist/assets/zap-Df-ORHkh.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-D94Dzyvg.js";/** +import{c as a}from"./index-CQgUnd1p.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 8f3abab..e07db4f 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/views/AgentView.tsx b/frontend/src/views/AgentView.tsx index 41183b4..00e43a6 100644 --- a/frontend/src/views/AgentView.tsx +++ b/frontend/src/views/AgentView.tsx @@ -236,15 +236,14 @@ export function AgentView() { Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden.

- Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im OS & Updates Drawer prüfen und die Dienste bei Bedarf neu starten. + Am schnellsten: In der System-Schublade unter Dienste den Eintrag{" "} + Hermes-Gateway mit einem Klick neu starten (dort gibt es auch die Logs dazu).

- -
-
# Dienste manuell auf der Box prüfen:
-
systemctl --user status hermes-gateway
-
systemctl --user status hermes-builtin-ui
-
- +

Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei: docs/HERMES_SETUP.md. diff --git a/frontend/src/views/AuftragsbuchView.tsx b/frontend/src/views/AuftragsbuchView.tsx index 14747e0..f28aa0c 100644 --- a/frontend/src/views/AuftragsbuchView.tsx +++ b/frontend/src/views/AuftragsbuchView.tsx @@ -36,6 +36,9 @@ function fmtWhen(ts: number | null | undefined): string { export function AuftragsbuchView() { const { data, isLoading, refetch, isFetching } = useAuftragsbuch() + // Geteilter Cache mit der IdeenSection — hier nur fürs ehrliche "Nichts zu entscheiden"- + // Banner (eine hängende Karte direkt darunter widerspräche dem grünen Häkchen). + const { data: ideenData } = useIdeen() const qc = useQueryClient() const { showAlert, showConfirm, dialogElement } = useDialog() const [busy, setBusy] = useState>({}) @@ -57,7 +60,8 @@ export function AuftragsbuchView() { const items = data?.items ?? [] const kandidaten = data?.skill_kandidaten ?? [] - const empty = items.length === 0 && kandidaten.length === 0 + const blockedIdeen = ideenData?.available ? ideenData.items.filter((i) => i.status === "blocked").length : 0 + const empty = items.length === 0 && kandidaten.length === 0 && blockedIdeen === 0 return (

@@ -102,7 +106,7 @@ export function AuftragsbuchView() { {items.length > 0 && (
- Fertige Patches ({items.length}) + Patch-Vorschläge ({items.length}) {items.map((it) => ( ))} @@ -243,7 +247,7 @@ function IdeenSection() {

Eine Queue, alle Türen: hier, per Telegram oder im Gespräch mit Lucy. Die Box arbeitet Ideen selbst - aus und baut — Code-Ergebnisse erscheinen als Karte unter „Fertige Patches“, nichts davon geht ohne + aus und baut — Code-Ergebnisse erscheinen als Karte unter „Patch-Vorschläge“, nichts davon geht ohne deinen Klick live. Nur reine Doku-Bagatellen zieht die Box nachts selbst ein (mit Fangnetz und Meldung).

diff --git a/frontend/src/views/EigenlebenView.tsx b/frontend/src/views/EigenlebenView.tsx index 2239baa..2261db5 100644 --- a/frontend/src/views/EigenlebenView.tsx +++ b/frontend/src/views/EigenlebenView.tsx @@ -30,6 +30,14 @@ const HERKUNFT_UI: Record = { + disabled: "abgeschaltet", + deprecated: "veraltet", + broken: "defekt", + error: "Fehler", +} + function datumKurz(iso: string | null): string { if (!iso) return "—" const d = new Date(iso) @@ -169,7 +177,9 @@ function SkillKarte({ skill }: { skill: EigenlebenSkill }) { )} {skill.status !== "active" && ( - {skill.status} + + {STATUS_LABEL[skill.status] ?? skill.status} + )}

diff --git a/frontend/src/views/KonsoleView.tsx b/frontend/src/views/KonsoleView.tsx index d49bae2..d3f52b5 100644 --- a/frontend/src/views/KonsoleView.tsx +++ b/frontend/src/views/KonsoleView.tsx @@ -1,5 +1,7 @@ -import { SquareTerminal, ExternalLink, AlertTriangle } from "lucide-react" -import { useAgentStatus } from "@/lib/queries" +import { useState } from "react" +import { SquareTerminal, ExternalLink, AlertTriangle, RefreshCw } from "lucide-react" +import { api } from "@/lib/api" +import { useAgentStatus, useQueryClient, qk, invalidate } from "@/lib/queries" import { resolveExternalUrl, cn } from "@/lib/utils" // Konsole = direkter, SSH-artiger Box-Zugriff (ttyd → Login-Shell auf :7682), eingebettet @@ -7,8 +9,28 @@ import { resolveExternalUrl, cn } from "@/lib/utils" // Terminal selbst). Die Passwort-Verwaltung liegt in System-Wartung → Einstellungen. export function KonsoleView() { const { data: agent } = useAgentStatus() + const qc = useQueryClient() const url = agent?.box_console_url ? resolveExternalUrl(agent.box_console_url) : undefined const ok = agent?.box_console_reachable + const [restarting, setRestarting] = useState(false) + const [restartMsg, setRestartMsg] = useState("") + + // Ein-Klick-Reparatur statt SSH-Anweisung: box-console ist ein normaler User-Dienst. + async function restartConsole() { + setRestarting(true) + setRestartMsg("") + try { + const r = await api<{ ok: boolean; err?: string }>("/api/maintenance/restart", { + method: "POST", body: JSON.stringify({ service: "box-console" }), + }) + setRestartMsg(r.ok ? "Neu gestartet — einen Moment, dann lädt das Terminal." : `Fehlgeschlagen: ${r.err || "Unbekannter Fehler"}`) + invalidate(qc, qk.agentStatus, qk.services) + } catch (e: any) { + setRestartMsg(`Fehlgeschlagen: ${e?.message || e}`) + } finally { + setRestarting(false) + } + } return (

@@ -42,9 +64,13 @@ export function KonsoleView() {
Konsole nicht erreichbar

- Der box-console-Dienst (ttyd) läuft nicht. - Auf der Box: systemctl --user restart box-console. + Der Terminal-Dienst (box-console) läuft gerade nicht.

+ + {restartMsg &&

{restartMsg}

}
)}