b0eec715c8
Die mitgelieferten Hermes-Skills sind Kategorie-Ordner (DESCRIPTION.md + Unter-Skills mit eigener SKILL.md) - der Walker lief nur ueber Ebene 1 und zeigte 12 statt ~40 Skills. Jetzt beide Ebenen, Unter-Skills mit Kategorie-Badge; Detail-Endpunkt erlaubt Kategorie/Name-Pfad. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
7 lines
7.6 KiB
JavaScript
7 lines
7.6 KiB
JavaScript
import{c as b,ah as p,r as i,j as e,L as g,ai as f,Z as j,N,e as o,w as k,F as w,G as v,g as y}from"./index-CDslgvwS.js";import{B as S}from"./book-open-kUtGvGMW.js";import{C as z}from"./circle-x-D-XzMNyu.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=b("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),D={selbst:{icon:N,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 a=new Date(t);return isNaN(a.getTime())?"—":a.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"2-digit"})}function K(){const{data:t,isLoading:a}=p(),d=i.useMemo(()=>{const s=[];for(const r of(t==null?void 0:t.skills)??[]){const n=s[s.length-1];n&&n.herkunft===r.herkunft?n.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:"Von allein"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was deine Box selbst geleistet hat: ihre Fähigkeiten (Skills) und was aus ihren Vorschlägen wurde. Das ist derselbe Skill-Satz, mit dem Lucy spricht und die Nacht-Worker arbeiten."})]}),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(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],n=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(n,{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:a,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:a}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:t})]})}function B({skill:t}){const[a,d]=i.useState(!1),[s,r]=i.useState(null),[n,l]=i.useState(!1);async function x(){const m=!a;if(d(m),m&&s===null&&!n){l(!0);try{const h=await y(`/api/eigenleben/skill/${encodeURIComponent(t.id)}`);r(h.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:[a?e.jsx(k,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(w,{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.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:o("mt-1 text-xs leading-relaxed text-foreground/75",!a&&"line-clamp-2"),children:t.beschreibung||"(keine Beschreibung im Skill hinterlegt)"})]})]}),a&&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}`:""]}),n?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[a,d]=i.useState(!1),s=a?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,n)=>{const l=r.art==="angenommen",x=l?v: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}-${n}`)})}),!a&&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{K as EigenlebenView};
|