Files
mission-control-v2/frontend/dist/assets/AuftragsbuchView-DZdqTLzA.js
T
Hitonabi 0cea01c699 Konzept nachschaerfen: Rueckmeldung statt nur annehmen-oder-wegwerfen
Nach dem Lesen eines Konzepts gab es bisher nur zwei Wege: "Gefaellt mir" oder
archivieren. Der haeufige Fall fehlte komplett — EIN Punkt passt nicht und der
Commander hat einen besseren Vorschlag.

- POST /api/ideen/nachschaerfen -> konzept_ueberarbeiten(): legt eine neue
  Idee-Karte an (kein Bau), verkettet an die Quell-Karte, mit dem Wortlaut der
  Rueckmeldung. Auftrag: bestehendes Konzept lesen, genannte Punkte UND deren
  Folgewirkungen aendern, Rest stehen lassen, kurzer Haertetest nur auf die
  geaenderten Teile. Schafft der Vorschlag ein Problem: einbauen UND die Folge
  sichtbar in die Risiken schreiben — nicht uebergehen, nicht schoenreden.
  Die neue Fassung geht an DIESELBE Stelle (Repo-Commit bzw. Datei + .bak), so
  zeigt "Konzept" ueberall den frischen Stand. Beliebig oft wiederholbar, weil
  die Ueberarbeitung selbst wieder eine Idee-Karte ist.
- UI: Rueckmeldefeld direkt unter dem gelesenen Konzept, ueber dem
  Gefaellt-mir-Weg (der haeufigere Fall gehoert nach oben und offen sichtbar).
- SOUL: neuer Sonderfall UEBERARBEITUNG (Schritt 2 entfaellt, kein zweites Repo).

Zwei Fehler nebenbei gefunden und behoben:
- _wo_liegt(): der Auftrag verwechselte "Repo bekannt" mit "Konzept kommt aus
  dem Repo". Faellt MC2 auf die lokale Datei zurueck, stand vorher "liegt im
  Repo als <lokaler Dateiname>" im Auftrag — eine Datei, die es dort nie gab.
- SOUL-Regel 4: der Push gilt erst als erledigt, wenn `git ls-remote` ihn
  BEWEIST. Ein Worker hat am 21.07. genau hier abgekuerzt, Erfolg gemeldet, und
  das Repo war nachher nicht auffindbar.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 09:05:34 +02:00

