@mcp-graph-workflow/mcp-graph 5.31.0 → 5.31.1

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.
Files changed (33) hide show
  1. package/dist/api/routes/benchmark.d.ts.map +1 -1
  2. package/dist/api/routes/benchmark.js +15 -2
  3. package/dist/api/routes/benchmark.js.map +1 -1
  4. package/dist/docs-manifest.json +1 -1
  5. package/dist/web/dashboard/dist/assets/benchmark-tab-GHO9Ji5M.js +1 -0
  6. package/dist/web/dashboard/dist/assets/{circle-alert-RxlCxXj1.js → circle-alert-CfDAmNcO.js} +1 -1
  7. package/dist/web/dashboard/dist/assets/{context-tab-DTPFGxle.js → context-tab-B_6B65lw.js} +1 -1
  8. package/dist/web/dashboard/dist/assets/{docs-tab-2uo7-Ybt.js → docs-tab-Dq7rtZol.js} +1 -1
  9. package/dist/web/dashboard/dist/assets/{gitnexus-tab-CiiNOf3e.js → gitnexus-tab-DAPpyAe_.js} +1 -1
  10. package/dist/web/dashboard/dist/assets/{graph-section-DKMay1zv.js → graph-section-O0mwo9kz.js} +1 -1
  11. package/dist/web/dashboard/dist/assets/{graph-tab-BYRVanTv.js → graph-tab-CAx8lu7Z.js} +1 -1
  12. package/dist/web/dashboard/dist/assets/{graph-utils-1O2cEKuy.js → graph-utils-BwdXFM9h.js} +1 -1
  13. package/dist/web/dashboard/dist/assets/index-BVhCKhGJ.css +1 -0
  14. package/dist/web/dashboard/dist/assets/{index-B5DzSMGg.js → index-BxYtgAYc.js} +1 -1
  15. package/dist/web/dashboard/dist/assets/{index-CIhDR5rf.js → index-D_SBClB-.js} +2 -2
  16. package/dist/web/dashboard/dist/assets/{index-CSeiGgX8.js → index-f0wNMEe_.js} +1 -1
  17. package/dist/web/dashboard/dist/assets/{insights-tab-DdI7TLP7.js → insights-tab-DfH4O_Gj.js} +1 -1
  18. package/dist/web/dashboard/dist/assets/{journey-tab-CDuvIW6V.js → journey-tab-D2_EXArZ.js} +1 -1
  19. package/dist/web/dashboard/dist/assets/{languages-tab-CrbP4u3b.js → languages-tab-Cs-EF0mT.js} +1 -1
  20. package/dist/web/dashboard/dist/assets/{loader-circle-Bl0DpM5P.js → loader-circle-D5Z5DuF4.js} +1 -1
  21. package/dist/web/dashboard/dist/assets/{logs-tab-QYKxeHna.js → logs-tab-DwVCJxNs.js} +1 -1
  22. package/dist/web/dashboard/dist/assets/{lsp-tab-CLO4RFMh.js → lsp-tab-D_3asNom.js} +1 -1
  23. package/dist/web/dashboard/dist/assets/{memories-tab-BT7A7YOy.js → memories-tab-BVe3nUf6.js} +1 -1
  24. package/dist/web/dashboard/dist/assets/{prd-backlog-tab-M1j0tAm2.js → prd-backlog-tab-DmeNjNES.js} +1 -1
  25. package/dist/web/dashboard/dist/assets/{refresh-cw-0ApsgAym.js → refresh-cw-dY_ihv6e.js} +1 -1
  26. package/dist/web/dashboard/dist/assets/{siebel-tab-CsZz2y2b.js → siebel-tab-CUO3fUiF.js} +3 -3
  27. package/dist/web/dashboard/dist/assets/{skills-tab-BrkrK7AC.js → skills-tab-lUKwXrZi.js} +1 -1
  28. package/dist/web/dashboard/dist/assets/{style-UgkJJqFQ.js → style-Chqa3iIg.js} +1 -1
  29. package/dist/web/dashboard/dist/assets/{triangle-alert-BcgxNLLr.js → triangle-alert-CkVvjxDP.js} +1 -1
  30. package/dist/web/dashboard/dist/index.html +2 -2
  31. package/package.json +1 -1
  32. package/dist/web/dashboard/dist/assets/benchmark-tab-BD02uofm.js +0 -1
  33. package/dist/web/dashboard/dist/assets/index-BxDGbcbB.css +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/api/routes/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAKlE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgKhE"}
