@mcp-graph-workflow/mcp-graph 5.32.0 → 5.34.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.
Files changed (292) hide show
  1. package/dist/api/router.d.ts.map +1 -1
  2. package/dist/api/router.js +2 -0
  3. package/dist/api/router.js.map +1 -1
  4. package/dist/api/routes/code-graph.d.ts.map +1 -1
  5. package/dist/api/routes/code-graph.js +3 -1
  6. package/dist/api/routes/code-graph.js.map +1 -1
  7. package/dist/api/routes/davinci.d.ts +3 -0
  8. package/dist/api/routes/davinci.d.ts.map +1 -0
  9. package/dist/api/routes/davinci.js +188 -0
  10. package/dist/api/routes/davinci.js.map +1 -0
  11. package/dist/core/analyzer/ac-coverage.d.ts +16 -0
  12. package/dist/core/analyzer/ac-coverage.d.ts.map +1 -0
  13. package/dist/core/analyzer/ac-coverage.js +38 -0
  14. package/dist/core/analyzer/ac-coverage.js.map +1 -0
  15. package/dist/core/analyzer/asset-blockers.d.ts +23 -0
  16. package/dist/core/analyzer/asset-blockers.d.ts.map +1 -0
  17. package/dist/core/analyzer/asset-blockers.js +50 -0
  18. package/dist/core/analyzer/asset-blockers.js.map +1 -0
  19. package/dist/core/analyzer/concurrency-risk.d.ts +26 -0
  20. package/dist/core/analyzer/concurrency-risk.d.ts.map +1 -0
  21. package/dist/core/analyzer/concurrency-risk.js +99 -0
  22. package/dist/core/analyzer/concurrency-risk.js.map +1 -0
  23. package/dist/core/analyzer/config-coverage.d.ts +20 -0
  24. package/dist/core/analyzer/config-coverage.d.ts.map +1 -0
  25. package/dist/core/analyzer/config-coverage.js +49 -0
  26. package/dist/core/analyzer/config-coverage.js.map +1 -0
  27. package/dist/core/analyzer/contract-coverage.d.ts +22 -0
  28. package/dist/core/analyzer/contract-coverage.d.ts.map +1 -0
  29. package/dist/core/analyzer/contract-coverage.js +51 -0
  30. package/dist/core/analyzer/contract-coverage.js.map +1 -0
  31. package/dist/core/analyzer/data-integrity.d.ts +22 -0
  32. package/dist/core/analyzer/data-integrity.d.ts.map +1 -0
  33. package/dist/core/analyzer/data-integrity.js +80 -0
  34. package/dist/core/analyzer/data-integrity.js.map +1 -0
  35. package/dist/core/analyzer/economy-simulator.d.ts +33 -0
  36. package/dist/core/analyzer/economy-simulator.d.ts.map +1 -0
  37. package/dist/core/analyzer/economy-simulator.js +162 -0
  38. package/dist/core/analyzer/economy-simulator.js.map +1 -0
  39. package/dist/core/analyzer/formula-consistency.d.ts +25 -0
  40. package/dist/core/analyzer/formula-consistency.d.ts.map +1 -0
  41. package/dist/core/analyzer/formula-consistency.js +82 -0
  42. package/dist/core/analyzer/formula-consistency.js.map +1 -0
  43. package/dist/core/analyzer/metric-coverage.d.ts +22 -0
  44. package/dist/core/analyzer/metric-coverage.d.ts.map +1 -0
  45. package/dist/core/analyzer/metric-coverage.js +52 -0
  46. package/dist/core/analyzer/metric-coverage.js.map +1 -0
  47. package/dist/core/analyzer/performance-budget-check.d.ts +22 -0
  48. package/dist/core/analyzer/performance-budget-check.d.ts.map +1 -0
  49. package/dist/core/analyzer/performance-budget-check.js +40 -0
  50. package/dist/core/analyzer/performance-budget-check.js.map +1 -0
  51. package/dist/core/analyzer/risk-assessment.d.ts.map +1 -1
  52. package/dist/core/analyzer/risk-assessment.js +9 -0
  53. package/dist/core/analyzer/risk-assessment.js.map +1 -1
  54. package/dist/core/analyzer/scenario-coverage.d.ts +19 -0
  55. package/dist/core/analyzer/scenario-coverage.d.ts.map +1 -0
  56. package/dist/core/analyzer/scenario-coverage.js +59 -0
  57. package/dist/core/analyzer/scenario-coverage.js.map +1 -0
  58. package/dist/core/analyzer/state-completeness.d.ts +22 -0
  59. package/dist/core/analyzer/state-completeness.d.ts.map +1 -0
  60. package/dist/core/analyzer/state-completeness.js +76 -0
  61. package/dist/core/analyzer/state-completeness.js.map +1 -0
  62. package/dist/core/code/code-indexer.d.ts +1 -1
  63. package/dist/core/code/code-indexer.d.ts.map +1 -1
  64. package/dist/core/code/code-indexer.js +50 -3
  65. package/dist/core/code/code-indexer.js.map +1 -1
  66. package/dist/core/code/code-store.js +3 -3
  67. package/dist/core/code/code-store.js.map +1 -1
  68. package/dist/core/code/code-types.d.ts +4 -4
  69. package/dist/core/code/treesitter/treesitter-manager.d.ts.map +1 -1
  70. package/dist/core/code/treesitter/treesitter-manager.js +2 -0
  71. package/dist/core/code/treesitter/treesitter-manager.js.map +1 -1
  72. package/dist/core/davinci/build-runner.d.ts +37 -0
  73. package/dist/core/davinci/build-runner.d.ts.map +1 -0
  74. package/dist/core/davinci/build-runner.js +239 -0
  75. package/dist/core/davinci/build-runner.js.map +1 -0
  76. package/dist/core/davinci/davinci-parser.d.ts +6 -0
  77. package/dist/core/davinci/davinci-parser.d.ts.map +1 -0
  78. package/dist/core/davinci/davinci-parser.js +218 -0
  79. package/dist/core/davinci/davinci-parser.js.map +1 -0
  80. package/dist/core/davinci/davinci-store.d.ts +49 -0
  81. package/dist/core/davinci/davinci-store.d.ts.map +1 -0
  82. package/dist/core/davinci/davinci-store.js +121 -0
  83. package/dist/core/davinci/davinci-store.js.map +1 -0
  84. package/dist/core/davinci/davinci-types.d.ts +241 -0
  85. package/dist/core/davinci/davinci-types.d.ts.map +1 -0
  86. package/dist/core/davinci/davinci-types.js +123 -0
  87. package/dist/core/davinci/davinci-types.js.map +1 -0
  88. package/dist/core/davinci/davinci-validators.d.ts +16 -0
  89. package/dist/core/davinci/davinci-validators.d.ts.map +1 -0
  90. package/dist/core/davinci/davinci-validators.js +86 -0
  91. package/dist/core/davinci/davinci-validators.js.map +1 -0
  92. package/dist/core/davinci/descriptor-generator.d.ts +19 -0
  93. package/dist/core/davinci/descriptor-generator.d.ts.map +1 -0
  94. package/dist/core/davinci/descriptor-generator.js +52 -0
  95. package/dist/core/davinci/descriptor-generator.js.map +1 -0
  96. package/dist/core/davinci/plugin-generator.d.ts +29 -0
  97. package/dist/core/davinci/plugin-generator.d.ts.map +1 -0
  98. package/dist/core/davinci/plugin-generator.js +86 -0
  99. package/dist/core/davinci/plugin-generator.js.map +1 -0
  100. package/dist/core/davinci/plugin-type-detector.d.ts +15 -0
  101. package/dist/core/davinci/plugin-type-detector.d.ts.map +1 -0
  102. package/dist/core/davinci/plugin-type-detector.js +114 -0
  103. package/dist/core/davinci/plugin-type-detector.js.map +1 -0
  104. package/dist/core/davinci/pom-generator.d.ts +4 -0
  105. package/dist/core/davinci/pom-generator.d.ts.map +1 -0
  106. package/dist/core/davinci/pom-generator.js +179 -0
  107. package/dist/core/davinci/pom-generator.js.map +1 -0
  108. package/dist/core/davinci/template-registry.d.ts +25 -0
  109. package/dist/core/davinci/template-registry.d.ts.map +1 -0
  110. package/dist/core/davinci/template-registry.js +280 -0
  111. package/dist/core/davinci/template-registry.js.map +1 -0
  112. package/dist/core/davinci/variable-resolver.d.ts +9 -0
  113. package/dist/core/davinci/variable-resolver.d.ts.map +1 -0
  114. package/dist/core/davinci/variable-resolver.js +62 -0
  115. package/dist/core/davinci/variable-resolver.js.map +1 -0
  116. package/dist/core/designer/adr-validator.d.ts.map +1 -1
  117. package/dist/core/designer/adr-validator.js +12 -4
  118. package/dist/core/designer/adr-validator.js.map +1 -1
  119. package/dist/core/designer/tech-risk-assessor.d.ts +5 -1
  120. package/dist/core/designer/tech-risk-assessor.d.ts.map +1 -1
  121. package/dist/core/designer/tech-risk-assessor.js +39 -11
  122. package/dist/core/designer/tech-risk-assessor.js.map +1 -1
  123. package/dist/core/designer/traceability-matrix.d.ts.map +1 -1
  124. package/dist/core/designer/traceability-matrix.js +14 -3
  125. package/dist/core/designer/traceability-matrix.js.map +1 -1
  126. package/dist/core/graph/auto-sequence.d.ts +10 -0
  127. package/dist/core/graph/auto-sequence.d.ts.map +1 -0
  128. package/dist/core/graph/auto-sequence.js +29 -0
  129. package/dist/core/graph/auto-sequence.js.map +1 -0
  130. package/dist/core/graph/csv-export.d.ts +7 -0
  131. package/dist/core/graph/csv-export.d.ts.map +1 -0
  132. package/dist/core/graph/csv-export.js +43 -0
  133. package/dist/core/graph/csv-export.js.map +1 -0
  134. package/dist/core/graph/graph-types.d.ts +2 -2
  135. package/dist/core/graph/graph-types.d.ts.map +1 -1
  136. package/dist/core/graph/mermaid-export.d.ts +1 -1
  137. package/dist/core/graph/mermaid-export.d.ts.map +1 -1
  138. package/dist/core/graph/mermaid-export.js +101 -0
  139. package/dist/core/graph/mermaid-export.js.map +1 -1
  140. package/dist/core/importer/prd-to-graph.d.ts.map +1 -1
  141. package/dist/core/importer/prd-to-graph.js +8 -1
  142. package/dist/core/importer/prd-to-graph.js.map +1 -1
  143. package/dist/core/listener/backlog-health.d.ts.map +1 -1
  144. package/dist/core/listener/backlog-health.js +15 -3
  145. package/dist/core/listener/backlog-health.js.map +1 -1
  146. package/dist/core/parser/classify.d.ts +4 -0
  147. package/dist/core/parser/classify.d.ts.map +1 -1
  148. package/dist/core/parser/classify.js +18 -0
  149. package/dist/core/parser/classify.js.map +1 -1
  150. package/dist/core/parser/extract.d.ts.map +1 -1
  151. package/dist/core/parser/extract.js +22 -4
  152. package/dist/core/parser/extract.js.map +1 -1
  153. package/dist/core/parser/prd-diff.d.ts +23 -0
  154. package/dist/core/parser/prd-diff.d.ts.map +1 -0
  155. package/dist/core/parser/prd-diff.js +55 -0
  156. package/dist/core/parser/prd-diff.js.map +1 -0
  157. package/dist/core/parser/read-swagger.d.ts.map +1 -1
  158. package/dist/core/parser/read-swagger.js +6 -0
  159. package/dist/core/parser/read-swagger.js.map +1 -1
  160. package/dist/core/parser/segment.d.ts +5 -0
  161. package/dist/core/parser/segment.d.ts.map +1 -1
  162. package/dist/core/parser/segment.js +70 -0
  163. package/dist/core/parser/segment.js.map +1 -1
  164. package/dist/core/planner/auto-ready.d.ts +19 -0
  165. package/dist/core/planner/auto-ready.d.ts.map +1 -0
  166. package/dist/core/planner/auto-ready.js +39 -0
  167. package/dist/core/planner/auto-ready.js.map +1 -0
  168. package/dist/core/planner/planning-report.d.ts +13 -1
  169. package/dist/core/planner/planning-report.d.ts.map +1 -1
  170. package/dist/core/planner/planning-report.js +53 -2
  171. package/dist/core/planner/planning-report.js.map +1 -1
  172. package/dist/core/planner/sprint-health.d.ts +22 -0
  173. package/dist/core/planner/sprint-health.d.ts.map +1 -0
  174. package/dist/core/planner/sprint-health.js +41 -0
  175. package/dist/core/planner/sprint-health.js.map +1 -0
  176. package/dist/core/siebel/sif-parser.d.ts.map +1 -1
  177. package/dist/core/siebel/sif-parser.js +6 -0
  178. package/dist/core/siebel/sif-parser.js.map +1 -1
  179. package/dist/core/siebel/wsdl-parser.d.ts.map +1 -1
  180. package/dist/core/siebel/wsdl-parser.js +6 -0
  181. package/dist/core/siebel/wsdl-parser.js.map +1 -1
  182. package/dist/core/store/migrations.d.ts.map +1 -1
  183. package/dist/core/store/migrations.js +17 -0
  184. package/dist/core/store/migrations.js.map +1 -1
  185. package/dist/core/store/sqlite-store.d.ts +6 -0
  186. package/dist/core/store/sqlite-store.d.ts.map +1 -1
  187. package/dist/core/store/sqlite-store.js +54 -3
  188. package/dist/core/store/sqlite-store.js.map +1 -1
  189. package/dist/core/templates/template-engine.d.ts +36 -0
  190. package/dist/core/templates/template-engine.d.ts.map +1 -0
  191. package/dist/core/templates/template-engine.js +104 -0
  192. package/dist/core/templates/template-engine.js.map +1 -0
  193. package/dist/core/translation/generators/universal-generator.d.ts.map +1 -1
  194. package/dist/core/translation/generators/universal-generator.js +187 -9
  195. package/dist/core/translation/generators/universal-generator.js.map +1 -1
  196. package/dist/core/translation/language-detect.d.ts.map +1 -1
  197. package/dist/core/translation/language-detect.js +37 -14
  198. package/dist/core/translation/language-detect.js.map +1 -1
  199. package/dist/docs-manifest.json +68 -5
  200. package/dist/mcp/app-factory.js +1 -1
  201. package/dist/mcp/app-factory.js.map +1 -1
  202. package/dist/mcp/tools/analyze.d.ts.map +1 -1
  203. package/dist/mcp/tools/analyze.js +100 -1
  204. package/dist/mcp/tools/analyze.js.map +1 -1
  205. package/dist/mcp/tools/davinci-analyze.d.ts +4 -0
  206. package/dist/mcp/tools/davinci-analyze.d.ts.map +1 -0
  207. package/dist/mcp/tools/davinci-analyze.js +31 -0
  208. package/dist/mcp/tools/davinci-analyze.js.map +1 -0
  209. package/dist/mcp/tools/davinci-build.d.ts +4 -0
  210. package/dist/mcp/tools/davinci-build.d.ts.map +1 -0
  211. package/dist/mcp/tools/davinci-build.js +43 -0
  212. package/dist/mcp/tools/davinci-build.js.map +1 -0
  213. package/dist/mcp/tools/davinci-convert.d.ts +4 -0
  214. package/dist/mcp/tools/davinci-convert.d.ts.map +1 -0
  215. package/dist/mcp/tools/davinci-convert.js +61 -0
  216. package/dist/mcp/tools/davinci-convert.js.map +1 -0
  217. package/dist/mcp/tools/edge.d.ts.map +1 -1
  218. package/dist/mcp/tools/edge.js +81 -3
  219. package/dist/mcp/tools/edge.js.map +1 -1
  220. package/dist/mcp/tools/export.d.ts.map +1 -1
  221. package/dist/mcp/tools/export.js +17 -4
  222. package/dist/mcp/tools/export.js.map +1 -1
  223. package/dist/mcp/tools/import-prd.d.ts.map +1 -1
  224. package/dist/mcp/tools/import-prd.js +89 -2
  225. package/dist/mcp/tools/import-prd.js.map +1 -1
  226. package/dist/mcp/tools/index.d.ts.map +1 -1
  227. package/dist/mcp/tools/index.js +12 -0
  228. package/dist/mcp/tools/index.js.map +1 -1
  229. package/dist/mcp/tools/node.d.ts.map +1 -1
  230. package/dist/mcp/tools/node.js +127 -6
  231. package/dist/mcp/tools/node.js.map +1 -1
  232. package/dist/mcp/tools/plan-sprint.d.ts.map +1 -1
  233. package/dist/mcp/tools/plan-sprint.js +6 -2
  234. package/dist/mcp/tools/plan-sprint.js.map +1 -1
  235. package/dist/mcp/tools/show.d.ts.map +1 -1
  236. package/dist/mcp/tools/show.js +11 -4
  237. package/dist/mcp/tools/show.js.map +1 -1
  238. package/dist/mcp/tools/template.d.ts +4 -0
  239. package/dist/mcp/tools/template.d.ts.map +1 -0
  240. package/dist/mcp/tools/template.js +137 -0
  241. package/dist/mcp/tools/template.js.map +1 -0
  242. package/dist/schemas/analyzer-schema.d.ts +2 -2
  243. package/dist/schemas/designer-schema.d.ts +21 -0
  244. package/dist/schemas/designer-schema.d.ts.map +1 -1
  245. package/dist/schemas/designer-schema.js +2 -0
  246. package/dist/schemas/designer-schema.js.map +1 -1
  247. package/dist/schemas/edge.schema.d.ts +6 -0
  248. package/dist/schemas/edge.schema.d.ts.map +1 -1
  249. package/dist/schemas/edge.schema.js +2 -0
  250. package/dist/schemas/edge.schema.js.map +1 -1
  251. package/dist/schemas/graph.schema.d.ts +13 -0
  252. package/dist/schemas/graph.schema.d.ts.map +1 -1
  253. package/dist/schemas/node.schema.d.ts +20 -0
  254. package/dist/schemas/node.schema.d.ts.map +1 -1
  255. package/dist/schemas/node.schema.js +3 -0
  256. package/dist/schemas/node.schema.js.map +1 -1
  257. package/dist/schemas/siebel.schema.d.ts +13 -13
  258. package/dist/web/dashboard/dist/assets/{benchmark-tab-en-UkR66.js → benchmark-tab-Aqr2Xzu5.js} +1 -1
  259. package/dist/web/dashboard/dist/assets/{circle-alert-5GIBBP3L.js → circle-alert-BJTyaShp.js} +1 -1
  260. package/dist/web/dashboard/dist/assets/constants-DLyESMjx.js +1 -0
  261. package/dist/web/dashboard/dist/assets/{context-tab-DjfwQik8.js → context-tab-CbmHGGZh.js} +1 -1
  262. package/dist/web/dashboard/dist/assets/davinci-tab-krxsY7Pp.js +10 -0
  263. package/dist/web/dashboard/dist/assets/{docs-tab-gEBzBEEV.js → docs-tab-AautK0dL.js} +1 -1
  264. package/dist/web/dashboard/dist/assets/file-code-DVOtQrhl.js +11 -0
  265. package/dist/web/dashboard/dist/assets/{gitnexus-tab-BE2pi0xe.js → gitnexus-tab-D5xRYU3u.js} +1 -1
  266. package/dist/web/dashboard/dist/assets/{graph-section-Cwx-Bmeh.js → graph-section-D5y4S3T1.js} +1 -1
  267. package/dist/web/dashboard/dist/assets/{graph-tab-BcS75lY0.js → graph-tab-tmjyMc4q.js} +1 -1
  268. package/dist/web/dashboard/dist/assets/{graph-utils-OY_fOvB3.js → graph-utils-BlwoHdjR.js} +1 -1
  269. package/dist/web/dashboard/dist/assets/index-BcMjWikL.css +1 -0
  270. package/dist/web/dashboard/dist/assets/{index-4X4gmCkA.js → index-C13O-yj1.js} +1 -1
  271. package/dist/web/dashboard/dist/assets/{index-1aGs8JPI.js → index-CAOXRHQq.js} +1 -1
  272. package/dist/web/dashboard/dist/assets/{index-C3Kad9YO.js → index-DrvFzUJS.js} +24 -19
  273. package/dist/web/dashboard/dist/assets/{insights-tab-CP2uIpid.js → insights-tab-9sq9NfBt.js} +1 -1
  274. package/dist/web/dashboard/dist/assets/{journey-tab-ChwNK_8S.js → journey-tab-ujeAoAsS.js} +1 -1
  275. package/dist/web/dashboard/dist/assets/{languages-tab-DnBvSh4N.js → languages-tab-DT-46f7p.js} +24 -39
  276. package/dist/web/dashboard/dist/assets/{loader-circle-Bxe_TLXv.js → loader-circle-DQz_g7p_.js} +1 -1
  277. package/dist/web/dashboard/dist/assets/{logs-tab-BH86QvKe.js → logs-tab-DHj9jG6G.js} +1 -1
  278. package/dist/web/dashboard/dist/assets/{lsp-tab-DUpaQXtx.js → lsp-tab-DGIm2cTM.js} +3 -3
  279. package/dist/web/dashboard/dist/assets/{memories-tab-CkwtNv3t.js → memories-tab-DT7JcHgq.js} +1 -1
  280. package/dist/web/dashboard/dist/assets/{prd-backlog-tab-CPJanaVF.js → prd-backlog-tab-CLzQ5p_3.js} +1 -1
  281. package/dist/web/dashboard/dist/assets/{refresh-cw-DL1dUrhF.js → refresh-cw-C0EeXZ6n.js} +1 -1
  282. package/dist/web/dashboard/dist/assets/{siebel-tab-D7x34UXy.js → siebel-tab-67cdoYQ_.js} +3 -3
  283. package/dist/web/dashboard/dist/assets/{sif-parse.worker-DZrybOHz.js → sif-parse.worker-Cty_N-lP.js} +3 -3
  284. package/dist/web/dashboard/dist/assets/{skills-tab-BuqCMS29.js → skills-tab-DL8-pMo9.js} +1 -1
  285. package/dist/web/dashboard/dist/assets/{style-iy_ryTT6.js → style-DeKQIW_i.js} +1 -1
  286. package/dist/web/dashboard/dist/assets/triangle-alert-cibtv50e.js +16 -0
  287. package/dist/web/dashboard/dist/assets/upload-CZI9Zosi.js +16 -0
  288. package/dist/web/dashboard/dist/index.html +2 -2
  289. package/package.json +3 -1
  290. package/dist/web/dashboard/dist/assets/constants-Dd6A34aQ.js +0 -1
  291. package/dist/web/dashboard/dist/assets/index-BVhCKhGJ.css +0 -1
  292. package/dist/web/dashboard/dist/assets/triangle-alert-CPzksLkC.js +0 -26
