@mcp-graph-workflow/mcp-graph 5.9.1 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/routes/siebel.d.ts.map +1 -1
- package/dist/api/routes/siebel.js +206 -0
- package/dist/api/routes/siebel.js.map +1 -1
- package/dist/core/rag/siebel-indexer.d.ts.map +1 -1
- package/dist/core/rag/siebel-indexer.js +57 -1
- package/dist/core/rag/siebel-indexer.js.map +1 -1
- package/dist/core/rag/wsdl-indexer.d.ts +16 -0
- package/dist/core/rag/wsdl-indexer.d.ts.map +1 -0
- package/dist/core/rag/wsdl-indexer.js +115 -0
- package/dist/core/rag/wsdl-indexer.js.map +1 -0
- package/dist/core/siebel/auto-wiring.d.ts +29 -0
- package/dist/core/siebel/auto-wiring.d.ts.map +1 -0
- package/dist/core/siebel/auto-wiring.js +211 -0
- package/dist/core/siebel/auto-wiring.js.map +1 -0
- package/dist/core/siebel/best-practices.d.ts +16 -0
- package/dist/core/siebel/best-practices.d.ts.map +1 -0
- package/dist/core/siebel/best-practices.js +92 -0
- package/dist/core/siebel/best-practices.js.map +1 -0
- package/dist/core/siebel/change-simulator.d.ts +32 -0
- package/dist/core/siebel/change-simulator.d.ts.map +1 -0
- package/dist/core/siebel/change-simulator.js +138 -0
- package/dist/core/siebel/change-simulator.js.map +1 -0
- package/dist/core/siebel/clone-adapt.d.ts +21 -0
- package/dist/core/siebel/clone-adapt.d.ts.map +1 -0
- package/dist/core/siebel/clone-adapt.js +157 -0
- package/dist/core/siebel/clone-adapt.js.map +1 -0
- package/dist/core/siebel/code-review.d.ts +36 -0
- package/dist/core/siebel/code-review.d.ts.map +1 -0
- package/dist/core/siebel/code-review.js +239 -0
- package/dist/core/siebel/code-review.js.map +1 -0
- package/dist/core/siebel/complexity-metrics.d.ts +24 -0
- package/dist/core/siebel/complexity-metrics.d.ts.map +1 -0
- package/dist/core/siebel/complexity-metrics.js +41 -0
- package/dist/core/siebel/complexity-metrics.js.map +1 -0
- package/dist/core/siebel/context-enrichment.d.ts +18 -0
- package/dist/core/siebel/context-enrichment.d.ts.map +1 -0
- package/dist/core/siebel/context-enrichment.js +91 -0
- package/dist/core/siebel/context-enrichment.js.map +1 -0
- package/dist/core/siebel/cross-project-analyzer.d.ts +30 -0
- package/dist/core/siebel/cross-project-analyzer.d.ts.map +1 -0
- package/dist/core/siebel/cross-project-analyzer.js +108 -0
- package/dist/core/siebel/cross-project-analyzer.js.map +1 -0
- package/dist/core/siebel/definition-of-ready.d.ts +25 -0
- package/dist/core/siebel/definition-of-ready.d.ts.map +1 -0
- package/dist/core/siebel/definition-of-ready.js +164 -0
- package/dist/core/siebel/definition-of-ready.js.map +1 -0
- package/dist/core/siebel/escript-crossref.d.ts +18 -0
- package/dist/core/siebel/escript-crossref.d.ts.map +1 -0
- package/dist/core/siebel/escript-crossref.js +50 -0
- package/dist/core/siebel/escript-crossref.js.map +1 -0
- package/dist/core/siebel/escript-generator.d.ts +33 -0
- package/dist/core/siebel/escript-generator.d.ts.map +1 -0
- package/dist/core/siebel/escript-generator.js +200 -0
- package/dist/core/siebel/escript-generator.js.map +1 -0
- package/dist/core/siebel/escript-patterns.d.ts +20 -0
- package/dist/core/siebel/escript-patterns.d.ts.map +1 -0
- package/dist/core/siebel/escript-patterns.js +69 -0
- package/dist/core/siebel/escript-patterns.js.map +1 -0
- package/dist/core/siebel/escript-refactor.d.ts +23 -0
- package/dist/core/siebel/escript-refactor.d.ts.map +1 -0
- package/dist/core/siebel/escript-refactor.js +270 -0
- package/dist/core/siebel/escript-refactor.js.map +1 -0
- package/dist/core/siebel/field-suggestion.d.ts +29 -0
- package/dist/core/siebel/field-suggestion.d.ts.map +1 -0
- package/dist/core/siebel/field-suggestion.js +105 -0
- package/dist/core/siebel/field-suggestion.js.map +1 -0
- package/dist/core/siebel/health-check.d.ts +21 -0
- package/dist/core/siebel/health-check.d.ts.map +1 -0
- package/dist/core/siebel/health-check.js +51 -0
- package/dist/core/siebel/health-check.js.map +1 -0
- package/dist/core/siebel/integration-test-gen.d.ts +26 -0
- package/dist/core/siebel/integration-test-gen.d.ts.map +1 -0
- package/dist/core/siebel/integration-test-gen.js +131 -0
- package/dist/core/siebel/integration-test-gen.js.map +1 -0
- package/dist/core/siebel/lov-mapper.d.ts +23 -0
- package/dist/core/siebel/lov-mapper.d.ts.map +1 -0
- package/dist/core/siebel/lov-mapper.js +42 -0
- package/dist/core/siebel/lov-mapper.js.map +1 -0
- package/dist/core/siebel/migration-package.d.ts +38 -0
- package/dist/core/siebel/migration-package.d.ts.map +1 -0
- package/dist/core/siebel/migration-package.js +276 -0
- package/dist/core/siebel/migration-package.js.map +1 -0
- package/dist/core/siebel/naming-convention-validator.d.ts +38 -0
- package/dist/core/siebel/naming-convention-validator.d.ts.map +1 -0
- package/dist/core/siebel/naming-convention-validator.js +165 -0
- package/dist/core/siebel/naming-convention-validator.js.map +1 -0
- package/dist/core/siebel/object-erd.d.ts +28 -0
- package/dist/core/siebel/object-erd.d.ts.map +1 -0
- package/dist/core/siebel/object-erd.js +82 -0
- package/dist/core/siebel/object-erd.js.map +1 -0
- package/dist/core/siebel/orphan-detector.d.ts +21 -0
- package/dist/core/siebel/orphan-detector.d.ts.map +1 -0
- package/dist/core/siebel/orphan-detector.js +64 -0
- package/dist/core/siebel/orphan-detector.js.map +1 -0
- package/dist/core/siebel/pattern-analyzer.d.ts +32 -0
- package/dist/core/siebel/pattern-analyzer.d.ts.map +1 -0
- package/dist/core/siebel/pattern-analyzer.js +155 -0
- package/dist/core/siebel/pattern-analyzer.js.map +1 -0
- package/dist/core/siebel/profileattr-flow.d.ts +26 -0
- package/dist/core/siebel/profileattr-flow.d.ts.map +1 -0
- package/dist/core/siebel/profileattr-flow.js +50 -0
- package/dist/core/siebel/profileattr-flow.js.map +1 -0
- package/dist/core/siebel/runtime-dep-builder.d.ts +9 -0
- package/dist/core/siebel/runtime-dep-builder.d.ts.map +1 -0
- package/dist/core/siebel/runtime-dep-builder.js +47 -0
- package/dist/core/siebel/runtime-dep-builder.js.map +1 -0
- package/dist/core/siebel/scaffold-generator.d.ts +25 -0
- package/dist/core/siebel/scaffold-generator.d.ts.map +1 -0
- package/dist/core/siebel/scaffold-generator.js +278 -0
- package/dist/core/siebel/scaffold-generator.js.map +1 -0
- package/dist/core/siebel/siebel-context-builder.d.ts +10 -0
- package/dist/core/siebel/siebel-context-builder.d.ts.map +1 -0
- package/dist/core/siebel/siebel-context-builder.js +75 -0
- package/dist/core/siebel/siebel-context-builder.js.map +1 -0
- package/dist/core/siebel/siebel-rag-booster.d.ts +19 -0
- package/dist/core/siebel/siebel-rag-booster.d.ts.map +1 -0
- package/dist/core/siebel/siebel-rag-booster.js +41 -0
- package/dist/core/siebel/siebel-rag-booster.js.map +1 -0
- package/dist/core/siebel/siebel-validators.d.ts +73 -0
- package/dist/core/siebel/siebel-validators.d.ts.map +1 -0
- package/dist/core/siebel/siebel-validators.js +269 -0
- package/dist/core/siebel/siebel-validators.js.map +1 -0
- package/dist/core/siebel/sif-batch-importer.d.ts +27 -0
- package/dist/core/siebel/sif-batch-importer.d.ts.map +1 -0
- package/dist/core/siebel/sif-batch-importer.js +68 -0
- package/dist/core/siebel/sif-batch-importer.js.map +1 -0
- package/dist/core/siebel/sif-diff.d.ts +57 -0
- package/dist/core/siebel/sif-diff.d.ts.map +1 -0
- package/dist/core/siebel/sif-diff.js +198 -0
- package/dist/core/siebel/sif-diff.js.map +1 -0
- package/dist/core/siebel/sif-parser.d.ts.map +1 -1
- package/dist/core/siebel/sif-parser.js +86 -0
- package/dist/core/siebel/sif-parser.js.map +1 -1
- package/dist/core/siebel/similarity-detector.d.ts +20 -0
- package/dist/core/siebel/similarity-detector.d.ts.map +1 -0
- package/dist/core/siebel/similarity-detector.js +83 -0
- package/dist/core/siebel/similarity-detector.js.map +1 -0
- package/dist/core/siebel/template-learner.d.ts +25 -0
- package/dist/core/siebel/template-learner.d.ts.map +1 -0
- package/dist/core/siebel/template-learner.js +129 -0
- package/dist/core/siebel/template-learner.js.map +1 -0
- package/dist/core/siebel/troubleshoot.d.ts +37 -0
- package/dist/core/siebel/troubleshoot.d.ts.map +1 -0
- package/dist/core/siebel/troubleshoot.js +249 -0
- package/dist/core/siebel/troubleshoot.js.map +1 -0
- package/dist/core/siebel/wsdl-correlation.d.ts +22 -0
- package/dist/core/siebel/wsdl-correlation.d.ts.map +1 -0
- package/dist/core/siebel/wsdl-correlation.js +64 -0
- package/dist/core/siebel/wsdl-correlation.js.map +1 -0
- package/dist/core/siebel/wsdl-parser.d.ts +57 -0
- package/dist/core/siebel/wsdl-parser.d.ts.map +1 -0
- package/dist/core/siebel/wsdl-parser.js +226 -0
- package/dist/core/siebel/wsdl-parser.js.map +1 -0
- package/dist/core/siebel/wsdl-to-sif.d.ts +22 -0
- package/dist/core/siebel/wsdl-to-sif.d.ts.map +1 -0
- package/dist/core/siebel/wsdl-to-sif.js +184 -0
- package/dist/core/siebel/wsdl-to-sif.js.map +1 -0
- package/dist/mcp/tools/siebel-analyze.d.ts.map +1 -1
- package/dist/mcp/tools/siebel-analyze.js +89 -6
- package/dist/mcp/tools/siebel-analyze.js.map +1 -1
- package/dist/mcp/tools/siebel-composer.d.ts.map +1 -1
- package/dist/mcp/tools/siebel-composer.js +40 -3
- package/dist/mcp/tools/siebel-composer.js.map +1 -1
- package/dist/mcp/tools/siebel-generate-sif.d.ts.map +1 -1
- package/dist/mcp/tools/siebel-generate-sif.js +188 -3
- package/dist/mcp/tools/siebel-generate-sif.js.map +1 -1
- package/dist/mcp/tools/siebel-search.js +1 -1
- package/dist/mcp/tools/siebel-search.js.map +1 -1
- package/dist/mcp/tools/siebel-validate.d.ts.map +1 -1
- package/dist/mcp/tools/siebel-validate.js +94 -5
- package/dist/mcp/tools/siebel-validate.js.map +1 -1
- package/dist/schemas/knowledge.schema.d.ts +6 -0
- package/dist/schemas/knowledge.schema.d.ts.map +1 -1
- package/dist/schemas/knowledge.schema.js +2 -1
- package/dist/schemas/knowledge.schema.js.map +1 -1
- package/dist/schemas/siebel.schema.d.ts +42 -0
- package/dist/schemas/siebel.schema.d.ts.map +1 -1
- package/dist/schemas/siebel.schema.js +4 -0
- package/dist/schemas/siebel.schema.js.map +1 -1
- package/dist/web/dashboard/dist/assets/benchmark-tab-DE9sF83l.js +1 -0
- package/dist/web/dashboard/dist/assets/{constants-z0QkAiYv.js → constants-lq4BIQN3.js} +1 -1
- package/dist/web/dashboard/dist/assets/context-tab-BDBUYfAA.js +1 -0
- package/dist/web/dashboard/dist/assets/{gitnexus-tab-DDw7DUED.js → gitnexus-tab-Yn1v6B3B.js} +16 -16
- package/dist/web/dashboard/dist/assets/graph-section-C6dzE7Vr.js +1 -0
- package/dist/web/dashboard/dist/assets/graph-tab-eIpG9sGq.js +1 -0
- package/dist/web/dashboard/dist/assets/graph-utils-Cq350VUG.js +1 -0
- package/dist/web/dashboard/dist/assets/{index-F9dY4AG_.js → index-BjE9IIVd.js} +2 -2
- package/dist/web/dashboard/dist/assets/index-CsH_Hv51.js +208 -0
- package/dist/web/dashboard/dist/assets/index-p238Jynp.css +1 -0
- package/dist/web/dashboard/dist/assets/index-ruquw1ns.js +1 -0
- package/dist/web/dashboard/dist/assets/{insights-tab-YN7G6mjm.js → insights-tab-iSZItsRP.js} +15 -15
- package/dist/web/dashboard/dist/assets/journey-tab-GXibD334.js +1 -0
- package/dist/web/dashboard/dist/assets/logs-tab-DROI_l7-.js +2 -0
- package/dist/web/dashboard/dist/assets/memories-tab-DUMqEP5R.js +1 -0
- package/dist/web/dashboard/dist/assets/prd-backlog-tab-DIQ0Fmr_.js +1 -0
- package/dist/web/dashboard/dist/assets/siebel-tab-Ci5KiOA6.js +4 -0
- package/dist/web/dashboard/dist/assets/sif-parse.worker-DZrybOHz.js +4 -0
- package/dist/web/dashboard/dist/assets/skills-tab-EfuAQFRT.js +1 -0
- package/dist/web/dashboard/dist/assets/{style-Da3qWU01.js → style-DF9Y1aXX.js} +1 -1
- package/dist/web/dashboard/dist/index.html +5 -2
- package/package.json +2 -2
- package/dist/web/dashboard/dist/assets/benchmark-tab-BoMsoQjO.js +0 -1
- package/dist/web/dashboard/dist/assets/context-tab-BLT4qQ77.js +0 -1
- package/dist/web/dashboard/dist/assets/graph-tab-DG9Q6nko.js +0 -1
- package/dist/web/dashboard/dist/assets/graph-utils-BpYHKE87.js +0 -1
- package/dist/web/dashboard/dist/assets/index-Cu23WCcu.css +0 -1
- package/dist/web/dashboard/dist/assets/index-DtkPX5ZZ.js +0 -55
- package/dist/web/dashboard/dist/assets/journey-tab-BcweuR82.js +0 -1
- package/dist/web/dashboard/dist/assets/logs-tab-BjdAURdy.js +0 -2
- package/dist/web/dashboard/dist/assets/memories-tab-CQ2xM2aw.js +0 -1
- package/dist/web/dashboard/dist/assets/prd-backlog-tab-CIeCpE1a.js +0 -1
- package/dist/web/dashboard/dist/assets/siebel-tab-bj5CT4-Z.js +0 -3
- package/dist/web/dashboard/dist/assets/skills-tab-Bgk72mKO.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,a as k,j as e}from"./index-DtkPX5ZZ.js";import{u as F,a as P,i as H,B as z,C as L,M as R,H as J,P as O}from"./style-Da3qWU01.js";import"./index-F9dY4AG_.js";const M={landing:"#2196f3",form:"#ff9800",selection:"#4caf50",listing:"#9c27b0",comparison:"#e91e63",detail:"#00bcd4",map:"#009688",calculator:"#ffc107",confirmation:"#3f51b5",success:"#4caf50",dashboard:"#607d8b",page:"#757575"},V={navigation:"#6c757d",form_submit:"#2196f3",redirect:"#ff9800",back:"#9e9e9e"},D=280,W=220,X=c.memo(function({data:l}){const{screen:o,screenshotUrl:s,onSelect:a}=l,n=M[o.screenType]??"#757575";return e.jsxs(e.Fragment,{children:[e.jsx(J,{type:"target",position:O.Top,className:"!w-2 !h-2"}),e.jsxs("div",{className:"bg-[var(--color-bg)] border-2 rounded-lg shadow-md hover:shadow-lg transition-shadow cursor-pointer overflow-hidden",style:{borderColor:n,width:D},onClick:()=>a(o),children:[e.jsxs("div",{className:"relative w-full bg-[var(--color-bg-tertiary)]",style:{height:140},children:[s?e.jsx("img",{src:s,alt:o.title,className:"w-full h-full object-cover",loading:"lazy"}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)] text-xs",children:"No screenshot"}),e.jsx("span",{className:"absolute top-1.5 left-1.5 text-[9px] font-bold uppercase px-1.5 py-0.5 rounded text-white",style:{background:n},children:o.screenType})]}),e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-sm font-semibold leading-tight line-clamp-1",children:o.title}),o.url&&e.jsx("div",{className:"text-[10px] text-[var(--color-text-muted)] truncate mt-0.5",children:o.url}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[o.fields&&o.fields.length>0&&e.jsxs("span",{className:"text-[9px] px-1 py-0.5 rounded bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]",children:[o.fields.length," fields"]}),o.ctas&&o.ctas.length>0&&e.jsxs("span",{className:"text-[9px] px-1 py-0.5 rounded bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]",children:[o.ctas.length," CTAs"]})]})]})]}),e.jsx(J,{type:"source",position:O.Bottom,className:"!w-2 !h-2"})]})}),Y={journeyScreen:X};function B(t,l){var i;const o=new Map,s=new Map;for(const r of t)o.set(r.id,[]),s.set(r.id,0);for(const r of l)(i=o.get(r.from))==null||i.push(r.to),s.set(r.to,(s.get(r.to)??0)+1);const a=[],n=[],h=new Set;for(const r of t)(s.get(r.id)??0)===0&&n.push(r.id);for(;n.length>0;){const r=[...n];a.push(r),n.length=0;for(const d of r){h.add(d);for(const m of o.get(d)??[])if(!h.has(m)){const b=(s.get(m)??1)-1;s.set(m,b),b<=0&&!h.has(m)&&n.push(m)}}}for(const r of t)h.has(r.id)||(a.length===0&&a.push([]),a[a.length-1].push(r.id));const v=new Map(t.map(r=>[r.id,r])),x=D+60,N=W+80,j=[];for(let r=0;r<a.length;r++){const d=a[r],b=-(d.length*x)/2+x/2;for(let y=0;y<d.length;y++){const u=v.get(d[y]);u&&j.push({id:u.id,type:"journeyScreen",position:{x:u.positionX!==0?u.positionX:b+y*x,y:u.positionY!==0?u.positionY:r*N},data:{screen:u,screenshotUrl:u.screenshot?`/api/v1/journey/screenshots/_/${u.screenshot}`:void 0,onSelect:()=>{}}})}}return j}function G(t){return t.map(l=>({id:l.id,source:l.from,target:l.to,label:l.label??"",type:"smoothstep",animated:l.type==="form_submit",style:{stroke:V[l.type]??"#6c757d",strokeWidth:2},labelStyle:{fontSize:10,fill:"var(--color-text-muted)"},labelBgStyle:{fill:"var(--color-bg)",fillOpacity:.8}}))}function $({screen:t,onClose:l}){const o=M[t.screenType]??"#757575";return e.jsxs("div",{className:"w-80 h-full border-l border-[var(--color-border)] bg-[var(--color-bg)] overflow-y-auto p-4 flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-bold uppercase px-2 py-0.5 rounded text-white",style:{background:o},children:t.screenType}),e.jsx("button",{onClick:l,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)]",children:"X"})]}),e.jsx("h3",{className:"text-lg font-semibold",children:t.title}),t.url&&e.jsx("div",{className:"text-xs text-[var(--color-text-muted)] break-all",children:t.url}),t.description&&e.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:t.description}),t.screenshot&&e.jsx("div",{className:"rounded-lg overflow-hidden border border-[var(--color-border)]",children:e.jsx("img",{src:`/api/v1/journey/screenshots/_/${t.screenshot}`,alt:t.title,className:"w-full"})}),t.fields&&t.fields.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-semibold uppercase text-[var(--color-text-muted)] mb-1.5",children:["Form Fields (",t.fields.length,")"]}),e.jsx("div",{className:"space-y-1.5",children:t.fields.map(s=>e.jsxs("div",{className:"flex items-center gap-2 text-sm bg-[var(--color-bg-secondary)] rounded px-2 py-1",children:[e.jsx("span",{className:"font-mono text-xs text-[var(--color-accent)]",children:s.type}),e.jsx("span",{children:s.label??s.name}),s.required&&e.jsx("span",{className:"text-[9px] text-red-400 font-bold",children:"*"})]},s.name))})]}),t.ctas&&t.ctas.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-semibold uppercase text-[var(--color-text-muted)] mb-1.5",children:["CTAs (",t.ctas.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.ctas.map(s=>e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-[var(--color-accent)] text-white",children:s},s))})]}),t.metadata&&Object.keys(t.metadata).length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase text-[var(--color-text-muted)] mb-1.5",children:"Metadata"}),e.jsx("pre",{className:"text-[10px] bg-[var(--color-bg-secondary)] rounded p-2 overflow-x-auto",children:JSON.stringify(t.metadata,null,2)})]})]})}function T({maps:t,selectedId:l,onSelect:o,onImport:s,loading:a}){return a?e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading journey maps..."}):t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-[var(--color-text-muted)]",children:[e.jsx("div",{className:"text-5xl",children:"🗺"}),e.jsx("p",{className:"text-sm font-medium",children:"No journey maps yet"}),e.jsx("p",{className:"text-xs text-center max-w-xs",children:"Import a journey map JSON file or capture website screens to create a journey flow visualization."}),e.jsx("button",{onClick:s,className:"px-4 py-2 rounded-lg bg-[var(--color-accent)] text-white text-sm hover:opacity-90 transition-opacity",children:"Import Journey Map"})]}):e.jsxs("div",{className:"flex items-center gap-2 p-2 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsx("label",{className:"text-xs font-medium text-[var(--color-text-muted)]",children:"Journey:"}),e.jsx("select",{value:l??"",onChange:n=>o(n.target.value),className:"text-sm bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-2 py-1 flex-1",children:t.map(n=>e.jsx("option",{value:n.id,children:n.name},n.id))}),e.jsx("button",{onClick:s,className:"text-xs px-2 py-1 rounded bg-[var(--color-bg-tertiary)] hover:bg-[var(--color-border)] text-[var(--color-text-muted)]",children:"+ Import"})]})}function U({variants:t,activeVariant:l,onSelect:o}){return t.length===0?null:e.jsxs("div",{className:"flex items-center gap-2 p-2 border-b border-[var(--color-border)]",children:[e.jsx("label",{className:"text-xs font-medium text-[var(--color-text-muted)]",children:"Variant:"}),e.jsx("button",{onClick:()=>o(null),className:`text-xs px-2 py-1 rounded ${l===null?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]"}`,children:"All"}),t.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`text-xs px-2 py-1 rounded ${l===s.id?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]"}`,title:s.description,children:s.name},s.id))]})}function _({open:t,onClose:l,onImported:o}){const[s,a]=c.useState(""),[n,h]=c.useState(null),[v,x]=c.useState(!1);if(!t)return null;const N=async()=>{h(null),x(!0);try{const i=JSON.parse(s);await k.importJourneyMap(i),o(),l(),a("")}catch(i){h(i instanceof Error?i.message:"Import failed")}finally{x(!1)}},j=i=>{var m;const r=(m=i.target.files)==null?void 0:m[0];if(!r)return;const d=new FileReader;d.onload=()=>a(d.result),d.readAsText(r)};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-[var(--color-bg)] rounded-lg shadow-xl w-full max-w-lg p-6 max-h-[80vh] overflow-y-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Import Journey Map"}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Upload JSON file"}),e.jsx("input",{type:"file",accept:".json",onChange:j,className:"text-sm"})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Or paste JSON"}),e.jsx("textarea",{value:s,onChange:i=>a(i.target.value),rows:10,className:"w-full text-xs font-mono bg-[var(--color-bg-secondary)] border border-[var(--color-border)] rounded p-2",placeholder:'{"journey": {"name": "..."}, "screens": [...], "edges": [...]}'})]}),n&&e.jsx("div",{className:"text-sm text-[var(--color-danger)] mb-3",children:n}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:l,className:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] hover:bg-[var(--color-bg-secondary)]",children:"Cancel"}),e.jsx("button",{onClick:N,disabled:!s.trim()||v,className:"px-3 py-1.5 text-sm rounded-lg bg-[var(--color-accent)] text-white hover:opacity-90 disabled:opacity-50",children:v?"Importing...":"Import"})]})]})})}const q={hideAttribution:!0};function ee(){const[t,l]=c.useState([]),[o,s]=c.useState(null),[a,n]=c.useState(null),[h,v]=c.useState(null),[x,N]=c.useState(null),[j,i]=c.useState(!1),[r,d]=c.useState(!0),[m,b,y]=F([]),[u,C,A]=P([]),S=c.useCallback(async()=>{try{const p=await k.getJourneyMaps();l(p.maps),p.maps.length>0&&!o&&s(p.maps[0].id)}catch{l([])}finally{d(!1)}},[o]),E=c.useCallback(async p=>{try{const f=await k.getJourneyMap(p);n(f)}catch{n(null)}},[]);c.useEffect(()=>{S()},[S]),c.useEffect(()=>{o&&E(o)},[o,E]);const w=c.useMemo(()=>{if(!a)return null;if(!x)return a;const p=a.variants.find(g=>g.id===x);if(!p)return a;const f=new Set(p.path);return{...a,screens:a.screens.filter(g=>f.has(g.id)),edges:a.edges.filter(g=>f.has(g.from)&&f.has(g.to))}},[a,x]);c.useEffect(()=>{if(!w){b([]),C([]);return}const f=B(w.screens,w.edges).map(g=>({...g,data:{...g.data,onSelect:v}}));b(f),C(G(w.edges))},[w,b,C]);const I=c.useCallback(()=>{d(!0),S()},[S]);return r||t.length===0?e.jsxs(e.Fragment,{children:[e.jsx(T,{maps:t,selectedId:o,onSelect:s,onImport:()=>i(!0),loading:r}),e.jsx(_,{open:j,onClose:()=>i(!1),onImported:I})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(T,{maps:t,selectedId:o,onSelect:s,onImport:()=>i(!0),loading:!1}),a&&e.jsx(U,{variants:a.variants,activeVariant:x,onSelect:N}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(H,{nodes:m,edges:u,onNodesChange:y,onEdgesChange:A,nodeTypes:Y,proOptions:q,fitView:!0,minZoom:.1,maxZoom:3,defaultViewport:{x:0,y:0,zoom:.7},children:[e.jsx(z,{color:"var(--color-border)",gap:20}),e.jsx(L,{position:"bottom-left"}),e.jsx(R,{nodeColor:p=>{const f=p.data;return M[f.screen.screenType]??"#757575"},maskColor:"rgba(0,0,0,0.1)",position:"bottom-right"})]})}),h&&e.jsx($,{screen:h,onClose:()=>v(null)})]}),e.jsx(_,{open:j,onClose:()=>i(!1),onImported:I})]})}export{ee as JourneyTab};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r,a as f,j as t}from"./index-DtkPX5ZZ.js";function w(){const[l,o]=r.useState([]),[n,v]=r.useState(!0),d=r.useRef(0),p=r.useCallback(async()=>{try{const{logs:c}=await f.getLogs();o(c),c.length>0&&(d.current=c[c.length-1].id)}finally{v(!1)}},[]),u=r.useCallback(async()=>{await f.clearLogs(),o([]),d.current=0},[]);return r.useEffect(()=>{p()},[p]),r.useEffect(()=>{const c=new EventSource("/api/v1/events"),i=b=>{try{const s=JSON.parse(b.data),a={id:s.payload.id,level:s.payload.level,message:s.payload.message,context:s.payload.context,timestamp:s.timestamp};a.id>d.current&&(d.current=a.id,o(h=>[...h,a]))}catch{}};return c.addEventListener("log:entry",i),c.onerror=()=>{c.close(),setTimeout(()=>{},5e3)},()=>c.close()},[]),{logs:l,loading:n,clearLogs:u,refresh:p}}const k={info:"bg-blue-500/20 text-blue-400",warn:"bg-yellow-500/20 text-yellow-400",error:"bg-red-500/20 text-red-400",success:"bg-green-500/20 text-green-400",debug:"bg-gray-500/20 text-gray-400"},E=["info","warn","error","success","debug"];function y(l){return new Date(l).toLocaleTimeString("en-US",{hour12:!1})}function L(l){return!l||Object.keys(l).length===0?"":Object.entries(l).map(([o,n])=>`${o}="${String(n)}"`).join(" ")}function j(l){return l.map(o=>{const n=L(o.context);return`[${y(o.timestamp)}] [${o.level.toUpperCase()}] ${o.message}${n?" "+n:""}`}).join(`
|
|
2
|
-
`)}function O(){const{logs:l,loading:o,clearLogs:n,refresh:v}=w(),[d,p]=r.useState("all"),[u,c]=r.useState(""),[i,b]=r.useState(!0),s=r.useRef(null),a=r.useMemo(()=>{let e=l;if(d!=="all"&&(e=e.filter(x=>x.level===d)),u.trim()){const x=u.toLowerCase();e=e.filter(g=>g.message.toLowerCase().includes(x))}return e},[l,d,u]);r.useEffect(()=>{i&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[a,i]);const h=r.useCallback(()=>{if(!s.current)return;const{scrollTop:e,scrollHeight:x,clientHeight:g}=s.current,m=x-e-g<40;b(m)},[]),C=r.useCallback(async()=>{const e=j(a);await navigator.clipboard.writeText(e)},[a]),N=r.useCallback(()=>{const e=j(a),x=new Blob([e],{type:"text/plain"}),g=URL.createObjectURL(x),m=document.createElement("a");m.href=g,m.download=`mcp-graph-logs-${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.txt`,m.click(),URL.revokeObjectURL(g)},[a]),S=r.useCallback(async()=>{await n()},[n]);return o?t.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading logs..."}):t.jsxs("div",{className:"flex flex-col h-full","data-testid":"logs-tab",children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[t.jsxs("select",{value:d,onChange:e=>p(e.target.value),className:"px-2 py-1 text-sm rounded border border-[var(--color-border)] bg-[var(--color-bg)] text-[var(--color-text)]","data-testid":"log-level-filter",children:[t.jsx("option",{value:"all",children:"All Levels"}),E.map(e=>t.jsx("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))]}),t.jsx("input",{type:"text",value:u,onChange:e=>c(e.target.value),placeholder:"Search logs...",className:"flex-1 px-2 py-1 text-sm rounded border border-[var(--color-border)] bg-[var(--color-bg)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)]","data-testid":"log-search"}),t.jsx("button",{onClick:()=>b(!i),className:`px-2 py-1 text-xs rounded border ${i?"border-[var(--color-accent)] text-[var(--color-accent)]":"border-[var(--color-border)] text-[var(--color-text-muted)]"}`,title:i?"Auto-scroll enabled":"Auto-scroll paused",children:i?"Auto-scroll ON":"Auto-scroll OFF"}),t.jsx("button",{onClick:C,className:"px-2 py-1 text-xs rounded border border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Copy all visible logs",children:"Copy"}),t.jsx("button",{onClick:N,className:"px-2 py-1 text-xs rounded border border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Download logs as .txt",children:"Download"}),t.jsx("button",{onClick:S,className:"px-2 py-1 text-xs rounded border border-red-500/30 text-red-400 hover:bg-red-500/10",title:"Clear all logs",children:"Clear"}),t.jsx("button",{onClick:()=>void v(),className:"px-2 py-1 text-xs rounded border border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Refresh logs",children:"Refresh"}),t.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:[a.length," entries"]})]}),t.jsx("div",{ref:s,onScroll:h,className:"flex-1 overflow-y-auto font-mono text-xs p-2","data-testid":"log-list",children:a.length===0?t.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"No logs to display"}):a.map(e=>t.jsxs("div",{className:"flex items-start gap-2 py-0.5 hover:bg-[var(--color-bg-secondary)]",children:[t.jsx("span",{className:"text-[var(--color-text-muted)] shrink-0",children:y(e.timestamp)}),t.jsx("span",{className:`px-1.5 py-0 rounded text-[10px] font-semibold uppercase shrink-0 ${k[e.level]}`,children:e.level}),t.jsx("span",{className:"text-[var(--color-text)]",children:e.message}),e.context&&Object.keys(e.context).length>0&&t.jsx("span",{className:"text-[var(--color-text-muted)]",children:L(e.context)})]},e.id))})]})}export{O as LogsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,a as b,j as e}from"./index-DtkPX5ZZ.js";function j(t){const c=[];for(const l of t){const o=l.name.split("/");let a=c;for(let n=0;n<o.length;n++){const r=o[n],x=o.slice(0,n+1).join("/"),d=n===o.length-1;let s=a.find(f=>f.name===r);s||(s={name:r,path:x,children:[]},d&&(s.memory=l),a.push(s)),d&&!s.memory&&(s.memory=l),a=s.children}}return c}function S(){const[t,c]=i.useState([]),[l,o]=i.useState(null),[a,n]=i.useState(null),[r,x]=i.useState(!0),d=i.useCallback(async()=>{try{x(!0);const s=await b.getMemories().catch(()=>[]);c(s)}catch(s){n(s instanceof Error?s.message:"Failed to load")}finally{x(!1)}},[]);return i.useEffect(()=>{d()},[d]),r?e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading Memories..."}):a?e.jsxs("div",{className:"flex items-center justify-center h-full text-[var(--color-danger)]",children:["Failed to load: ",a]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Memories"}),e.jsx(g,{label:"Memories",active:t.length>0}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[t.length," memories"]})]}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(N,{memories:t,selectedMemory:l,onSelect:o}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:e.jsx(y,{selectedMemory:l})})]})]})}function g({label:t,active:c}){const l=c?"var(--color-success)":"var(--color-text-muted)",o=c?"Active":"No data";return e.jsxs("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full",style:{background:`${l}20`,color:l},children:[t,": ",o]})}function N({memories:t,selectedMemory:c,onSelect:l}){const[o,a]=i.useState(""),[n,r]=i.useState(!1),[x,d]=i.useState(new Set),s=i.useMemo(()=>{if(!o.trim())return t;const m=o.toLowerCase();return t.filter(p=>p.name.toLowerCase().includes(m))},[t,o]),f=i.useMemo(()=>j(s),[s]),v=i.useCallback(m=>{d(p=>{const u=new Set(p);return u.has(m)?u.delete(m):u.add(m),u})},[]);return n?e.jsx("div",{className:"w-8 border-r border-[var(--color-border)] bg-[var(--color-bg-secondary)] flex flex-col items-center pt-2",children:e.jsx("button",{onClick:()=>r(!1),className:"text-[10px] text-[var(--color-text-muted)] hover:text-[var(--color-text)] rotate-90",title:"Expand file explorer",children:"Files"})}):e.jsxs("div",{className:"w-64 border-r border-[var(--color-border)] bg-[var(--color-bg-secondary)] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-[var(--color-border)]",children:[e.jsx("span",{className:"text-[10px] font-semibold text-[var(--color-text-muted)] uppercase tracking-wider",children:"Files"}),e.jsx("button",{onClick:()=>r(!0),className:"text-[10px] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Collapse",children:"✕"})]}),e.jsx("div",{className:"px-2 py-1.5 border-b border-[var(--color-border)]",children:e.jsx("input",{type:"text",value:o,onChange:m=>a(m.target.value),placeholder:"Search files...",className:"w-full text-[11px] px-2 py-1 rounded bg-[var(--color-bg)] border border-[var(--color-border)] focus:outline-none focus:border-[var(--color-accent)]"})}),e.jsx("div",{className:"flex-1 overflow-y-auto text-[11px]",children:t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-[var(--color-text-muted)]",children:"No memories"}):e.jsx(h,{nodes:f,depth:0,expandedPaths:x,onToggle:v,selectedMemory:c,onSelect:l})})]})}function h({nodes:t,depth:c,expandedPaths:l,onToggle:o,selectedMemory:a,onSelect:n}){return e.jsx(e.Fragment,{children:t.map(r=>{const x=r.children.length>0,d=l.has(r.path),s=r.memory!=null&&(a==null?void 0:a.name)===r.memory.name;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>{x&&o(r.path),r.memory&&n(r.memory)},className:`w-full text-left px-2 py-0.5 flex items-center gap-1 hover:bg-[var(--color-bg-tertiary)] transition-colors ${s?"bg-[var(--color-accent)]15 text-[var(--color-accent)]":"text-[var(--color-text)]"}`,style:{paddingLeft:`${c*12+8}px`},children:[x?e.jsx("span",{className:"w-3 text-[9px] text-[var(--color-text-muted)]",children:d?"▾":"▸"}):e.jsx("span",{className:"w-3 text-[9px] text-[var(--color-text-muted)]",children:"·"}),e.jsx("span",{className:"truncate",children:r.name})]}),x&&d&&e.jsx(h,{nodes:r.children,depth:c+1,expandedPaths:l,onToggle:o,selectedMemory:a,onSelect:n})]},r.path)})})}function y({selectedMemory:t}){return t?e.jsxs("div",{className:"p-4",children:[e.jsx("div",{className:"flex items-center gap-2 mb-3 pb-2 border-b border-[var(--color-border)]",children:e.jsx("span",{className:"text-sm font-semibold",children:t.name})}),e.jsx("pre",{className:"text-xs whitespace-pre-wrap text-[var(--color-text-muted)] font-mono leading-relaxed",children:t.content})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm mb-1",children:"Select a memory from the explorer"}),e.jsx("p",{className:"text-xs",children:"Project memories appear as navigable files"})]})})}export{S as MemoriesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,j as e}from"./index-DtkPX5ZZ.js";import{R as _,u as M,a as E,b as P,i as T,B,C as D}from"./style-Da3qWU01.js";import{S as y}from"./constants-z0QkAiYv.js";import{b as R,g as F,t as $,c as z,d as I,W as L,e as A,N as O}from"./graph-utils-BpYHKE87.js";import"./index-F9dY4AG_.js";const V=a.memo(function({graph:c,onNodeClick:N}){const{groups:w,nextTask:h,nodeMap:g}=a.useMemo(()=>{const d=c.nodes.filter(s=>s.type==="task"||s.type==="subtask"),x=new Map(c.nodes.map(s=>[s.id,s])),m=new Set(c.nodes.filter(s=>s.status==="done").map(s=>s.id)),f=d.filter(s=>s.status!=="backlog"&&s.status!=="ready"||s.blocked?!1:c.edges.filter(r=>r.from===s.id&&r.relationType==="depends_on").every(r=>m.has(r.to)));f.sort((s,t)=>s.priority-t.priority);const i=new Map;for(const s of d){const t=s.parentId||"__root__";i.has(t)||i.set(t,[]),i.get(t).push(s)}for(const s of i.values())s.sort((t,r)=>t.priority-r.priority);return{groups:i,nextTask:f[0]||null,nodeMap:x}},[c]);return c.nodes.filter(d=>d.type==="task"||d.type==="subtask").length===0?e.jsx("div",{className:"p-4 text-center text-[var(--color-text-muted)]",children:"No tasks in backlog."}):e.jsxs("div",{className:"p-2",children:[h&&e.jsxs("div",{className:"mb-3 px-3 py-2 bg-[var(--color-accent)]10 border border-[var(--color-accent)] rounded-lg",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--color-accent)]",children:"Next:"})," ",e.jsx("span",{className:"text-sm font-semibold",children:h.title})]}),Array.from(w.entries()).map(([d,x])=>{const m=d!=="__root__"?g.get(d):null,f=m?m.title:"Ungrouped Tasks",i=x.filter(t=>t.status==="done").length,s=Math.round(i/x.length*100);return e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[e.jsx("h4",{className:"text-xs font-semibold truncate",children:f}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[i,"/",x.length]})]}),e.jsx("div",{className:"h-1 mx-2 mb-1 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${s}%`,background:y.done}})}),x.map(t=>{const r=(h==null?void 0:h.id)===t.id,v=y[t.status]||"#9e9e9e",j=c.edges.filter(n=>n.from===t.id&&n.relationType==="depends_on").map(n=>{var l;return((l=g.get(n.to))==null?void 0:l.title)||n.to});return e.jsxs("div",{onClick:()=>N(t),className:`mx-1 mb-1 px-2 py-1.5 rounded cursor-pointer hover:bg-[var(--color-bg-tertiary)] transition-colors ${r?"ring-1 ring-[var(--color-accent)]":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded font-medium shrink-0",style:{background:`${v}20`,color:v},children:t.status.replace("_"," ")}),e.jsx("span",{className:"text-xs truncate flex-1",children:t.title}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["P",t.priority]}),t.xpSize&&e.jsx("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:t.xpSize})]}),j.length>0&&e.jsxs("div",{className:"text-[10px] text-[var(--color-text-muted)] mt-0.5 truncate pl-1",children:["Depends on: ",j.join(", ")]})]},t.id)})]},d)})]})}),W={workflowNode:A},U={workflowEdge:L},Z={hideAttribution:!0};function G({graph:o}){const[c,N,w]=M([]),[h,g,d]=E([]),[x,m]=a.useState(null),[f,i]=a.useState(new Set),s=a.useRef(!0),{fitView:t}=P(),r=a.useMemo(()=>R(o.nodes,o.edges),[o.nodes,o.edges]),v=a.useCallback(l=>{i(u=>{const p=new Set(u);return p.has(l)?p.delete(l):p.add(l),p})},[]);a.useEffect(()=>{const l=F(o.nodes,f,r),u=$(l,void 0,r,f,v),p=new Set(u.map(S=>S.id)),k=z(o.edges,p),b=I(u,k,"TB");N(b.nodes),g(b.edges),s.current?s.current=!1:setTimeout(()=>t({duration:300}),50)},[o,N,g,f,r,v,t]);const C=a.useCallback((l,u)=>{m(u.data.sourceNode)},[]),j=a.useCallback(l=>{m(l)},[]),n=a.useMemo(()=>{const l=o.nodes.length,u=o.nodes.filter(b=>b.status==="done").length,p=o.nodes.filter(b=>b.status==="in_progress").length,k=o.nodes.filter(b=>b.status==="blocked").length;return{total:l,done:u,inProgress:p,blocked:k,pctDone:l?Math.round(u/l*100):0}},[o.nodes]);return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-1.5 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border)] flex items-center gap-2 text-xs relative z-10",children:e.jsxs("span",{className:"text-[var(--color-text-muted)]",children:["Showing ",c.length," of ",o.nodes.length," nodes — click ▶ to expand"]})}),o.nodes.length>0?e.jsxs(T,{nodes:c,edges:h,onNodesChange:w,onEdgesChange:d,onNodeClick:C,nodeTypes:W,edgeTypes:U,nodesDraggable:!1,nodesConnectable:!1,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Z,children:[e.jsx(B,{gap:16,size:1}),e.jsx(D,{showInteractive:!1})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Import a PRD to see the workflow"})]}),e.jsxs("div",{className:"w-96 border-l border-[var(--color-border)] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsxs("span",{children:[n.done,"/",n.total," done (",n.pctDone,"%)"]}),e.jsxs("span",{className:"text-[var(--color-text-muted)]",children:[n.inProgress," in progress, ",n.blocked," blocked"]})]}),e.jsxs("div",{className:"h-2 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full transition-all",style:{width:`${n.pctDone}%`,background:y.done}}),e.jsx("div",{className:"h-full transition-all",style:{width:`${n.total?Math.round(n.inProgress/n.total*100):0}%`,background:y.in_progress}})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(V,{graph:o,onNodeClick:j})})]}),x&&e.jsx(O,{node:x,onClose:()=>m(null)})]})}function X({graph:o}){return e.jsx(_,{children:e.jsx(G,{graph:o})})}export{X as PrdBacklogTab};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r,a as d,j as e}from"./index-DtkPX5ZZ.js";function z(){const[h,C]=r.useState([]),[k,L]=r.useState([]),[P,N]=r.useState(!0),[w,I]=r.useState(null),[f,i]=r.useState(null),v=r.useRef(null),g=r.useRef(null),[c,T]=r.useState(""),[x,D]=r.useState(["business_component"]),[j,F]=r.useState(""),[m,S]=r.useState(null),[u,G]=r.useState(""),[a,y]=r.useState(null),[b,p]=r.useState(!1),n=r.useCallback(async()=>{try{N(!0);const[t,s]=await Promise.all([d.siebelGetObjects({limit:100}).catch(()=>({objects:[],total:0})),d.siebelGetTemplates().catch(()=>({templates:[]}))]);C(t.objects),L(s.templates)}catch(t){I(t instanceof Error?t.message:"Failed to load")}finally{N(!1)}},[]);r.useEffect(()=>{n()},[n]);const E=r.useCallback(async t=>{var l;const s=(l=t.target.files)==null?void 0:l[0];if(s){try{i("Importing SIF...");const o=await s.text();await d.siebelImportSif(o,s.name,!0),i(`SIF imported: ${s.name}`),n()}catch(o){i(`Error: ${o instanceof Error?o.message:String(o)}`)}v.current&&(v.current.value="")}},[n]),R=r.useCallback(async t=>{var l;const s=(l=t.target.files)==null?void 0:l[0];if(s){try{i("Uploading documentation...");const o=await d.siebelUploadDocs(s);i(`Indexed: ${o.fileName} (${o.chunksIndexed} chunks)`),n()}catch(o){i(`Error: ${o instanceof Error?o.message:String(o)}`)}g.current&&(g.current.value="")}},[n]),$=r.useCallback(async()=>{if(c.trim()){p(!0),y(null);try{const t=await d.siebelPrepareGeneration({description:c,objectTypes:x,basedOnProject:j||void 0});S(t.prompt)}catch(t){S(`Error: ${t instanceof Error?t.message:String(t)}`)}finally{p(!1)}}},[c,x,j]),U=r.useCallback(async()=>{if(u.trim()){p(!0);try{const t=await d.siebelFinalizeGeneration({generatedXml:u,description:c,objectTypes:x});y(t),n()}catch(t){y({sifContent:"",objects:[],validation:{status:"invalid",messages:[{level:"error",message:t instanceof Error?t.message:String(t)}],score:0},metadata:{generatedAt:new Date().toISOString(),requestDescription:c,objectCount:0}})}finally{p(!1)}}},[u,c,x,n]),O=r.useCallback(()=>{if(!(a!=null&&a.sifContent))return;const t=new Blob([a.sifContent],{type:"application/xml"}),s=URL.createObjectURL(t),l=document.createElement("a");l.href=s,l.download="generated.sif",l.click(),URL.revokeObjectURL(s)},[a]),M=r.useCallback(t=>{D(s=>s.includes(t)?s.filter(l=>l!==t):[...s,t])},[]);return P?e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading Siebel..."}):w?e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-danger)]",children:w}):e.jsx("div",{className:"h-full overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-6 max-w-6xl mx-auto",children:[e.jsxs("section",{className:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-border)]",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Upload & Context"}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:"Upload SIF files and documentation to build RAG context for generation"})]}),e.jsxs("div",{className:"p-4 grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5",children:"SIF File (.sif)"}),e.jsx("input",{ref:v,type:"file",accept:".sif,.xml",onChange:E,className:"block w-full text-xs file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-medium file:bg-[var(--color-accent)] file:text-white hover:file:opacity-90 cursor-pointer"}),e.jsx("p",{className:"text-[10px] text-[var(--color-text-muted)] mt-1",children:"Imports Siebel objects into the graph + knowledge store"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5",children:"Documentation (PDF, HTML, DOC, DOCX, TXT, MD)"}),e.jsx("input",{ref:g,type:"file",accept:".pdf,.html,.htm,.txt,.md,.doc,.docx",onChange:R,className:"block w-full text-xs file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-medium file:bg-[var(--color-accent)] file:text-white hover:file:opacity-90 cursor-pointer"}),e.jsx("p",{className:"text-[10px] text-[var(--color-text-muted)] mt-1",children:"Indexes documentation as context for SIF generation"})]})]}),f&&e.jsx("div",{className:`px-4 py-2 text-xs border-t border-[var(--color-border)] ${f.startsWith("Error")?"text-red-500":"text-green-500"}`,children:f})]}),e.jsxs("section",{className:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsx("div",{className:"px-4 py-3 border-b border-[var(--color-border)]",children:e.jsxs("h3",{className:"text-sm font-semibold",children:["Indexed Siebel Objects",e.jsxs("span",{className:"ml-2 text-xs font-normal text-[var(--color-text-muted)]",children:[h.length," objects"]})]})}),h.length===0?e.jsx("div",{className:"p-4 text-xs text-[var(--color-text-muted)]",children:"No Siebel objects indexed yet. Upload a .sif file above."}):e.jsx("div",{className:"max-h-64 overflow-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-[var(--color-bg-secondary)]",children:e.jsxs("tr",{className:"border-b border-[var(--color-border)]",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Name"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Type"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Project"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Preview"})]})}),e.jsx("tbody",{children:h.map((t,s)=>e.jsxs("tr",{className:"border-b border-[var(--color-border)] hover:bg-[var(--color-bg-primary)]",children:[e.jsx("td",{className:"px-4 py-1.5 font-mono",children:t.title}),e.jsx("td",{className:"px-4 py-1.5",children:e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-[var(--color-accent)]/10 text-[var(--color-accent)]",children:t.siebelType??t.sourceType})}),e.jsx("td",{className:"px-4 py-1.5 text-[var(--color-text-muted)]",children:t.siebelProject??"-"}),e.jsx("td",{className:"px-4 py-1.5 text-[var(--color-text-muted)] truncate max-w-xs",children:t.contentPreview})]},s))})]})})]}),e.jsxs("section",{className:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-border)]",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"SIF Generation"}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:"Describe what you need, generate context for the LLM, then validate the output"})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"Description"}),e.jsx("textarea",{value:c,onChange:t=>T(t.target.value),placeholder:"e.g., Create a Business Component for Service Requests with fields: SR Number, Status, Priority",rows:3,className:"w-full px-3 py-2 text-xs rounded-md border border-[var(--color-border)] bg-[var(--color-bg-primary)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5",children:"Object Types"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:k.map(t=>e.jsx("button",{onClick:()=>M(t.type),className:`px-2 py-1 text-[10px] rounded-md border transition-colors ${x.includes(t.type)?"bg-[var(--color-accent)] text-white border-[var(--color-accent)]":"bg-transparent text-[var(--color-text-muted)] border-[var(--color-border)] hover:border-[var(--color-accent)]"}`,children:t.type.replace(/_/g," ")},t.type))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"Base Project (optional)"}),e.jsx("input",{value:j,onChange:t=>F(t.target.value),placeholder:"e.g., Account (SSE)",className:"w-full px-3 py-1.5 text-xs rounded-md border border-[var(--color-border)] bg-[var(--color-bg-primary)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent)]"})]}),e.jsx("button",{onClick:$,disabled:!c.trim()||b,className:"px-4 py-1.5 text-xs font-medium rounded-md bg-[var(--color-accent)] text-white hover:opacity-90 disabled:opacity-50 transition-opacity",children:b?"Generating Context...":"Generate Context & Prompt"}),m&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"text-xs font-medium",children:"Generated Prompt (copy to LLM)"}),e.jsx("button",{onClick:()=>navigator.clipboard.writeText(m),className:"text-[10px] px-2 py-0.5 rounded bg-[var(--color-bg-primary)] text-[var(--color-text-muted)] hover:text-[var(--color-text)] border border-[var(--color-border)]",children:"Copy"})]}),e.jsxs("pre",{className:"text-[10px] p-3 rounded-md bg-[var(--color-bg-primary)] border border-[var(--color-border)] max-h-48 overflow-auto whitespace-pre-wrap text-[var(--color-text-muted)]",children:[m.slice(0,3e3),m.length>3e3&&`
|
|
2
|
-
|
|
3
|
-
... (truncated for display)`]})]}),m&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",children:"Paste LLM-generated SIF XML"}),e.jsx("textarea",{value:u,onChange:t=>G(t.target.value),placeholder:'Paste the XML output from the LLM here (starting with <?xml version="1.0"...)',rows:8,className:"w-full px-3 py-2 text-xs font-mono rounded-md border border-[var(--color-border)] bg-[var(--color-bg-primary)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent)]"}),e.jsx("button",{onClick:U,disabled:!u.trim()||b,className:"mt-2 px-4 py-1.5 text-xs font-medium rounded-md bg-green-600 text-white hover:opacity-90 disabled:opacity-50 transition-opacity",children:b?"Validating...":"Validate & Finalize"})]}),a&&e.jsxs("div",{className:`rounded-md border p-4 space-y-2 ${a.validation.status==="valid"?"border-green-500/30 bg-green-500/5":a.validation.status==="warnings"?"border-yellow-500/30 bg-yellow-500/5":"border-red-500/30 bg-red-500/5"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-sm font-bold ${a.validation.status==="valid"?"text-green-500":a.validation.status==="warnings"?"text-yellow-500":"text-red-500"}`,children:a.validation.status==="valid"?"Valid":a.validation.status==="warnings"?"Warnings":"Invalid"}),e.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:["Score: ",a.validation.score,"/100"]}),e.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:[a.metadata.objectCount," objects"]})]}),a.validation.status!=="invalid"&&e.jsx("button",{onClick:O,className:"px-3 py-1 text-xs font-medium rounded-md bg-[var(--color-accent)] text-white hover:opacity-90",children:"Download SIF"})]}),a.objects.length>0&&e.jsxs("div",{className:"text-xs text-[var(--color-text-muted)]",children:["Objects: ",a.objects.map(t=>`${t.type}:${t.name}`).join(", ")]}),a.validation.messages.length>0&&e.jsx("ul",{className:"space-y-0.5",children:a.validation.messages.map((t,s)=>e.jsxs("li",{className:`text-[10px] ${t.level==="error"?"text-red-500":t.level==="warning"?"text-yellow-600":"text-[var(--color-text-muted)]"}`,children:["[",t.level,"] ",t.message,t.objectName&&` (${t.objectName})`]},s))})]})]})]})]})})}export{z as SiebelTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,a as k,j as e}from"./index-DtkPX5ZZ.js";import{P,L as O}from"./constants-z0QkAiYv.js";function D(){const[t,s]=a.useState([]),[x,l]=a.useState([]),[i,n]=a.useState(0),[m,h]=a.useState(!0),[b,v]=a.useState(null),d=a.useCallback(async()=>{h(!0),v(null);try{const[o,u]=await Promise.all([k.getSkills(),k.getRecommendations().catch(()=>({recommendations:[]}))]);s(o.skills),n(o.totalTokens),l(u.recommendations)}catch(o){v(o instanceof Error?o.message:"Failed to load skills")}finally{h(!1)}},[]);a.useEffect(()=>{d()},[d]);const j=a.useCallback(async(o,u)=>{s(C=>C.map(N=>N.name===o?{...N,enabled:u}:N));try{await k.toggleSkill(o,u)}catch{d()}},[d]),p=a.useCallback(async o=>{await k.createCustomSkill(o),d()},[d]),y=a.useCallback(async(o,u)=>{await k.updateCustomSkill(o,u),d()},[d]),f=a.useCallback(async o=>{await k.deleteCustomSkill(o),d()},[d]),g=t.filter(o=>o.enabled).reduce((o,u)=>o+u.estimatedTokens,0);return{skills:t,recommendations:x,totalTokens:i,activeTokens:g,loading:m,error:b,refresh:d,toggleSkill:j,createSkill:p,updateSkill:y,deleteSkill:f}}function A({skill:t,onClose:s,onToggle:x,onDelete:l,onEdit:i}){return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n=>{n.target===n.currentTarget&&s()},children:e.jsxs("div",{className:"bg-[var(--color-bg)] rounded-lg shadow-xl w-full max-w-lg p-6 max-h-[80vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold truncate",children:t.name}),e.jsx("button",{onClick:s,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-xl",children:"×"})]}),e.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mb-4",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-medium ${t.source==="built-in"?"bg-blue-500/10 text-blue-500":t.source==="custom"?"bg-purple-500/10 text-purple-500":"bg-gray-500/10 text-gray-500"}`,children:t.source}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium bg-[var(--color-border)] text-[var(--color-text-muted)]",children:t.category}),e.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium bg-[var(--color-border)] text-[var(--color-text-muted)]",children:[t.estimatedTokens.toLocaleString()," tokens"]})]}),t.phases&&t.phases.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-4",children:t.phases.map(n=>{const m=P[n]??"#6b7280";return e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium",style:{background:`${m}20`,color:m},children:n},n)})}),e.jsx("div",{className:"flex items-center gap-3 mb-4 p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:n=>x(t.name,n.target.checked),className:"w-4 h-4 accent-[var(--color-accent)]"}),t.enabled?"Enabled":"Disabled"]})}),t.source==="custom"&&e.jsxs("div",{className:"flex gap-2",children:[i&&e.jsx("button",{onClick:()=>i(t),className:"px-3 py-1.5 text-sm border border-[var(--color-border)] rounded hover:bg-[var(--color-bg-tertiary)]",children:"Edit"}),l&&t.id&&e.jsx("button",{onClick:()=>l(t.id),className:"px-3 py-1.5 text-sm text-red-500 border border-red-500/30 rounded hover:bg-red-500/10",children:"Delete"})]})]})}):null}const F=["know-me","software-design","security","testing","cost-reducer","research","ddd","frontend-design","other"];function z({open:t,onClose:s,onSubmit:x,editSkill:l}){const[i,n]=a.useState(""),[m,h]=a.useState(""),[b,v]=a.useState("know-me"),[d,j]=a.useState(["IMPLEMENT"]),[p,y]=a.useState(""),[f,g]=a.useState(!1),[o,u]=a.useState(null);a.useEffect(()=>{l?(n(l.name),h(l.description),v(l.category),j(l.phases??["IMPLEMENT"]),y("")):(n(""),h(""),v("know-me"),j(["IMPLEMENT"]),y("")),u(null)},[l,t]);const C=a.useCallback(r=>{j(S=>S.includes(r)?S.filter(T=>T!==r):[...S,r])},[]),N=a.useCallback(async()=>{if(!i.trim()||!m.trim()||!p.trim()||d.length===0){u("All fields are required and at least one phase must be selected.");return}g(!0),u(null);try{await x({name:i.trim(),description:m.trim(),category:b,phases:d,instructions:p.trim()}),s()}catch(r){u(r instanceof Error?r.message:"Failed to save skill")}finally{g(!1)}},[i,m,b,d,p,x,s]);return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r=>{r.target===r.currentTarget&&s()},children:e.jsxs("div",{className:"bg-[var(--color-bg)] rounded-lg shadow-xl w-full max-w-lg p-6 max-h-[85vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:l?"Edit Skill":"Create Custom Skill"}),e.jsx("button",{onClick:s,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-xl",children:"×"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Name"}),e.jsx("input",{type:"text",value:i,onChange:r=>n(r.target.value),placeholder:"my-workflow",disabled:!!l,className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Description"}),e.jsx("input",{type:"text",value:m,onChange:r=>h(r.target.value),placeholder:"What does this skill do?",className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Category"}),e.jsx("select",{value:b,onChange:r=>v(r.target.value),className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:F.map(r=>e.jsx("option",{value:r,children:r},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Phases"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:O.map(r=>e.jsx("button",{type:"button",onClick:()=>C(r),className:`px-2 py-1 text-[10px] font-medium rounded-full border transition-colors ${d.includes(r)?"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]":"border-[var(--color-border)] text-[var(--color-text-muted)] hover:border-[var(--color-text)]"}`,children:r},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Instructions"}),e.jsx("textarea",{value:p,onChange:r=>y(r.target.value),rows:6,placeholder:"Instructions for the AI agent when this skill is active...",className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] resize-y"})]}),o&&e.jsx("div",{className:"text-sm p-2 rounded bg-red-500/10 text-red-500",children:o}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:s,className:"px-3 py-1.5 text-sm border border-[var(--color-border)] rounded hover:bg-[var(--color-bg-tertiary)]",children:"Cancel"}),e.jsx("button",{onClick:N,disabled:f,className:"px-3 py-1.5 text-sm bg-[var(--color-accent)] text-white rounded hover:opacity-90 disabled:opacity-50",children:f?"Saving...":l?"Update":"Create"})]})]})]})}):null}const I=4e3;function w({value:t,label:s}){return e.jsxs("div",{className:"p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] text-center","data-testid":"metric-card",children:[e.jsx("div",{className:"text-xl font-bold",children:t}),e.jsx("div",{className:"text-[10px] text-[var(--color-text-muted)] uppercase",children:s})]})}function _({phase:t}){const s=P[t]??"#6b7280";return e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium",style:{background:`${s}20`,color:s},children:t})}function G({source:t}){const s={"built-in":"bg-[var(--color-accent)]/10 text-[var(--color-accent)]",filesystem:"bg-[var(--color-text-muted)]/10 text-[var(--color-text-muted)]",custom:"bg-purple-500/10 text-purple-500"};return e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${s[t]}`,children:t})}function H({skill:t,onToggle:s,onClick:x}){return e.jsxs("div",{className:`p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] cursor-pointer hover:border-[var(--color-accent)]/50 transition-all ${t.enabled?"":"opacity-50"}`,onClick:()=>x(t),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium truncate",children:t.name}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:l=>{l.stopPropagation(),s(t.name,l.target.checked)},onClick:l=>l.stopPropagation(),className:"w-3.5 h-3.5 accent-[var(--color-accent)]"}),e.jsx(G,{source:t.source}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[t.estimatedTokens.toLocaleString()," tok"]})]})]}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)] line-clamp-2",children:t.description})]})}function B({phase:t,skills:s,onToggle:x,onSkillClick:l}){const[i,n]=a.useState(!0),m=P[t]??"#6b7280",h=s.filter(b=>b.enabled).length;return e.jsxs("div",{className:"rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>n(!i),className:"w-full flex items-center justify-between px-3 py-2 text-xs font-medium hover:bg-[var(--color-bg-tertiary)] transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:m}}),t,e.jsxs("span",{className:"px-1.5 py-0.5 rounded-full bg-[var(--color-border)] text-[10px]",children:[h,"/",s.length]})]}),e.jsx("span",{className:"text-[var(--color-text-muted)]",children:i?"▲":"▼"})]}),i&&e.jsx("div",{className:"px-3 pb-3 space-y-2",children:s.map(b=>e.jsx(H,{skill:b,onToggle:x,onClick:l},b.name))})]})}function U({rec:t}){return e.jsxs("div",{className:"p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-accent)]/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium",children:t.skill}),e.jsx(_,{phase:t.phase})]}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)]",children:t.reason})]})}function q({totalTokens:t,activeTokens:s}){const x=Math.min(s/I,1),l=Math.min(t/I,1),i=Math.round(x*100),n=x>.8?"#ef4444":x>.5?"#f59e0b":"#10b981";return e.jsxs("div",{"data-testid":"token-budget-bar",className:"p-4 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:"Token Budget"}),e.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:[s.toLocaleString()," active / ",t.toLocaleString()," total (",i,"%)"]})]}),e.jsxs("div",{className:"w-full h-2 rounded-full bg-[var(--color-border)] relative",children:[e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 opacity-30",style:{width:`${Math.round(l*100)}%`,background:"#6b7280"}}),e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 transition-all",style:{width:`${i}%`,background:n}})]})]})}function Y(){const{skills:t,recommendations:s,totalTokens:x,activeTokens:l,loading:i,error:n,refresh:m,toggleSkill:h,createSkill:b,updateSkill:v,deleteSkill:d}=D(),[j,p]=a.useState(null),[y,f]=a.useState(!1),[g,o]=a.useState(null),u=a.useCallback(async c=>{await d(c),p(null)},[d]),C=a.useCallback(c=>{p(null),o(c),f(!0)},[]),N=a.useCallback(async c=>{g!=null&&g.id?await v(g.id,c):await b(c),o(null)},[g,b,v]);if(n)return e.jsxs("div",{className:"flex items-center justify-center h-full text-[var(--color-danger)]",children:["Failed to load skills: ",n]});if(i)return e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading skills..."});const r=t.filter(c=>c.source==="built-in").length,S=t.filter(c=>c.source==="custom").length,T=t.filter(c=>c.enabled).length,M=new Map;for(const c of O){const E=t.filter($=>{var R;return(R=$.phases)==null?void 0:R.includes(c)});E.length>0&&M.set(c,E)}const L=t.filter(c=>!c.phases||c.phases.length===0);return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6 overflow-y-auto h-full",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Skills"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{o(null),f(!0)},className:"text-xs px-3 py-1.5 rounded-lg border border-[var(--color-accent)] text-[var(--color-accent)] hover:bg-[var(--color-accent)]/10 transition-colors",children:"+ Custom Skill"}),e.jsx("button",{onClick:()=>void m(),className:"text-xs px-3 py-1.5 rounded-lg bg-[var(--color-accent)] text-white hover:opacity-90 transition-opacity",children:"Refresh"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3","data-testid":"skills-stats",children:[e.jsx(w,{value:t.length,label:"Total Skills"}),e.jsx(w,{value:r,label:"Built-in"}),e.jsx(w,{value:S,label:"Custom"}),e.jsx(w,{value:T,label:"Enabled"}),e.jsx(w,{value:l.toLocaleString(),label:"Active Tokens"})]}),e.jsx(q,{totalTokens:x,activeTokens:l}),s.length>0&&e.jsxs("div",{"data-testid":"recommendations-section",className:"space-y-2",children:[e.jsxs("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:["Recommendations (",s.length,")"]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-2",children:s.map(c=>e.jsx(U,{rec:c},c.skill))})]}),e.jsxs("div",{"data-testid":"skills-by-phase",className:"space-y-3",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:"Skills by Lifecycle Phase"}),[...M.entries()].map(([c,E])=>e.jsx(B,{phase:c,skills:E,onToggle:h,onSkillClick:p},c)),L.length>0&&e.jsx(B,{phase:"Other",skills:L,onToggle:h,onSkillClick:p})]}),e.jsx(A,{skill:j,onClose:()=>p(null),onToggle:h,onDelete:u,onEdit:C}),e.jsx(z,{open:y,onClose:()=>{f(!1),o(null)},onSubmit:N,editSkill:g})]})}export{Y as SkillsTab};
|