1
+ {"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/api/routes/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAKlE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgLhE"}
@@ -21,10 +21,14 @@ export function createBenchmarkRouter(storeRef) {
21
21
  const ctx = buildTaskContext(store, node.id);
22
22
  if (!ctx)
23
23
  continue;
24
- const rawTokens = Math.ceil(ctx.metrics.originalChars / 4);
25
24
  const layered = computeLayeredMetrics(store, node.id) ?? undefined;
26
25
  if (layered)
27
26
  layeredSamples.push(layered);
27
+ // Use naiveNeighborhoodTokens as the honest baseline (full context without compression).
28
+ // Fallback to originalChars estimate only when layered metrics are unavailable.
29
+ const baselineTokens = layered
30
+ ? layered.naiveNeighborhoodTokens
31
+ : Math.ceil(ctx.metrics.originalChars / 4);
28
32
  perTaskMetrics.push({
29
33
  id: node.id,
30
34
  title: node.title,
@@ -32,7 +36,7 @@ export function createBenchmarkRouter(storeRef) {
32
36
  compactChars: ctx.metrics.compactChars,
33
37
  compressionPercent: ctx.metrics.reductionPercent,
34
38
  estimatedTokens: ctx.metrics.estimatedTokens,
35
- estimatedTokensSaved: Math.max(0, rawTokens - ctx.metrics.estimatedTokens),
39
+ estimatedTokensSaved: Math.max(0, baselineTokens - ctx.metrics.estimatedTokens),
36
40
  layered,
37
41
  });
38
42
  }
@@ -69,9 +73,16 @@ export function createBenchmarkRouter(storeRef) {
69
73
  // Cost calculations
70
74
  const opusInputPrice = 15.0; // $/MTok
71
75
  const sonnetInputPrice = 3.0; // $/MTok
76
+ // Average baseline tokens per task (uncompressed context)
77
+ const avgBaselineTokensPerTask = sampleSize > 0
78
+ ? Math.round(perTaskMetrics.reduce((s, m) => s + m.estimatedTokens + m.estimatedTokensSaved, 0) / sampleSize)
79
+ : 0;
72
80
  // Cost per task AFTER compression (what you actually pay)
73
81
  const opusCostPerTask = avgTokensPerTask > 0 ? (avgTokensPerTask * opusInputPrice) / 1_000_000 : 0;
74
82
  const sonnetCostPerTask = avgTokensPerTask > 0 ? (avgTokensPerTask * sonnetInputPrice) / 1_000_000 : 0;
83
+ // Cost per task WITHOUT compression (what you would pay without it)
84
+ const opusCostPerTaskUncompressed = avgBaselineTokensPerTask > 0 ? (avgBaselineTokensPerTask * opusInputPrice) / 1_000_000 : 0;
85
+ const sonnetCostPerTaskUncompressed = avgBaselineTokensPerTask > 0 ? (avgBaselineTokensPerTask * sonnetInputPrice) / 1_000_000 : 0;
75
86
  // Actual savings from compression (what you save)
76
87
  const avgTokensSavedPerTask = sampleSize > 0 ? Math.round(totalTokensSaved / sampleSize) : 0;
77
88
  const opusSavedPerTask = avgTokensSavedPerTask > 0 ? (avgTokensSavedPerTask * opusInputPrice) / 1_000_000 : 0;
@@ -108,6 +119,8 @@ export function createBenchmarkRouter(storeRef) {
108
119
  sonnetSavedPerTask: Math.round(sonnetSavedPerTask * 1000) / 1000,
109
120
  opusTotalSaved: Math.round(opusTotalSaved * 100) / 100,
110
121
  sonnetTotalSaved: Math.round(sonnetTotalSaved * 100) / 100,
122
+ opusCostPerTaskUncompressed: Math.round(opusCostPerTaskUncompressed * 1000) / 1000,
123
+ sonnetCostPerTaskUncompressed: Math.round(sonnetCostPerTaskUncompressed * 1000) / 1000,
111
124
  },
112
125
  },
113
126
  layeredCompression,
@@ -1 +1 @@
1
- {"version":3,"file":"benchmark.js","sourceRoot":"","sources":["../../../src/api/routes/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAA4B,MAAM,uCAAuC,CAAC;AAC1H,OAAO,EAAE,YAAY,E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3
3
  "tools": [
4
4
  {
5
5
  "name": "analyze",
@@ -0,0 +1 @@
1
+ import{r as h,a as p,j as e}from"./index-D_SBClB-.js";function j(){const[r,n]=h.useState(null),[i,m]=h.useState(!0),[u,a]=h.useState(null);return h.useEffect(()=>{async function s(){try{const c=await p.request("/benchmark");n(c)}catch(c){a(c instanceof Error?c.message:"Failed to load benchmark data")}finally{m(!1)}}s()},[]),{data:r,loading:i,error:u}}function f(){const{data:r,loading:n,error:i}=j(),[m,u]=h.useState(!1);if(n)return e.jsxs("div",{className:"p-6 max-w-5xl mx-auto space-y-6",children:[e.jsx("div",{className:"h-5 w-40 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:Array.from({length:3}).map((o,t)=>e.jsx("div",{className:"h-20 rounded-xl border border-edge bg-surface-alt animate-pulse"},t))}),e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((o,t)=>e.jsx("div",{className:"h-6 rounded bg-surface animate-pulse",style:{width:`${60+Math.random()*30}%`}},t))})]});if(i)return e.jsx("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load benchmark"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:i})]})});if(!r)return e.jsx("div",{});const{tokenEconomy:a,layeredCompression:s,dependencyIntelligence:c,toolTokenUsage:d}=r,g=(s==null?void 0:s.avgTotalRealSavingsPercent)??a.avgCompressionPercent;return e.jsxs("div",{className:"p-6 max-w-5xl mx-auto space-y-6 overflow-y-auto h-full",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Token Savings"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[e.jsxs("div",{className:"p-4 rounded-xl border border-edge shadow-sm bg-surface-alt text-center","data-testid":"metric-card",children:[e.jsxs("div",{className:"text-3xl font-bold text-accent",children:[g,"%"]}),e.jsx("div",{className:"text-[10px] text-muted uppercase mt-1",children:"compression rate"})]}),e.jsx(l,{value:a.totalTokensSaved.toLocaleString(),label:`tokens saved (${a.sampleSize} tasks)`}),e.jsx(l,{value:a.avgTokensSavedPerTask.toLocaleString(),label:"avg saved / task"})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Cost Impact"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[e.jsx(v,{label:"Opus",before:a.costSavings.opusCostPerTaskUncompressed,after:a.costSavings.opusCostPerTask,totalSaved:a.costSavings.opusTotalSaved}),e.jsx(v,{label:"Sonnet",before:a.costSavings.sonnetCostPerTaskUncompressed,after:a.costSavings.sonnetCostPerTask,totalSaved:a.costSavings.sonnetTotalSaved})]})]}),a.perTaskMetrics.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Compression per Task"}),e.jsx("div",{className:"space-y-1.5","data-testid":"compression-bars",children:a.perTaskMetrics.slice(0,15).map(o=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-32 truncate",title:o.title,children:o.title}),e.jsx("div",{className:"flex-1 h-3 bg-surface-elevated rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-accent",style:{width:`${Math.min(o.compressionPercent,100)}%`}})}),e.jsxs("span",{className:"text-muted w-28 text-right",children:[o.compressionPercent,"% (",o.estimatedTokens.toLocaleString()," tok)"]})]},o.id))})]}),s&&s.avgLayer1SavingsPercent!=null&&e.jsxs("section",{children:[e.jsxs("button",{type:"button",className:"text-sm font-semibold mb-3 flex items-center gap-1 hover:text-accent transition-colors",onClick:()=>u(!m),children:[e.jsx("span",{className:"text-xs",children:m?"▼":"▶"}),"How compression works"]}),m&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-5 gap-3 mb-2",children:[e.jsx(l,{value:`${s.avgLayer1SavingsPercent}%`,label:"Field cleanup"}),e.jsx(l,{value:`${s.avgLayer2SavingsPercent}%`,label:"Desc summary"}),e.jsx(l,{value:`${s.avgLayer3SavingsPercent}%`,label:"Default omit"}),e.jsx(l,{value:`${s.avgLayer4SavingsPercent}%`,label:"Key shorten"}),e.jsx(l,{value:`${s.avgTotalRealSavingsPercent}%`,label:"Total saved"})]}),(()=>{const o=Math.max(s.avgNaiveNeighborhoodTokens,1),t=[{label:"Original context",tokens:s.avgNaiveNeighborhoodTokens,color:"#ef4444"},{label:"Field cleanup",tokens:s.avgCompactContextTokens,color:"#f97316"},{label:"Desc summary",tokens:s.avgNeighborTruncatedTokens,color:"#eab308"},{label:"Default omit",tokens:s.avgDefaultOmittedTokens,color:"#22c55e"},{label:"Key shorten",tokens:s.avgShortKeysTokens,color:"#3b82f6"},{label:"Minimal context",tokens:s.avgSummaryTierTokens,color:"#8b5cf6"}];return e.jsx("div",{className:"space-y-1.5","data-testid":"waterfall-bars",children:t.map(x=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-32 truncate",title:x.label,children:x.label}),e.jsx("div",{className:"flex-1 h-3 bg-surface-elevated rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(x.tokens/o*100,100)}%`,backgroundColor:x.color}})}),e.jsxs("span",{className:"text-muted w-20 text-right",children:[x.tokens.toLocaleString()," tok"]})]},x.label))})})()]})]}),d&&d.totalCalls>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Token Usage per Tool"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[e.jsx(l,{value:d.totalCalls.toLocaleString(),label:"Total calls"}),e.jsx(l,{value:d.totalInputTokens.toLocaleString(),label:"Input tokens"}),e.jsx(l,{value:d.totalOutputTokens.toLocaleString(),label:"Output tokens"})]}),d.perTool.length>0&&(()=>{const o=Math.max(...d.perTool.map(t=>t.totalTokens),1);return e.jsx("div",{className:"space-y-1.5","data-testid":"tool-token-bars",children:d.perTool.slice(0,15).map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-32 truncate font-mono",title:t.toolName,children:t.toolName}),e.jsx("div",{className:"flex-1 h-3 bg-surface-elevated rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-accent",style:{width:`${Math.min(t.totalTokens/o*100,100)}%`}})}),e.jsxs("span",{className:"text-muted w-32 text-right",children:[t.callCount," calls, ",t.totalTokens.toLocaleString()," tok"]})]},t.toolName))})})()]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Graph Integrity"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(l,{value:c.inferredDeps,label:"Auto-inferred deps"}),e.jsx(l,{value:`${c.blockedTasks}/${a.totalNodes}`,label:"Blocked tasks"}),e.jsx(l,{value:c.cycles,label:"Cycles detected"})]})]})]})}function l({value:r,label:n}){return e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center","data-testid":"metric-card",children:[e.jsx("div",{className:"text-xl font-bold",children:r}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:n})]})}function v({label:r,before:n,after:i,totalSaved:m}){const u=n>0?Math.round((n-i)/n*100):0;return e.jsxs("div",{className:"p-4 rounded-xl border border-edge shadow-sm bg-surface-alt","data-testid":"metric-card",children:[e.jsx("div",{className:"text-xs font-medium text-muted mb-2",children:r}),e.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[e.jsxs("span",{className:"text-sm text-muted line-through",children:["$",n.toFixed(3)]}),e.jsxs("span",{className:"text-xl font-bold",children:["$",i.toFixed(3)]}),e.jsxs("span",{className:"text-xs text-accent",children:["-",u,"%"]})]}),e.jsxs("div",{className:"text-[10px] text-muted uppercase",children:["per task · $",m.toFixed(2)," total saved"]})]})}export{f as BenchmarkTab};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-CIhDR5rf.js";/**
1
+ import{c as e}from"./index-D_SBClB-.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as o,a as m,j as e,R as v}from"./index-CIhDR5rf.js";function C(){const[t,s]=o.useState(null),[l,n]=o.useState(!0),[a,i]=o.useState(null),x=o.useCallback(async()=>{n(!0),i(null);try{const u=await m.getContextBudget();s(u)}catch(u){i(u instanceof Error?u.message:"Failed to load context budget")}finally{n(!1)}},[]);return o.useEffect(()=>{x()},[x]),{budget:t,loading:l,error:a,refresh:x}}function S(){const[t,s]=o.useState(null),[l,n]=o.useState([]),[a,i]=o.useState(null),[x,u]=o.useState(!0),[g,r]=o.useState(null),d=o.useCallback(async()=>{u(!0),r(null);try{const[c,h,k]=await Promise.all([m.dreamGetStatus(),m.dreamGetHistory(20),m.dreamGetMetrics()]);s(c),n(h),i(k)}catch(c){r(c instanceof Error?c.message:"Failed to load dream data")}finally{u(!1)}},[]);o.useEffect(()=>{d()},[d]);const y=o.useCallback(async c=>{try{await m.dreamStartCycle(c),setTimeout(()=>void d(),500)}catch(h){r(h instanceof Error?h.message:"Failed to start dream cycle")}},[d]),N=o.useCallback(async()=>{try{await m.dreamCancelCycle(),d()}catch(c){r(c instanceof Error?c.message:"Failed to cancel dream cycle")}},[d]),w=o.useCallback(async()=>{try{return await m.dreamGetPreview()}catch(c){return r(c instanceof Error?c.message:"Failed to get dream preview"),null}},[]);return{status:t,history:l,metrics:a,loading:x,error:g,startCycle:y,cancelCycle:N,preview:w,refresh:d}}const b=[{key:"nrem",label:"NREM",subtitle:"Replay + Decay + Prune"},{key:"rem",label:"REM",subtitle:"Priority + Merge + Associate"},{key:"wake-ready",label:"Wake",subtitle:"Report + Synthesize"}],p={completed:"#10b981",active:"#3B82F6",pending:"#6b7280"};function f(t,s,l){if(!l)return"pending";const n=["nrem","rem","wake-ready"],a=n.indexOf(s??""),i=n.indexOf(t);return i<a?"completed":i===a?"active":"pending"}function M({status:t}){return e.jsx("div",{className:"flex items-center gap-2",children:b.map((s,l)=>{const n=f(s.key,t.currentPhase,t.running),a=p[n];return e.jsxs(v.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-1 min-w-[80px]",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-colors duration-200",style:{backgroundColor:n==="pending"?"transparent":a,border:`2px solid ${a}`,color:n==="pending"?a:"#fff"},children:l+1}),e.jsx("span",{className:"text-[10px] font-semibold transition-colors duration-200",style:{color:a},children:s.label}),e.jsx("span",{className:"text-[9px] text-muted text-center leading-tight",children:s.subtitle})]}),l<b.length-1&&e.jsx("div",{className:"h-0.5 flex-1 transition-colors duration-200",style:{backgroundColor:f(b[l+1].key,t.currentPhase,t.running)!=="pending"?p.completed:p.pending}})]},s.key)})})}function D({status:t,onStartCycle:s,onCancelCycle:l,onPreview:n}){const[a,i]=v.useState(!1),x=async()=>{i(!0);try{await n()}finally{i(!1)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl border border-edge shadow-sm bg-surface-alt",children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.running?"bg-blue-500 animate-pulse":"bg-gray-500"}`}),e.jsx("span",{className:"text-sm font-medium",children:t.running?"Dream Cycle Running":"Idle"}),t.running&&t.progress!==void 0&&e.jsxs("span",{className:"text-xs text-muted",children:["(",Math.round(t.progress*100),"%)"]})]})}),e.jsx(M,{status:t})]}),e.jsx("div",{className:"flex items-center gap-2",children:t.running?e.jsx("button",{onClick:l,className:"px-4 py-2 text-sm font-medium rounded-lg bg-red-600/80 text-white hover:bg-red-600 cursor-pointer transition-colors duration-200",children:"Cancel Cycle"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"px-4 py-2 text-sm font-medium rounded-lg bg-blue-600 text-white hover:bg-blue-700 cursor-pointer transition-colors duration-200",children:"Start Dream Cycle"}),e.jsx("button",{onClick:()=>void x(),disabled:a,className:"px-4 py-2 text-sm font-medium rounded-lg border border-edge text-muted hover:text-white hover:border-blue-500 cursor-pointer transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:a?"Previewing...":"Preview (Dry Run)"})]})})]})}const T=[{key:"totalCycles",label:"Total Cycles",format:t=>t.toString()},{key:"totalPruned",label:"Docs Pruned",format:t=>t.toLocaleString()},{key:"totalMerged",label:"Docs Merged",format:t=>t.toLocaleString()},{key:"avgQualityImprovement",label:"Avg Quality Delta",format:t=>(t>=0?"+":"")+(t*100).toFixed(1)+"%"}];function P({metrics:t}){return t?e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:T.map(({key:s,label:l,format:n})=>e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:n(t[s])}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:l})]},s))}):e.jsx(e.Fragment,{})}const E={completed:"text-green-500",running:"text-blue-500",failed:"text-red-500",cancelled:"text-yellow-500"};function R(t){return t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function $(t){return t?new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"}function L({cycles:t}){return t.length===0?e.jsx("div",{className:"p-4 text-center text-sm text-muted",children:"No dream cycles yet"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted uppercase text-[10px]",children:[e.jsx("th",{className:"text-left p-2",children:"Date"}),e.jsx("th",{className:"text-left p-2",children:"Status"}),e.jsx("th",{className:"text-right p-2",children:"Pruned"}),e.jsx("th",{className:"text-right p-2",children:"Merged"}),e.jsx("th",{className:"text-right p-2",children:"Duration"})]})}),e.jsx("tbody",{children:t.map(s=>{const l=s.phases.nrem.durationMs+s.phases.rem.durationMs+s.phases.wakeReady.durationMs;return e.jsxs("tr",{className:"border-t border-edge hover:bg-surface-alt/50 transition-colors",children:[e.jsx("td",{className:"p-2",children:$(s.startedAt)}),e.jsx("td",{className:`p-2 font-medium ${E[s.status]??"text-muted"}`,children:s.status}),e.jsx("td",{className:"p-2 text-right",children:s.summary.totalPruned}),e.jsx("td",{className:"p-2 text-right",children:s.summary.totalMerged}),e.jsx("td",{className:"p-2 text-right",children:R(l)})]},s.id)})})]})})}const j={green:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},yellow:{bg:"bg-yellow-500/10",text:"text-yellow-500",border:"border-yellow-500/30"},red:{bg:"bg-red-500/10",text:"text-red-500",border:"border-red-500/30"}};function A(){const{budget:t,loading:s,error:l,refresh:n}=C(),a=S(),[i,x]=o.useState(null);if(l)return e.jsxs("div",{className:"flex items-center justify-center h-full text-danger",children:["Failed to load context budget: ",l]});if(s||!t)return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"h-5 w-48 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:4}).map((r,d)=>e.jsx("div",{className:"h-20 rounded-xl border border-edge bg-surface-alt animate-pulse"},d))}),e.jsx("div",{className:"h-24 rounded-lg border border-edge bg-surface-alt animate-pulse"}),e.jsx("div",{className:"h-12 rounded-xl border border-edge bg-surface-alt animate-pulse"})]});const u=j[t.health]??j.green,g=r=>{i===r?(x(null),m.toggleSkill(r,!1).then(()=>n())):(x(r),setTimeout(()=>x(d=>d===r?null:d),3e3))};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:"Context Management"}),e.jsx("button",{onClick:()=>n(),className:"text-xs px-3 py-1.5 rounded-lg bg-accent text-white hover:opacity-90 transition-opacity",children:"Refresh"})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.activeTokens.toLocaleString()}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Active Tokens"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.totalTokens.toLocaleString()}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Total Tokens"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.activeCount}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Active Skills"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.totalCount}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Total Skills"})]})]}),e.jsxs("div",{className:`p-4 rounded-lg border ${u.bg} ${u.border}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${t.health==="green"?"bg-green-500":t.health==="yellow"?"bg-yellow-500":"bg-red-500"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:`text-sm font-medium ${u.text}`,children:["Session Health: ",t.health.charAt(0).toUpperCase()+t.health.slice(1)]}),e.jsx("div",{className:"text-xs text-muted mt-0.5",children:t.healthMessage})]})]}),t.recommendations.length>0&&e.jsx("div",{className:"mt-3 space-y-1",children:t.recommendations.map((r,d)=>e.jsx("div",{className:"text-xs text-muted",children:r},d))})]}),e.jsxs("div",{className:"p-4 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Token Budget"}),e.jsxs("span",{className:"text-xs text-muted",children:[t.activeTokens.toLocaleString()," / 4,000 (",Math.round(t.activeTokens/40),"%)"]})]}),e.jsxs("div",{className:"w-full h-3 rounded-full bg-edge relative",children:[e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 opacity-20",style:{width:`${Math.min(Math.round(t.totalTokens/40),100)}%`,background:"#6b7280"}}),e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 transition-all",style:{width:`${Math.min(Math.round(t.activeTokens/40),100)}%`,background:t.health==="red"?"#ef4444":t.health==="yellow"?"#f59e0b":"#10b981"}})]})]}),e.jsxs("div",{className:"border-t border-edge pt-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"DreamMode"}),e.jsx("p",{className:"text-xs text-muted",children:"REM-inspired knowledge consolidation: replay, decay, prune, merge, and synthesize."}),a.error&&e.jsx("div",{className:"text-xs text-red-400",children:a.error}),a.status&&e.jsx(D,{status:a.status,onStartCycle:()=>void a.startCycle(),onCancelCycle:()=>void a.cancelCycle(),onPreview:a.preview}),e.jsx(P,{metrics:a.metrics}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Cycle History"}),e.jsx(L,{cycles:a.history})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Token Breakdown by Skill"}),e.jsx("div",{className:"space-y-1",children:t.breakdown.map(r=>{const d=t.totalTokens>0?Math.round(r.tokens/t.totalTokens*100):0;return e.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt ${r.enabled?"":"opacity-40"}`,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:r.name}),e.jsx("span",{className:`px-1 py-0.5 rounded text-[9px] ${r.source==="custom"?"bg-purple-500/10 text-purple-500":"bg-blue-500/10 text-blue-500"}`,children:r.source})]}),e.jsx("div",{className:"w-full h-1 rounded-full bg-edge mt-1",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,background:r.enabled?"#3b82f6":"#6b7280"}})})]}),e.jsxs("span",{className:"text-[10px] text-muted shrink-0 w-16 text-right",children:[r.tokens.toLocaleString()," tok"]}),r.enabled&&e.jsx("button",{onClick:()=>g(r.name),className:`text-[10px] px-1.5 py-0.5 rounded border shrink-0 cursor-pointer transition-all ${i===r.name?"bg-red-500/10 text-red-400 border-red-500/30 font-medium":"border-edge text-muted hover:text-red-500 hover:border-red-500/50"}`,children:i===r.name?"Sure?":"Disable"})]},r.name)})})]})]})}export{A as ContextTab};
1
+ import{r as o,a as m,j as e,R as v}from"./index-D_SBClB-.js";function C(){const[t,s]=o.useState(null),[l,n]=o.useState(!0),[a,i]=o.useState(null),x=o.useCallback(async()=>{n(!0),i(null);try{const u=await m.getContextBudget();s(u)}catch(u){i(u instanceof Error?u.message:"Failed to load context budget")}finally{n(!1)}},[]);return o.useEffect(()=>{x()},[x]),{budget:t,loading:l,error:a,refresh:x}}function S(){const[t,s]=o.useState(null),[l,n]=o.useState([]),[a,i]=o.useState(null),[x,u]=o.useState(!0),[g,r]=o.useState(null),d=o.useCallback(async()=>{u(!0),r(null);try{const[c,h,k]=await Promise.all([m.dreamGetStatus(),m.dreamGetHistory(20),m.dreamGetMetrics()]);s(c),n(h),i(k)}catch(c){r(c instanceof Error?c.message:"Failed to load dream data")}finally{u(!1)}},[]);o.useEffect(()=>{d()},[d]);const y=o.useCallback(async c=>{try{await m.dreamStartCycle(c),setTimeout(()=>void d(),500)}catch(h){r(h instanceof Error?h.message:"Failed to start dream cycle")}},[d]),N=o.useCallback(async()=>{try{await m.dreamCancelCycle(),d()}catch(c){r(c instanceof Error?c.message:"Failed to cancel dream cycle")}},[d]),w=o.useCallback(async()=>{try{return await m.dreamGetPreview()}catch(c){return r(c instanceof Error?c.message:"Failed to get dream preview"),null}},[]);return{status:t,history:l,metrics:a,loading:x,error:g,startCycle:y,cancelCycle:N,preview:w,refresh:d}}const b=[{key:"nrem",label:"NREM",subtitle:"Replay + Decay + Prune"},{key:"rem",label:"REM",subtitle:"Priority + Merge + Associate"},{key:"wake-ready",label:"Wake",subtitle:"Report + Synthesize"}],p={completed:"#10b981",active:"#3B82F6",pending:"#6b7280"};function f(t,s,l){if(!l)return"pending";const n=["nrem","rem","wake-ready"],a=n.indexOf(s??""),i=n.indexOf(t);return i<a?"completed":i===a?"active":"pending"}function M({status:t}){return e.jsx("div",{className:"flex items-center gap-2",children:b.map((s,l)=>{const n=f(s.key,t.currentPhase,t.running),a=p[n];return e.jsxs(v.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-1 min-w-[80px]",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-colors duration-200",style:{backgroundColor:n==="pending"?"transparent":a,border:`2px solid ${a}`,color:n==="pending"?a:"#fff"},children:l+1}),e.jsx("span",{className:"text-[10px] font-semibold transition-colors duration-200",style:{color:a},children:s.label}),e.jsx("span",{className:"text-[9px] text-muted text-center leading-tight",children:s.subtitle})]}),l<b.length-1&&e.jsx("div",{className:"h-0.5 flex-1 transition-colors duration-200",style:{backgroundColor:f(b[l+1].key,t.currentPhase,t.running)!=="pending"?p.completed:p.pending}})]},s.key)})})}function D({status:t,onStartCycle:s,onCancelCycle:l,onPreview:n}){const[a,i]=v.useState(!1),x=async()=>{i(!0);try{await n()}finally{i(!1)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl border border-edge shadow-sm bg-surface-alt",children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.running?"bg-blue-500 animate-pulse":"bg-gray-500"}`}),e.jsx("span",{className:"text-sm font-medium",children:t.running?"Dream Cycle Running":"Idle"}),t.running&&t.progress!==void 0&&e.jsxs("span",{className:"text-xs text-muted",children:["(",Math.round(t.progress*100),"%)"]})]})}),e.jsx(M,{status:t})]}),e.jsx("div",{className:"flex items-center gap-2",children:t.running?e.jsx("button",{onClick:l,className:"px-4 py-2 text-sm font-medium rounded-lg bg-red-600/80 text-white hover:bg-red-600 cursor-pointer transition-colors duration-200",children:"Cancel Cycle"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"px-4 py-2 text-sm font-medium rounded-lg bg-blue-600 text-white hover:bg-blue-700 cursor-pointer transition-colors duration-200",children:"Start Dream Cycle"}),e.jsx("button",{onClick:()=>void x(),disabled:a,className:"px-4 py-2 text-sm font-medium rounded-lg border border-edge text-muted hover:text-white hover:border-blue-500 cursor-pointer transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:a?"Previewing...":"Preview (Dry Run)"})]})})]})}const T=[{key:"totalCycles",label:"Total Cycles",format:t=>t.toString()},{key:"totalPruned",label:"Docs Pruned",format:t=>t.toLocaleString()},{key:"totalMerged",label:"Docs Merged",format:t=>t.toLocaleString()},{key:"avgQualityImprovement",label:"Avg Quality Delta",format:t=>(t>=0?"+":"")+(t*100).toFixed(1)+"%"}];function P({metrics:t}){return t?e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:T.map(({key:s,label:l,format:n})=>e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:n(t[s])}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:l})]},s))}):e.jsx(e.Fragment,{})}const E={completed:"text-green-500",running:"text-blue-500",failed:"text-red-500",cancelled:"text-yellow-500"};function R(t){return t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function $(t){return t?new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"}function L({cycles:t}){return t.length===0?e.jsx("div",{className:"p-4 text-center text-sm text-muted",children:"No dream cycles yet"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-muted uppercase text-[10px]",children:[e.jsx("th",{className:"text-left p-2",children:"Date"}),e.jsx("th",{className:"text-left p-2",children:"Status"}),e.jsx("th",{className:"text-right p-2",children:"Pruned"}),e.jsx("th",{className:"text-right p-2",children:"Merged"}),e.jsx("th",{className:"text-right p-2",children:"Duration"})]})}),e.jsx("tbody",{children:t.map(s=>{const l=s.phases.nrem.durationMs+s.phases.rem.durationMs+s.phases.wakeReady.durationMs;return e.jsxs("tr",{className:"border-t border-edge hover:bg-surface-alt/50 transition-colors",children:[e.jsx("td",{className:"p-2",children:$(s.startedAt)}),e.jsx("td",{className:`p-2 font-medium ${E[s.status]??"text-muted"}`,children:s.status}),e.jsx("td",{className:"p-2 text-right",children:s.summary.totalPruned}),e.jsx("td",{className:"p-2 text-right",children:s.summary.totalMerged}),e.jsx("td",{className:"p-2 text-right",children:R(l)})]},s.id)})})]})})}const j={green:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},yellow:{bg:"bg-yellow-500/10",text:"text-yellow-500",border:"border-yellow-500/30"},red:{bg:"bg-red-500/10",text:"text-red-500",border:"border-red-500/30"}};function A(){const{budget:t,loading:s,error:l,refresh:n}=C(),a=S(),[i,x]=o.useState(null);if(l)return e.jsxs("div",{className:"flex items-center justify-center h-full text-danger",children:["Failed to load context budget: ",l]});if(s||!t)return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"h-5 w-48 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:4}).map((r,d)=>e.jsx("div",{className:"h-20 rounded-xl border border-edge bg-surface-alt animate-pulse"},d))}),e.jsx("div",{className:"h-24 rounded-lg border border-edge bg-surface-alt animate-pulse"}),e.jsx("div",{className:"h-12 rounded-xl border border-edge bg-surface-alt animate-pulse"})]});const u=j[t.health]??j.green,g=r=>{i===r?(x(null),m.toggleSkill(r,!1).then(()=>n())):(x(r),setTimeout(()=>x(d=>d===r?null:d),3e3))};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:"Context Management"}),e.jsx("button",{onClick:()=>n(),className:"text-xs px-3 py-1.5 rounded-lg bg-accent text-white hover:opacity-90 transition-opacity",children:"Refresh"})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.activeTokens.toLocaleString()}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Active Tokens"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.totalTokens.toLocaleString()}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Total Tokens"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.activeCount}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Active Skills"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:t.totalCount}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Total Skills"})]})]}),e.jsxs("div",{className:`p-4 rounded-lg border ${u.bg} ${u.border}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${t.health==="green"?"bg-green-500":t.health==="yellow"?"bg-yellow-500":"bg-red-500"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:`text-sm font-medium ${u.text}`,children:["Session Health: ",t.health.charAt(0).toUpperCase()+t.health.slice(1)]}),e.jsx("div",{className:"text-xs text-muted mt-0.5",children:t.healthMessage})]})]}),t.recommendations.length>0&&e.jsx("div",{className:"mt-3 space-y-1",children:t.recommendations.map((r,d)=>e.jsx("div",{className:"text-xs text-muted",children:r},d))})]}),e.jsxs("div",{className:"p-4 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Token Budget"}),e.jsxs("span",{className:"text-xs text-muted",children:[t.activeTokens.toLocaleString()," / 4,000 (",Math.round(t.activeTokens/40),"%)"]})]}),e.jsxs("div",{className:"w-full h-3 rounded-full bg-edge relative",children:[e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 opacity-20",style:{width:`${Math.min(Math.round(t.totalTokens/40),100)}%`,background:"#6b7280"}}),e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 transition-all",style:{width:`${Math.min(Math.round(t.activeTokens/40),100)}%`,background:t.health==="red"?"#ef4444":t.health==="yellow"?"#f59e0b":"#10b981"}})]})]}),e.jsxs("div",{className:"border-t border-edge pt-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"DreamMode"}),e.jsx("p",{className:"text-xs text-muted",children:"REM-inspired knowledge consolidation: replay, decay, prune, merge, and synthesize."}),a.error&&e.jsx("div",{className:"text-xs text-red-400",children:a.error}),a.status&&e.jsx(D,{status:a.status,onStartCycle:()=>void a.startCycle(),onCancelCycle:()=>void a.cancelCycle(),onPreview:a.preview}),e.jsx(P,{metrics:a.metrics}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Cycle History"}),e.jsx(L,{cycles:a.history})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Token Breakdown by Skill"}),e.jsx("div",{className:"space-y-1",children:t.breakdown.map(r=>{const d=t.totalTokens>0?Math.round(r.tokens/t.totalTokens*100):0;return e.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt ${r.enabled?"":"opacity-40"}`,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:r.name}),e.jsx("span",{className:`px-1 py-0.5 rounded text-[9px] ${r.source==="custom"?"bg-purple-500/10 text-purple-500":"bg-blue-500/10 text-blue-500"}`,children:r.source})]}),e.jsx("div",{className:"w-full h-1 rounded-full bg-edge mt-1",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,background:r.enabled?"#3b82f6":"#6b7280"}})})]}),e.jsxs("span",{className:"text-[10px] text-muted shrink-0 w-16 text-right",children:[r.tokens.toLocaleString()," tok"]}),r.enabled&&e.jsx("button",{onClick:()=>g(r.name),className:`text-[10px] px-1.5 py-0.5 rounded border shrink-0 cursor-pointer transition-all ${i===r.name?"bg-red-500/10 text-red-400 border-red-500/30 font-medium":"border-edge text-muted hover:text-red-500 hover:border-red-500/50"}`,children:i===r.name?"Sure?":"Disable"})]},r.name)})})]})]})}export{A as ContextTab};
@@ -1 +1 @@
1
- import{r as c,a as p,j as e}from"./index-CIhDR5rf.js";function $(){const[t,l]=c.useState([]),[n,s]=c.useState([]),[o,b]=c.useState([]),[f,r]=c.useState(null),[u,a]=c.useState(!0),[N,x]=c.useState(null),h=c.useCallback(async()=>{try{a(!0),x(null);const[d,g,v,z]=await Promise.all([p.getDocsTools().catch(()=>({tools:[]})),p.getDocsRoutes().catch(()=>({routes:[]})),p.getDocsList().catch(()=>({docs:[]})),p.getDocsStats().catch(()=>null)]);l(d.tools),s(g.routes),b(v.docs),r(z)}catch(d){x(d instanceof Error?d.message:"Failed to load docs")}finally{a(!1)}},[]);c.useEffect(()=>{h()},[h]);const C=c.useCallback(async(d,g)=>(await p.getDocContent(d,g)).content,[]);return{tools:t,routes:n,docs:o,stats:f,loading:u,error:N,fetchDocContent:C,refresh:h}}const E={Core:"bg-blue-500/20 text-blue-400","Siebel CRM":"bg-purple-500/20 text-purple-400",Translation:"bg-green-500/20 text-green-400",Knowledge:"bg-yellow-500/20 text-yellow-400","Code Intelligence":"bg-cyan-500/20 text-cyan-400",Deprecated:"bg-red-500/20 text-red-400"},M={get:"bg-green-600/30 text-green-300",post:"bg-blue-600/30 text-blue-300",patch:"bg-yellow-600/30 text-yellow-300",put:"bg-orange-600/30 text-orange-300",delete:"bg-red-600/30 text-red-300"};function H(){const{tools:t,routes:l,docs:n,stats:s,loading:o,error:b,fetchDocContent:f}=$(),[r,u]=c.useState("overview"),[a,N]=c.useState(""),[x,h]=c.useState("all"),[C,d]=c.useState(""),[g,v]=c.useState(""),[z,S]=c.useState(!1),L=c.useMemo(()=>{const i=new Set(t.map(m=>m.category));return["all",...Array.from(i).sort()]},[t]),D=c.useMemo(()=>t.filter(i=>!(x!=="all"&&i.category!==x||a&&!i.name.toLowerCase().includes(a.toLowerCase())&&!i.description.toLowerCase().includes(a.toLowerCase()))),[t,x,a]),R=c.useMemo(()=>l.filter(i=>!(a&&!i.mountPath.toLowerCase().includes(a.toLowerCase())&&!i.routerName.toLowerCase().includes(a.toLowerCase()))),[l,a]),T=c.useMemo(()=>{const i=new Map;for(const m of n){const j=i.get(m.category)??[];j.push(m),i.set(m.category,j)}return i},[n]),G=c.useCallback(async(i,m,j)=>{S(!0),v(j),u("guide-content");try{const k=m.split("/"),P=await f(k[0],k[1]);d(P)}catch{d("Failed to load document.")}finally{S(!1)}},[f]);return o?e.jsx("div",{className:"flex items-center justify-center h-64 text-zinc-400",children:"Loading docs..."}):b?e.jsxs("div",{className:"p-4 text-red-400",children:["Error: ",b]}):e.jsxs("div",{className:"flex h-full",children:[e.jsxs("nav",{className:"w-56 shrink-0 border-r border-zinc-700 p-3 space-y-1 overflow-y-auto",children:[e.jsx(y,{label:"Overview",active:r==="overview",onClick:()=>u("overview"),count:null}),e.jsx(y,{label:"MCP Tools",active:r==="tools",onClick:()=>u("tools"),count:(s==null?void 0:s.tools.active)??0}),e.jsx(y,{label:"API Routes",active:r==="routes",onClick:()=>u("routes"),count:(s==null?void 0:s.routes.endpoints)??0}),e.jsx(y,{label:"Guides",active:r==="guides"||r==="guide-content",onClick:()=>u("guides"),count:n.length})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[(r==="tools"||r==="routes")&&e.jsx("div",{className:"mb-4",children:e.jsx("input",{type:"text",placeholder:`Search ${r}...`,value:a,onChange:i=>N(i.target.value),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-600 rounded-md text-zinc-200 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})}),r==="overview"&&e.jsx(A,{stats:s,toolCount:t.length,routeCount:l.length,docCount:n.length}),r==="tools"&&e.jsx(O,{tools:D,categories:L,categoryFilter:x,onCategoryChange:h}),r==="routes"&&e.jsx(I,{routes:R}),r==="guides"&&e.jsx(F,{categories:T,onGuideClick:G}),r==="guide-content"&&e.jsx(B,{title:g,content:C,loading:z,onBack:()=>u("guides")})]})]})}function y({label:t,active:l,onClick:n,count:s}){return e.jsxs("button",{onClick:n,className:`w-full text-left px-3 py-2 rounded-md text-sm transition-colors ${l?"bg-blue-600/20 text-blue-400 font-medium":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"}`,children:[t,s!==null&&e.jsxs("span",{className:"ml-2 text-xs text-zinc-500",children:["(",s,")"]})]})}function A({stats:t,toolCount:l,routeCount:n,docCount:s}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-zinc-100",children:"mcp-graph Documentation"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(w,{label:"MCP Tools",value:(t==null?void 0:t.tools.active)??l,sub:`+ ${(t==null?void 0:t.tools.deprecated)??0} deprecated`}),e.jsx(w,{label:"API Endpoints",value:(t==null?void 0:t.routes.endpoints)??0,sub:`${(t==null?void 0:t.routes.routers)??n} routers`}),e.jsx(w,{label:"Guides",value:(t==null?void 0:t.docs)??s,sub:"markdown docs"})]}),e.jsx("p",{className:"text-zinc-400 text-sm",children:"Use the sidebar to browse MCP tools, API routes, and project guides. All data is introspected live from the source code."})]})}function w({label:t,value:l,sub:n}){return e.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4 border border-zinc-700",children:[e.jsx("div",{className:"text-2xl font-bold text-zinc-100",children:l}),e.jsx("div",{className:"text-sm font-medium text-zinc-300",children:t}),e.jsx("div",{className:"text-xs text-zinc-500 mt-1",children:n})]})}function O({tools:t,categories:l,categoryFilter:n,onCategoryChange:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:l.map(o=>e.jsx("button",{onClick:()=>s(o),className:`px-3 py-1 rounded-full text-xs font-medium transition-colors ${n===o?"bg-blue-600 text-white":"bg-zinc-800 text-zinc-400 hover:bg-zinc-700"}`,children:o==="all"?"All":o},o))}),e.jsxs("div",{className:"text-xs text-zinc-500 mb-2",children:[t.length," tools"]}),e.jsx("div",{className:"space-y-1",children:t.map(o=>e.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-md ${o.deprecated?"opacity-50":"hover:bg-zinc-800/50"}`,children:[e.jsx("code",{className:"text-sm font-mono text-blue-400 shrink-0 w-40",children:o.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full shrink-0 ${E[o.category]??"bg-zinc-700 text-zinc-300"}`,children:o.category}),e.jsx("span",{className:"text-sm text-zinc-400 flex-1",children:o.description})]},o.name))})]})}function I({routes:t}){const l=t.reduce((n,s)=>n+s.endpoints.length,0);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs text-zinc-500",children:[t.length," routers, ",l," endpoints"]}),t.map(n=>e.jsxs("div",{className:"border border-zinc-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-zinc-800 px-4 py-2 flex items-center justify-between",children:[e.jsx("code",{className:"text-sm font-mono text-green-400",children:n.mountPath}),e.jsxs("span",{className:"text-xs text-zinc-500",children:[n.endpoints.length," endpoints"]})]}),e.jsx("div",{className:"divide-y divide-zinc-800",children:n.endpoints.map((s,o)=>e.jsxs("div",{className:"px-4 py-2 flex items-center gap-3",children:[e.jsx("span",{className:`text-xs font-mono uppercase px-2 py-0.5 rounded ${M[s.method]??"bg-zinc-700 text-zinc-300"}`,children:s.method}),e.jsxs("code",{className:"text-sm text-zinc-300",children:[n.mountPath,s.path]})]},`${s.method}-${s.path}-${o}`))})]},n.mountPath))]})}function F({categories:t,onGuideClick:l}){return e.jsx("div",{className:"space-y-6",children:Array.from(t).map(([n,s])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-300 uppercase tracking-wider mb-2",children:n}),e.jsx("div",{className:"space-y-1",children:s.map(o=>e.jsx("button",{onClick:()=>l(o.category,o.slug,o.title),className:"w-full text-left px-3 py-2 rounded-md text-sm text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200 transition-colors",children:o.title},o.slug))})]},n))})}function B({title:t,content:l,loading:n,onBack:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("button",{onClick:s,className:"text-sm text-blue-400 hover:text-blue-300",children:"← Back to Guides"}),e.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:t}),n?e.jsx("div",{className:"text-zinc-400",children:"Loading..."}):e.jsx("pre",{className:"whitespace-pre-wrap text-sm text-zinc-300 bg-zinc-900 rounded-lg p-4 border border-zinc-700 overflow-auto max-h-[70vh]",children:l})]})}export{H as DocsTab};
1
+ import{r as c,a as p,j as e}from"./index-D_SBClB-.js";function $(){const[t,l]=c.useState([]),[n,s]=c.useState([]),[o,b]=c.useState([]),[f,r]=c.useState(null),[u,a]=c.useState(!0),[N,x]=c.useState(null),h=c.useCallback(async()=>{try{a(!0),x(null);const[d,g,v,z]=await Promise.all([p.getDocsTools().catch(()=>({tools:[]})),p.getDocsRoutes().catch(()=>({routes:[]})),p.getDocsList().catch(()=>({docs:[]})),p.getDocsStats().catch(()=>null)]);l(d.tools),s(g.routes),b(v.docs),r(z)}catch(d){x(d instanceof Error?d.message:"Failed to load docs")}finally{a(!1)}},[]);c.useEffect(()=>{h()},[h]);const C=c.useCallback(async(d,g)=>(await p.getDocContent(d,g)).content,[]);return{tools:t,routes:n,docs:o,stats:f,loading:u,error:N,fetchDocContent:C,refresh:h}}const E={Core:"bg-blue-500/20 text-blue-400","Siebel CRM":"bg-purple-500/20 text-purple-400",Translation:"bg-green-500/20 text-green-400",Knowledge:"bg-yellow-500/20 text-yellow-400","Code Intelligence":"bg-cyan-500/20 text-cyan-400",Deprecated:"bg-red-500/20 text-red-400"},M={get:"bg-green-600/30 text-green-300",post:"bg-blue-600/30 text-blue-300",patch:"bg-yellow-600/30 text-yellow-300",put:"bg-orange-600/30 text-orange-300",delete:"bg-red-600/30 text-red-300"};function H(){const{tools:t,routes:l,docs:n,stats:s,loading:o,error:b,fetchDocContent:f}=$(),[r,u]=c.useState("overview"),[a,N]=c.useState(""),[x,h]=c.useState("all"),[C,d]=c.useState(""),[g,v]=c.useState(""),[z,S]=c.useState(!1),L=c.useMemo(()=>{const i=new Set(t.map(m=>m.category));return["all",...Array.from(i).sort()]},[t]),D=c.useMemo(()=>t.filter(i=>!(x!=="all"&&i.category!==x||a&&!i.name.toLowerCase().includes(a.toLowerCase())&&!i.description.toLowerCase().includes(a.toLowerCase()))),[t,x,a]),R=c.useMemo(()=>l.filter(i=>!(a&&!i.mountPath.toLowerCase().includes(a.toLowerCase())&&!i.routerName.toLowerCase().includes(a.toLowerCase()))),[l,a]),T=c.useMemo(()=>{const i=new Map;for(const m of n){const j=i.get(m.category)??[];j.push(m),i.set(m.category,j)}return i},[n]),G=c.useCallback(async(i,m,j)=>{S(!0),v(j),u("guide-content");try{const k=m.split("/"),P=await f(k[0],k[1]);d(P)}catch{d("Failed to load document.")}finally{S(!1)}},[f]);return o?e.jsx("div",{className:"flex items-center justify-center h-64 text-zinc-400",children:"Loading docs..."}):b?e.jsxs("div",{className:"p-4 text-red-400",children:["Error: ",b]}):e.jsxs("div",{className:"flex h-full",children:[e.jsxs("nav",{className:"w-56 shrink-0 border-r border-zinc-700 p-3 space-y-1 overflow-y-auto",children:[e.jsx(y,{label:"Overview",active:r==="overview",onClick:()=>u("overview"),count:null}),e.jsx(y,{label:"MCP Tools",active:r==="tools",onClick:()=>u("tools"),count:(s==null?void 0:s.tools.active)??0}),e.jsx(y,{label:"API Routes",active:r==="routes",onClick:()=>u("routes"),count:(s==null?void 0:s.routes.endpoints)??0}),e.jsx(y,{label:"Guides",active:r==="guides"||r==="guide-content",onClick:()=>u("guides"),count:n.length})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[(r==="tools"||r==="routes")&&e.jsx("div",{className:"mb-4",children:e.jsx("input",{type:"text",placeholder:`Search ${r}...`,value:a,onChange:i=>N(i.target.value),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-600 rounded-md text-zinc-200 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})}),r==="overview"&&e.jsx(A,{stats:s,toolCount:t.length,routeCount:l.length,docCount:n.length}),r==="tools"&&e.jsx(O,{tools:D,categories:L,categoryFilter:x,onCategoryChange:h}),r==="routes"&&e.jsx(I,{routes:R}),r==="guides"&&e.jsx(F,{categories:T,onGuideClick:G}),r==="guide-content"&&e.jsx(B,{title:g,content:C,loading:z,onBack:()=>u("guides")})]})]})}function y({label:t,active:l,onClick:n,count:s}){return e.jsxs("button",{onClick:n,className:`w-full text-left px-3 py-2 rounded-md text-sm transition-colors ${l?"bg-blue-600/20 text-blue-400 font-medium":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"}`,children:[t,s!==null&&e.jsxs("span",{className:"ml-2 text-xs text-zinc-500",children:["(",s,")"]})]})}function A({stats:t,toolCount:l,routeCount:n,docCount:s}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-zinc-100",children:"mcp-graph Documentation"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(w,{label:"MCP Tools",value:(t==null?void 0:t.tools.active)??l,sub:`+ ${(t==null?void 0:t.tools.deprecated)??0} deprecated`}),e.jsx(w,{label:"API Endpoints",value:(t==null?void 0:t.routes.endpoints)??0,sub:`${(t==null?void 0:t.routes.routers)??n} routers`}),e.jsx(w,{label:"Guides",value:(t==null?void 0:t.docs)??s,sub:"markdown docs"})]}),e.jsx("p",{className:"text-zinc-400 text-sm",children:"Use the sidebar to browse MCP tools, API routes, and project guides. All data is introspected live from the source code."})]})}function w({label:t,value:l,sub:n}){return e.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4 border border-zinc-700",children:[e.jsx("div",{className:"text-2xl font-bold text-zinc-100",children:l}),e.jsx("div",{className:"text-sm font-medium text-zinc-300",children:t}),e.jsx("div",{className:"text-xs text-zinc-500 mt-1",children:n})]})}function O({tools:t,categories:l,categoryFilter:n,onCategoryChange:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:l.map(o=>e.jsx("button",{onClick:()=>s(o),className:`px-3 py-1 rounded-full text-xs font-medium transition-colors ${n===o?"bg-blue-600 text-white":"bg-zinc-800 text-zinc-400 hover:bg-zinc-700"}`,children:o==="all"?"All":o},o))}),e.jsxs("div",{className:"text-xs text-zinc-500 mb-2",children:[t.length," tools"]}),e.jsx("div",{className:"space-y-1",children:t.map(o=>e.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-md ${o.deprecated?"opacity-50":"hover:bg-zinc-800/50"}`,children:[e.jsx("code",{className:"text-sm font-mono text-blue-400 shrink-0 w-40",children:o.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full shrink-0 ${E[o.category]??"bg-zinc-700 text-zinc-300"}`,children:o.category}),e.jsx("span",{className:"text-sm text-zinc-400 flex-1",children:o.description})]},o.name))})]})}function I({routes:t}){const l=t.reduce((n,s)=>n+s.endpoints.length,0);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs text-zinc-500",children:[t.length," routers, ",l," endpoints"]}),t.map(n=>e.jsxs("div",{className:"border border-zinc-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-zinc-800 px-4 py-2 flex items-center justify-between",children:[e.jsx("code",{className:"text-sm font-mono text-green-400",children:n.mountPath}),e.jsxs("span",{className:"text-xs text-zinc-500",children:[n.endpoints.length," endpoints"]})]}),e.jsx("div",{className:"divide-y divide-zinc-800",children:n.endpoints.map((s,o)=>e.jsxs("div",{className:"px-4 py-2 flex items-center gap-3",children:[e.jsx("span",{className:`text-xs font-mono uppercase px-2 py-0.5 rounded ${M[s.method]??"bg-zinc-700 text-zinc-300"}`,children:s.method}),e.jsxs("code",{className:"text-sm text-zinc-300",children:[n.mountPath,s.path]})]},`${s.method}-${s.path}-${o}`))})]},n.mountPath))]})}function F({categories:t,onGuideClick:l}){return e.jsx("div",{className:"space-y-6",children:Array.from(t).map(([n,s])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-300 uppercase tracking-wider mb-2",children:n}),e.jsx("div",{className:"space-y-1",children:s.map(o=>e.jsx("button",{onClick:()=>l(o.category,o.slug,o.title),className:"w-full text-left px-3 py-2 rounded-md text-sm text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200 transition-colors",children:o.title},o.slug))})]},n))})}function B({title:t,content:l,loading:n,onBack:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("button",{onClick:s,className:"text-sm text-blue-400 hover:text-blue-300",children:"← Back to Guides"}),e.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:t}),n?e.jsx("div",{className:"text-zinc-400",children:"Loading..."}):e.jsx("pre",{className:"whitespace-pre-wrap text-sm text-zinc-300 bg-zinc-900 rounded-lg p-4 border border-zinc-700 overflow-auto max-h-[70vh]",children:l})]})}export{H as DocsTab};