@devflow-tools/devflow 0.11.0 → 0.12.2

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 (32) hide show
  1. package/dist/cli.js +19 -27
  2. package/dist/dashboard/404.html +1 -0
  3. package/dist/dashboard/_next/static/9y2HWmEr_Gbgkkmk6aE_C/_buildManifest.js +1 -0
  4. package/dist/dashboard/_next/static/9y2HWmEr_Gbgkkmk6aE_C/_ssgManifest.js +1 -0
  5. package/dist/dashboard/_next/static/chunks/1dd3208c-f3e84932bdc53383.js +1 -0
  6. package/dist/dashboard/_next/static/chunks/254-814190ccf12d2df8.js +1 -0
  7. package/dist/dashboard/_next/static/chunks/528-7d4fc14903647f1e.js +2 -0
  8. package/dist/dashboard/_next/static/chunks/6b3bb038-34d5cf36bd0210d6.js +1 -0
  9. package/dist/dashboard/_next/static/chunks/781-97eaf0e93843fa67.js +1 -0
  10. package/dist/dashboard/_next/static/chunks/app/_not-found/page-5252c260804ee1ce.js +1 -0
  11. package/dist/dashboard/_next/static/chunks/app/layout-0e71002867d54cb5.js +1 -0
  12. package/dist/dashboard/_next/static/chunks/app/page-570d1b92af49aa0f.js +1 -0
  13. package/dist/dashboard/_next/static/chunks/framework-58c3457e28c4602f.js +1 -0
  14. package/dist/dashboard/_next/static/chunks/main-595171e579e3e067.js +1 -0
  15. package/dist/dashboard/_next/static/chunks/main-app-202a5f91ead17fa7.js +1 -0
  16. package/dist/dashboard/_next/static/chunks/pages/_app-58c3f1a8a070bd35.js +1 -0
  17. package/dist/dashboard/_next/static/chunks/pages/_error-312a564ec7e2663f.js +1 -0
  18. package/dist/dashboard/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  19. package/dist/dashboard/_next/static/chunks/webpack-d6388c5dcd85b0c5.js +1 -0
  20. package/dist/dashboard/_next/static/css/322e14d06135256b.css +31 -0
  21. package/dist/dashboard/_next/static/css/9bb745101fd21603.css +3 -0
  22. package/dist/dashboard/index.html +1 -0
  23. package/dist/dashboard/index.txt +9 -0
  24. package/dist/dashboard/locales/en.json +328 -0
  25. package/dist/dashboard/locales/zh.json +328 -0
  26. package/dist/hooks/hook-client.js +7 -0
  27. package/dist/hooks/hook-daemon.js +4 -0
  28. package/dist/hooks/post-tool-use.js +2 -2
  29. package/package.json +13 -13
  30. package/plugin-registry.json +17 -17
  31. package/dist/mcp-server.js +0 -7
  32. package/dist/server.js +0 -10
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[409],{42247:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_not-found/page",function(){return n(59114)}])},59114:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}}),n(11887);let i=n(27573);n(7653);let o={fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},l={display:"inline-block"},r={display:"inline-block",margin:"0 20px 0 0",padding:"0 23px 0 0",fontSize:24,fontWeight:500,verticalAlign:"top",lineHeight:"49px"},d={fontSize:14,fontWeight:400,lineHeight:"49px",margin:0};function s(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("title",{children:"404: This page could not be found."}),(0,i.jsx)("div",{style:o,children:(0,i.jsxs)("div",{children:[(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}),(0,i.jsx)("h1",{className:"next-error-h1",style:r,children:"404"}),(0,i.jsx)("div",{style:l,children:(0,i.jsx)("h2",{style:d,children:"This page could not be found."})})]})})]})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},function(e){e.O(0,[293,528,744],function(){return e(e.s=42247)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{70135:function(e,t,n){Promise.resolve().then(n.bind(n,72921))},72921:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return B}});var o=n(27573);n(72625);var i=n(50803),s=n(99617),r=n(2906),a=n(24559),l=class extends a.l{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let o=t.queryKey,r=t.queryHash??(0,i.Rm)(o,t),a=this.get(r);return a||(a=new s.A({client:e,queryKey:o,queryHash:r,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(o)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){r.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,i._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,i._x)(e,t)):t}notify(e){r.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){r.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){r.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},c=n(64855),u=class extends a.l{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#n=new Map,this.#o=0}#t;#n;#o;build(e,t,n){let o=new c.m({client:e,mutationCache:this,mutationId:++this.#o,options:e.defaultMutationOptions(t),state:n});return this.add(o),o}add(e){this.#t.add(e);let t=d(e);if("string"==typeof t){let n=this.#n.get(t);n?n.push(e):this.#n.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){let t=d(e);if("string"==typeof t){let n=this.#n.get(t);if(n){if(n.length>1){let t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#n.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=d(e);if("string"!=typeof t)return!0;{let n=this.#n.get(t),o=n?.find(e=>"pending"===e.state.status);return!o||o===e}}runNext(e){let t=d(e);if("string"!=typeof t)return Promise.resolve();{let n=this.#n.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}}clear(){r.Vr.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#n.clear()})}getAll(){return Array.from(this.#t)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,i.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,i.X7)(e,t))}notify(e){r.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return r.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(i.ZT))))}};function d(e){return e.options.scope?.id}var h=n(87047),m=n(33906),f=class{#i;#s;#r;#a;#l;#c;#u;#d;constructor(e={}){this.#i=e.queryCache||new l,this.#s=e.mutationCache||new u,this.#r=e.defaultOptions||{},this.#a=new Map,this.#l=new Map,this.#c=0}mount(){this.#c++,1===this.#c&&(this.#u=h.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#i.onFocus())}),this.#d=m.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#i.onOnline())}))}unmount(){this.#c--,0===this.#c&&(this.#u?.(),this.#u=void 0,this.#d?.(),this.#d=void 0)}isFetching(e){return this.#i.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#s.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#i.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#i.build(this,t),o=n.state.data;return void 0===o?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime((0,i.KC)(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return this.#i.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let o=this.defaultQueryOptions({queryKey:e}),s=this.#i.get(o.queryHash),r=s?.state.data,a=(0,i.SE)(t,r);if(void 0!==a)return this.#i.build(this,o).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return r.Vr.batch(()=>this.#i.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#i.get(t.queryHash)?.state}removeQueries(e){let t=this.#i;r.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#i;return r.Vr.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t};return Promise.all(r.Vr.batch(()=>this.#i.findAll(e).map(e=>e.cancel(n)))).then(i.ZT).catch(i.ZT)}invalidateQueries(e,t={}){return r.Vr.batch(()=>(this.#i.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(r.Vr.batch(()=>this.#i.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(i.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(i.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let n=this.#i.build(this,t);return n.isStaleByTime((0,i.KC)(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(i.ZT).catch(i.ZT)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(i.ZT).catch(i.ZT)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return m.N.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#i}getMutationCache(){return this.#s}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#a.set((0,i.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#a.values()],n={};return t.forEach(t=>{(0,i.to)(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#l.set((0,i.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#l.values()],n={};return t.forEach(t=>{(0,i.to)(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,i.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===i.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#i.clear(),this.#s.clear()}},g=n(77930),p=n(7653);function y(e){let{children:t}=e,[n]=(0,p.useState)(()=>new f({defaultOptions:{queries:{staleTime:3e4,retry:1}}}));return(0,o.jsx)(g.aH,{client:n,children:t})}var v=n(98533),k=n(3806);let{slice:w,forEach:S}=[],b=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,R=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{path:"/"},o=encodeURIComponent(t),i=`${e}=${o}`;if(n.maxAge>0){let e=n.maxAge-0;if(Number.isNaN(e))throw Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!b.test(n.domain))throw TypeError("option domain is invalid");i+=`; Domain=${n.domain}`}if(n.path){if(!b.test(n.path))throw TypeError("option path is invalid");i+=`; Path=${n.path}`}if(n.expires){if("function"!=typeof n.expires.toUTCString)throw TypeError("option expires is invalid");i+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(i+="; HttpOnly"),n.secure&&(i+="; Secure"),n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return n.partitioned&&(i+="; Partitioned"),i},C={create(e,t,n,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+6e4*n)),o&&(i.domain=o),document.cookie=R(e,t,i)},read(e){let t=`${e}=`,n=document.cookie.split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var T={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&"undefined"!=typeof document)return C.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:o,cookieDomain:i,cookieOptions:s}=t;n&&"undefined"!=typeof document&&C.create(n,e,o,i,s)}},D={name:"querystring",lookup(e){let t,{lookupQuerystring:n}=e;if("undefined"!=typeof window){let{search:e}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(e=window.location.hash.substring(window.location.hash.indexOf("?")));let o=e.substring(1).split("&");for(let e=0;e<o.length;e++){let i=o[e].indexOf("=");i>0&&o[e].substring(0,i)===n&&(t=o[e].substring(i+1))}}return t}},x={name:"hash",lookup(e){let t,{lookupHash:n,lookupFromHashIndex:o}=e;if("undefined"!=typeof window){let{hash:e}=window.location;if(e&&e.length>2){let i=e.substring(1);if(n){let e=i.split("&");for(let o=0;o<e.length;o++){let i=e[o].indexOf("=");i>0&&e[o].substring(0,i)===n&&(t=e[o].substring(i+1))}}if(t)return t;if(!t&&o>-1){let t=e.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(t))return;return t["number"==typeof o?o:0]?.replace("/","")}}}return t}};let P=null,O=()=>{if(null!==P)return P;try{if(!(P="undefined"!=typeof window&&null!==window.localStorage))return!1;let e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){P=!1}return P};var A={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&O())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&O()&&window.localStorage.setItem(n,e)}};let M=null,I=()=>{if(null!==M)return M;try{if(!(M="undefined"!=typeof window&&null!==window.sessionStorage))return!1;let e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){M=!1}return M};var E={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&I())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&I()&&window.sessionStorage.setItem(n,e)}},q={name:"navigator",lookup(e){let t=[];if("undefined"!=typeof navigator){let{languages:e,userLanguage:n,language:o}=navigator;if(e)for(let n=0;n<e.length;n++)t.push(e[n]);n&&t.push(n),o&&t.push(o)}return t.length>0?t:void 0}},F={name:"htmlTag",lookup(e){let t,{htmlTag:n}=e,o=n||("undefined"!=typeof document?document.documentElement:null);return o&&"function"==typeof o.getAttribute&&(t=o.getAttribute("lang")),t}},L={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if("undefined"==typeof window)return;let n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(Array.isArray(n))return n["number"==typeof t?t:0]?.replace("/","")}},_={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e,n="undefined"!=typeof window&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n["number"==typeof t?t+1:1]}};let N=!1;try{document.cookie,N=!0}catch(e){}let j=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];N||j.splice(1,1);let Q=()=>({order:j,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class H{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{languageUtils:{}},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return S.call(w.call(arguments,1),t=>{if(t)for(let n in t)void 0===e[n]&&(e[n]=t[n])}),e}(t,this.options||{},Q()),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=e=>e.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(T),this.addDetector(D),this.addDetector(A),this.addDetector(E),this.addDetector(q),this.addDetector(F),this.addDetector(L),this.addDetector(_),this.addDetector(x)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.order,t=[];return(e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&"string"==typeof n&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>null!=e&&!("string"==typeof e&&[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(t=>t.test(e)))).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes)?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}}H.type="languageDetector";var U=JSON.parse('{"nav":{"title":"DevFlow","overview":"Overview","graph":"Graph","context":"Context","workflows":"Workflows","memory":"Memory","benchmark":"Benchmark","knowledge":"Knowledge","runs":"Runs","timeline":"Timeline","executions":"Executions","toolMetrics":"Tool Metrics","accuracy":"Accuracy","settings":"Settings","language":"中文"},"overview":{"title":"Project Overview","project":"Project","noProject":"No project connected","filesIndexed":"Files Indexed","workflows":"Workflows","agentRuns":"Agent Runs","techStack":"Tech Stack","recentRuns":"Recent Agent Runs","noRuns":"No agent runs recorded yet.","agent":"Agent","mode":"Mode","source":"Source","status":"Status","tokens":"Tokens","connectTitle":"Connect Project","connectDescription":"Enter the root path of your project to connect. The server will index and analyze the codebase.","connectPlaceholder":"/path/to/your/project","connecting":"Connecting...","connect":"Connect","connectError":"Failed to connect. Make sure the path exists and is accessible.","architectureLayers":"Architecture Layers","filesCount":"{{count}} files","keyModules":"Key Modules","keyFiles":"Key Files","recommended":"Recommended Next Steps","plugins":"Plugins","queries":"Queries","switchProject":"Switch Project","switchProjectPlaceholder":"Enter project path...","switchProjectConfirm":"Switch","disconnectProject":"Disconnect"},"onboarding":{"title":"Onboarding Pack","empty":"No onboarding pack generated yet","noActiveProject":"No active project","generate":"Generate Onboarding Pack"},"context":{"title":"Context Builder","placeholder":"Search symbols or ask a question...","build":"Build","building":"Building context...","results":"Results ({{files}} files, ~{{tokens}} tokens)","taskMode":"Task Mode","taskContext":"Task Context","confidenceTokens":"{{confidence}}% confidence \xb7 {{tokens}} tokens","requiredFiles":"Required Files","optionalFiles":"Optional Files","keySymbols":"Key Symbols","riskHints":"Risk Hints","nextActions":"Next Actions","relevanceDirect":"direct","relevanceIndirect":"indirect","levelHigh":"high","levelMedium":"medium","levelLow":"low","wasHelpful":"Was this helpful?","hit":"Hit","partial":"Partial","miss":"Miss","thanks":"Thanks for your feedback!"},"memory":{"title":"Memory","loading":"Loading...","ollamaStatus":"Ollama Status","installed":"Installed","running":"Running","model":"Model","available":"Available","notPulled":"Not pulled","pendingApproval":"Pending Approval","approvedMemories":"Approved Memories","approve":"Approve","reject":"Reject","noMemories":"No memories yet","noMemoriesHint":"Memories help avoid repeating mistakes","confidence":"confidence","original":"Original","yes":"Yes","no":"No","category":{"mcp_correction":"MCP Correction","project_knowledge":"Project Knowledge","failure_lesson":"Failure Lesson"},"searchPlaceholder":"Search memories...","addMemory":"Add Memory","editMemory":"Edit Memory","deleteMemory":"Delete","deleteConfirm":"Delete this memory?","categoryLabel":"Category","content":"Content","scope":"Scope (optional)","cancel":"Cancel","save":"Save"},"workflows":{"title":"Workflow Runs","available":"Available Workflows","steps":"steps","stream":"Stream","closeStream":"Close stream","runHistory":"Run History","runId":"Run ID","started":"Started","noRuns":"No runs yet. Trigger a workflow above."},"benchmark":{"title":"Benchmark","running":"Running...","run":"Run Benchmark","tasks":"tasks","noReports":"No benchmark reports yet. Run one to get started.","roiTitle":"ROI Dashboard","loading":"Loading...","noData":"No data available. Start using DevFlow to collect telemetry.","overview":"Overview","totalRuns":"Total Runs","completed":"Completed","failed":"Failed","avgDuration":"Avg Duration","avgTokens":"Avg Tokens","firstPassRate":"First Pass Rate","feedbackHitRate":"Feedback Hit Rate","efficiency":"Efficiency","avgTimePerTask":"Avg Time Per Task","avgRetryCount":"Avg Retry Count","tokensSaved":"Tokens Saved","failureBreakdown":"Failure Breakdown","workflowHealth":"Workflow Health","workflow":"Workflow","runs":"Runs","successRate":"Success Rate","pluginEffectiveness":"Plugin Effectiveness","plugin":"Plugin","dailyTrends":"Daily Trends","date":"Date","tokens":"Tokens","failures":"Failures","empty":"No telemetry data yet. Start using DevFlow with an AI agent to collect ROI metrics.","failureCategories":{"context_insufficient":"Context Insufficient","knowledge_missing":"Knowledge Missing","workflow_design_issue":"Workflow Design Issue","tool_error":"Tool Error","agent_override":"Agent Override","unknown":"Unknown"},"seconds":"{{value}}s","period":"{{from}} → {{to}}","experimentSummary":"Experiment Summary","timeSavedRate":"Time Saved","tokenSavedRate":"Token Saved","detailedResults":"Detailed Results","faster":"{{percent}}% faster","baseline":"Baseline","devflow":"DevFlow","noExperimentData":"No experiment data","opsSummary":"Operations Summary","totalRunsCount":"Total Runs","successRatePercent":"Success Rate","avgTokenUsage":"Avg Token Usage","avgDurationTime":"Avg Duration","feedbackHitRatePercent":"Feedback Hit Rate","noOpsData":"No operations data","loadFailed":"Load failed: {{error}}","pluginAnalysis":"Plugin Value Analysis","recommendedInstall":"Recommended to Install","suggestedRemove":"Suggested to Remove","installCount":"Installs","usageRate":"Usage","successRateShort":"Success","tokenImpact":"Token Impact","lastUsed":"Last Used","noPluginData":"No plugin data","recommended":"Recommended","lowEfficiency":"Low Efficiency"},"graph":{"searchPlaceholder":"Search nodes...","filterOnly":"Filter only","highlightAll":"Highlight all"},"detail":{"selectNode":"Select a node to view details","properties":"Properties","imports":"Imports","history":"History","name":"Name","type":"Type","file":"File","notFound":"Node not found"},"knowledge":{"title":"Knowledge Base","sources":"Sources","syncing":"Syncing...","syncAll":"Sync All","loading":"Loading...","noSources":"No knowledge sources. Install a plugin and sync docs.","search":"Search","searchPlaceholder":"Search knowledge...","synced":"Synced","notSynced":"Not synced","last":"Last","sync":"Sync","score":"Score"},"runs":{"title":"Runs","empty":"No runs recorded yet."},"timeline":{"title":"Timeline","runs":"Runs","tokens":"Tokens","llmCalls":"LLM Calls","toolUses":"Tool Uses","completed":"completed","failed":"failed"},"events":{"llmCall":"LLM Call","toolUse":"Tool Use","memoryRead":"Memory Read","memoryWrite":"Memory Write","fileRead":"File Read","fileWrite":"File Write","bashCommand":"Bash","mcpToolCall":"MCP Tool","error":"Error","userInput":"User Input","stepStart":"Step Start","stepEnd":"Step End","empty":"No events recorded for this run.","steps":"Steps","eventCount":"events","selectEvent":"Select an event to view details","eventDetail":"Event Detail","kind":"Kind","step":"Step","duration":"Duration","model":"Model","tokens":"Tokens","tokensInOut":"{{input}} in / {{output}} out","prompt":"Prompt","response":"Response","stdout":"Stdout","stderr":"Stderr","truncated":"Content was truncated"},"runDetail":{"title":"Run Detail","events":"events","llm":"LLM","tokens":"tokens","failureCategory":"Failure Category","failureReason":"Failure Reason","suggestedActions":"Suggested Actions","category":{"context_insufficient":"Context Insufficient","knowledge_missing":"Knowledge Missing","workflow_design_issue":"Workflow Design Issue","tool_error":"Tool Error","agent_override":"Agent Override"}},"plugin":{"title":"Plugin Effectiveness","installCount":"Install Count","activeRate":"Active Rate","successRate":"Success Rate","avgTokenImpact":"Avg Token Impact","recommendInstall":"Recommend Install","recommendOptimize":"Recommend Optimize","recommendRemove":"Recommend Remove"},"executions":{"title":"Skill Executions","loading":"Loading executions...","overallCompliance":"Overall MCP Compliance","totalExecutions":"Total Executions","skillsTracked":"Skills Tracked","skill":"Skill","status":"Status","tools":"Tools","mcpRate":"MCP Rate","duration":"Duration","tokens":"Tokens","empty":"No executions recorded yet","traceTimeline":"Execution Trace","blocked":"Blocked","fallback":"Fallback"},"settings":{"title":"Project Settings","projectInfo":"Project Info","name":"Name","mode":"Mode","plugins":"Plugins","noPlugins":"No plugins installed","telemetry":"Telemetry","totalRuns":"Runs stored","totalTokens":"Total tokens","clearOldRuns":"Clear old runs (30d+)"}}'),K=JSON.parse('{"nav":{"title":"DevFlow","overview":"概览","graph":"图谱","context":"上下文","workflows":"工作流","memory":"记忆","benchmark":"基准测试","knowledge":"知识库","runs":"运行记录","timeline":"时间线","executions":"执行轨迹","toolMetrics":"工具指标","accuracy":"准确率","settings":"设置","language":"EN"},"overview":{"title":"项目概览","project":"项目","noProject":"未连接项目","filesIndexed":"已索引文件","workflows":"工作流","agentRuns":"智能体运行","techStack":"技术栈","recentRuns":"最近运行","noRuns":"暂无运行记录","agent":"智能体","mode":"模式","source":"来源","status":"状态","tokens":"令牌数","connectTitle":"连接项目","connectDescription":"输入项目根路径进行连接。服务端将索引并分析代码库。","connectPlaceholder":"/path/to/your/project","connecting":"连接中...","connect":"连接","connectError":"连接失败,请确认路径存在且可访问。","architectureLayers":"架构分层","filesCount":"{{count}} 个文件","keyModules":"关键模块","keyFiles":"关键文件","recommended":"推荐下一步","plugins":"插件","queries":"推荐查询","switchProject":"切换项目","switchProjectPlaceholder":"输入项目路径...","switchProjectConfirm":"切换","disconnectProject":"断开连接"},"onboarding":{"title":"启动包","empty":"尚未生成启动包","noActiveProject":"未激活项目","generate":"生成启动包"},"context":{"title":"上下文构建器","placeholder":"搜索符号或输入查询...","build":"构建","building":"正在构建上下文...","results":"结果({{files}} 个文件,约 {{tokens}} 个令牌)","taskMode":"任务模式","taskContext":"任务上下文","confidenceTokens":"{{confidence}}% 置信度 \xb7 {{tokens}} 令牌","requiredFiles":"必需文件","optionalFiles":"可选文件","keySymbols":"关键符号","riskHints":"风险提示","nextActions":"下一步操作","relevanceDirect":"直接","relevanceIndirect":"间接","levelHigh":"高","levelMedium":"中","levelLow":"低","wasHelpful":"有帮助吗?","hit":"有用","partial":"部分有用","miss":"无用","thanks":"感谢反馈!"},"memory":{"title":"记忆","loading":"加载中...","ollamaStatus":"Ollama 状态","installed":"已安装","running":"运行中","model":"模型","available":"可用","notPulled":"未拉取","pendingApproval":"待审批","approvedMemories":"已批准的记忆","approve":"批准","reject":"拒绝","noMemories":"暂无记忆","noMemoriesHint":"记忆有助于避免重复犯错","confidence":"置信度","original":"原始","yes":"是","no":"否","category":{"mcp_correction":"MCP 纠正","project_knowledge":"项目知识","failure_lesson":"失败教训"},"searchPlaceholder":"搜索记忆...","addMemory":"添加记忆","editMemory":"编辑记忆","deleteMemory":"删除","deleteConfirm":"确定删除这条记忆?","categoryLabel":"分类","content":"内容","scope":"作用域(可选)","cancel":"取消","save":"保存"},"workflows":{"title":"工作流运行","available":"可用工作流","steps":"步骤","stream":"流","closeStream":"关闭流","runHistory":"运行历史","runId":"运行 ID","started":"开始时间","noRuns":"暂无运行,请触发上方工作流"},"benchmark":{"title":"基准测试","running":"运行中...","run":"运行测试","tasks":"任务","noReports":"暂无测试报告,点击运行开始","roiTitle":"ROI 仪表盘","loading":"加载中...","noData":"暂无数据。使用 DevFlow 与 AI Agent 协作以收集 ROI 数据。","overview":"概览","totalRuns":"总运行数","completed":"已完成","failed":"已失败","avgDuration":"平均耗时","avgTokens":"平均令牌","firstPassRate":"首次通过率","feedbackHitRate":"反馈命中率","efficiency":"效率","avgTimePerTask":"平均每任务耗时","avgRetryCount":"平均重试次数","tokensSaved":"节省令牌数","failureBreakdown":"失败分类","workflowHealth":"工作流健康度","workflow":"工作流","runs":"运行数","successRate":"成功率","pluginEffectiveness":"插件有效性","plugin":"插件","dailyTrends":"每日趋势","date":"日期","tokens":"令牌数","failures":"失败数","empty":"暂无遥测数据。使用 DevFlow 与 AI Agent 协作以收集 ROI 指标。","failureCategories":{"context_insufficient":"上下文不足","knowledge_missing":"知识缺失","workflow_design_issue":"工作流设计问题","tool_error":"工具错误","agent_override":"智能体覆盖","unknown":"未知"},"seconds":"{{value}}s","period":"{{from}} → {{to}}","experimentSummary":"实验收益总结","timeSavedRate":"时间节省率","tokenSavedRate":"Token 节省率","detailedResults":"详细结果","faster":"{{percent}}% 更快","baseline":"基线","devflow":"DevFlow","noExperimentData":"暂无实验数据","opsSummary":"运营统计","totalRunsCount":"总运行次数","successRatePercent":"成功率","avgTokenUsage":"平均 Token 使用","avgDurationTime":"平均耗时","feedbackHitRatePercent":"反馈命中率","noOpsData":"暂无运营数据","loadFailed":"加载失败: {{error}}","pluginAnalysis":"插件价值分析","recommendedInstall":"推荐安装","suggestedRemove":"建议移除","installCount":"安装量","usageRate":"使用率","successRateShort":"成功率","tokenImpact":"Token 影响","lastUsed":"最近使用","noPluginData":"暂无插件数据","recommended":"推荐","lowEfficiency":"低效"},"graph":{"searchPlaceholder":"搜索节点...","filterOnly":"仅显示匹配","highlightAll":"高亮全部"},"detail":{"selectNode":"选择一个节点查看详情","properties":"属性","imports":"导入","history":"历史","name":"名称","type":"类型","file":"文件","notFound":"节点未找到"},"knowledge":{"title":"知识库","sources":"数据源","syncing":"同步中...","syncAll":"全部同步","loading":"加载中...","noSources":"暂无知识源,安装插件并同步文档。","search":"搜索","searchPlaceholder":"搜索知识...","synced":"已同步","notSynced":"未同步","last":"最近","sync":"同步","score":"相关性"},"runs":{"title":"运行记录","empty":"暂无运行记录。"},"timeline":{"title":"时间线","runs":"运行数","tokens":"令牌数","llmCalls":"LLM 调用","toolUses":"工具调用","completed":"已完成","failed":"已失败"},"events":{"llmCall":"LLM 调用","toolUse":"工具使用","memoryRead":"读取记忆","memoryWrite":"写入记忆","fileRead":"读取文件","fileWrite":"写入文件","bashCommand":"Bash","mcpToolCall":"MCP 工具","error":"错误","userInput":"用户输入","stepStart":"步骤开始","stepEnd":"步骤结束","empty":"此运行未记录任何事件。","steps":"步骤","eventCount":"个事件","selectEvent":"选择一个事件查看详情","eventDetail":"事件详情","kind":"类型","step":"步骤","duration":"耗时","model":"模型","tokens":"令牌数","tokensInOut":"{{input}} 输入 / {{output}} 输出","prompt":"提示词","response":"响应","stdout":"标准输出","stderr":"标准错误","truncated":"内容已截断"},"runDetail":{"title":"运行详情","events":"个事件","llm":"次 LLM","tokens":"tokens","failureCategory":"失败类别","failureReason":"失败原因","suggestedActions":"建议动作","category":{"context_insufficient":"上下文不足","knowledge_missing":"知识缺失","workflow_design_issue":"工作流设计问题","tool_error":"工具错误","agent_override":"Agent 覆盖"}},"plugin":{"title":"插件效果","installCount":"安装量","activeRate":"活跃率","successRate":"成功率","avgTokenImpact":"平均 Token 影响","recommendInstall":"推荐安装","recommendOptimize":"建议优化","recommendRemove":"建议淘汰"},"executions":{"title":"技能执行记录","loading":"加载执行记录中...","overallCompliance":"总体 MCP 合规率","totalExecutions":"总执行次数","skillsTracked":"追踪技能数","skill":"技能","status":"状态","tools":"工具数","mcpRate":"MCP 比率","duration":"耗时","tokens":"Token","empty":"暂无执行记录","traceTimeline":"执行时间线","blocked":"已拦截","fallback":"降级"},"settings":{"title":"项目设置","projectInfo":"项目信息","name":"名称","mode":"模式","plugins":"插件","noPlugins":"未安装插件","telemetry":"遥测","totalRuns":"运行数","totalTokens":"总令牌数","clearOldRuns":"清理旧记录(30天前)"}}');function B(e){let{children:t}=e;return(0,o.jsx)("html",{lang:"zh",className:"dark",children:(0,o.jsx)("body",{className:"h-screen overflow-hidden",children:(0,o.jsx)(y,{children:t})})})}v.ZP.use(H).use(k.Db).init({resources:{en:{translation:U},zh:{translation:K}},fallbackLng:"zh",detection:{order:["localStorage","navigator"],caches:["localStorage"]},interpolation:{escapeValue:!1}})},72625:function(){}},function(e){e.O(0,[387,254,293,528,744],function(){return e(e.s=70135)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{56364:function(e,s,t){Promise.resolve().then(t.bind(t,83138))},83138:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return sW}});var l,n,r=t(27573),a=t(7653),i=t(62052);let d="devflow-project-root",o="devflow-active-project-root";function c(e){try{return localStorage.getItem(e)}catch(e){return null}}function m(e,s){try{null===s?localStorage.removeItem(e):localStorage.setItem(e,s)}catch(e){}}let x=(0,i.Ue)(e=>({activeView:"overview",selectedNodeId:null,detailTab:"properties",searchQuery:"",projectRoot:c(d),activeProjectRoot:c(o),selectedRunId:null,setActiveView:s=>e({activeView:s,selectedNodeId:null}),selectNode:s=>e({selectedNodeId:s}),setDetailTab:s=>e({detailTab:s}),setSearchQuery:s=>e({searchQuery:s}),setProjectRoot:s=>{m(d,s),e({projectRoot:s})},setActiveProjectRoot:s=>{m(o,s),e({activeProjectRoot:s})},setSelectedRunId:s=>e({selectedRunId:s})}));function u(e){let{nav:s,main:t,detail:l}=e;return(0,r.jsxs)("div",{className:"flex h-screen w-full",children:[(0,r.jsx)("aside",{className:"w-[220px] shrink-0 border-r border-border bg-card overflow-y-auto",children:s}),(0,r.jsx)("main",{className:"flex-1 overflow-hidden",children:t}),l&&(0,r.jsx)("aside",{className:"w-[340px] shrink-0 border-l border-border bg-card overflow-y-auto",children:l})]})}var h=t(10607),v=t(25579);function j(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return(0,v.m6)((0,h.W)(s))}var p=t(83071),f=t(50646),g=t(88497),y=t(61990),N=t(31815),b=t(46693),w=t(70548),k=t(41755),S=t(25555),C=t(39790),R=t(84142),F=t(31095),T=t(12198),P=t(3806);let q=[{id:"overview",labelKey:"nav.overview",icon:p.Z},{id:"graph",labelKey:"nav.graph",icon:f.Z},{id:"context",labelKey:"nav.context",icon:g.Z},{id:"workflows",labelKey:"nav.workflows",icon:y.Z},{id:"memory",labelKey:"nav.memory",icon:N.Z},{id:"benchmark",labelKey:"nav.benchmark",icon:b.Z},{id:"knowledge",labelKey:"nav.knowledge",icon:w.Z},{id:"runs",labelKey:"nav.runs",icon:k.Z},{id:"timeline",labelKey:"nav.timeline",icon:S.Z},{id:"executions",labelKey:"nav.executions",icon:C.Z},{id:"tool-metrics",labelKey:"nav.toolMetrics",icon:R.Z},{id:"accuracy",labelKey:"nav.accuracy",icon:F.Z},{id:"settings",labelKey:"nav.settings",icon:T.Z}];function K(){let{t:e,i18n:s}=(0,P.$G)(),t=x(e=>e.activeView),l=x(e=>e.setActiveView);return(0,r.jsxs)("nav",{className:"flex flex-col gap-1 p-3 h-full",children:[(0,r.jsx)("h1",{className:"text-lg font-bold mb-4 px-3 text-primary",children:e("nav.title")}),q.map(s=>(0,r.jsxs)("button",{onClick:()=>l(s.id),className:j("flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",t===s.id?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-accent"),children:[(0,r.jsx)(s.icon,{className:"h-4 w-4"}),e(s.labelKey)]},s.id)),(0,r.jsx)("div",{className:"mt-auto pt-4 border-t border-border",children:(0,r.jsx)("button",{onClick:()=>{s.changeLanguage("zh"===s.language?"en":"zh")},className:"w-full px-3 py-2 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:e("nav.language")})})]})}var D=t(31988),L=t(77930),I=t(15969),Z=t(49767);let E=null!==(l=Z.env.NEXT_PUBLIC_DEVFLOW_API_URL)&&void 0!==l?l:"http://localhost:13337",_=null!==(n=Z.env.NEXT_PUBLIC_DEVFLOW_API_KEY)&&void 0!==n?n:"dev-key-000000";async function O(e,s){let t=function(){try{return localStorage.getItem("devflow-active-project-root")}catch(e){return null}}(),l={"Content-Type":"application/json","x-api-key":_};t&&(l["x-devflow-project"]=t);let n=await fetch("".concat(E,"/api").concat(e),{...s,headers:{...l,...null==s?void 0:s.headers}});if(!n.ok)throw Error("API ".concat(n.status,": ").concat(await n.text()));let r=await n.json();return r&&"object"==typeof r&&"ok"in r&&"data"in r?r.data:r}let A=()=>O("/projects"),M=e=>O("/projects/connect",{method:"POST",body:JSON.stringify({rootPath:e})}),z=()=>O("/projects/active",{method:"DELETE"}),Q=()=>O("/projects/active"),G=e=>O("/projects/onboarding-pack?rootPath=".concat(encodeURIComponent(e))),U=()=>O("/context/status"),V=e=>O("/context/build",{method:"POST",body:JSON.stringify(e)}),$=e=>O("/context/build-task",{method:"POST",body:JSON.stringify(e)}),H=e=>O("/context/feedback",{method:"POST",body:JSON.stringify(e)}),J=()=>O("/graph"),B=()=>O("/graph?view=layered"),W=()=>O("/workflows"),X=(e,s)=>O("/workflows/".concat(e,"/run"),{method:"POST",body:JSON.stringify({input:s})}),Y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return O("/workflows/runs?limit=".concat(e,"&offset=").concat(s))},ee=()=>O("/memory"),es=e=>O("/memory",{method:"POST",body:JSON.stringify(e)}),et=(e,s)=>O("/memory/".concat(e),{method:"PUT",body:JSON.stringify(s)}),el=e=>O("/memory/".concat(e),{method:"DELETE"}),en=e=>O("/memory/candidates/".concat(e,"/approve"),{method:"POST"}),er=e=>O("/memory/candidates/".concat(e,"/reject"),{method:"POST"}),ea=(e,s,t)=>O("/memory/search",{method:"POST",body:JSON.stringify({query:e,limit:s,categories:t})}),ei=()=>O("/memory/ollama/status"),ed=(e,s)=>O("/knowledge/search?q=".concat(encodeURIComponent(e)).concat(s?"&scope=".concat(s):"")),eo=e=>O("/knowledge/sync",{method:"POST",body:JSON.stringify({pluginName:e})}),ec=()=>O("/knowledge/sources"),em=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2?arguments[2]:void 0;return O("/telemetry/runs?limit=".concat(e,"&offset=").concat(s).concat(t?"&source=".concat(t):""))},ex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2?arguments[2]:void 0,l=new URLSearchParams({limit:String(e),offset:String(s)});return t&&l.set("projectRoot",t),O("/telemetry/sessions?".concat(l))},eu=e=>O("/telemetry/sessions/".concat(e)),eh=e=>O("/telemetry/sessions/".concat(e,"/events")),ev=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7;return O("/telemetry/stats?days=".concat(e))},ej=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7;return O("/telemetry/roi-summary?days=".concat(e))},ep=e=>O("/telemetry/cleanup",{method:"POST",body:JSON.stringify({olderThanDays:e})}),ef=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7;return O("/telemetry/tool-metrics/summary?days=".concat(e))},eg=(e,s)=>{let t=new URLSearchParams;e&&t.set("engine",e),s&&t.set("since",String(s));let l=t.toString();return O("/telemetry/accuracy/stats".concat(l?"?".concat(l):""))},ey=e=>{let s=new URLSearchParams;(null==e?void 0:e.engine)&&s.set("engine",e.engine),(null==e?void 0:e.status)&&s.set("status",e.status),(null==e?void 0:e.limit)&&s.set("limit",String(e.limit)),(null==e?void 0:e.offset)&&s.set("offset",String(e.offset));let t=s.toString();return O("/telemetry/accuracy/queries".concat(t?"?".concat(t):""))},eN=e=>O("/telemetry/accuracy/feedback",{method:"POST",body:JSON.stringify(e)}),eb=()=>O("/telemetry/auto-check"),ew=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,s=arguments.length>1?arguments[1]:void 0,t=new URLSearchParams({limit:String(e)});return s&&t.set("skillName",s),O("/telemetry/executions?".concat(t))},ek=e=>O("/telemetry/executions/".concat(e,"/events")),eS=()=>O("/telemetry/mcp-compliance"),eC=()=>O("/benchmark/results"),eR=(e,s)=>O("/registry/plugins".concat(e?"?search=".concat(encodeURIComponent(e)).concat(s?"&tag=".concat(s):""):s?"?tag=".concat(s):"")),eF=e=>O("/registry/plugins/effectiveness".concat(e?"?rootPath=".concat(encodeURIComponent(e)):""));function eT(){return(0,D.a)({queryKey:["workflows"],queryFn:()=>W()})}function eP(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2?arguments[2]:void 0;return(0,D.a)({queryKey:["sessions",e,s,t],queryFn:()=>ex(e,s,t)})}function eq(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7;return(0,D.a)({queryKey:["telemetry-stats",e],queryFn:()=>ev(e)})}function eK(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7;return(0,D.a)({queryKey:["roi-summary",e],queryFn:()=>ej(e)})}let eD={properties:"detail.properties",imports:"detail.imports",history:"detail.history"};function eL(){let{t:e}=(0,P.$G)(),s=x(e=>e.selectedNodeId),t=x(e=>e.detailTab),l=x(e=>e.setDetailTab),{data:n}=(0,D.a)({queryKey:["graph"],queryFn:()=>J()}),a=null==n?void 0:n.nodes.find(e=>e.id===s);return s?(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"flex border-b border-border",children:Object.keys(eD).map(s=>(0,r.jsx)("button",{onClick:()=>l(s),className:j("flex-1 py-2 text-xs font-medium capitalize",t===s?"border-b-2 border-primary text-primary":"text-muted-foreground"),children:e(eD[s])},s))}),(0,r.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:a?(0,r.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[e("detail.name"),":"]})," ",a.name]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[e("detail.type"),":"]})," ",(0,r.jsx)("span",{className:"capitalize",children:a.type})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[e("detail.file"),":"]})," ",(0,r.jsx)("span",{className:"font-mono text-xs",children:a.file})]})]}):(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:e("detail.notFound")})})]}):(0,r.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:e("detail.selectNode")})}let eI=a.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,r.jsx)("div",{ref:s,className:j("rounded-lg border border-border bg-card text-card-foreground",t),...l})});eI.displayName="Card";let eZ=a.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,r.jsx)("div",{ref:s,className:j("flex flex-col space-y-1.5 p-4",t),...l})});eZ.displayName="CardHeader";let eE=a.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,r.jsx)("h3",{ref:s,className:j("text-sm font-semibold leading-none tracking-tight",t),...l})});eE.displayName="CardTitle";let e_=a.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,r.jsx)("div",{ref:s,className:j("p-4 pt-0",t),...l})});function eO(e){let{className:s,...t}=e;return(0,r.jsx)("div",{className:j("animate-pulse rounded-md bg-muted",s),...t})}e_.displayName="CardContent";var eA=t(79419),eM=t(88623),ez=t(10269),eQ=t(3271),eG=t(10977),eU=t(40384),eV=t(90743),e$=t(96631),eH=t(91684),eJ=t(77329);function eB(e){let{icon:s,label:t,value:l}=e;return(0,r.jsx)(eI,{children:(0,r.jsxs)(e_,{className:"p-4 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"text-primary",children:s}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:t}),(0,r.jsx)("div",{className:"font-bold text-lg",children:l})]})]})})}let eW=a.forwardRef((e,s)=>{let{className:t,type:l,...n}=e;return(0,r.jsx)("input",{type:l,className:j("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...n})});eW.displayName="Input";var eX=t(49289);let eY=(0,eX.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),e0=a.forwardRef((e,s)=>{let{className:t,variant:l,size:n,...a}=e;return(0,r.jsx)("button",{className:j(eY({variant:l,size:n,className:t})),ref:s,...a})});e0.displayName="Button";var e2=t(15134);t(23867);var e1=t(86332),e4=t.n(e1),e5=t(26598);let e3={component:"C",hook:"H",api:"A",store:"S",function:"F",class:"CL",interface:"I",enum:"E",type:"T",variable:"V",unknown:"?"},e6={graphNode:function(e){var s,t,l,n,a;let{data:i}=e,d=null!==(n=null!==(l=e3[i.nodeType])&&void 0!==l?l:null===(t=i.nodeType)||void 0===t?void 0:null===(s=t.charAt(0))||void 0===s?void 0:s.toUpperCase())&&void 0!==n?n:"?",o=null!==(a=i.layerColor)&&void 0!==a?a:"#6b7280",c=void 0!==i.highlighted,m=!0===i.highlighted;return(0,r.jsxs)("div",{className:"px-3 py-2 rounded-lg border-2 text-xs font-medium transition-opacity duration-200",style:{borderColor:o,backgroundColor:"color-mix(in srgb, ".concat(o," 8%, var(--background, #fff))"),boxShadow:m?"0 0 12px ".concat(o,", 0 0 4px ").concat(o):"0 1px 3px rgba(0,0,0,0.12)",opacity:c&&!m?.15:1},children:[(0,r.jsx)(e2.HH,{type:"target",position:e5.Ly.Top,style:{background:o}}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded text-[10px] font-bold text-white flex-shrink-0",style:{backgroundColor:o},children:d}),(0,r.jsx)("span",{className:"truncate max-w-[140px]",children:i.label})]}),(0,r.jsx)(e2.HH,{type:"source",position:e5.Ly.Bottom,style:{background:o}})]})}};function e7(e){let{filterMode:s="highlight",searchQuery:t=""}=e;return(0,r.jsx)(e2.tV,{children:(0,r.jsx)(e8,{filterMode:s,searchQuery:t})})}function e8(e){let{filterMode:s,searchQuery:t}=e,{data:l}=(0,D.a)({queryKey:["layered-graph"],queryFn:()=>B()}),n=x(e=>e.selectNode),{fitView:i}=(0,e2._K)(),d=(0,a.useMemo)(()=>{if(!l)return{nodes:[],edges:[]};let e=(null!=t?t:"").toLowerCase().trim(),n="filter"===s&&e?l.nodes.filter(s=>s.name.toLowerCase().includes(e)):l.nodes.slice(0,300),r=e.length>0,a=n.map(s=>{var t,l;return{id:s.id,type:"graphNode",position:{x:0,y:0},data:{label:s.name,nodeType:s.type,layer:null!==(t=s.layer)&&void 0!==t?t:"Other",layerColor:null!==(l=s.layerColor)&&void 0!==l?l:"#6b7280",highlighted:r?s.name.toLowerCase().includes(e):void 0}}}),i=new Set(a.map(e=>e.id));return function(e,s){let t=new(e4()).graphlib.Graph;for(let s of(t.setDefaultEdgeLabel(()=>({})),t.setGraph({rankdir:"TB",ranksep:80,nodesep:60}),e))t.setNode(s.id,{width:180,height:50});for(let e of s)t.setEdge(e.source,e.target);return e4().layout(t),{nodes:e.map(e=>{let s=t.node(e.id);return{...e,position:{x:s.x-90,y:s.y-25}}}),edges:s}}(a,l.edges.filter(e=>i.has(e.from)&&i.has(e.to)).slice(0,500).map((e,s)=>({id:"".concat(e.from,"->").concat(e.to,"-").concat(s),source:e.from,target:e.to,animated:!1,style:{stroke:"#4b5563"}})))},[l,t,s]),[o,c,m]=(0,e2.Rr)(d.nodes),[u,h,v]=(0,e2.ll)(d.edges);(0,a.useEffect)(()=>{c(d.nodes),h(d.edges)},[d,c,h]),(0,a.useEffect)(()=>{if(t){let e=d.nodes.find(e=>!0===e.data.highlighted);e&&setTimeout(()=>{i({nodes:[e],duration:500,maxZoom:1.5})},100)}},[t,d.nodes,i]);let j=(0,a.useCallback)((e,s)=>{n(s.id)},[n]);return(0,r.jsxs)(e2.x$,{nodes:o,edges:u,onNodesChange:m,onEdgesChange:v,onNodeClick:j,nodeTypes:e6,fitView:!0,children:[(0,r.jsx)(e2.Aq,{}),(0,r.jsx)(e2.ZX,{}),(0,r.jsx)(e2.a9,{nodeColor:e=>{var s;let t=null===(s=e.data)||void 0===s?void 0:s.layerColor;return null!=t?t:"#6b7280"}})]})}var e9=t(95731),se=t(38333),ss=t(57124),st=t(36673),sl=t(20054),sn=t(87354),sr=t(5025),sa=t(49767),si=t(6315),sd=t(10997),so=t(57431);let sc=so.fC;so.xz;let sm=so.h_;function sx(e){let{className:s,...t}=e;return(0,r.jsx)(so.aV,{className:"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ".concat(null!=s?s:""),...t})}function su(e){let{className:s,children:t,...l}=e;return(0,r.jsxs)(sm,{children:[(0,r.jsx)(sx,{}),(0,r.jsx)(so.VY,{className:"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg ".concat(null!=s?s:""),...l,children:t})]})}function sh(e){let{className:s,...t}=e;return(0,r.jsx)("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left ".concat(null!=s?s:""),...t})}function sv(e){let{className:s,...t}=e;return(0,r.jsx)(so.Dx,{className:"text-lg font-semibold leading-none tracking-tight ".concat(null!=s?s:""),...t})}so.x8;let sj=["semantic","procedural","episodic","failure_lesson"];function sp(e){var s,t,l;let{open:n,onOpenChange:i,mode:d,defaultValues:o}=e,{t:c}=(0,P.$G)(),m=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>es(e),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}(),x=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>{let{id:s,updates:t}=e;return et(s,t)},onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}(),[u,h]=(0,a.useState)(null!==(s=null==o?void 0:o.category)&&void 0!==s?s:"semantic"),[v,j]=(0,a.useState)(null!==(t=null==o?void 0:o.content)&&void 0!==t?t:""),[p,f]=(0,a.useState)(null!==(l=null==o?void 0:o.scope)&&void 0!==l?l:"");(0,a.useEffect)(()=>{if(n){var e,s,t;h(null!==(e=null==o?void 0:o.category)&&void 0!==e?e:"semantic"),j(null!==(s=null==o?void 0:o.content)&&void 0!==s?s:""),f(null!==(t=null==o?void 0:o.scope)&&void 0!==t?t:"")}},[n,o]);let g=e=>{let s="memory.category.".concat(e),t=c(s);return t===s?e:t};return(0,r.jsx)(sc,{open:n,onOpenChange:i,children:(0,r.jsxs)(su,{children:[(0,r.jsx)(sh,{children:(0,r.jsx)(sv,{children:"add"===d?c("memory.addMemory"):c("memory.editMemory")})}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:c("memory.categoryLabel")}),(0,r.jsx)("select",{className:"w-full mt-1 rounded-md border bg-background px-3 py-2 text-sm",value:u,onChange:e=>h(e.target.value),children:sj.map(e=>(0,r.jsx)("option",{value:e,children:g(e)},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:c("memory.content")}),(0,r.jsx)("textarea",{className:"w-full mt-1 rounded-md border bg-background px-3 py-2 text-sm min-h-[100px]",value:v,onChange:e=>j(e.target.value)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium",children:c("memory.scope")}),(0,r.jsx)("input",{className:"w-full mt-1 rounded-md border bg-background px-3 py-2 text-sm",value:p,onChange:e=>f(e.target.value)})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)(e0,{variant:"outline",onClick:()=>i(!1),children:c("memory.cancel")}),(0,r.jsx)(e0,{onClick:()=>{v.trim()&&("add"===d?m.mutate({category:u,content:v.trim(),scope:p.trim()||void 0}):(null==o?void 0:o.id)&&x.mutate({id:o.id,updates:{category:u,content:v.trim(),scope:p.trim()||void 0}}),i(!1))},disabled:!v.trim(),children:c("memory.save")})]})]})]})})}let sf=["all","failure_lesson","semantic","procedural","episodic"];var sg=t(4343);let sy=sg.fC,sN=a.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,r.jsx)(sg.aV,{ref:s,className:j("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...l})});sN.displayName=sg.aV.displayName;let sb=a.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,r.jsx)(sg.xz,{ref:s,className:j("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...l})});sb.displayName=sg.xz.displayName;let sw=a.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,r.jsx)(sg.VY,{ref:s,className:j("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...l})});sw.displayName=sg.VY.displayName;var sk=t(74497),sS=t(12439);let sC=(0,eX.j)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function sR(e){let{className:s,variant:t,...l}=e;return(0,r.jsx)("div",{className:j(sC({variant:t}),s),...l})}function sF(){let{t:e}=(0,P.$G)(),{data:s=[],isLoading:t,error:l}=(0,D.a)({queryKey:["benchmark-results"],queryFn:()=>eC()});if(t)return(0,r.jsx)("div",{children:e("benchmark.loading")});if(l||0===s.length)return(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:e("benchmark.experimentSummary")})}),(0,r.jsx)(e_,{children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:l?e("benchmark.loadFailed",{error:String(l)}):e("benchmark.noExperimentData")})})]});let n=s.reduce((e,s)=>{var t,l;return e+(null!==(l=null==s?void 0:null===(t=s.comparison)||void 0===t?void 0:t.timeSavedRate)&&void 0!==l?l:0)},0)/s.length,a=s.reduce((e,s)=>{var t,l;return e+(null!==(l=null==s?void 0:null===(t=s.comparison)||void 0===t?void 0:t.tokenReductionRate)&&void 0!==l?l:0)},0)/s.length;return(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:e("benchmark.experimentSummary")})}),(0,r.jsxs)(e_,{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("benchmark.timeSavedRate")}),(0,r.jsxs)("p",{className:"text-2xl font-bold",children:[((null!=n?n:0)*100).toFixed(1),"%"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("benchmark.tokenSavedRate")}),(0,r.jsxs)("p",{className:"text-2xl font-bold",children:[((null!=a?a:0)*100).toFixed(1),"%"]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h4",{className:"font-semibold",children:e("benchmark.detailedResults")}),s.map(s=>{var t,l,n,a,i,d,o,c,m,x,u,h;return(0,r.jsxs)("div",{className:"border rounded p-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("span",{className:"font-medium",children:s.scenarioId}),(0,r.jsx)(sR,{variant:(null!==(o=null==s?void 0:null===(t=s.comparison)||void 0===t?void 0:t.timeSavedRate)&&void 0!==o?o:0)>.3?"default":"secondary",children:e("benchmark.faster",{percent:((null!==(c=null==s?void 0:null===(l=s.comparison)||void 0===l?void 0:l.timeSavedRate)&&void 0!==c?c:0)*100).toFixed(0)})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[e("benchmark.baseline"),": "]}),(0,r.jsxs)("span",{children:[null!==(m=null==s?void 0:null===(n=s.baseline)||void 0===n?void 0:n.tokenCount)&&void 0!==m?m:0," tokens, ",((null!==(x=null==s?void 0:null===(a=s.baseline)||void 0===a?void 0:a.durationMs)&&void 0!==x?x:0)/1e3).toFixed(1),"s"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[e("benchmark.devflow"),": "]}),(0,r.jsxs)("span",{children:[null!==(u=null==s?void 0:null===(i=s.devflow)||void 0===i?void 0:i.tokenCount)&&void 0!==u?u:0," tokens, ",((null!==(h=null==s?void 0:null===(d=s.devflow)||void 0===d?void 0:d.durationMs)&&void 0!==h?h:0)/1e3).toFixed(1),"s"]})]})]})]},s.scenarioId)})]})]})]})}function sT(){var e,s,t;let{t:l}=(0,P.$G)(),{data:n,isLoading:a,error:i}=eK(7);if(a)return(0,r.jsx)("div",{children:l("benchmark.loading")});if(i||!(null==n?void 0:n.overview))return(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:l("benchmark.opsSummary")})}),(0,r.jsx)(e_,{children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:i?l("benchmark.loadFailed",{error:String(i)}):l("benchmark.noOpsData")})})]});let d=n.overview;return(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:l("benchmark.opsSummary")})}),(0,r.jsx)(e_,{className:"space-y-4",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:l("benchmark.totalRunsCount")}),(0,r.jsx)("p",{className:"text-2xl font-bold",children:null!==(e=null==d?void 0:d.totalRuns)&&void 0!==e?e:0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:l("benchmark.successRatePercent")}),(0,r.jsxs)("p",{className:"text-2xl font-bold",children:[(null!==(s=null==d?void 0:d.firstPassSuccessRate)&&void 0!==s?s:0).toFixed(1),"%"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:l("benchmark.avgDurationTime")}),(0,r.jsxs)("p",{className:"text-2xl font-bold",children:[((null!==(t=null==d?void 0:d.avgDuration)&&void 0!==t?t:0)/1e3).toFixed(1),"s"]})]})]})})]})}function sP(){var e;let{t:s}=(0,P.$G)(),{data:t=[],isLoading:l,error:n}=(e=localStorage.getItem("devflow-active-project-root")||void 0,(0,D.a)({queryKey:["plugin-effectiveness",e],queryFn:()=>eF(e)}));if(l)return(0,r.jsx)("div",{children:s("benchmark.loading")});if(n)return(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:s("benchmark.pluginAnalysis")})}),(0,r.jsx)(e_,{children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:s("benchmark.loadFailed",{error:String(n)})})})]});let a=t.filter(e=>"install"===e.recommendation),i=t.filter(e=>"remove"===e.recommendation);return(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:s("benchmark.pluginAnalysis")})}),(0,r.jsxs)(e_,{className:"space-y-6",children:[a.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold mb-2 text-green-600",children:s("benchmark.recommendedInstall")}),(0,r.jsx)("div",{className:"space-y-2",children:a.map(e=>{var t,l,n;return(0,r.jsxs)("div",{className:"border rounded p-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)(sR,{variant:"default",children:s("benchmark.recommended")})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[(0,r.jsxs)("div",{children:[s("benchmark.installCount"),": ",e.installCount]}),(0,r.jsxs)("div",{children:[s("benchmark.usageRate"),": ",((null!==(t=null==e?void 0:e.activeRate)&&void 0!==t?t:0)*100).toFixed(0),"%"]}),(0,r.jsxs)("div",{children:[s("benchmark.successRateShort"),": ",((null!==(l=null==e?void 0:e.successRate)&&void 0!==l?l:0)*100).toFixed(0),"%"]}),(0,r.jsxs)("div",{children:[s("benchmark.tokenImpact"),": ",(null!==(n=null==e?void 0:e.avgTokenImpact)&&void 0!==n?n:0).toFixed(0)]})]}),e.lastUsedAt&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s("benchmark.lastUsed"),": ",new Date(e.lastUsedAt).toLocaleDateString()]})]},e.name)})})]}),i.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold mb-2 text-red-600",children:s("benchmark.suggestedRemove")}),(0,r.jsx)("div",{className:"space-y-2",children:i.map(e=>{var t,l;return(0,r.jsxs)("div",{className:"border rounded p-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)(sR,{variant:"destructive",children:s("benchmark.lowEfficiency")})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[(0,r.jsxs)("div",{children:[s("benchmark.installCount"),": ",e.installCount]}),(0,r.jsxs)("div",{children:[s("benchmark.usageRate"),": ",((null!==(t=null==e?void 0:e.activeRate)&&void 0!==t?t:0)*100).toFixed(0),"%"]}),(0,r.jsxs)("div",{children:[s("benchmark.successRateShort"),": ",((null!==(l=null==e?void 0:e.successRate)&&void 0!==l?l:0)*100).toFixed(0),"%"]})]})]},e.name)})})]}),0===t.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:s("benchmark.noPluginData")})]})]})}let sq=[7,14,30];function sK(e){let{label:s,value:t}=e;return(0,r.jsxs)("div",{className:"p-3 rounded-md bg-secondary/50",children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:s}),(0,r.jsx)("div",{className:"text-lg font-bold",children:t})]})}function sD(e){let{steps:s,events:t}=e,{t:l}=(0,P.$G)();return(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground mb-2",children:l("events.steps")}),s.map(e=>{let s=t.filter(s=>s.stepId===e),n=s.reduce((e,s)=>{var t;return e+(null!==(t=s.duration)&&void 0!==t?t:0)},0);return(0,r.jsxs)("div",{className:"text-xs py-1 px-2 rounded hover:bg-accent cursor-pointer",children:[(0,r.jsx)("div",{className:"font-medium truncate",children:e}),(0,r.jsxs)("div",{className:"text-muted-foreground",children:[s.length," ",l("events.eventCount")," \xb7 ",n,"ms"]})]},e)})]})}let sL={llm_call:"text-blue-500",tool_use:"text-green-500",memory_read:"text-pink-500",memory_write:"text-pink-500",file_read:"text-gray-500",file_write:"text-yellow-500",bash_command:"text-purple-500",subagent:"text-orange-500",skill_invoke:"text-cyan-500",mcp_tool_call:"text-indigo-500",error:"text-red-500",user_input:"text-orange-500",step_start:"text-cyan-500",step_end:"text-cyan-500"},sI={llm_call:"events.llmCall",tool_use:"events.toolUse",memory_read:"events.memoryRead",memory_write:"events.memoryWrite",file_read:"events.fileRead",file_write:"events.fileWrite",bash_command:"events.bashCommand",subagent:"events.subagent",skill_invoke:"events.skillInvoke",mcp_tool_call:"events.mcpToolCall",error:"events.error",user_input:"events.userInput",step_start:"events.stepStart",step_end:"events.stepEnd"};function sZ(e){let{events:s,onSelect:t,selectedId:l}=e,{t:n}=(0,P.$G)(),a=[...s].sort((e,s)=>e.timestamp-s.timestamp);if(0===a.length)return(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:n("events.empty")});let i="";return(0,r.jsx)("div",{className:"space-y-0",children:a.map(e=>{var s,a,d,o,c,m,x,u;let h=e.stepId!==i;i=e.stepId;let v=null!==(u=sL[e.kind])&&void 0!==u?u:"text-muted-foreground",j=sI[e.kind],p=j?n(j):e.kind,f=(null===(s=e.data)||void 0===s?void 0:s.toolName)||(null===(a=e.data)||void 0===a?void 0:a.filePath)||(null===(d=e.data)||void 0===d?void 0:d.model)||(null===(o=e.data)||void 0===o?void 0:o.command)||(null===(c=e.data)||void 0===c?void 0:c.memoryKey)||"";return(0,r.jsxs)("div",{children:[h&&(0,r.jsx)("div",{className:"text-xs font-semibold text-muted-foreground pt-2 pb-1 border-t border-border mt-1",children:e.stepId}),(0,r.jsxs)("div",{onClick:()=>t(e),className:"flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer text-xs hover:bg-accent ".concat(l===e.id?"bg-accent":""," ").concat((null===(m=e.metadata)||void 0===m?void 0:m.blocked)?"border-l-2 border-red-500 bg-red-50 dark:bg-red-950":""),children:[(null===(x=e.metadata)||void 0===x?void 0:x.blocked)&&(0,r.jsx)("span",{className:"text-red-500 font-bold text-[10px] uppercase tracking-wider",children:"BLOCKED"}),(0,r.jsx)("span",{className:"w-16 ".concat(v," font-medium"),children:p}),(0,r.jsx)("span",{className:"text-muted-foreground truncate flex-1",children:f}),e.duration?(0,r.jsxs)("span",{className:"text-muted-foreground",children:[e.duration,"ms"]}):null]})]},e.id)})})}function sE(e){let{event:s}=e,[t,l]=(0,a.useState)(!1),n=s.input?JSON.stringify(s.input,null,2):"null",i=s.output?JSON.stringify(s.output,null,2):"null";return(0,r.jsxs)("div",{className:"space-y-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold text-lg",children:s.mcpToolName||s.toolName}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s.toolType," \xb7 ",s.kind," \xb7 ",s.duration,"ms",s.blocked&&(0,r.jsx)("span",{className:"text-red-500 ml-2 font-bold",children:"BLOCKED"})]})]}),(0,r.jsx)("button",{onClick:()=>l(!t),className:"text-xs border rounded px-2 py-1 hover:bg-accent",children:t?"Formatted":"Raw JSON"})]}),s.error&&(0,r.jsx)("div",{className:"p-3 bg-red-50 dark:bg-red-950 border border-red-300 rounded text-sm text-red-700",children:s.error}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,r.jsxs)(eI,{className:"p-3",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase",children:"Input"}),(0,r.jsx)("pre",{className:"text-xs overflow-auto max-h-96 ".concat(t?"":"max-h-40 overflow-hidden"),children:(0,r.jsx)("code",{children:t?n:n.slice(0,500)+(n.length>500?"\n... (truncated)":"")})})]}),(0,r.jsxs)(eI,{className:"p-3",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase",children:"Output"}),null==s.output?(0,r.jsx)("p",{className:"text-xs text-yellow-600",children:"No output captured for this event"}):(0,r.jsx)("pre",{className:"text-xs overflow-auto max-h-96 ".concat(t?"":"max-h-40 overflow-hidden"),children:(0,r.jsx)("code",{children:t?i:i.slice(0,500)+(i.length>500?"\n... (truncated)":"")})})]})]})]})}function s_(e){var s,t;let{event:l}=e,{t:n}=(0,P.$G)();if(!l)return(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:n("events.selectEvent")});if("tool_use"===l.kind&&(l.toolName||l.mcpToolName))return(0,r.jsx)(sE,{event:l});let a=null!==(t=l.data)&&void 0!==t?t:{};return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:n("events.eventDetail")}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.kind")}),(0,r.jsx)("div",{className:"text-sm font-medium",children:l.kind})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.step")}),(0,r.jsx)("div",{className:"text-sm font-mono",children:l.stepId})]}),null!=l.duration&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.duration")}),(0,r.jsxs)("div",{className:"text-sm",children:[l.duration,"ms"]})]}),null!=a.inputTokens&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.tokens")}),(0,r.jsx)("div",{className:"text-sm",children:n("events.tokensInOut",{input:a.inputTokens,output:a.outputTokens})})]}),null!=a.prompt&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.prompt")}),(0,r.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded mt-1 max-h-40 overflow-y-auto whitespace-pre-wrap",children:a.prompt})]}),null!=a.response&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.response")}),(0,r.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded mt-1 max-h-40 overflow-y-auto whitespace-pre-wrap",children:a.response})]}),null!=a.stdout&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.stdout")}),(0,r.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded mt-1 max-h-40 overflow-y-auto whitespace-pre-wrap",children:a.stdout})]}),null!=a.stderr&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.stderr")}),(0,r.jsx)("pre",{className:"text-xs bg-red-50 dark:bg-red-950 p-2 rounded mt-1 max-h-40 overflow-y-auto whitespace-pre-wrap",children:a.stderr})]}),null!=a.errorMessage&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:n("events.error")}),(0,r.jsx)("pre",{className:"text-xs bg-red-50 dark:bg-red-950 p-2 rounded mt-1 max-h-40 overflow-y-auto whitespace-pre-wrap",children:a.errorMessage})]}),(null===(s=l.metadata)||void 0===s?void 0:s.truncated)!=null&&(0,r.jsx)("div",{className:"text-xs text-yellow-500",children:n("events.truncated")})]})]})}var sO=t(61883);function sA(e){let{runId:s,onBack:t}=e,{t:l}=(0,P.$G)(),{data:n}=(0,D.a)({queryKey:["session-events",s],queryFn:()=>eh(s),enabled:!!s}),{data:i}=(0,D.a)({queryKey:["session",s],queryFn:()=>eu(s),enabled:!!s}),[d,o]=(0,a.useState)(null),c=(null!=n?n:[]).map(e=>{var s,t,l,n,r,a,i;let d=null!==(t=null!==(s=e.eventId)&&void 0!==s?s:e.id)&&void 0!==t?t:"",o=(null!==(l=e.kind)&&void 0!==l?l:e.toolType)||"tool_use",c={toolName:null!==(n=e.toolName)&&void 0!==n?n:e.mcpToolName,...null!==(r=e.input)&&void 0!==r?r:{}};return{id:d,stepId:null!==(a=e.executionId)&&void 0!==a?a:d,kind:o,timestamp:null!==(i=e.timestamp)&&void 0!==i?i:0,duration:e.duration,data:c,metadata:{isMcpTool:e.isMcpTool,mcpEnforced:e.mcpEnforced,mcpFallback:e.mcpFallback,blocked:e.blocked,blockReason:e.blockReason}}}),m=[...new Set(c.map(e=>e.stepId))],x=null!=i?i:{};return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b border-border",children:[(0,r.jsx)("button",{onClick:t,className:"p-1 rounded hover:bg-accent",children:(0,r.jsx)(sO.Z,{className:"h-4 w-4"})}),(0,r.jsx)("h2",{className:"text-lg font-bold",children:l("runDetail.title","Session Detail")}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground font-mono",children:s}),null!=x.totalToolCalls&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[String(x.totalToolCalls)," tools \xb7 ",String(x.mcpToolCalls)," MCP"]})]}),(0,r.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,r.jsx)("div",{className:"w-48 border-r border-border overflow-y-auto p-3",children:(0,r.jsx)(sD,{steps:m,events:c})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:(0,r.jsx)(sZ,{events:c,onSelect:e=>o(e),selectedId:null==d?void 0:d.id})}),(0,r.jsx)("div",{className:"w-80 border-l border-border overflow-y-auto p-3",children:(0,r.jsx)(s_,{event:d})})]})]})}let sM={active:"text-yellow-500",closed:"text-green-500"},sz={cli:"#3b82f6",mcp:"#22c55e",dashboard:"#a855f7"};function sQ(e){let{runs:s,date:t}=e,l=new Date(t+"T00:00:00Z").getTime(),n=Math.max(28*s.length+40,120),a=[0,4,8,12,16,20,24].map(e=>({hour:e,x:40+e/24*720,label:"".concat(String(e).padStart(2,"0"),":00")}));return(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("svg",{viewBox:"0 0 ".concat(800," ").concat(n),className:"w-full",children:[a.map(e=>(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:e.x,y1:0,x2:e.x,y2:n,stroke:"#e5e7eb",strokeWidth:.5}),(0,r.jsx)("text",{x:e.x,y:12,textAnchor:"middle",fontSize:"9",fill:"#9ca3af",children:e.label})]},e.hour)),s.map((e,s)=>{var t;let n=40+(e.startedAt-l)/864e5*720,a=Math.max(40,e.tokenUsed/500),i=40+28*s,d=null!==(t=sz[e.source])&&void 0!==t?t:"#6b7280",o="completed"===e.status?.9:"failed"===e.status?.6:.4;return(0,r.jsxs)("g",{children:[(0,r.jsx)("rect",{x:n,y:i,width:a,height:20,rx:3,fill:d,opacity:o}),(0,r.jsx)("text",{x:n+a+4,y:i+13,fontSize:"10",fill:"#6b7280",children:new Date(e.startedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),a>60&&(0,r.jsxs)("text",{x:n+4,y:i+13,fontSize:"9",fill:"white",fontWeight:"500",children:[e.agent," \xb7 ",e.source]})]},e.id)})]})})}var sG=t(58410),sU=t(2966),sV=t(97066),s$=t(53512);function sH(e){let{rate:s}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-20 h-2 bg-muted rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full ".concat(s>=80?"bg-green-500":s>=50?"bg-yellow-500":"bg-red-500"," rounded-full"),style:{width:"".concat(s,"%")}})}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[s.toFixed(1),"%"]})]})}let sJ={overview:function(){var e;let{t:s}=(0,P.$G)(),{data:t}=(0,D.a)({queryKey:["active-project"],queryFn:()=>Q()}),l=x(e=>e.projectRoot),n=x(e=>e.setProjectRoot),i=x(e=>e.activeProjectRoot),d=x(e=>e.setActiveProjectRoot),[o,c]=(0,a.useState)(""),[m,u]=(0,a.useState)(""),[h,v]=(0,a.useState)(!1),j=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>M(e),onSuccess:()=>e.invalidateQueries({queryKey:["active-project"]})})}(),p=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:()=>z(),onSuccess:()=>e.invalidateQueries({queryKey:["active-project"]})})}();(0,a.useEffect)(()=>{(null==t?void 0:t.rootPath)&&t.rootPath!==i&&(n(t.rootPath),d(t.rootPath))},[t,n,d,i]);let[f,g]=(0,a.useState)(!1);(0,a.useEffect)(()=>{f||(null==t?void 0:t.rootPath)||!i||j.isPending||(g(!0),j.mutate(i))},[null==t?void 0:t.rootPath,i,j.isPending,f]);let{data:y}=(0,D.a)({queryKey:["projects"],queryFn:()=>A()}),{data:N}=(0,D.a)({queryKey:["context-status"],queryFn:()=>U()}),{data:b}=eT(),{data:w}=eP(10,0),{data:k,isLoading:S}=(0,D.a)({queryKey:["onboarding-pack",i],queryFn:()=>G(i),enabled:!!i}),C=null==y?void 0:y.find(e=>e.rootPath===i),R=()=>{if((null==C?void 0:C.stack)&&C.stack.length>0)return C.stack;if(null==k?void 0:k.stack){let e=[...k.stack.languages,...k.stack.frameworks,...k.stack.buildTools,...k.stack.testTools];if(e.length>0)return e}return[]},F=()=>{o.trim()&&j.mutate(o.trim(),{onSuccess:e=>{n(e.rootPath),d(e.rootPath)}})},T=()=>{m.trim()&&j.mutate(m.trim(),{onSuccess:e=>{n(e.rootPath),d(e.rootPath),v(!1),u("")}})};return l?(0,r.jsxs)("div",{className:"p-6 space-y-6 overflow-y-auto h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:s("overview.title")}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground bg-secondary px-2 py-1 rounded font-mono",children:l}),(0,r.jsx)("button",{onClick:()=>v(!h),className:"p-1 rounded hover:bg-secondary text-muted-foreground",title:s("overview.switchProject"),children:(0,r.jsx)(eM.Z,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:()=>{p.mutate(void 0,{onSuccess:()=>{n(null),d(null)}})},className:"p-1 rounded hover:bg-secondary text-muted-foreground",title:s("overview.disconnectProject"),children:(0,r.jsx)(ez.Z,{className:"h-4 w-4"})})]})]}),h&&(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 rounded-lg border bg-card",children:[(0,r.jsx)("input",{type:"text",value:m,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&T(),"Escape"===e.key&&(v(!1),u(""))},placeholder:s("overview.switchProjectPlaceholder"),className:"flex-1 px-3 py-1.5 rounded-md border border-border bg-background text-sm"}),(0,r.jsx)("button",{onClick:T,disabled:j.isPending||!m.trim(),className:"px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",children:j.isPending?s("overview.connecting"):s("overview.switchProjectConfirm")})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsx)(eB,{icon:(0,r.jsx)(eQ.Z,{className:"h-5 w-5"}),label:s("overview.project"),value:(null==C?void 0:C.name)?C.name:(null==k?void 0:k.projectName)?k.projectName:i&&null!==(e=i.split("/").pop())&&void 0!==e?e:"Unknown Project"}),(0,r.jsx)(eB,{icon:(0,r.jsx)(eG.Z,{className:"h-5 w-5"}),label:s("overview.filesIndexed"),value:N?String(N.totalFiles):"--"}),(0,r.jsx)(eB,{icon:(0,r.jsx)(eU.Z,{className:"h-5 w-5"}),label:s("overview.workflows"),value:b?String(b.length):"--"}),(0,r.jsx)(eB,{icon:(0,r.jsx)(eV.Z,{className:"h-5 w-5"}),label:s("overview.agentRuns"),value:w?String(w.length):"--"})]}),R().length>0&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:s("overview.techStack")})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:R().map(e=>(0,r.jsx)("span",{className:"px-2 py-1 rounded-md bg-secondary text-secondary-foreground text-xs",children:e},e))})})]}),S?(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(e$.Z,{className:"h-4 w-4"}),s("onboarding.title")]})}),(0,r.jsx)(e_,{children:(0,r.jsx)(eO,{className:"h-32 w-full"})})]}):k?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(e$.Z,{className:"h-4 w-4"}),s("overview.architectureLayers")]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-2",children:k.architectureLayers.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground bg-secondary px-2 py-0.5 rounded",children:s("overview.filesCount",{count:e.files})})]},e.name))})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(eH.Z,{className:"h-4 w-4"}),s("overview.keyModules")]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-2",children:k.keyModules.slice(0,6).map(e=>(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-sm font-mono text-primary",children:e.name}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:e.reason})]},e.name))})})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(eG.Z,{className:"h-4 w-4"}),s("overview.keyFiles")]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-2",children:k.keyFiles.slice(0,6).map(e=>(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-sm font-mono truncate",children:e.path}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:e.reason})]},e.path))})})]})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(eJ.Z,{className:"h-4 w-4"}),s("overview.recommended")]})}),(0,r.jsx)(e_,{children:(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase",children:s("overview.plugins")}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:k.recommendedPlugins.map(e=>(0,r.jsx)("span",{className:"px-2 py-0.5 rounded bg-green-100 text-green-800 text-xs",children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase",children:s("overview.workflows")}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:k.recommendedWorkflows.map(e=>(0,r.jsx)("span",{className:"px-2 py-0.5 rounded bg-blue-100 text-blue-800 text-xs",children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase",children:s("overview.queries")}),(0,r.jsx)("div",{className:"space-y-1",children:k.recommendedQueries.slice(0,3).map(e=>(0,r.jsxs)("div",{className:"text-xs text-muted-foreground",children:['"',e,'"']},e))})]})]})})]})]}):(0,r.jsx)(eI,{children:(0,r.jsx)(e_,{className:"py-8 text-center text-muted-foreground",children:s("onboarding.empty")})}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:s("overview.recentRuns")})}),(0,r.jsx)(e_,{children:w&&w.length>0?(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-left text-muted-foreground",children:[(0,r.jsx)("th",{children:s("overview.label")}),(0,r.jsx)("th",{children:s("overview.status")}),(0,r.jsx)("th",{children:s("overview.toolCalls")}),(0,r.jsx)("th",{children:s("overview.duration")})]})}),(0,r.jsx)("tbody",{children:w.slice(0,5).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border",children:[(0,r.jsx)("td",{className:"py-1",children:e.label||e.projectRoot}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs ".concat("closed"===e.status?"bg-green-100 text-green-700":"bg-yellow-100 text-yellow-700"),children:e.status})}),(0,r.jsxs)("td",{children:[e.totalToolCalls," (",e.mcpToolCalls," MCP)"]}),(0,r.jsx)("td",{children:e.durationMs>0?"".concat((e.durationMs/1e3).toFixed(1),"s"):"--"})]},e.id))})]}):(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:s("overview.noRuns")})})]})]}):(0,r.jsx)("div",{className:"p-6 flex items-center justify-center h-full",children:(0,r.jsxs)(eI,{className:"w-full max-w-md",children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(eA.Z,{className:"h-5 w-5"}),s("overview.connectTitle")]})}),(0,r.jsxs)(e_,{className:"space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:s("overview.connectDescription")}),(0,r.jsx)("input",{type:"text",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&F(),placeholder:s("overview.connectPlaceholder"),className:"w-full px-3 py-2 rounded-md border border-border bg-background text-sm"}),(0,r.jsx)("button",{onClick:F,disabled:j.isPending||!o.trim(),className:"w-full px-4 py-2 rounded-md bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50",children:j.isPending?s("overview.connecting"):s("overview.connect")}),j.isError&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:s("overview.connectError")})]})]})})},graph:function(){let{t:e}=(0,P.$G)(),s=x(e=>e.searchQuery),t=x(e=>e.setSearchQuery),[l,n]=(0,a.useState)("highlight");return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"p-3 border-b border-border flex items-center gap-2",children:[(0,r.jsxs)("div",{className:"relative flex-1 max-w-sm",children:[(0,r.jsx)(e9.Z,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,r.jsx)(eW,{placeholder:e("graph.searchPlaceholder"),value:s,onChange:e=>t(e.target.value),className:"pl-8"})]}),s&&(0,r.jsx)(e0,{variant:"ghost",size:"sm",onClick:()=>n(e=>"highlight"===e?"filter":"highlight"),title:e("highlight"===l?"graph.filterOnly":"graph.highlightAll"),className:"flex-shrink-0",children:"highlight"===l?(0,r.jsx)(se.Z,{className:"h-4 w-4"}):(0,r.jsx)(ss.Z,{className:"h-4 w-4"})})]}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(e7,{filterMode:l,searchQuery:s})})]})},context:function(){let{t:e}=(0,P.$G)(),[s,t]=(0,a.useState)(""),[l,n]=(0,a.useState)(!1),[i,d]=(0,a.useState)({}),o=x(e=>e.activeProjectRoot),c=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>V(e),onSuccess:s=>e.setQueryData(["context-result"],s)})}(),m=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>$(e),onSuccess:s=>e.setQueryData(["task-context-result"],s)})}(),{data:u}=(0,D.a)({queryKey:["context-result"],queryFn:()=>Promise.reject(Error("No queryFn — this query is never enabled")),enabled:!1}),{data:h}=(0,D.a)({queryKey:["task-context-result"],queryFn:()=>Promise.reject(Error("No queryFn — this query is never enabled")),enabled:!1}),v=(0,I.D)({mutationFn:e=>H(e)}),j=l?h:u,p=l?m.isPending:c.isPending,f=()=>{s.trim()&&(d({}),l?m.mutate({query:s,mode:"fast"}):c.mutate({query:s,mode:"fast"}))},g=e=>{s.trim()&&(d({[s]:e}),v.mutate({query:s,feedback:e,projectRoot:null!=o?o:void 0,taskType:l&&h?h.taskType:void 0,contextMode:l?"task":"general",tokenCount:null==j?void 0:j.tokenCount}))};return(0,r.jsxs)("div",{className:"p-6 space-y-4 h-full overflow-y-auto",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:e("context.title")}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)("input",{type:"checkbox",checked:l,onChange:e=>n(e.target.checked),className:"rounded"}),e("context.taskMode")]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(eW,{placeholder:e("context.placeholder"),value:s,onChange:e=>t(e.target.value),onKeyDown:e=>"Enter"===e.key&&f()}),(0,r.jsxs)(e0,{onClick:f,disabled:p,children:[(0,r.jsx)(e9.Z,{className:"h-4 w-4 mr-1"})," ",e("context.build")]})]}),p&&(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:e("context.building")}),j&&(0,r.jsxs)(r.Fragment,{children:[!l&&u&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:e("context.results",{files:u.files.length,tokens:u.tokenCount})})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-3",children:u.files.map((e,s)=>(0,r.jsxs)("div",{className:"p-3 rounded-md bg-secondary/50",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground font-mono",children:e.path}),(0,r.jsx)("pre",{className:"text-xs mt-1 overflow-x-auto whitespace-pre-wrap",children:e.snippet})]},s))})})]}),l&&h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eI,{children:(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{children:[e("context.taskContext"),": ",h.taskType]}),(0,r.jsx)("span",{className:"text-sm font-normal text-muted-foreground",children:e("context.confidenceTokens",{confidence:(100*h.confidence).toFixed(0),tokens:h.tokenCount})})]})})}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(st.Z,{className:"h-4 w-4"}),e("context.requiredFiles")," (",h.requiredFiles.files.length,")"]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-1",children:h.requiredFiles.files.map(e=>(0,r.jsxs)("div",{className:"text-sm font-mono text-green-700 dark:text-green-400",children:["● ",e]},e))})})]}),h.optionalFiles.files.length>0&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(st.Z,{className:"h-4 w-4"}),e("context.optionalFiles")," (",h.optionalFiles.files.length,")"]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-1",children:h.optionalFiles.files.map(e=>(0,r.jsxs)("div",{className:"text-sm font-mono text-muted-foreground",children:["○ ",e]},e))})})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{children:[e("context.keySymbols")," (",h.keySymbols.length,")"]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-2",children:h.keySymbols.slice(0,10).map(s=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded ".concat("direct"===s.relevance?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"),children:"direct"===s.relevance?e("context.relevanceDirect"):e("context.relevanceIndirect")}),(0,r.jsx)("span",{className:"text-sm font-medium",children:s.name}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",s.kind,")"]}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground font-mono ml-auto",children:s.file})]},"".concat(s.file,":").concat(s.name)))})})]}),h.riskHints.length>0&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(sl.Z,{className:"h-4 w-4"}),e("context.riskHints")," (",h.riskHints.length,")"]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-2",children:h.riskHints.map((s,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:"mt-0.5 px-1.5 py-0.5 rounded text-xs font-medium ".concat("high"===s.level?"bg-red-100 text-red-700":"medium"===s.level?"bg-yellow-100 text-yellow-700":"bg-gray-100 text-gray-600"),children:"high"===s.level?e("context.levelHigh"):"medium"===s.level?e("context.levelMedium"):e("context.levelLow")}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:s.category}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:s.description})]})]},t))})})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(eJ.Z,{className:"h-4 w-4"}),e("context.nextActions")]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-2",children:h.nextActions.map((e,s)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 text-xs",children:e.kind}),(0,r.jsx)("span",{children:e.label}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground font-mono",children:e.payload})]},s))})})]})]}),j&&(0,r.jsx)(eI,{children:(0,r.jsx)(e_,{className:"p-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-sm text-muted-foreground mr-2",children:e("context.wasHelpful")}),(0,r.jsxs)(e0,{size:"sm",variant:"hit"===i[s]?"default":"outline",onClick:()=>g("hit"),disabled:v.isPending,children:[(0,r.jsx)(sn.Z,{className:"h-3 w-3 mr-1"})," ",e("context.hit")]}),(0,r.jsxs)(e0,{size:"sm",variant:"partial"===i[s]?"default":"outline",onClick:()=>g("partial"),disabled:v.isPending,children:[(0,r.jsx)(sr.Z,{className:"h-3 w-3 mr-1"})," ",e("context.partial")]}),(0,r.jsxs)(e0,{size:"sm",variant:"miss"===i[s]?"default":"outline",onClick:()=>g("miss"),disabled:v.isPending,children:[(0,r.jsx)(ez.Z,{className:"h-3 w-3 mr-1"})," ",e("context.miss")]}),v.isSuccess&&(0,r.jsx)("span",{className:"text-xs text-green-600 ml-2",children:e("context.thanks")})]})})})]})]})},workflows:function(){let{t:e}=(0,P.$G)(),{data:s}=eT(),{data:t}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,D.a)({queryKey:["workflow-runs",e,s],queryFn:()=>Y(e,s)})}(),l=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>{let{type:s,input:t}=e;return X(s,t)},onSuccess:()=>e.invalidateQueries({queryKey:["workflow-runs"]})})}(),[n,i]=(0,a.useState)(null),{events:d,clear:o}=function(e){let[s,t]=(0,a.useState)([]),l=(0,a.useRef)(null);return(0,a.useEffect)(()=>{var s;if(!e)return;let n=new EventSource("".concat(null!==(s=sa.env.NEXT_PUBLIC_DEVFLOW_API_URL)&&void 0!==s?s:"http://localhost:13337","/api/workflows/runs/").concat(e,"/stream"));l.current=n;let r=e=>{try{t(s=>[...s,{type:e.type,data:JSON.parse(e.data)}])}catch(e){}};return n.addEventListener("step-started",r),n.addEventListener("step-completed",r),n.addEventListener("step-failed",r),n.addEventListener("error",()=>n.close()),()=>n.close()},[e]),{events:s,clear:(0,a.useCallback)(()=>t([]),[])}}(n);return(0,r.jsxs)("div",{className:"p-6 space-y-4 h-full overflow-y-auto",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:e("workflows.title")}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:e("workflows.available")})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:(null!=s?s:[]).map(s=>(0,r.jsxs)(e0,{variant:"outline",size:"sm",onClick:()=>l.mutate({type:s.name},{onSuccess:e=>i(e.runId)}),children:[s.name," (",s.stepCount," ",e("workflows.steps"),")"]},s.name))})})]}),n&&d.length>0&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{children:[e("workflows.stream"),": ",n]})}),(0,r.jsxs)(e_,{children:[(0,r.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto font-mono text-xs",children:d.map((e,s)=>(0,r.jsxs)("div",{className:"text-muted-foreground",children:["[",e.type,"] ",JSON.stringify(e.data)]},s))}),(0,r.jsx)(e0,{variant:"ghost",size:"sm",onClick:()=>{i(null),o()},className:"mt-2",children:e("workflows.closeStream")})]})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:e("workflows.runHistory")})}),(0,r.jsx)(e_,{children:t&&t.length>0?(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-left text-muted-foreground",children:[(0,r.jsx)("th",{children:e("workflows.runId")}),(0,r.jsx)("th",{children:e("overview.status")}),(0,r.jsx)("th",{children:e("workflows.started")})]})}),(0,r.jsx)("tbody",{children:t.slice(0,10).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border",children:[(0,r.jsx)("td",{className:"py-1 font-mono text-xs",children:e.runId}),(0,r.jsx)("td",{children:e.status}),(0,r.jsx)("td",{children:new Date(e.startedAt).toLocaleTimeString()})]},e.runId))})]}):(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:e("workflows.noRuns")})})]})]})},memory:function(){var e,s,t,l,n,i;let{t:d}=(0,P.$G)(),{data:o}=(0,D.a)({queryKey:["memory"],queryFn:()=>ee()}),{data:c}=(0,D.a)({queryKey:["ollama-status"],queryFn:()=>ei(),refetchInterval:3e4}),m=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>en(e),onSuccess:()=>{e.invalidateQueries({queryKey:["memory"]}),e.invalidateQueries({queryKey:["memory-candidates"]})}})}(),x=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>er(e),onSuccess:()=>{e.invalidateQueries({queryKey:["memory"]}),e.invalidateQueries({queryKey:["memory-candidates"]})}})}(),u=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>el(e),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}(),h=function(){let{t:e}=(0,P.$G)();return s=>{let t="memory.category.".concat(s),l=e(t);return l===t?s:l}}(),[v,j]=(0,a.useState)(""),{data:p}=(0,D.a)({queryKey:["memory-search",v,void 0],queryFn:()=>ea(v,null==i?void 0:i.limit,null==i?void 0:i.categories),enabled:v.length>0}),[f,g]=(0,a.useState)(!1),[y,N]=(0,a.useState)(),[b,w]=(0,a.useState)("all"),k=null!==(t=null==o?void 0:null===(e=o.memories)||void 0===e?void 0:e.filter(e=>"approved"===e.status))&&void 0!==t?t:[],S=null!==(l=null==o?void 0:null===(s=o.memories)||void 0===s?void 0:s.filter(e=>"pending"===e.status))&&void 0!==l?l:[],C="all"===b?k:k.filter(e=>e.category===b),R="all"===b?S:S.filter(e=>e.category===b),F=(0,a.useMemo)(()=>{let e=new Map;for(let t of R){var s;let l=null!==(s=e.get(t.category))&&void 0!==s?s:[];l.push(t),e.set(t.category,l)}return[...e.entries()].sort((e,s)=>{let[t]=e,[l]=s;return"failure_lesson"===t?-1:"failure_lesson"===l?1:t.localeCompare(l)})},[R]),T=v&&p?p:C,q=e=>{var s;N({id:e.id,category:e.category,content:e.content,scope:null!==(s=e.scope)&&void 0!==s?s:""}),g(!0)},K=e=>{window.confirm(d("memory.deleteConfirm"))&&u.mutate(e.id)};return o?(0,r.jsxs)("div",{className:"p-6 space-y-4 h-full overflow-y-auto",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:d("memory.title")}),(0,r.jsxs)(e0,{size:"sm",onClick:()=>{N(void 0),g(!0)},children:["+ ",d("memory.addMemory")]})]}),(0,r.jsx)("div",{className:"relative",children:(0,r.jsx)(eW,{placeholder:d("memory.searchPlaceholder"),value:v,onChange:e=>j(e.target.value)})}),!v&&(0,r.jsx)("div",{className:"flex gap-2 flex-wrap",children:sf.map(e=>(0,r.jsx)(e0,{variant:b===e?"default":"outline",size:"sm",onClick:()=>w(e),children:"all"===e?d("memory.allCategories","All"):h(e)},e))}),c&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:d("memory.ollamaStatus")})}),(0,r.jsx)(e_,{children:(0,r.jsxs)("div",{className:"text-sm space-y-1",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{children:[d("memory.installed"),":"]}),(0,r.jsx)("span",{className:c.installed?"text-green-500":"text-red-500",children:c.installed?d("memory.yes"):d("memory.no")})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{children:[d("memory.running"),":"]}),(0,r.jsx)("span",{className:c.running?"text-green-500":"text-red-500",children:c.running?d("memory.yes"):d("memory.no")})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{children:[d("memory.model")," (",c.modelName,"):"]}),(0,r.jsx)("span",{className:c.modelAvailable?"text-green-500":"text-yellow-500",children:c.modelAvailable?d("memory.available"):d("memory.notPulled")})]}),c.infoMessage&&(0,r.jsx)("p",{className:"text-yellow-500 text-xs mt-2",children:c.infoMessage})]})})]}),!v&&R.length>0&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{children:[d("memory.pendingApproval")," (",R.length,")"]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-4",children:F.map(e=>{let[s,t]=e;return(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase mb-2",children:h(s)}),(0,r.jsx)("div",{className:"space-y-2",children:t.map(e=>(0,r.jsxs)("div",{className:"flex items-start justify-between p-2 rounded bg-secondary/50",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:e.content}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[d("memory.confidence"),": ",e.confidence]})]}),(0,r.jsxs)("div",{className:"flex gap-1 ml-2",children:[(0,r.jsx)(e0,{size:"sm",variant:"outline",onClick:()=>m.mutate(e.id),children:d("memory.approve")}),(0,r.jsx)(e0,{size:"sm",variant:"ghost",onClick:()=>x.mutate(e.id),children:d("memory.reject")})]})]},e.id))})]},s)})})})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{children:v?"".concat(null!==(n=null==p?void 0:p.length)&&void 0!==n?n:0," results"):"".concat(d("memory.approvedMemories")," (").concat(C.length,")")})}),(0,r.jsx)(e_,{children:0===T.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 border border-dashed border-border rounded-lg text-center",children:[(0,r.jsx)("p",{className:"text-muted-foreground text-sm font-medium",children:d("memory.noMemories")}),(0,r.jsx)("p",{className:"text-muted-foreground text-xs mt-1",children:d("memory.noMemoriesHint")})]}):(0,r.jsx)("div",{className:"space-y-2",children:T.map(e=>(0,r.jsxs)("div",{className:"p-2 rounded bg-secondary/50 text-sm",children:[(0,r.jsxs)("div",{className:"flex justify-between items-start",children:[(0,r.jsx)("span",{className:"flex-1",children:e.content}),(0,r.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h(e.category)}),(0,r.jsx)(e0,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>q(e),title:d("memory.editMemory"),children:(0,r.jsx)(si.Z,{className:"h-3.5 w-3.5"})}),(0,r.jsx)(e0,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-destructive",onClick:()=>K(e),title:d("memory.deleteMemory"),children:(0,r.jsx)(sd.Z,{className:"h-3.5 w-3.5"})})]})]}),e.originalText&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:[d("memory.original"),": ",e.originalText]})]},e.id))})})]}),(0,r.jsx)(sp,{open:f,onOpenChange:g,mode:y?"edit":"add",defaultValues:y})]}):(0,r.jsx)("div",{className:"p-6 text-muted-foreground",children:d("memory.loading")})},benchmark:function(){var e,s,t,l,n,i,d,o,c,m,x,u,h,v,j,p,f,g,y,N,b,w,k,R,q;let{t:K}=(0,P.$G)(),[D,L]=(0,a.useState)(7),{data:I,isLoading:Z}=eK(D);return Z||!I?(0,r.jsxs)("div",{className:"p-6 space-y-4 h-full overflow-y-auto",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:K("benchmark.roiTitle")}),(0,r.jsx)("p",{className:"text-muted-foreground",children:Z?K("benchmark.loading"):K("benchmark.noData")})]}):(0,r.jsxs)("div",{className:"p-6 space-y-6 h-full overflow-y-auto",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:K("benchmark.roiTitle")}),(0,r.jsx)("div",{className:"flex gap-1",children:sq.map(e=>(0,r.jsxs)(e0,{size:"sm",variant:e===D?"default":"outline",onClick:()=>L(e),children:[e,"d"]},e))})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:K("benchmark.period",{from:I.period.from,to:I.period.to})}),(0,r.jsxs)(sy,{defaultValue:"experiment",className:"space-y-6",children:[(0,r.jsxs)(sN,{children:[(0,r.jsxs)(sb,{value:"experiment",children:[(0,r.jsx)(sk.Z,{className:"h-4 w-4 mr-2"}),K("benchmark.experimentTab","实验收益")]}),(0,r.jsxs)(sb,{value:"operations",children:[(0,r.jsx)(T.Z,{className:"h-4 w-4 mr-2"}),K("benchmark.operationsTab","运行治理")]})]}),(0,r.jsxs)(sw,{value:"experiment",className:"space-y-4",children:[(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(sS.Z,{className:"h-4 w-4"}),K("benchmark.efficiency")]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"grid grid-cols-3 gap-4",children:(0,r.jsx)(sK,{label:K("benchmark.avgTimePerTask"),value:"".concat(((null!==(u=null==I?void 0:null===(e=I.efficiency)||void 0===e?void 0:e.avgTimePerTask)&&void 0!==u?u:0)/1e3).toFixed(1),"s")})})})]}),(null!==(h=null==I?void 0:null===(s=I.plugins)||void 0===s?void 0:s.length)&&void 0!==h?h:0)>0&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(eV.Z,{className:"h-4 w-4"}),K("benchmark.pluginEffectiveness")]})}),(0,r.jsx)(e_,{children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-left text-muted-foreground",children:[(0,r.jsx)("th",{children:K("benchmark.plugin")}),(0,r.jsx)("th",{children:K("benchmark.runs")}),(0,r.jsx)("th",{children:K("benchmark.successRate")})]})}),(0,r.jsx)("tbody",{children:(null!==(v=null==I?void 0:I.plugins)&&void 0!==v?v:[]).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border",children:[(0,r.jsx)("td",{className:"py-1 font-mono",children:e.name}),(0,r.jsx)("td",{children:e.runs}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs ".concat(e.successRate>=.8?"bg-green-100 text-green-700":e.successRate>=.5?"bg-yellow-100 text-yellow-700":"bg-red-100 text-red-700"),children:[e.successRate.toFixed(0),"%"]})})]},e.name))})]})})]}),(0,r.jsx)(sF,{})]}),(0,r.jsxs)(sw,{value:"operations",className:"space-y-4",children:[(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(C.Z,{className:"h-4 w-4"}),K("benchmark.overview")]})}),(0,r.jsx)(e_,{children:(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,r.jsx)(sK,{label:K("benchmark.totalRuns"),value:null!==(j=null==I?void 0:null===(t=I.overview)||void 0===t?void 0:t.totalRuns)&&void 0!==j?j:0}),(0,r.jsx)(sK,{label:K("benchmark.completed"),value:null!==(p=null==I?void 0:null===(l=I.overview)||void 0===l?void 0:l.completedRuns)&&void 0!==p?p:0}),(0,r.jsx)(sK,{label:K("benchmark.failed"),value:null!==(f=null==I?void 0:null===(n=I.overview)||void 0===n?void 0:n.failedRuns)&&void 0!==f?f:0}),(0,r.jsx)(sK,{label:K("benchmark.avgDuration"),value:"".concat(((null!==(g=null==I?void 0:null===(i=I.overview)||void 0===i?void 0:i.avgDuration)&&void 0!==g?g:0)/1e3).toFixed(1),"s")}),(0,r.jsx)(sK,{label:K("benchmark.firstPassRate"),value:"".concat((null!==(y=null==I?void 0:null===(d=I.overview)||void 0===d?void 0:d.firstPassSuccessRate)&&void 0!==y?y:0).toFixed(0),"%")})]})})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(sl.Z,{className:"h-4 w-4"}),K("benchmark.failureBreakdown")," (",null!==(N=null==I?void 0:null===(o=I.failures)||void 0===o?void 0:o.total)&&void 0!==N?N:0,")"]})}),(0,r.jsx)(e_,{children:(0,r.jsx)("div",{className:"space-y-2",children:Object.entries(null!==(b=null==I?void 0:null===(c=I.failures)||void 0===c?void 0:c.breakdown)&&void 0!==b?b:{}).map(e=>{var s,t,l,n;let[a,i]=e;return(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm capitalize",children:K("benchmark.failureCategories.".concat(a))}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-32 h-2 bg-secondary rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-red-500 rounded-full",style:{width:"".concat((null!==(l=null==I?void 0:null===(s=I.failures)||void 0===s?void 0:s.total)&&void 0!==l?l:0)>0?i/(null!==(n=null==I?void 0:null===(t=I.failures)||void 0===t?void 0:t.total)&&void 0!==n?n:1)*100:0,"%")}})}),(0,r.jsx)("span",{className:"text-sm font-mono w-8 text-right",children:i})]})]},a)})})})]}),(null!==(w=null==I?void 0:null===(m=I.workflows)||void 0===m?void 0:m.length)&&void 0!==w?w:0)>0&&(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(e$.Z,{className:"h-4 w-4"}),K("benchmark.workflowHealth")]})}),(0,r.jsx)(e_,{children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-left text-muted-foreground",children:[(0,r.jsx)("th",{children:K("benchmark.workflow")}),(0,r.jsx)("th",{children:K("benchmark.runs")}),(0,r.jsx)("th",{children:K("benchmark.successRate")}),(0,r.jsx)("th",{children:K("benchmark.avgDuration")})]})}),(0,r.jsx)("tbody",{children:(null!==(k=null==I?void 0:I.workflows)&&void 0!==k?k:[]).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border",children:[(0,r.jsx)("td",{className:"py-1 font-mono",children:e.name}),(0,r.jsx)("td",{children:e.runs}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs ".concat(e.successRate>=.8?"bg-green-100 text-green-700":e.successRate>=.5?"bg-yellow-100 text-yellow-700":"bg-red-100 text-red-700"),children:[e.successRate.toFixed(0),"%"]})}),(0,r.jsxs)("td",{children:[(e.avgDuration/1e3).toFixed(1),"s"]})]},e.name))})]})})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"flex items-center gap-2",children:[(0,r.jsx)(S.Z,{className:"h-4 w-4"}),K("benchmark.dailyTrends")]})}),(0,r.jsx)(e_,{children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-left text-muted-foreground",children:[(0,r.jsx)("th",{children:K("benchmark.date")}),(0,r.jsx)("th",{children:K("benchmark.runs")}),(0,r.jsx)("th",{children:K("benchmark.failures")})]})}),(0,r.jsx)("tbody",{children:(null!==(R=null==I?void 0:I.byDay)&&void 0!==R?R:[]).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border",children:[(0,r.jsx)("td",{className:"py-1",children:e.date}),(0,r.jsx)("td",{children:e.runs}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:e.failures>0?"text-red-600":"text-green-600",children:e.failures})})]},e.date))})]})})]}),(0,r.jsx)(sT,{}),(0,r.jsx)(sP,{}),(null!==(q=null==I?void 0:null===(x=I.overview)||void 0===x?void 0:x.totalRuns)&&void 0!==q?q:0)===0&&(0,r.jsx)(eI,{children:(0,r.jsxs)(e_,{className:"p-6 text-center text-muted-foreground",children:[(0,r.jsx)(F.Z,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),K("benchmark.empty")]})})]})]})]})},knowledge:function(){let{t:e}=(0,P.$G)(),{data:s,isLoading:t}=(0,D.a)({queryKey:["knowledge-sources"],queryFn:()=>ec()}),l=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>eo(e),onSuccess:()=>e.invalidateQueries({queryKey:["knowledge-sources"]})})}(),[n,i]=(0,a.useState)(""),{data:d}=(0,D.a)({queryKey:["knowledge-search",n],queryFn:()=>ed(n),enabled:n.length>0});return(0,r.jsxs)("div",{className:"p-6 space-y-4 h-full overflow-y-auto",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:e("knowledge.title","Knowledge Base")}),(0,r.jsx)(e0,{onClick:()=>l.mutate(void 0),disabled:l.isPending,children:l.isPending?e("knowledge.syncing","Syncing..."):e("knowledge.syncAll","Sync All")})]}),t?(0,r.jsx)("div",{className:"text-muted-foreground",children:e("knowledge.loading","Loading...")}):s&&s.length>0?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-muted-foreground",children:e("knowledge.sources","Sources")}),s.map(s=>{var t,n,a,i,d,o,c,m;return(0,r.jsx)(eI,{children:(0,r.jsxs)(e_,{className:"p-4 flex justify-between items-center",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-semibold",children:null!==(d=null===(t=s.source)||void 0===t?void 0:t.name)&&void 0!==d?d:s.name}),(0,r.jsxs)("div",{className:"text-sm text-muted-foreground",children:[null!==(o=s.entryCount)&&void 0!==o?o:0," chunks \xb7 ",null!==(c=null===(a=s.source)||void 0===a?void 0:null===(n=a.urls)||void 0===n?void 0:n.length)&&void 0!==c?c:0," URLs \xb7 ","ready"===s.status?e("knowledge.synced"):e("knowledge.notSynced"),s.lastSyncTime?" \xb7 ".concat(e("knowledge.last"),": ").concat(new Date(s.lastSyncTime).toLocaleDateString()):""]})]}),(0,r.jsx)(e0,{variant:"outline",size:"sm",onClick:()=>{var e,t;return l.mutate(null!==(t=null===(e=s.source)||void 0===e?void 0:e.name)&&void 0!==t?t:s.name)},disabled:l.isPending,children:e("knowledge.sync")})]})},null!==(m=null===(i=s.source)||void 0===i?void 0:i.name)&&void 0!==m?m:s.name)})]}):(0,r.jsx)(eI,{children:(0,r.jsx)(e_,{className:"p-6 text-center text-muted-foreground",children:e("knowledge.noSources","No knowledge sources. Install a plugin and sync docs.")})}),(0,r.jsxs)("div",{className:"space-y-2 pt-4",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-muted-foreground",children:e("knowledge.search","Search")}),(0,r.jsx)("div",{className:"flex gap-2",children:(0,r.jsx)(eW,{placeholder:e("knowledge.searchPlaceholder","Search knowledge..."),value:n,onChange:e=>i(e.target.value)})}),d&&d.length>0&&(0,r.jsx)("div",{className:"space-y-2",children:d.map((s,t)=>{var l;return(0,r.jsx)(eI,{children:(0,r.jsxs)(e_,{className:"p-4",children:[(0,r.jsx)("div",{className:"font-semibold",children:s.title}),(0,r.jsx)("div",{className:"text-sm text-muted-foreground mt-1",children:null===(l=s.content)||void 0===l?void 0:l.slice(0,200)}),void 0!==s.score&&(0,r.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:[e("knowledge.score"),": ",s.score.toFixed(2)]})]})},t)})})]})]})},runs:function(){let{t:e}=(0,P.$G)(),{data:s}=eP(50,0),[t,l]=(0,a.useState)(null);if(t)return(0,r.jsx)(sA,{runId:t,onBack:()=>l(null)});let n=null!=s?s:[];return(0,r.jsxs)("div",{className:"p-6 space-y-4",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:e("runs.title")}),0===n.length?(0,r.jsx)("p",{className:"text-muted-foreground",children:e("runs.empty")}):(0,r.jsx)("div",{className:"space-y-2",children:n.map(e=>{var s;return(0,r.jsxs)("div",{onClick:()=>l(e.id),className:"flex items-center gap-4 p-3 rounded bg-secondary hover:bg-accent cursor-pointer",children:[(0,r.jsx)("span",{className:"font-mono text-xs truncate max-w-[200px]",children:e.label||e.id}),(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs ".concat(null!==(s=sM[e.status])&&void 0!==s?s:"text-muted-foreground"),children:e.status}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.totalToolCalls," tools (",e.mcpToolCalls," MCP)"]}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.durationMs>0?"".concat((e.durationMs/1e3).toFixed(1),"s"):"--"}),(0,r.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:new Date(e.startedAt).toLocaleString()})]},e.id)})})]})},timeline:function(){let{t:e}=(0,P.$G)(),s=new Date().toISOString().slice(0,10),[t,l]=(0,a.useState)(s),{data:n}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,D.a)({queryKey:["telemetry-runs",e,s],queryFn:()=>em(e,s)})}(100,0),{data:i}=eq(1),d=new Date(t+"T00:00:00Z").getTime(),o=d+864e5,c=(null!=n?n:[]).filter(e=>e.startedAt>=d&&e.startedAt<o).slice(0,100),m=e=>{let s=new Date(t+"T00:00:00Z");s.setDate(s.getDate()+e),l(s.toISOString().slice(0,10))};return(0,r.jsxs)("div",{className:"p-6 space-y-4 h-full overflow-y-auto",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:e("timeline.title")}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>m(-1),className:"p-1 rounded hover:bg-accent",children:(0,r.jsx)(sG.Z,{className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t}),(0,r.jsx)("button",{onClick:()=>m(1),className:"p-1 rounded hover:bg-accent",children:(0,r.jsx)(sU.Z,{className:"h-4 w-4"})})]})]}),(0,r.jsx)(sQ,{runs:c,date:t}),i&&(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[(0,r.jsxs)("div",{className:"bg-secondary rounded-lg p-3",children:[(0,r.jsx)("div",{className:"text-muted-foreground text-xs",children:e("timeline.runs")}),(0,r.jsxs)("div",{className:"font-bold text-lg",children:[i.summary.completedRuns," ",e("timeline.completed")," / ",i.summary.failedRuns," ",e("timeline.failed")]})]}),(0,r.jsxs)("div",{className:"bg-secondary rounded-lg p-3",children:[(0,r.jsx)("div",{className:"text-muted-foreground text-xs",children:e("timeline.toolUses")}),(0,r.jsx)("div",{className:"font-bold text-lg",children:i.summary.totalToolUses})]}),(0,r.jsxs)("div",{className:"bg-secondary rounded-lg p-3",children:[(0,r.jsx)("div",{className:"text-muted-foreground text-xs",children:e("timeline.avgDuration")}),(0,r.jsxs)("div",{className:"font-bold text-lg",children:[(i.summary.avgRunDuration/1e3).toFixed(1),"s"]})]})]})]})},executions:function(){let{t:e}=(0,P.$G)(),[s,t]=(0,a.useState)(null),{data:l,isLoading:n}=(0,D.a)({queryKey:["telemetry","executions"],queryFn:()=>ew(50),refetchInterval:1e4}),{data:i}=(0,D.a)({queryKey:["telemetry","mcp-compliance"],queryFn:()=>eS()}),{data:d}=(0,D.a)({queryKey:["telemetry","executions",s,"events"],queryFn:()=>ek(s),enabled:!!s}),o=null!=l?l:[];return n?(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[(0,r.jsx)(C.Z,{className:"h-5 w-5 animate-spin mr-2"}),e("executions.loading")]}):(0,r.jsxs)("div",{className:"h-full overflow-auto p-6",children:[(0,r.jsx)("h2",{className:"text-xl font-bold mb-4",children:e("executions.title")}),i&&(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"bg-card border border-border rounded-lg p-4",children:[(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:e("executions.overallCompliance")}),(0,r.jsxs)("div",{className:"text-2xl font-bold mt-1",children:[i.overall.toFixed(1),"%"]})]}),(0,r.jsxs)("div",{className:"bg-card border border-border rounded-lg p-4",children:[(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:e("executions.totalExecutions")}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1",children:o.length})]}),(0,r.jsxs)("div",{className:"bg-card border border-border rounded-lg p-4",children:[(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:e("executions.skillsTracked")}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1",children:Object.keys(i.bySkill).length})]})]}),(0,r.jsx)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{className:"bg-muted/50",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"text-left px-4 py-2 font-medium",children:e("executions.skill")}),(0,r.jsx)("th",{className:"text-left px-4 py-2 font-medium",children:e("executions.status")}),(0,r.jsx)("th",{className:"text-left px-4 py-2 font-medium",children:e("executions.tools")}),(0,r.jsx)("th",{className:"text-left px-4 py-2 font-medium",children:e("executions.mcpRate")}),(0,r.jsx)("th",{className:"text-left px-4 py-2 font-medium",children:e("executions.duration")})]})}),(0,r.jsxs)("tbody",{children:[o.map(e=>{var l,n,a;return(0,r.jsxs)("tr",{className:"border-t border-border cursor-pointer hover:bg-muted/30 ".concat(s===e.executionId?"bg-muted/50":""),onClick:()=>t(e.executionId),children:[(0,r.jsx)("td",{className:"px-4 py-2 font-mono text-xs",children:e.skillName}),(0,r.jsx)("td",{className:"px-4 py-2",children:"completed"===e.status?(0,r.jsx)(sV.Z,{className:"h-4 w-4 text-green-500 inline"}):"failed"===e.status?(0,r.jsx)(s$.Z,{className:"h-4 w-4 text-red-500 inline"}):(0,r.jsx)(S.Z,{className:"h-4 w-4 text-yellow-500 inline animate-spin"})}),(0,r.jsx)("td",{className:"px-4 py-2",children:e.totalToolCalls}),(0,r.jsx)("td",{className:"px-4 py-2",children:(0,r.jsx)(sH,{rate:null!==(l=e.mcpComplianceRate)&&void 0!==l?l:0})}),(0,r.jsx)("td",{className:"px-4 py-2",children:(a=null!==(n=e.totalDuration)&&void 0!==n?n:0)<1e3?"".concat(a,"ms"):"".concat((a/1e3).toFixed(1),"s")})]},e.executionId)}),0===o.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:5,className:"px-4 py-8 text-center text-muted-foreground",children:e("executions.empty")})})]})]})}),s&&d&&(0,r.jsxs)("div",{className:"mt-6 bg-card border border-border rounded-lg p-4",children:[(0,r.jsxs)("h3",{className:"font-bold mb-3 flex items-center gap-2",children:[(0,r.jsx)(eV.Z,{className:"h-4 w-4"}),e("executions.traceTimeline")]}),(0,r.jsx)("div",{className:"space-y-2",children:(null!=d?d:[]).map(s=>(0,r.jsxs)("div",{className:"flex items-start gap-3 p-2 rounded-md bg-muted/30 text-sm",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground w-16 shrink-0",children:new Date(s.timestamp).toLocaleTimeString()}),(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs font-mono ".concat(s.isMcpTool?"bg-green-500/20 text-green-400":"subagent"===s.toolType?"bg-blue-500/20 text-blue-400":"bg-muted text-muted-foreground"),children:s.toolType}),(0,r.jsx)("span",{className:"font-mono text-xs flex-1",children:s.toolName}),s.blocked&&(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-red-500/20 text-red-400",children:e("executions.blocked")}),s.mcpEnforced&&(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-green-500/20 text-green-400",children:"MCP"}),s.mcpFallback&&(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-400",children:e("executions.fallback")})]},s.eventId))})]})]})},"tool-metrics":function(){let[e,s]=(0,a.useState)(7),{data:t=[],isLoading:l}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7;return(0,D.a)({queryKey:["tool-metrics-summary",e],queryFn:()=>ef(e)})}(e);return l?(0,r.jsx)("div",{className:"p-4 text-muted-foreground",children:"Loading tool metrics..."}):(0,r.jsxs)("div",{className:"p-6 space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Tool Metrics"}),(0,r.jsxs)("select",{value:e,onChange:e=>s(Number(e.target.value)),className:"border rounded px-2 py-1 text-sm bg-background",children:[(0,r.jsx)("option",{value:1,children:"Last 24h"}),(0,r.jsx)("option",{value:7,children:"Last 7 days"}),(0,r.jsx)("option",{value:30,children:"Last 30 days"})]})]}),0===t.length?(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:"No tool metrics yet. Start a Claude Code session to collect data."}):(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.map(e=>(0,r.jsxs)(eI,{className:"p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h3",{className:"font-mono text-sm font-medium",children:e.toolName}),(0,r.jsxs)(sR,{variant:e.callCount>10?"default":"secondary",children:[e.callCount," calls"]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Success"}),(0,r.jsxs)("p",{className:"font-semibold",style:{color:e.successRate>=90?"#22c55e":e.successRate>=70?"#f59e0b":"#ef4444"},children:[e.successRate,"%"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Empty"}),(0,r.jsxs)("p",{className:"font-semibold",style:{color:e.emptyRate<=10?"#22c55e":e.emptyRate<=30?"#f59e0b":"#ef4444"},children:[e.emptyRate,"%"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Avg Results"}),(0,r.jsx)("p",{className:"font-semibold",children:e.avgResults})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Avg Latency"}),(0,r.jsxs)("p",{className:"font-semibold",children:[e.avgLatency,"ms"]})]})]})]},e.toolName))})]})},accuracy:function(){var e,s;let[t,l]=(0,a.useState)(""),{data:n}=(e=t||void 0,(0,D.a)({queryKey:["accuracy-stats",e],queryFn:()=>eg(e)})),{data:i}=(s={engine:t||void 0,status:"unannotated",limit:20},(0,D.a)({queryKey:["accuracy-queries",s],queryFn:()=>ey(s)})),{data:d}=(0,D.a)({queryKey:["auto-check"],queryFn:()=>eb()}),o=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>eN(e),onSuccess:()=>{e.invalidateQueries({queryKey:["accuracy-stats"]}),e.invalidateQueries({queryKey:["accuracy-queries"]})}})}(),c=null!=n?n:{},m=Array.isArray(i)?i:[],x=Array.isArray(d)?d:[],u=(0,a.useCallback)((e,s)=>{o.mutate({queryId:e,relevance:s})},[o]);return(0,r.jsxs)("div",{className:"p-6 space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Accuracy"}),(0,r.jsxs)("select",{value:t,onChange:e=>l(e.target.value),className:"border rounded px-2 py-1 text-sm bg-background",children:[(0,r.jsx)("option",{value:"",children:"All Engines"}),(0,r.jsx)("option",{value:"codegraph",children:"CodeGraph"}),(0,r.jsx)("option",{value:"knowledge",children:"Knowledge"}),(0,r.jsx)("option",{value:"memory",children:"Memory"})]})]}),x.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h3",{className:"text-sm font-medium",children:"Auto Check Results"}),x.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded text-sm ".concat("error"===e.severity?"bg-red-50 dark:bg-red-950 border border-red-300":"warning"===e.severity?"bg-yellow-50 dark:bg-yellow-950 border border-yellow-300":"bg-green-50 dark:bg-green-950 border border-green-300"),children:[(0,r.jsx)(sR,{variant:"ok"===e.severity?"default":"destructive",children:e.severity}),(0,r.jsx)("span",{className:"flex-1",children:e.detail})]},e.name))]}),Object.keys(c).length>0&&(0,r.jsx)("div",{className:"grid grid-cols-3 gap-4",children:Object.entries(c).map(e=>{let[s,t]=e;return(0,r.jsxs)(eI,{className:"p-4 space-y-2",children:[(0,r.jsx)("h3",{className:"font-medium text-sm capitalize",children:s}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-1 text-xs",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Queries"}),(0,r.jsx)("span",{className:"font-semibold text-right",children:t.totalQueries}),(0,r.jsx)("span",{className:"text-muted-foreground",children:"Annotated"}),(0,r.jsx)("span",{className:"font-semibold text-right",children:t.annotatedQueries}),(0,r.jsx)("span",{className:"text-muted-foreground",children:"Hit Rate"}),(0,r.jsx)("span",{className:"font-semibold text-right",children:null!=t.hitRate?"".concat(Math.round(100*t.hitRate),"%"):"N/A"})]})]},s)})}),m.length>0&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("h3",{className:"text-sm font-medium",children:["Annotation Queue (",m.length," unannotated)"]}),m.slice(0,10).map(e=>{var s;return(0,r.jsxs)(eI,{className:"p-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(sR,{variant:"outline",children:e.engine}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleString()})]}),(0,r.jsx)("p",{className:"text-sm font-mono",children:e.query}),(0,r.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Top results: ",(null===(s=e.topKResults)||void 0===s?void 0:s.slice(0,3).map(e=>{var s;return null!==(s=e.name)&&void 0!==s?s:e.title}).join(", "))||"none"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(e0,{size:"sm",variant:"default",onClick:()=>u(e.id,"hit"),children:"Hit"}),(0,r.jsx)(e0,{size:"sm",variant:"secondary",onClick:()=>u(e.id,"partial"),children:"Partial"}),(0,r.jsx)(e0,{size:"sm",variant:"destructive",onClick:()=>u(e.id,"miss"),children:"Miss"})]})]},e.id)})]}),0===Object.keys(c).length&&0===m.length&&0===x.length&&(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:"No accuracy data yet. Start a Claude Code session to collect queries."})]})},settings:function(){var e,s,t,l,n,a,i;let{t:d}=(0,P.$G)(),{data:o}=(0,D.a)({queryKey:["plugins",void 0,void 0],queryFn:()=>eR(a,i)}),{data:c}=eq(),m=function(){let e=(0,L.NL)();return(0,I.D)({mutationFn:e=>ep(e),onSuccess:()=>e.invalidateQueries({queryKey:["telemetry-stats"]})})}();return(0,r.jsxs)("div",{className:"p-6 space-y-4 h-full overflow-y-auto",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:d("settings.title","Project Settings")}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{className:"text-sm",children:d("settings.projectInfo","Project Info")})}),(0,r.jsxs)(e_,{className:"space-y-2 text-sm",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[d("settings.name","Name"),":"]}),(0,r.jsx)("span",{children:"devflow"})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[d("settings.mode","Mode"),":"]}),(0,r.jsx)("span",{children:"monorepo"})]})]})]}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsxs)(eE,{className:"text-sm",children:[d("settings.plugins","Plugins")," (",null!==(t=null==o?void 0:o.length)&&void 0!==t?t:0," installed)"]})}),(0,r.jsx)(e_,{className:"space-y-2",children:o&&o.length>0?o.map(e=>(0,r.jsxs)("div",{className:"flex justify-between items-center text-sm p-2 border rounded",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:["@",e.version]})]},e.name)):(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:d("settings.noPlugins","No plugins installed")})})]}),(0,r.jsx)(sP,{}),(0,r.jsxs)(eI,{children:[(0,r.jsx)(eZ,{children:(0,r.jsx)(eE,{className:"text-sm",children:d("settings.telemetry","Telemetry")})}),(0,r.jsxs)(e_,{className:"space-y-2 text-sm",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[d("settings.totalRuns","Runs stored"),":"]}),(0,r.jsx)("span",{children:null!==(l=null==c?void 0:null===(e=c.summary)||void 0===e?void 0:e.totalRuns)&&void 0!==l?l:0})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"text-muted-foreground",children:[d("settings.totalTokens","Total tokens"),":"]}),(0,r.jsx)("span",{children:(null!==(n=null==c?void 0:null===(s=c.summary)||void 0===s?void 0:s.totalTokens)&&void 0!==n?n:0).toLocaleString()})]}),(0,r.jsx)(e0,{variant:"outline",size:"sm",onClick:()=>m.mutate(30),disabled:m.isPending,children:d("settings.clearOldRuns","Clear old runs (30d+)")})]})]})]})}};function sB(){var e;let s=x(e=>e.activeView),t=null!==(e=sJ[s])&&void 0!==e?e:()=>(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-lg",children:[s," view"]});return(0,r.jsx)(t,{})}function sW(){let e=x(e=>e.activeView),[s,t]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{t(!0)},[]),s)?(0,r.jsx)(u,{nav:(0,r.jsx)(K,{}),main:(0,r.jsx)(sB,{}),detail:"graph"===e?(0,r.jsx)(eL,{}):void 0}):(0,r.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,r.jsx)("div",{className:"text-muted-foreground",children:"Loading..."})})}}},function(e){e.O(0,[650,856,254,781,293,528,744],function(){return e(e.s=56364)}),_N_E=e.O()}]);