@@ -1 +1 @@
1
- import{r as h,a as p,j as e}from"./index-C3Kad9YO.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
+ import{r as h,a as p,j as e}from"./index-DrvFzUJS.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-C3Kad9YO.js";/**
1
+ import{c as e}from"./index-DrvFzUJS.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ const e={epic:"#7c3aed",task:"#2196f3",subtask:"#10b981",requirement:"#f59e0b",constraint:"#ef4444",milestone:"#8b5cf6",acceptance_criteria:"#06b6d4",risk:"#f97316",decision:"#ec4899",interface:"#14b8a6",formula:"#a855f7",state_machine:"#6366f1",contract:"#0ea5e9",scenario:"#22c55e",performance_budget:"#eab308",asset:"#f472b6",data_table:"#64748b",metric:"#fb923c",config_schema:"#84cc16"},a={done:"#4caf50",in_progress:"#2196f3",blocked:"#f44336",ready:"#ff9800",backlog:"#9e9e9e"},s={done:"Done",in_progress:"In Progress",blocked:"Blocked",ready:"Ready",backlog:"Backlog"},o={depends_on:{color:"#6c757d",dashed:!1,label:"depends on"},blocks:{color:"#f44336",dashed:!0,label:"blocks"},parent_of:{color:"#7c3aed",dashed:!1,label:"parent of"},child_of:{color:"#10b981",dashed:!1,label:"child of"},related_to:{color:"#9e9e9e",dashed:!0,label:"related to"},priority_over:{color:"#ff9800",dashed:!0,label:"priority over"},implements:{color:"#2196f3",dashed:!1,label:"implements"},derived_from:{color:"#06b6d4",dashed:!0,label:"derived from"},provides:{color:"#22c55e",dashed:!1,label:"provides"},consumes:{color:"#f97316",dashed:!1,label:"consumes"},requires_asset:{color:"#f472b6",dashed:!0,label:"requires asset"}},c=["backlog","ready","in_progress","blocked","done"],t=["epic","task","subtask","requirement","constraint","milestone","acceptance_criteria","risk","decision","interface","formula","state_machine","contract","scenario","performance_budget","asset","data_table","metric","config_schema"],r=["ANALYZE","DESIGN","PLAN","IMPLEMENT","VALIDATE","REVIEW","HANDOFF","DEPLOY","LISTENING"],l={ANALYZE:"#8b5cf6",DESIGN:"#3b82f6",PLAN:"#06b6d4",IMPLEMENT:"#10b981",VALIDATE:"#f59e0b",REVIEW:"#ef4444",HANDOFF:"#ec4899",DEPLOY:"#f97316",LISTENING:"#6b7280"},d={function:"#4fc3f7",class:"#ce93d8",method:"#81c784",interface:"#4dd0e1",variable:"#ffd54f",module:"#b39ddb",file:"#90a4ae",folder:"#78909c",struct:"#ef9a9a",enum:"#ffcc80",trait:"#a5d6a7",property:"#80deea",constant:"#ffe082",package:"#c5e1a5",annotation:"#f48fb1",macro:"#ffab91",type_alias:"#b0bec5",constructor:"#9fa8da",field:"#bcaaa4",delegate:"#80cbc4",event:"#ce93d8",namespace:"#b39ddb"},n={belongs_to:"#546e7a",imports:"#546e7a",calls:"#4fc3f7",extends:"#81c784",implements:"#4dd0e1",exports:"#66bb6a",uses:"#78909c",overrides:"#ffb74d",decorates:"#f48fb1"},b={belongs_to:"Contains",imports:"Imports",calls:"Calls",extends:"Extends",implements:"Implements",exports:"Exports",uses:"Uses",overrides:"Overrides",decorates:"Decorates"},f={screen:"#8b5cf6",view:"#3b82f6",applet:"#06b6d4",business_object:"#7c3aed",business_component:"#10b981",business_service:"#f59e0b",workflow:"#ef4444",table:"#78909c",integration_object:"#ec4899",web_template:"#6b7280",pick_list:"#a78bfa",field:"#94a3b8",link:"#64748b",column:"#94a3b8",control:"#94a3b8",list_column:"#94a3b8",menu_item:"#94a3b8",project:"#d97706"},i={uses:{color:"#2196f3",dashed:!1,label:"uses"},references:{color:"#6c757d",dashed:!0,label:"references"},contains:{color:"#7c3aed",dashed:!1,label:"contains"},extends:{color:"#10b981",dashed:!0,label:"extends"},based_on:{color:"#f59e0b",dashed:!1,label:"based on"},linked_to:{color:"#ef4444",dashed:!0,label:"linked to"},parent_of:{color:"#8b5cf6",dashed:!1,label:"parent of"}};export{c as A,d as C,o as E,r as L,e as N,l as P,a as S,t as a,n as b,b as c,s as d,f as e,i as f};
@@ -1 +1 @@
1
- import{r as o,a as m,j as e,R as v}from"./index-C3Kad9YO.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-DrvFzUJS.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};
@@ -0,0 +1,10 @@
1
+ import{c as $,r as n,j as e,C as I}from"./index-DrvFzUJS.js";import{U as L,C as v,a as N}from"./upload-CZI9Zosi.js";import{S as O,T as y,C as U}from"./triangle-alert-cibtv50e.js";/**
2
+ * @license lucide-react v1.7.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const V=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],k=$("hammer",V),f="/api/v1/davinci";function G(){const[o,j]=n.useState("upload"),[a,S]=n.useState(""),[p,T]=n.useState("pingfederate"),[u,P]=n.useState("my-davinci-plugin"),[h,A]=n.useState("com.example.plugin"),[b,E]=n.useState("MyDaVinciPlugin"),[d,x]=n.useState(!1),[l,B]=n.useState(null),[i,D]=n.useState(null),[m,J]=n.useState(null),[c,z]=n.useState(null),[C,r]=n.useState(null),g=n.useCallback(async()=>{try{const t=await(await fetch(`${f}/environment`)).json();t.ok&&J(t.environment.items)}catch{}},[]),F=n.useCallback(async()=>{if(a.trim()){x(!0),r(null);try{const t=await(await fetch(`${f}/analyze`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a})})).json();t.ok?(B(t.analysis),j("analysis")):r(t.error)}catch(s){r(s instanceof Error?s.message:"Analysis failed")}finally{x(!1)}}},[a]),w=n.useCallback(async()=>{if(a.trim()){x(!0),r(null);try{const t=await(await fetch(`${f}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,pluginName:u,packageName:h,className:b,targetSdk:p})})).json();t.ok?(D(t),j("preview"),g()):r(t.error)}catch(s){r(s instanceof Error?s.message:"Conversion failed")}finally{x(!1)}}},[a,u,h,b,p,g]),R=n.useCallback(async()=>{if(a.trim()){x(!0),r(null),z(null);try{const t=await(await fetch(`${f}/convert-and-build`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,pluginName:u,packageName:h,className:b,targetSdk:p})})).json();z(t),!t.ok&&t.phase==="environment_check"?r("Build environment not ready. Install missing tools."):t.ok||r(t.buildErrors||"Build failed"),g(),j("build")}catch(s){r(s instanceof Error?s.message:"Build failed")}finally{x(!1)}}},[a,u,h,b,p,g]);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-zinc-700/50 bg-zinc-900/50",children:["upload","analysis","preview","build"].map(s=>e.jsxs("button",{onClick:()=>j(s),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors ${o===s?"bg-blue-600 text-white":"text-zinc-400 hover:text-white hover:bg-zinc-800"}`,children:[s==="upload"&&e.jsx(L,{size:14}),s==="analysis"&&e.jsx(O,{size:14}),s==="preview"&&e.jsx(I,{size:14}),s==="build"&&e.jsx(k,{size:14}),s.charAt(0).toUpperCase()+s.slice(1)]},s))}),C&&e.jsxs("div",{className:"mx-4 mt-2 px-3 py-2 bg-red-900/30 border border-red-700/50 rounded text-red-300 text-xs flex items-center gap-2",children:[e.jsx(y,{size:14}),C,e.jsx("button",{onClick:()=>r(null),className:"ml-auto text-red-400 hover:text-red-200",children:"x"})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[o==="upload"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"DaVinci Custom Code"}),e.jsx("p",{className:"text-xs text-zinc-400",children:"Paste your DaVinci JavaScript code (Custom Function, Code Snippet, or HTML Template)."}),e.jsx("textarea",{value:a,onChange:s=>S(s.target.value),placeholder:`module.exports = a = async ({params}) => {
7
+ const apiKey = "{{global.variables.apiKey}}";
8
+ // your DaVinci logic here
9
+ return { result: "ok" };
10
+ }`,className:"w-full h-64 bg-zinc-900 border border-zinc-700 rounded p-3 text-xs font-mono text-zinc-200 resize-y focus:outline-none focus:border-blue-500"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Target SDK"}),e.jsxs("select",{value:p,onChange:s=>T(s.target.value),className:"w-full bg-zinc-900 border border-zinc-700 rounded px-2 py-1.5 text-xs text-zinc-200",children:[e.jsx("option",{value:"pingfederate",children:"PingFederate"}),e.jsx("option",{value:"pingaccess",children:"PingAccess"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Plugin Name"}),e.jsx("input",{value:u,onChange:s=>P(s.target.value),className:"w-full bg-zinc-900 border border-zinc-700 rounded px-2 py-1.5 text-xs text-zinc-200"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Package Name"}),e.jsx("input",{value:h,onChange:s=>A(s.target.value),className:"w-full bg-zinc-900 border border-zinc-700 rounded px-2 py-1.5 text-xs text-zinc-200"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Class Name"}),e.jsx("input",{value:b,onChange:s=>E(s.target.value),className:"w-full bg-zinc-900 border border-zinc-700 rounded px-2 py-1.5 text-xs text-zinc-200"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:F,disabled:d||!a.trim(),className:"px-4 py-2 bg-blue-600 hover:bg-blue-500 disabled:opacity-50 text-white text-xs rounded font-medium",children:d?"Analyzing...":"Analyze"}),e.jsx("button",{onClick:w,disabled:d||!a.trim(),className:"px-4 py-2 bg-green-600 hover:bg-green-500 disabled:opacity-50 text-white text-xs rounded font-medium",children:d?"Converting...":"Convert to Java"})]})]}),o==="analysis"&&l&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"Analysis Results"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-zinc-900 border border-zinc-700 rounded p-3",children:[e.jsx("div",{className:"text-xs text-zinc-400",children:"Variables"}),e.jsx("div",{className:"text-lg font-bold text-blue-400",children:l.variables.length})]}),e.jsxs("div",{className:"bg-zinc-900 border border-zinc-700 rounded p-3",children:[e.jsx("div",{className:"text-xs text-zinc-400",children:"API Calls"}),e.jsx("div",{className:"text-lg font-bold text-purple-400",children:l.apiCalls.length})]}),e.jsxs("div",{className:"bg-zinc-900 border border-zinc-700 rounded p-3",children:[e.jsx("div",{className:"text-xs text-zinc-400",children:"Plugin Type"}),e.jsx("div",{className:"text-sm font-bold text-green-400",children:l.recommendedPluginType}),e.jsxs("div",{className:"text-xs text-zinc-500",children:[(l.pluginTypeConfidence*100).toFixed(0),"% confidence"]})]})]}),l.variables.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-zinc-300 mb-2",children:"Variables Detected"}),e.jsx("div",{className:"space-y-1",children:l.variables.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs bg-zinc-900/50 px-2 py-1 rounded",children:[e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${s.kind==="global"?"bg-blue-900/50 text-blue-300":s.kind==="local"?"bg-yellow-900/50 text-yellow-300":s.kind==="flow"?"bg-purple-900/50 text-purple-300":"bg-zinc-800 text-zinc-300"}`,children:s.kind}),e.jsx("span",{className:"font-mono text-zinc-300",children:s.fieldName}),e.jsx("span",{className:"text-zinc-500 ml-auto",children:s.rawTemplate})]},t))})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-zinc-300 mb-2",children:"Flow Logic"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(l.flowLogic).map(([s,t])=>e.jsxs("span",{className:`px-2 py-1 rounded text-[10px] font-medium ${t?"bg-green-900/30 text-green-400":"bg-zinc-800 text-zinc-500"}`,children:[t?e.jsx(v,{size:10,className:"inline mr-1"}):null,s.replace("has","")]},s))})]}),l.warnings.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-yellow-400 mb-2",children:"Warnings"}),l.warnings.map((s,t)=>e.jsxs("div",{className:"text-xs text-yellow-300 bg-yellow-900/20 px-2 py-1 rounded mb-1 flex items-start gap-1.5",children:[e.jsx(y,{size:12,className:"mt-0.5 shrink-0"}),s]},t))]}),e.jsxs("button",{onClick:w,disabled:d,className:"px-4 py-2 bg-green-600 hover:bg-green-500 disabled:opacity-50 text-white text-xs rounded font-medium flex items-center gap-1.5",children:[e.jsx(U,{size:14}),d?"Converting...":"Convert to Java"]})]}),o==="analysis"&&!l&&e.jsx("div",{className:"text-center text-zinc-500 text-sm py-12",children:"No analysis yet. Go to Upload and click Analyze."}),o==="preview"&&i&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"Generated Java Plugin"}),e.jsxs("span",{className:"text-xs px-2 py-1 bg-green-900/30 text-green-400 rounded",children:[i.pluginType," (",(i.confidence*100).toFixed(0),"%)"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Java Source"}),e.jsx("button",{onClick:()=>navigator.clipboard.writeText(i.javaCode),className:"text-[10px] text-blue-400 hover:text-blue-300",children:"Copy"})]}),e.jsx("pre",{className:"bg-zinc-950 border border-zinc-700 rounded p-3 text-[11px] font-mono text-zinc-300 overflow-auto max-h-96",children:i.javaCode})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"pom.xml"}),e.jsx("button",{onClick:()=>navigator.clipboard.writeText(i.pomXml),className:"text-[10px] text-blue-400 hover:text-blue-300",children:"Copy"})]}),e.jsx("pre",{className:"bg-zinc-950 border border-zinc-700 rounded p-3 text-[11px] font-mono text-zinc-300 overflow-auto max-h-96",children:i.pomXml})]})]}),e.jsxs("div",{className:"bg-zinc-900 border border-zinc-700 rounded p-3",children:[e.jsx("span",{className:"text-xs text-zinc-400",children:"PF-INF Descriptor: "}),e.jsxs("span",{className:"text-xs font-mono text-zinc-200",children:[i.pfInfType,"/",i.pfInfContent]})]}),i.warnings.length>0&&e.jsx("div",{children:i.warnings.map((s,t)=>e.jsxs("div",{className:"text-xs text-yellow-300 bg-yellow-900/20 px-2 py-1 rounded mb-1 flex items-start gap-1.5",children:[e.jsx(y,{size:12,className:"mt-0.5 shrink-0"}),s]},t))})]}),o==="preview"&&!i&&e.jsx("div",{className:"text-center text-zinc-500 text-sm py-12",children:"No conversion yet. Go to Upload and click Convert."}),o==="build"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"Build Environment"}),e.jsx("p",{className:"text-xs text-zinc-400",children:"Check if your environment has JDK + Maven installed to compile the plugin JAR."}),e.jsx("button",{onClick:g,className:"px-3 py-1.5 bg-zinc-800 hover:bg-zinc-700 text-zinc-200 text-xs rounded font-medium",children:"Check Environment"}),m&&e.jsxs("div",{className:"space-y-2",children:[m.map(s=>e.jsxs("div",{className:"flex items-center gap-3 bg-zinc-900 border border-zinc-700 rounded p-3",children:[s.available?e.jsx(v,{size:18,className:"text-green-500 shrink-0"}):e.jsx(N,{size:18,className:"text-red-500 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-medium text-zinc-200",children:s.name}),s.available&&s.version&&e.jsxs("div",{className:"text-[10px] text-zinc-500",children:["v",s.version]}),!s.available&&s.instruction&&e.jsx("div",{className:"text-[10px] text-red-400",children:s.instruction})]}),!s.available&&s.installUrl&&e.jsx("a",{href:s.installUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-blue-400 hover:text-blue-300 underline",children:"Install"})]},s.name)),e.jsx("div",{className:`flex items-center gap-2 p-3 rounded border ${m.every(s=>s.available)?"bg-green-900/20 border-green-700/50 text-green-400":"bg-red-900/20 border-red-700/50 text-red-400"}`,children:m.every(s=>s.available)?e.jsxs(e.Fragment,{children:[e.jsx(v,{size:16}),e.jsx("span",{className:"text-xs font-medium",children:"Ready to Build"})]}):e.jsxs(e.Fragment,{children:[e.jsx(N,{size:16}),e.jsx("span",{className:"text-xs font-medium",children:"Not Ready — install missing tools"})]})})]}),m&&m.every(s=>s.available)&&a.trim()&&e.jsx("div",{className:"pt-2 border-t border-zinc-700/50",children:e.jsxs("button",{onClick:R,disabled:d,className:"px-4 py-2 bg-green-600 hover:bg-green-500 disabled:opacity-50 text-white text-xs rounded font-medium flex items-center gap-1.5",children:[e.jsx(k,{size:14}),d?"Building...":"Build JAR"]})}),c&&e.jsx("div",{className:`p-3 rounded border ${c.ok?"bg-green-900/20 border-green-700/50":"bg-red-900/20 border-red-700/50"}`,children:c.ok?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[e.jsx(v,{size:16}),e.jsx("span",{className:"text-xs font-medium",children:"Build Successful!"}),c.buildDurationMs&&e.jsxs("span",{className:"text-[10px] text-zinc-500 ml-auto",children:[(c.buildDurationMs/1e3).toFixed(1),"s"]})]}),c.jarPath&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] text-zinc-300 font-mono bg-zinc-950 px-2 py-1 rounded",children:c.jarPath}),e.jsxs("div",{className:"text-[10px] text-zinc-500",children:["Project: ",c.projectDir]})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[e.jsx(N,{size:16}),e.jsx("span",{className:"text-xs font-medium",children:"Build Failed"})]}),c.buildErrors&&e.jsx("pre",{className:"text-[10px] text-red-300 bg-zinc-950 px-2 py-1 rounded overflow-auto max-h-32",children:c.buildErrors})]})})]})]})]})}export{G as DavinciTab};
@@ -1 +1 @@
1
- import{r as c,a as p,j as e}from"./index-C3Kad9YO.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-DrvFzUJS.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};
@@ -0,0 +1,11 @@
1
+ import{c as o}from"./index-DrvFzUJS.js";/**
2
+ * @license lucide-react v1.7.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const e=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],t=o("chevron-down",e);/**
7
+ * @license lucide-react v1.7.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const a=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],c=o("file-code",a);export{t as C,c as F};