50 lines
50 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{c as P,j as e,e as v,aa as Ne,ab as he,u as me,b as pe,r as o,a3 as J,L as S,C as ge,U as be,ac as we,V as Y,X as Z,T as R,D as $,M as T,g as B,ad as ve,ae as fe,af as ye,q as ke}from"./index-DZ34eLRy.js";import{L as _}from"./lightbulb-CUD1a5ov.js";import{C as V}from"./code-xml-CCSjVAVc.js";import{S as xe}from"./send-DrbIxJOY.js";import{L as De}from"./layers-a89ag0RB.js";import{R as Se}from"./rotate-ccw-DRxIaGHA.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 Ce=P("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
* @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 ze=P("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
* @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 Ke=P("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 Ae=P("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 Ee=P("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 Be=P("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/**
* @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=P("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"}]]);/**
* @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=P("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);function Le({text:t,className:a}){const x=(t||"").split(`
`),s=[];let d=[],h=null;const c=g=>{d.length&&(s.push(e.jsx("ul",{className:"mb-3 ml-4 list-disc space-y-1",children:d},g)),d=[])};return x.forEach((g,i)=>{const l=`l${i}`;if(h!==null){g.trimEnd()==="```"?(s.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:h.join(`
`)},l)),h=null):h.push(g);return}if(g.trimStart().startsWith("```")){c(l),h=[];return}const b=g.trimEnd();if(!b.trim()){c(l);return}const n=b.match(/^(#{1,4})\s+(.*)$/);if(n){c(l);const w=n[1].length,m=w===1?"text-base font-bold mt-1 mb-2":w===2?"text-sm font-bold mt-4 mb-1.5":"text-xs font-bold mt-3 mb-1 uppercase tracking-wide text-muted-foreground";s.push(e.jsx("p",{className:v(m,"font-space text-foreground"),children:H(n[2],l)},l));return}const k=b.match(/^\s*[-*•]\s+(.*)$/);if(k){d.push(e.jsx("li",{className:"text-xs leading-relaxed text-foreground/85",children:H(k[1],l)},l));return}const y=b.match(/^\s*\d+\.\s+(.*)$/);if(y){d.push(e.jsx("li",{className:"text-xs leading-relaxed text-foreground/85",children:H(y[1],l)},l));return}c(l),s.push(e.jsx("p",{className:"mb-2 text-xs leading-relaxed text-foreground/85",children:H(b,l)},l))}),c("end"),h!==null&&s.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:h.join(`
`)},"code-end")),e.jsx("div",{className:v("max-w-3xl",a),children:s})}function H(t,a){return t.split(/(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g).map((s,d)=>{const h=`${a}-${d}`;return/^\*\*[^*]+\*\*$/.test(s)?e.jsx("b",{className:"font-semibold text-foreground",children:s.slice(2,-2)},h):/^\*[^*]+\*$/.test(s)?e.jsx("i",{children:s.slice(1,-1)},h):/^`[^`]+`$/.test(s)?e.jsx("code",{className:"rounded bg-background/50 px-1 font-mono text-[11px] text-foreground/90",children:s.slice(1,-1)},h):e.jsx("span",{children:s},h)})}const We={wartung:"Werkstatt",orchestrator:"Orchestrator",doku:"Doku",feature:"Feature"},Ie={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 te(t){return t?new Date(t*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}function et(){const{data:t,isLoading:a,refetch:x,isFetching:s}=Ne(),{data:d}=he(),h=me(),{showAlert:c,showConfirm:g,dialogElement:i}=pe(),[l,b]=o.useState({}),n=()=>h.invalidateQueries({queryKey:ke.auftragsbuch});async function k(p,N,A,L){b(D=>({...D,[p]:!0}));try{await B(N,{method:"POST",body:JSON.stringify(A)}),L&&c("Erledigt",L),n()}catch(D){c("Das hat nicht geklappt",String((D==null?void 0:D.message)||D))}finally{b(D=>({...D,[p]:!1}))}}const y=(t==null?void 0:t.items)??[],w=(t==null?void 0:t.skill_kandidaten)??[],m=d!=null&&d.available?d.items.filter(p=>p.status==="blocked").length:0,z=y.length===0&&w.length===0&&m===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:()=>x(),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(J,{className:v("h-3.5 w-3.5",s&&"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."}),a&&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(S,{className:"h-4 w-4 animate-spin"})," Vorschläge werden geladen …"]}),(t==null?void 0:t.available)&&z&&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(ge,{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(Te,{}),y.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs(X,{icon:Ee,children:["Patch-Vorschläge (",y.length,")"]}),y.map(p=>e.jsx(_e,{item:p,busy:l,onAct:k,showConfirm:g},`${p.repo??"mc2"}:${p.branch}`))]}),w.length>0&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs(X,{icon:be,children:["Skill-Kandidaten aus dem Traum (",w.length,")"]}),w.map(p=>e.jsx(Ze,{k:p,busy:l,onAct:k,showConfirm:g},p.file))]}),i]})}function X({icon:t,children:a}){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"})," ",a]})}const Re={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:"gleich dran",cls:"text-sky-300/80 border-sky-500/30 bg-sky-500/5"},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"}},Ve={box:{label:"BOX",icon:ee,cls:"border-border/60 bg-background/40 text-muted-foreground",title:"Box-Welt: die Werkstatt baut das selbst. Das Ergebnis kommt als Patch-Vorschlag zurück — nichts geht ohne deinen Klick live."},idee:{label:"IDEE",icon:_,cls:"border-sky-500/40 bg-sky-500/10 text-sky-300",title:"Nur durchdacht: die Box hat die Produkt-Idee mit voller Denk-Kaskade zu einem Konzept ausgearbeitet. Kein Gerüst, kein Bau — du liest es und entscheidest, ob ein Projekt draus wird."},projekt:{label:"IDE",icon:V,cls:"border-violet-500/40 bg-violet-500/10 text-violet-300",title:"IDE-Welt: die Box bereitet nur vor (Konzept + Repo + Doku, kein Code). Gebaut wird von dir in Zed."}},$e={needs_input:"Die Box hat eine Frage:",capability:"Die Box kam hier nicht weiter:",transient:"Die Aufgabe hakt:"};function Te(){var le,ie;const{data:t,isLoading:a}=he(),x=me(),{showAlert:s,showConfirm:d,dialogElement:h}=pe(),[c,g]=o.useState(""),[i,l]=o.useState("box"),b=i==="idee",n=i==="simpel"||i==="gruendlich",k=b||n,[y,w]=o.useState("lxc"),[m,z]=o.useState(!1),[p,N]=o.useState({}),[A,L]=o.useState(null),[D,M]=o.useState(null),[f,K]=o.useState({}),F=(t==null?void 0:t.items)??[],W=()=>x.invalidateQueries({queryKey:ke.ideen}),re=A!==null&&(((le=t==null?void 0:t.items.find(r=>r.id===A))==null?void 0:le.status)==="triage"||((ie=t==null?void 0:t.items.find(r=>r.id===A))==null?void 0:ie.status)==="running"),I=we(A??"",re);async function se(){const r=c.trim();if(!(r.length<3||m)){z(!0);try{const u=r.length>160?r.slice(0,157)+"…":r;await B("/api/ideen",{method:"POST",body:JSON.stringify({titel:u,notiz:r.length>160?r:"",welt:k?"ide":"box",tiefe:n?i:"",ziel:n?y:"",art:b?"idee":"projekt"})}),g(""),W()}catch(u){s("Das hat nicht geklappt",String((u==null?void 0:u.message)||u))}finally{z(!1)}}}async function je(r){N(u=>({...u,[r]:!0}));try{await B("/api/ideen/archivieren",{method:"POST",body:JSON.stringify({id:r})}),W()}catch(u){s("Das hat nicht geklappt",String((u==null?void 0:u.message)||u))}finally{N(u=>({...u,[r]:!1}))}}async function G(r,u,j,O){N(C=>({...C,[r+u]:!0}));try{await B(j,{method:"POST",body:JSON.stringify(O)}),W()}catch(C){s("Das hat nicht geklappt",String((C==null?void 0:C.message)||C))}finally{N(C=>({...C,[r+u]:!1}))}}async function ne(r){const u=(f[r]||"").trim();if(!(u.length<1||p["ans:"+r])){N(j=>({...j,["ans:"+r]:!0}));try{await B("/api/ideen/antwort",{method:"POST",body:JSON.stringify({id:r,antwort:u})}),K(j=>({...j,[r]:""})),W()}catch(j){s("Das hat nicht geklappt",String((j==null?void 0:j.message)||j))}finally{N(j=>({...j,["ans:"+r]:!1}))}}}const ae=r=>{var ce,ue;const u=Re[r.status]??{label:r.status,cls:"text-muted-foreground border-border/60 bg-background/30"},j=A===r.id,O=r.status==="triage"||r.status==="running"||r.status==="done",C=r.status==="blocked",de=!!p["ans:"+r.id],q=r.status==="running"&&(r.puls_alter??0)>600,oe=r.status==="todo"||r.status==="ready"||r.status==="scheduled";return e.jsxs("li",{className:v("flex flex-col gap-2 rounded-xl border bg-background/30 px-3 py-2",C?"border-red-500/30":q?"border-amber-500/40":"border-border/40"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:v("flex shrink-0 items-center gap-1.5 rounded-lg border px-2 py-0.5 text-[10px] font-bold",u.cls),children:[u.spin&&e.jsx(S,{className:"h-3 w-3 animate-spin"}),u.label]}),q&&e.jsxs("span",{className:"flex shrink-0 items-center gap-1 rounded-lg border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-bold text-amber-300",title:"Der Worker lebt, gibt aber kein Lebenszeichen mehr — vermutlich wartet er auf etwas, das nie kommt. „Neuer Versuch“ startet die Karte frisch.",children:[e.jsx(R,{className:"h-3 w-3"})," ",Math.round((r.puls_alter??0)/60)," min ohne Regung"]}),(r.prio??0)!==0&&e.jsxs("span",{className:"shrink-0 rounded bg-background/50 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",title:"Priorität — höher kommt zuerst dran (bei gleicher Prio: Erstellzeit)",children:["P",r.prio]}),(()=>{const E=Ve[r.art||(r.welt==="ide"?"projekt":"box")];if(!E)return null;const Q=E.icon;return e.jsxs("span",{className:v("flex shrink-0 items-center gap-1 rounded-lg border px-2 py-0.5 text-[10px] font-bold",E.cls),title:E.title,children:[e.jsx(Q,{className:"h-3 w-3"})," ",E.label]})})(),e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground",title: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(Y,{className:"h-3 w-3"}),te(r.erstellt)]}),oe&&e.jsxs("span",{className:"flex shrink-0 items-center",children:[e.jsx("button",{disabled:!!p["pr:"+r.id],onClick:()=>G("pr:",r.id,"/api/ideen/prio",{id:r.id,richtung:"hoch"}),title:"Vorziehen (Prio +1)",className:"rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-foreground cursor-pointer disabled:opacity-50",children:e.jsx(ze,{className:"h-3.5 w-3.5"})}),e.jsx("button",{disabled:!!p["pr:"+r.id],onClick:()=>G("pr:",r.id,"/api/ideen/prio",{id:r.id,richtung:"runter"}),title:"Zurückstellen (Prio 1)",className:"rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-foreground cursor-pointer disabled:opacity-50",children:e.jsx(Ce,{className:"h-3.5 w-3.5"})})]}),(r.status==="running"||C)&&e.jsx("button",{disabled:!!p["rt:"+r.id],onClick:()=>d("Neuer Versuch?",r.status==="running"?`Der laufende Worker von '${r.titel.slice(0,60)}' wird beendet (samt gestarteter Test-Prozesse) und die Karte frisch gestartet. Bisheriger Zwischenstand im Workspace bleibt liegen.`:`Die Karte '${r.titel.slice(0,60)}' wird entsperrt und läuft weiter, sobald ein Platz frei ist.`,()=>G("rt:",r.id,"/api/ideen/retry",{id:r.id})),title:"Neuer Versuch — Karte frisch starten",className:v("shrink-0 rounded-md p-1 transition-colors cursor-pointer disabled:opacity-50",q?"text-amber-300 hover:text-amber-200":"text-muted-foreground/60 hover:text-foreground"),children:p["rt:"+r.id]?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Se,{className:"h-3.5 w-3.5"})}),(r.status==="running"||oe||r.status==="triage")&&e.jsx("button",{disabled:!!p["st:"+r.id],onClick:()=>d("Karte stoppen?",`'${r.titel.slice(0,60)}' wird angehalten${r.status==="running"?" und der laufende Worker beendet":""}. Sie bleibt als gestoppt im Board und kann jederzeit per „Neuer Versuch“ weiterlaufen.`,()=>G("st:",r.id,"/api/ideen/stopp",{id:r.id})),title:"Stoppen — Karte anhalten",className:"shrink-0 rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-red-300 cursor-pointer disabled:opacity-50",children:p["st:"+r.id]?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Pe,{className:"h-3.5 w-3.5"})}),(r.status==="done"||C)&&e.jsx("button",{disabled:!!p[r.id],onClick:()=>je(r.id),title:C?"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:p[r.id]?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Z,{className:"h-3.5 w-3.5"})}),r.welt==="ide"&&(r.status==="running"||r.status==="done")&&e.jsxs("button",{onClick:()=>M(D===r.id?null:r.id),title:"Konzept ansehen (das ausgearbeitete KONZEPT.md)",className:v("flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-[10px] font-bold transition-colors cursor-pointer",D===r.id?"text-violet-300":"text-violet-300/70 hover:text-violet-200"),children:[e.jsx(fe,{className:"h-3.5 w-3.5"})," Konzept"]}),O&&e.jsx("button",{onClick:()=>L(j?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:j?e.jsx($,{className:"h-3.5 w-3.5"}):e.jsx(T,{className:"h-3.5 w-3.5"})})]}),D===r.id&&e.jsx(Fe,{id:r.id,istIdee:r.art==="idee"&&r.status==="done",onWeiter:W}),r.status==="running"&&r.notiz&&e.jsxs("p",{className:"-mt-1 ml-1 text-[11px] italic leading-relaxed text-sky-200/80",title:"Jüngste Zwischenmeldung des Workers (Heartbeat)",children:["„",r.notiz,"“"]}),(r.status==="todo"||r.status==="scheduled"||r.status==="ready")&&(((ce=r.wartet_auf)==null?void 0:ce.length)??0)>0&&e.jsxs("p",{className:"-mt-1 ml-1 text-[10px] text-muted-foreground/70",children:["→ wartet auf: ",r.wartet_auf.join(" · ")]}),C&&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(ye,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-300"}),e.jsxs("span",{children:[e.jsx("b",{children:$e[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:f[r.id]||"",onChange:E=>K(Q=>({...Q,[r.id]:E.target.value})),onKeyDown:E=>{E.key==="Enter"&&ne(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:()=>ne(r.id),disabled:de||(f[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:[de?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(xe,{className:"h-3.5 w-3.5"})," Antworten & weiter"]})]})]}),j&&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:re&&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"}):(ue=I.data)!=null&&ue.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"})})}),j&&r.status==="done"&&e.jsx(Oe,{id:r.id})]},r.id)};return t&&!t.available?null:e.jsxs("section",{className:"space-y-3",children:[e.jsxs(X,{icon:_,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:c,onChange:r=>g(r.target.value),onKeyDown:r=>{r.key==="Enter"&&se()},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:se,disabled:m||c.trim().length<3,className:v("flex h-9 shrink-0 items-center gap-1.5 rounded-lg border px-3 text-[11px] font-bold uppercase tracking-wide transition-all cursor-pointer disabled:opacity-50",i==="gruendlich"?"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20":i==="simpel"?"border-violet-500/40 bg-violet-500/10 text-violet-300 hover:bg-violet-500/20":b?"border-sky-500/40 bg-sky-500/10 text-sky-300 hover:bg-sky-500/20":"border-primary/40 bg-primary/10 text-primary hover:bg-primary/20"),children:[m?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):b?e.jsx(_,{className:"h-3.5 w-3.5"}):n?e.jsx(V,{className:"h-3.5 w-3.5"}):e.jsx(xe,{className:"h-3.5 w-3.5"}),b?"Durchdenken":n?"Vorbereiten":"In die Queue"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"Modus"}),e.jsxs("div",{className:"flex rounded-lg border border-border/60 p-0.5",children:[e.jsxs("button",{onClick:()=>l("box"),className:v("flex items-center gap-1 rounded px-2 py-1 text-[10px] font-bold uppercase tracking-wide transition-all cursor-pointer",i==="box"?"bg-primary/15 text-primary":"text-muted-foreground/60 hover:text-foreground"),children:[e.jsx(ee,{className:"h-3 w-3"})," Box"]}),e.jsxs("button",{onClick:()=>l("idee"),title:"Produkt-Idee erst einmal durchdenken lassen: Was ist es, für wen, was gibt es schon, was spricht dagegen? Ergebnis ist ein Konzept — kein Projekt, kein Bau-Druck.",className:v("flex items-center gap-1 rounded px-2 py-1 text-[10px] font-bold uppercase tracking-wide transition-all cursor-pointer",i==="idee"?"bg-sky-500/15 text-sky-300":"text-muted-foreground/60 hover:text-foreground"),children:[e.jsx(_,{className:"h-3 w-3"})," Idee"]}),e.jsxs("button",{onClick:()=>l("simpel"),title:"IDE-Projekt, schnell vorbereitet: knappes Konzept, wenige Denk-Runden. Für kleine, klar umrissene Sachen.",className:v("flex items-center gap-1 rounded px-2 py-1 text-[10px] font-bold uppercase tracking-wide transition-all cursor-pointer",i==="simpel"?"bg-violet-500/15 text-violet-300":"text-muted-foreground/60 hover:text-foreground"),children:[e.jsx(V,{className:"h-3 w-3"})," IDE: simpel"]}),e.jsxs("button",{onClick:()=>l("gruendlich"),title:"IDE-Projekt, gründlich durchdacht: volle Kaskade mit mehreren Rollen und Härtetests. Für große/ambitionierte Projekte.",className:v("flex items-center gap-1 rounded px-2 py-1 text-[10px] font-bold uppercase tracking-wide transition-all cursor-pointer",i==="gruendlich"?"bg-amber-500/15 text-amber-300":"text-muted-foreground/60 hover:text-foreground"),children:[e.jsx(V,{className:"h-3 w-3"})," IDE: gründlich"]})]})]}),e.jsxs("p",{className:"text-[10px] leading-relaxed text-muted-foreground/60",children:[e.jsx("b",{className:"text-primary/80",children:"Box"}),", wenn die Box es selbst bauen soll (dein Heimlabor, MC2, Lucy — Ergebnis kommt als Patch-Vorschlag zurück). ·"," ",e.jsx("b",{className:"text-sky-300/80",children:"Idee"}),", wenn du noch nicht weißt, ob es das überhaupt wert ist — erst durchdenken, entscheiden kannst du danach. ·"," ",e.jsx("b",{className:"text-violet-300/80",children:"IDE"}),", wenn du es selbst in Zed bauen willst und dafür ein startklares Repo brauchst."]}),n&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"Ziel"}),e.jsxs("div",{className:"flex rounded-lg border border-border/40 p-0.5",children:[e.jsx("button",{onClick:()=>w("lxc"),title:"Läuft als Dienst in einem eigenen Proxmox-LXC (systemd, kein Docker). Wird vom Backup-Server automatisch mitgesichert.",className:v("rounded px-2 py-0.5 text-[10px] font-semibold transition-all cursor-pointer",y==="lxc"?"bg-foreground/10 text-foreground":"text-muted-foreground/50 hover:text-foreground/80"),children:"LXC"}),e.jsx("button",{onClick:()=>w("docker"),title:"Natives Docker nach Standard-Praxis: Dockerfile + compose, portabel, über Gitea-/GitLab-Pipelines baubar. Für Projekte, die bewusst außerhalb der LXC-Welt leben.",className:v("rounded px-2 py-0.5 text-[10px] font-semibold transition-all cursor-pointer",y==="docker"?"bg-foreground/10 text-foreground":"text-muted-foreground/50 hover:text-foreground/80"),children:"Docker"})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground/50",children:y==="lxc"?"Dienst im Proxmox-Container (deine Heimat)":"natives Docker, portabel & pipeline-tauglich"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:b?e.jsxs(e.Fragment,{children:[e.jsx("b",{className:"text-sky-300/90",children:"Idee durchdenken:"})," Die Box arbeitet deine Produkt-Idee mit Produkt-Blick aus — was ist es genau, für wen, was gibt es dafür schon, was wäre der kleinste sinnvolle Wurf und was spricht dagegen. Volle Denk-Kaskade mit Kritiker, Ergebnis ist ",e.jsx("b",{children:"nur ein Konzept"})," (kein Gerüst, keine Roadmap, kein Bau-Druck) — du liest es hier und entscheidest danach, ob ein Projekt draus wird."]}):n?e.jsxs(e.Fragment,{children:[e.jsxs("b",{className:i==="gruendlich"?"text-amber-300/90":"text-violet-300/90",children:["IDE-Welt",i==="gruendlich"?" · gründlich":" · simpel",":"]})," ","Die Box denkt das Konzept durch",i==="gruendlich"?" — volle Kaskade: mehrere Fach-Rollen, bis zu 3 Denk-Runden, mehrfacher Kritiker-Härtetest (für große/ambitionierte Projekte, dauert entsprechend)":" — schlank: 2 Rollen, 1 Denk-Runde (für kleine, klar umrissene Projekte, ein paar Minuten)",", legt ein leeres Gitea-Repo an und füllt es nur mit den wichtigen Dokumenten (Konzept, Roadmap, AGENTS.md, .aiexclude) — ",e.jsx("b",{children:"kein Code"}),". Danach öffnest du das Repo in Zed und baust selbst."]}):e.jsx(e.Fragment,{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)."})}),a&&e.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(S,{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."}),F.length>0&&e.jsxs("div",{className:"space-y-3",children:[((t==null?void 0:t.projekte)??[]).map(r=>e.jsx(Me,{projekt:r,karten:F.filter(u=>u.projekt===r.key),zeile:ae},r.key)),(()=>{const r=new Set(((t==null?void 0:t.projekte)??[]).map(j=>j.key)),u=F.filter(j=>!j.projekt||!r.has(j.projekt));return u.length>0?e.jsx("ul",{className:"space-y-1.5",children:u.map(j=>ae(j))}):null})()]}),(t==null?void 0:t.available)&&!a&&F.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Queue ist leer — wirf der Box eine Idee zu."})]}),h]})}const U={blocked:0,running:1,review:2,ready:3,triage:4};function Me({projekt:t,karten:a,zeile:x}){const[s,d]=o.useState(!1),[h,c]=o.useState(!1),g=a.filter(n=>U[n.status]!==void 0).sort((n,k)=>U[n.status]-U[k.status]||(n.erstellt??0)-(k.erstellt??0)),i=a.filter(n=>n.status==="todo"||n.status==="scheduled").sort((n,k)=>{var y,w;return((y=n.wartet_auf)!=null&&y.length?1:0)-((w=k.wartet_auf)!=null&&w.length?1:0)||(n.erstellt??0)-(k.erstellt??0)}),l=a.filter(n=>n.status==="done").sort((n,k)=>(k.fertig??0)-(n.fertig??0)),b=t.gesamt>0?Math.round(t.fertig/t.gesamt*100):0;return e.jsxs("div",{className:"space-y-2 rounded-xl border border-border/50 bg-background/20 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{className:"h-4 w-4 shrink-0 text-primary/70"}),e.jsx("p",{className:"min-w-0 flex-1 truncate text-xs font-semibold text-foreground",title:t.titel,children:t.titel}),e.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[t.fertig," von ",t.gesamt," fertig"]})]}),e.jsx("div",{className:"h-1 overflow-hidden rounded-full bg-background/60",title:`${b}%`,children:e.jsx("div",{className:"h-1 rounded-full bg-primary/70 transition-all",style:{width:`${b}%`}})}),g.length>0&&e.jsx("ul",{className:"space-y-1.5",children:g.map(n=>x(n))}),i.length>0&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>d(n=>!n),className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[s?e.jsx($,{className:"h-3.5 w-3.5"}):e.jsx(T,{className:"h-3.5 w-3.5"}),i.length," Karte",i.length===1?"":"n"," in der Kette — laufen automatisch der Reihe nach"]}),s&&e.jsx("ul",{className:"mt-1.5 space-y-1.5",children:i.map(n=>x(n))})]}),l.length>0&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>c(n=>!n),className:"flex items-center gap-1.5 text-[11px] font-semibold text-emerald-300/70 hover:text-emerald-300 transition-colors cursor-pointer",children:[h?e.jsx($,{className:"h-3.5 w-3.5"}):e.jsx(T,{className:"h-3.5 w-3.5"}),l.length," fertig"]}),h&&e.jsx("ul",{className:"mt-1.5 space-y-1.5",children:l.map(n=>x(n))})]})]})}function Fe({id:t,istIdee:a,onWeiter:x}){const[s,d]=o.useState(null),[h,c]=o.useState(!1),[g,i]=o.useState(0);return o.useEffect(()=>{let l=!1;return d(null),c(!1),B(`/api/ideen/${t}/konzept`).then(b=>{l||d(b)}).catch(()=>{l||c(!0)}),()=>{l=!0}},[t,g]),e.jsx("div",{className:"ml-2 -mt-1",children:e.jsxs("div",{className:"rounded-lg border border-violet-500/25 bg-violet-500/[0.04] p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wide text-violet-300",children:[e.jsx(fe,{className:"h-3 w-3"})," Konzept"]}),(s==null?void 0:s.repo)&&e.jsxs("a",{href:`https://git.tobisniceshomelab.ddnsfree.com/${s.repo}`,className:"flex items-center gap-1 text-[10px] text-violet-300/70 hover:text-violet-200",children:[e.jsx(Be,{className:"h-3 w-3"})," ",s.repo]}),!(s!=null&&s.repo)&&(s==null?void 0:s.quelle)==="datei"&&e.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/70",title:"Der Worker hat kein Repo angelegt — das Konzept liegt als Datei auf der Box.",children:s.pfad}),e.jsx("button",{onClick:()=>i(l=>l+1),title:"Neu laden",className:"ml-auto rounded p-0.5 text-muted-foreground/50 hover:text-foreground cursor-pointer",children:e.jsx(J,{className:"h-3 w-3"})})]}),h?e.jsx("p",{className:"text-[11px] text-red-400",children:"Konzept nicht ladbar — später nochmal versuchen."}):s===null?e.jsx("p",{className:"text-[10px] text-muted-foreground animate-pulse",children:"Konzept wird geladen …"}):s.konzept?e.jsx("div",{className:"max-h-[28rem] overflow-y-auto pr-1",children:e.jsx(Le,{text:s.konzept})}):e.jsx("p",{className:"text-[11px] text-muted-foreground italic",children:s.error||"Noch kein Konzept — das Projekt wird gerade vorbereitet."}),a&&(s==null?void 0:s.konzept)&&e.jsx(Ge,{id:t,onFertig:x})]})})}function Ge({id:t,onFertig:a}){const[x,s]=o.useState("lxc"),[d,h]=o.useState("simpel"),[c,g]=o.useState(!1),[i,l]=o.useState(null),[b,n]=o.useState(""),[k,y]=o.useState(""),w=async(m,z,p)=>{g(!0),n("");try{const N=await B(m,{method:"POST",body:JSON.stringify(z)});l({id:N.id,art:p}),a==null||a()}catch(N){n(String((N==null?void 0:N.message)||N))}finally{g(!1)}};return i?e.jsx("p",{className:"mt-3 border-t border-violet-500/20 pt-2 text-[11px] text-emerald-300",children:i.art==="projekt"?e.jsxs(e.Fragment,{children:["Projekt-Karte ",e.jsx("span",{className:"font-mono",children:i.id})," ist angelegt — die Box bereitet das Repo vor (Konzept übernimmt sie, sie denkt es nicht neu). Danach öffnest du es in Zed."]}):e.jsxs(e.Fragment,{children:["Überarbeitung ",e.jsx("span",{className:"font-mono",children:i.id}),' läuft — die Box arbeitet deine Rückmeldung ein und schreibt die neue Fassung an dieselbe Stelle. Danach hier wieder „Konzept" öffnen.']})}):e.jsxs("div",{className:"mt-3 space-y-3 border-t border-violet-500/20 pt-2.5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[e.jsx("b",{className:"text-sky-300/90",children:"Passt etwas nicht?"})," Schreib hin, was anders werden soll — die Box arbeitet es ein und lässt den Rest stehen. Beliebig oft wiederholbar."]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:k,onChange:m=>y(m.target.value),onKeyDown:m=>{m.key==="Enter"&&k.trim().length>=3&&!c&&w("/api/ideen/nachschaerfen",{id:t,hinweis:k},"runde")},placeholder:"z. B. „Punkt 3: kein WebSocket, das ist mir zu fragil — nimm Polling“",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-sky-400/50 focus:outline-none"}),e.jsxs("button",{onClick:()=>w("/api/ideen/nachschaerfen",{id:t,hinweis:k},"runde"),disabled:c||k.trim().length<3,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-sky-500/40 bg-sky-500/10 px-3 text-[10px] font-bold uppercase tracking-wide text-sky-300 transition-all hover:bg-sky-500/20 cursor-pointer disabled:opacity-50",children:[c?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(J,{className:"h-3.5 w-3.5"}),"Nachschärfen"]})]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[e.jsx("b",{className:"text-violet-300/90",children:"Passt es so?"})," Dann macht die Box daraus ein startklares Repo — Konzept wird übernommen (nicht neu gedacht), dazu Roadmap, AGENTS.md & Co. Gebaut wird danach von dir in Zed."]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"Ziel"}),e.jsx("div",{className:"flex rounded-lg border border-border/40 p-0.5",children:["lxc","docker"].map(m=>e.jsx("button",{onClick:()=>s(m),title:m==="lxc"?"Dienst in einem eigenen Proxmox-LXC (systemd, kein Docker) — wird automatisch mitgesichert.":"Natives Docker: Dockerfile + compose, portabel und pipeline-tauglich.",className:v("rounded px-2 py-0.5 text-[10px] font-semibold transition-all cursor-pointer",x===m?"bg-foreground/10 text-foreground":"text-muted-foreground/50 hover:text-foreground/80"),children:m==="lxc"?"LXC":"Docker"},m))}),e.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"Aufwand"}),e.jsx("div",{className:"flex rounded-lg border border-border/40 p-0.5",children:["simpel","gruendlich"].map(m=>e.jsx("button",{onClick:()=>h(m),title:m==="simpel"?"Konzept ist schon gehärtet — nur kurz auf die Bau-Sicht nachschärfen (empfohlen).":"Nochmal volle Kaskade über die Bau-Sicht: mehrere Rollen, Härtetests. Dauert entsprechend.",className:v("rounded px-2 py-0.5 text-[10px] font-semibold transition-all cursor-pointer",d===m?"bg-foreground/10 text-foreground":"text-muted-foreground/50 hover:text-foreground/80"),children:m==="simpel"?"schlank":"gründlich"},m))}),e.jsxs("button",{onClick:()=>w("/api/ideen/weiterfuehren",{id:t,ziel:x,tiefe:d},"projekt"),disabled:c,className:"ml-auto flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-violet-500/40 bg-violet-500/10 px-3 text-[10px] font-bold uppercase tracking-wide text-violet-300 transition-all hover:bg-violet-500/20 cursor-pointer disabled:opacity-50",children:[c?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(V,{className:"h-3.5 w-3.5"}),"Gefällt mir — Projekt daraus machen"]})]}),b&&e.jsx("p",{className:"text-[11px] text-red-400",children:b})]})}function Oe({id:t}){const[a,x]=o.useState(null),[s,d]=o.useState(!1),[h,c]=o.useState(0);o.useEffect(()=>{let i=!1;return d(!1),x(null),B(`/api/ideen/${t}/ergebnis`).then(l=>{i||x(l)}).catch(()=>{i||d(!0)}),()=>{i=!0}},[t,h]);const g=a?a.summary||a.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(Ke,{className:"h-3 w-3"})," Ergebnis des Workers"]}),s?e.jsx("button",{type:"button",onClick:()=>c(i=>i+1),className:"text-[10px] text-red-400 underline decoration-dotted underline-offset-2 hover:text-red-300",children:"Ergebnis nicht ladbar — nochmal versuchen"}):a===null?e.jsx("p",{className:"text-[10px] text-muted-foreground animate-pulse",children:"Wird geladen …"}):g?e.jsx("p",{className:"max-h-64 overflow-y-auto whitespace-pre-wrap text-xs leading-relaxed text-foreground/85",children:g}):e.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Der Worker hat keine Abschluss-Zusammenfassung hinterlassen (ältere Karte oder Protokollverstoß)."})]})})}function He({item:t}){const a=t.status;if(!a)return null;const x=Ie[a.state];return x?e.jsxs("span",{className:v("flex items-center gap-1.5 rounded-lg border px-2 py-0.5 text-[10px] font-bold",x.cls),title:a.detail,children:[x.spin&&e.jsx(S,{className:"h-3 w-3 animate-spin"}),x.label]}):null}function _e({item:t,busy:a,onAct:x,showConfirm:s}){var L,D,M;const[d,h]=o.useState(!1),[c,g]=o.useState(null),[i,l]=o.useState(!1),[b,n]=o.useState(!1),[k,y]=o.useState(""),w=((L=t.status)==null?void 0:L.state)==="laeuft"||((D=t.status)==null?void 0:D.state)==="rollback",m=((M=t.status)==null?void 0:M.state)==="eingespielt",z=t.repo??"mc2",p=z==="lucy",N=`${z}:${t.branch}`;async function A(){const f=!d;if(h(f),f&&c===null){l(!0);try{const K=await B(`/api/auftragsbuch/diff?branch=${encodeURIComponent(t.branch)}&repo=${z}`);g(K.diff+(K.truncated?`
… (gekürzt)`:""))}catch(K){g(`(Diff nicht ladbar: ${(K==null?void 0:K.message)||K})`)}finally{l(!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:We[t.kind]??t.kind}),p&&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(Y,{className:"h-3 w-3"}),te(t.ts)]}),e.jsx(He,{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:v("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(be,{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]})]})]}),!w&&!m&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!t.verwaist&&e.jsxs("button",{disabled:!!a[N],onClick:()=>s("Vorschlag annehmen?",p?`'${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.`:""}`,()=>x(N,"/api/auftragsbuch/annehmen",{branch:t.branch,repo:z})),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:[a[N]?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ge,{className:"h-3.5 w-3.5"})," Annehmen"]}),e.jsxs("button",{disabled:!!a["ab:"+N],onClick:()=>n(f=>!f),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:[a["ab:"+N]?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Z,{className:"h-3.5 w-3.5"})," Ablehnen"]})]})]}),b&&!w&&!m&&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:f=>y(f.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:!!a["ab:"+N],onClick:()=>{n(!1),x("ab:"+N,"/api/auftragsbuch/ablehnen",{branch:t.branch,repo:z,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:()=>n(!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&&(w||!m)&&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(R,{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(R,{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(R,{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(R,{className:"h-3 w-3"})," Frontend ohne Build"]})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:A,className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[d?e.jsx($,{className:"h-3.5 w-3.5"}):e.jsx(T,{className:"h-3.5 w-3.5"}),e.jsx(Ae,{className:"h-3.5 w-3.5"})," ",t.files.length," Datei",t.files.length===1?"":"en"," — Änderungen ansehen"]}),d&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.files.map(f=>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:v(f.status.startsWith("A")&&"text-emerald-400",f.status.startsWith("D")&&"text-red-400",f.status.startsWith("M")&&"text-sky-400"),children:f.status})," ",f.path]},f.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:i?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:(c??"").split(`
`).map((f,K)=>e.jsx("span",{className:v("block",f.startsWith("+")&&!f.startsWith("+++")&&"text-emerald-300/90 bg-emerald-500/5",f.startsWith("-")&&!f.startsWith("---")&&"text-red-300/90 bg-red-500/5",(f.startsWith("@@")||f.startsWith("diff "))&&"text-sky-300/90"),children:f||" "},K))})})]})]})]})}function Ze({k:t,busy:a,onAct:x,showConfirm:s}){const[d,h]=o.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(Y,{className:"h-3 w-3"}),te(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:!!a["sk:"+t.file],onClick:()=>s("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.`,()=>x("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:[a["sk:"+t.file]?e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ee,{className:"h-3.5 w-3.5"})," Beauftragen"]}),e.jsxs("button",{disabled:!!a["skab:"+t.file],onClick:()=>s("Kandidat verwerfen?",`'${t.title}' wandert ins Archiv des Wissens-Vaults (verworfen/). Der Traum schlägt ihn nicht erneut vor.`,()=>x("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:[a["skab:"+t.file]?e.jsx(S,{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(c=>!c),className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[d?e.jsx($,{className:"h-3.5 w-3.5"}):e.jsx(T,{className:"h-3.5 w-3.5"}),e.jsx(ve,{className:"h-3.5 w-3.5"})," Vorschlag lesen"]}),d&&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{et as AuftragsbuchView};