@ash-ai/dashboard 0.0.6 → 0.0.7

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 (78) hide show
  1. package/app/agents/detail/page.tsx +182 -0
  2. package/app/agents/eval-compare/page.tsx +445 -0
  3. package/app/agents/eval-run/page.tsx +331 -0
  4. package/app/agents/eval-runs/page.tsx +376 -0
  5. package/app/agents/evals/page.tsx +448 -0
  6. package/app/agents/knowledge/page.tsx +202 -0
  7. package/app/agents/page.tsx +5 -3
  8. package/app/agents/versions/page.tsx +280 -0
  9. package/lib/hooks.ts +120 -0
  10. package/out/404/index.html +1 -1
  11. package/out/404.html +1 -1
  12. package/out/_next/static/chunks/839-186b95b4d095e127.js +1 -0
  13. package/out/_next/static/chunks/90-8e47c31ab931867f.js +1 -0
  14. package/out/_next/static/chunks/{929-6faf1adeb65ee383.js → 929-b631fe082fe4e852.js} +1 -1
  15. package/out/_next/static/chunks/app/agents/detail/page-7427483b9c74ad63.js +1 -0
  16. package/out/_next/static/chunks/app/agents/eval-compare/page-bc4e8051ba07e56f.js +1 -0
  17. package/out/_next/static/chunks/app/agents/eval-run/page-a38dac74d1b3787d.js +1 -0
  18. package/out/_next/static/chunks/app/agents/eval-runs/page-af2fb33c0fce7934.js +1 -0
  19. package/out/_next/static/chunks/app/agents/evals/page-6bdc4b839a7a8eda.js +1 -0
  20. package/out/_next/static/chunks/app/agents/knowledge/page-0e02b14bfa2a6d04.js +1 -0
  21. package/out/_next/static/chunks/app/agents/page-99f179eb7c41ebd4.js +1 -0
  22. package/out/_next/static/chunks/app/agents/versions/page-c482d9bad8f35df6.js +1 -0
  23. package/out/_next/static/chunks/app/analytics/page-ca5d8c60e62118ed.js +1 -0
  24. package/out/_next/static/chunks/app/layout-b06d1caafc026d0c.js +1 -0
  25. package/out/_next/static/chunks/app/logs/page-1a7df17a605f36d3.js +1 -0
  26. package/out/_next/static/chunks/app/page-9e02cb0e8897ab5d.js +1 -0
  27. package/out/_next/static/chunks/app/playground/{page-10d3461f118bfb21.js → page-cb17c2ffaeb31b4e.js} +1 -1
  28. package/out/_next/static/chunks/app/queue/page-6013b93817822c75.js +1 -0
  29. package/out/_next/static/chunks/app/sessions/page-add67d96ab66b690.js +1 -0
  30. package/out/_next/static/chunks/app/settings/credentials/page-ffe97ffb2f60229d.js +1 -0
  31. package/out/_next/static/css/ab505eeeff3f7df5.css +1 -0
  32. package/out/_next/static/sXYgh3eUKXRKt1T_1T3tk/_buildManifest.js +1 -0
  33. package/out/agents/detail/index.html +1 -0
  34. package/out/agents/detail/index.txt +22 -0
  35. package/out/agents/eval-compare/index.html +1 -0
  36. package/out/agents/eval-compare/index.txt +22 -0
  37. package/out/agents/eval-run/index.html +1 -0
  38. package/out/agents/eval-run/index.txt +22 -0
  39. package/out/agents/eval-runs/index.html +1 -0
  40. package/out/agents/eval-runs/index.txt +22 -0
  41. package/out/agents/evals/index.html +1 -0
  42. package/out/agents/evals/index.txt +22 -0
  43. package/out/agents/index.html +1 -1
  44. package/out/agents/index.txt +6 -6
  45. package/out/agents/knowledge/index.html +1 -0
  46. package/out/agents/knowledge/index.txt +22 -0
  47. package/out/agents/versions/index.html +1 -0
  48. package/out/agents/versions/index.txt +22 -0
  49. package/out/analytics/index.html +1 -1
  50. package/out/analytics/index.txt +6 -6
  51. package/out/index.html +1 -1
  52. package/out/index.txt +6 -6
  53. package/out/logs/index.html +1 -1
  54. package/out/logs/index.txt +6 -6
  55. package/out/playground/index.html +1 -1
  56. package/out/playground/index.txt +6 -6
  57. package/out/queue/index.html +1 -1
  58. package/out/queue/index.txt +6 -6
  59. package/out/sessions/index.html +1 -1
  60. package/out/sessions/index.txt +6 -6
  61. package/out/settings/api-keys/index.html +1 -1
  62. package/out/settings/api-keys/index.txt +6 -6
  63. package/out/settings/credentials/index.html +1 -1
  64. package/out/settings/credentials/index.txt +6 -6
  65. package/package.json +4 -4
  66. package/out/_next/static/_fEfzU87y-4u457akpPDC/_buildManifest.js +0 -1
  67. package/out/_next/static/chunks/322-bab4df5c5188e993.js +0 -1
  68. package/out/_next/static/chunks/432-11ec8af7ccfbd019.js +0 -1
  69. package/out/_next/static/chunks/app/agents/page-5f872b5fa12d7854.js +0 -1
  70. package/out/_next/static/chunks/app/analytics/page-bb296f848e25a94f.js +0 -1
  71. package/out/_next/static/chunks/app/layout-f5d1d76b525135c7.js +0 -1
  72. package/out/_next/static/chunks/app/logs/page-5165b556d13654ae.js +0 -1
  73. package/out/_next/static/chunks/app/page-d1e6d7bff1216f08.js +0 -1
  74. package/out/_next/static/chunks/app/queue/page-50142f2cfb3664e7.js +0 -1
  75. package/out/_next/static/chunks/app/sessions/page-7f55a0a4ba0be458.js +0 -1
  76. package/out/_next/static/chunks/app/settings/credentials/page-deb5556bfe57b8b9.js +0 -1
  77. package/out/_next/static/css/15bfa5d891bcf58c.css +0 -1
  78. /package/out/_next/static/{_fEfzU87y-4u457akpPDC → sXYgh3eUKXRKt1T_1T3tk}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[90],{3:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},647:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},2087:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},4193:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},4195:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},5689:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},7413:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]])},8530:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]])},8785:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8154).A)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]])},9061:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return g},handleClientScriptLoad:function(){return y},initScriptLoader:function(){return p}});let n=r(403),a=r(8520),l=r(534),i=n._(r(7763)),d=a._(r(4166)),c=r(9036),o=r(996),s=r(9232),u=new Map,f=new Set,h=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:a=null,dangerouslySetInnerHTML:l,children:d="",strategy:c="afterInteractive",onError:s,stylesheets:h}=e,y=r||t;if(y&&f.has(y))return;if(u.has(t)){f.add(y),u.get(t).then(n,s);return}let p=()=>{a&&a(),f.add(y)},k=document.createElement("script"),g=new Promise((e,t)=>{k.addEventListener("load",function(t){e(),n&&n.call(this,t),p()}),k.addEventListener("error",function(e){t(e)})}).catch(function(e){s&&s(e)});l?(k.innerHTML=l.__html||"",p()):d?(k.textContent="string"==typeof d?d:Array.isArray(d)?d.join(""):"",p()):t&&(k.src=t,u.set(t,g)),(0,o.setAttributesFromProps)(k,e),"worker"===c&&k.setAttribute("type","text/partytown"),k.setAttribute("data-nscript",c),h&&(e=>{if(i.default.preinit)return e.forEach(e=>{i.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(h),document.body.appendChild(k)};function y(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,s.requestIdleCallback)(()=>h(e))}):h(e)}function p(e){e.forEach(y),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");f.add(t)})}function k(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:a=null,strategy:o="afterInteractive",onError:u,stylesheets:y,...p}=e,{updateScripts:k,scripts:g,getIsSsr:m,appDir:_,nonce:b}=(0,d.useContext)(c.HeadManagerContext);b=p.nonce||b;let v=(0,d.useRef)(!1);(0,d.useEffect)(()=>{let e=t||r;v.current||(a&&e&&f.has(e)&&a(),v.current=!0)},[a,t,r]);let x=(0,d.useRef)(!1);if((0,d.useEffect)(()=>{if(!x.current){if("afterInteractive"===o)h(e);else"lazyOnload"===o&&("complete"===document.readyState?(0,s.requestIdleCallback)(()=>h(e)):window.addEventListener("load",()=>{(0,s.requestIdleCallback)(()=>h(e))}));x.current=!0}},[e,o]),("beforeInteractive"===o||"worker"===o)&&(k?(g[o]=(g[o]||[]).concat([{id:t,src:r,onLoad:n,onReady:a,onError:u,...p,nonce:b}]),k(g)):m&&m()?f.add(t||r):m&&!m()&&h({...e,nonce:b})),_){if(y&&y.forEach(e=>{i.default.preinit(e,{as:"style"})}),"beforeInteractive"===o)if(!r)return p.dangerouslySetInnerHTML&&(p.children=p.dangerouslySetInnerHTML.__html,delete p.dangerouslySetInnerHTML),(0,l.jsx)("script",{nonce:b,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([0,{...p,id:t}])+")"}});else return i.default.preload(r,p.integrity?{as:"script",integrity:p.integrity,nonce:b,crossOrigin:p.crossOrigin}:{as:"script",nonce:b,crossOrigin:p.crossOrigin}),(0,l.jsx)("script",{nonce:b,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([r,{...p,id:t}])+")"}});"afterInteractive"===o&&r&&i.default.preload(r,p.integrity?{as:"script",integrity:p.integrity,nonce:b,crossOrigin:p.crossOrigin}:{as:"script",nonce:b,crossOrigin:p.crossOrigin})}return null}Object.defineProperty(k,"__nextScript",{value:!0});let g=k;("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)},9197:(e,t,r)=>{var n=r(4841);r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},9232:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{cancelIdleCallback:function(){return n},requestIdleCallback:function(){return r}});let r="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},n="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("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)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[929],{3929:(e,t,s)=>{let a;async function*i(e){let t=e.getReader(),s=new TextDecoder,a="",i="";try{for(;;){let{done:e,value:n}=await t.read();if(e)break;let r=(a+=s.decode(n,{stream:!0})).split("\n");for(let e of(a=r.pop()||"",r))if(e.startsWith("event: "))i=e.slice(7).trim();else if(e.startsWith("data: ")){let t=e.slice(6);try{yield{type:i,data:JSON.parse(t)}}catch(e){}}}}finally{t.releaseLock()}}s.d(t,{z5:()=>u,KU:()=>c});var n=s(1053).hp;class r extends Error{constructor(e,t){super(t),this.name="AshApiError",this.statusCode=e}}class o{headers(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={};return e&&(t["Content-Type"]="application/json"),this.apiKey&&(t.Authorization="Bearer ".concat(this.apiKey)),t}async request(e,t,s){let a=await fetch("".concat(this.serverUrl).concat(t),{method:e,headers:this.headers(!!s),body:s?JSON.stringify(s):void 0});if(!a.ok){let e=await a.json().catch(()=>({})),t=e.message||e.error||a.statusText;throw new r(a.status,t)}return await a.json()}async deployAgent(e,t,s){let a={name:e,path:t};return(null==s?void 0:s.env)&&(a.env=s.env),(await this.request("POST","/api/agents",a)).agent}async createAgent(e,t){let s={name:e};return(null==t?void 0:t.slug)&&(s.slug=t.slug),(null==t?void 0:t.description)&&(s.description=t.description),(null==t?void 0:t.model)&&(s.model=t.model),(null==t?void 0:t.backend)&&(s.backend=t.backend),(null==t?void 0:t.systemPrompt)&&(s.systemPrompt=t.systemPrompt),(null==t?void 0:t.config)&&(s.config=t.config),(null==t?void 0:t.files)&&(s.files=t.files),(await this.request("POST","/api/agents",s)).agent}async listAgents(){return(await this.request("GET","/api/agents")).agents}async getAgent(e){return(await this.request("GET","/api/agents/".concat(e))).agent}async deleteAgent(e){await this.request("DELETE","/api/agents/".concat(e))}async updateAgent(e,t){return(await this.request("PATCH","/api/agents/".concat(e),t)).agent}async listAgentFiles(e){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/files"))}async getAgentFile(e,t){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/files/").concat(t,"?format=json"))}async createSession(e,t){let s={agent:e};return(null==t?void 0:t.credentialId)&&(s.credentialId=t.credentialId),(null==t?void 0:t.extraEnv)&&(s.extraEnv=t.extraEnv),(null==t?void 0:t.model)&&(s.model=t.model),(null==t?void 0:t.mcpServers)&&(s.mcpServers=t.mcpServers),(null==t?void 0:t.systemPrompt)!=null&&(s.systemPrompt=t.systemPrompt),(null==t?void 0:t.allowedTools)&&(s.allowedTools=t.allowedTools),(null==t?void 0:t.disallowedTools)&&(s.disallowedTools=t.disallowedTools),(null==t?void 0:t.betas)&&(s.betas=t.betas),(null==t?void 0:t.subagents)&&(s.subagents=t.subagents),(null==t?void 0:t.initialAgent)&&(s.initialAgent=t.initialAgent),(await this.request("POST","/api/sessions",s)).session}async listSessions(e){let t="string"==typeof e?{agent:e}:null!=e?e:{},s=new URLSearchParams;t.agent&&s.set("agent",t.agent),t.status&&s.set("status",t.status),t.limit&&s.set("limit",String(t.limit)),t.offset&&s.set("offset",String(t.offset));let a=s.toString();return(await this.request("GET","/api/sessions".concat(a?"?".concat(a):""))).sessions}async listSessionsWithTotal(e){let t=new URLSearchParams;(null==e?void 0:e.agent)&&t.set("agent",e.agent),(null==e?void 0:e.status)&&t.set("status",e.status),(null==e?void 0:e.limit)&&t.set("limit",String(e.limit)),(null==e?void 0:e.offset)&&t.set("offset",String(e.offset)),t.set("includeTotal","true");let s=t.toString();return this.request("GET","/api/sessions?".concat(s))}async getSession(e){return(await this.request("GET","/api/sessions/".concat(e))).session}async sendMessage(e,t,s){let a={content:t};(null==s?void 0:s.includePartialMessages)&&(a.includePartialMessages=!0),(null==s?void 0:s.model)&&(a.model=s.model),(null==s?void 0:s.maxTurns)!=null&&(a.maxTurns=s.maxTurns),(null==s?void 0:s.maxBudgetUsd)!=null&&(a.maxBudgetUsd=s.maxBudgetUsd),(null==s?void 0:s.effort)&&(a.effort=s.effort),(null==s?void 0:s.thinking)&&(a.thinking=s.thinking),(null==s?void 0:s.outputFormat)&&(a.outputFormat=s.outputFormat);let i=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/messages"),{method:"POST",headers:this.headers(!0),body:JSON.stringify(a)});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.message||e.error||i.statusText;throw new r(i.status,t)}return i}async *sendMessageStream(e,t,s){let a=await this.sendMessage(e,t,s);a.body&&(yield*i(a.body))}async updateSessionConfig(e,t){return(await this.request("PATCH","/api/sessions/".concat(e,"/config"),t)).session}async stopSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/stop"))).session}async forkSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/fork"))).session}async pauseSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/pause"))).session}async resumeSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/resume"))).session}async endSession(e){return(await this.request("DELETE","/api/sessions/".concat(e))).session}async exec(e,t,s){let a={command:t};return(null==s?void 0:s.timeout)&&(a.timeout=s.timeout),this.request("POST","/api/sessions/".concat(e,"/exec"),a)}async listMessages(e,t){let s=new URLSearchParams;(null==t?void 0:t.limit)&&s.set("limit",String(t.limit)),(null==t?void 0:t.afterSequence)&&s.set("after",String(t.afterSequence));let a=s.toString(),i="/api/sessions/".concat(e,"/messages").concat(a?"?".concat(a):"");return(await this.request("GET",i)).messages}async listSessionEvents(e,t){let s=new URLSearchParams;(null==t?void 0:t.limit)&&s.set("limit",String(t.limit)),(null==t?void 0:t.afterSequence)&&s.set("after",String(t.afterSequence)),(null==t?void 0:t.type)&&s.set("type",t.type);let a=s.toString(),i="/api/sessions/".concat(e,"/events").concat(a?"?".concat(a):"");return(await this.request("GET",i)).events}async getSessionLogs(e,t){let s=new URLSearchParams;(null==t?void 0:t.after)!=null&&s.set("after",String(t.after));let a=s.toString(),i="/api/sessions/".concat(e,"/logs").concat(a?"?".concat(a):"");return this.request("GET",i)}async getSessionFiles(e,t){var s;let a=new URLSearchParams;null==(s=null==t?void 0:t.includeHidden)||s||a.set("includeHidden","false");let i=a.toString();return this.request("GET","/api/sessions/".concat(e,"/files").concat(i?"?".concat(i):""))}async getSessionFile(e,t){return this.request("GET","/api/sessions/".concat(e,"/files/").concat(t,"?format=json"))}async downloadSessionFile(e,t){let s=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/files/").concat(t),{headers:this.headers()});if(!s.ok){let e=await s.json().catch(()=>({})),t=e.message||e.error||s.statusText;throw new r(s.status,t)}return{buffer:n.from(await s.arrayBuffer()),mimeType:s.headers.get("Content-Type")||"application/octet-stream",source:s.headers.get("X-Ash-Source")||"unknown"}}async downloadSessionFileRaw(e,t){let s=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/files/").concat(t),{headers:this.headers()});if(!s.ok){let e=await s.json().catch(()=>({})),t=e.message||e.error||s.statusText;throw new r(s.status,t)}return s}async writeSessionFiles(e,t,s){let a={files:t};return s&&(a.targetPath=s),this.request("POST","/api/sessions/".concat(e,"/files"),a)}async deleteSessionFile(e,t){return this.request("DELETE","/api/sessions/".concat(e,"/files/").concat(t))}async storeCredential(e,t,s){let a={type:e,key:t};return s&&(a.label=s),(await this.request("POST","/api/credentials",a)).credential}async storeBedrockCredential(e){let t=JSON.stringify({accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,region:e.region,...e.sessionToken&&{sessionToken:e.sessionToken}});return this.storeCredential("bedrock",t,e.label)}async listCredentials(){return(await this.request("GET","/api/credentials")).credentials}async deleteCredential(e){await this.request("DELETE","/api/credentials/".concat(e))}async uploadAttachment(e,t,s,a){let i={filename:t,content:s.toString("base64")};return(null==a?void 0:a.mimeType)&&(i.mimeType=a.mimeType),(null==a?void 0:a.messageId)&&(i.messageId=a.messageId),(await this.request("POST","/api/sessions/".concat(e,"/attachments"),i)).attachment}async listAttachments(e){return(await this.request("GET","/api/sessions/".concat(e,"/attachments"))).attachments}async downloadAttachment(e){let t=await fetch("".concat(this.serverUrl,"/api/attachments/").concat(e),{headers:this.headers()});if(!t.ok){let e=await t.json().catch(()=>({})),s=e.message||e.error||t.statusText;throw new r(t.status,s)}return n.from(await t.arrayBuffer())}async deleteAttachment(e){await this.request("DELETE","/api/attachments/".concat(e))}async downloadWorkspace(e){let t=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/workspace"),{headers:this.headers()});if(!t.ok){let e=await t.json().catch(()=>({})),s=e.message||e.error||t.statusText;throw new r(t.status,s)}return n.from(await t.arrayBuffer())}async uploadWorkspace(e,t){await this.request("POST","/api/sessions/".concat(e,"/workspace"),{bundle:t.toString("base64")})}async enqueue(e,t,s){let a={agentName:e,prompt:t};return(null==s?void 0:s.sessionId)&&(a.sessionId=s.sessionId),(null==s?void 0:s.priority)!==void 0&&(a.priority=s.priority),(null==s?void 0:s.maxRetries)!==void 0&&(a.maxRetries=s.maxRetries),(await this.request("POST","/api/queue",a)).item}async listQueueItems(e){let t=new URLSearchParams;(null==e?void 0:e.status)&&t.set("status",e.status),(null==e?void 0:e.limit)&&t.set("limit",String(e.limit));let s=t.toString();return(await this.request("GET","/api/queue".concat(s?"?".concat(s):""))).items}async getQueueItem(e){return(await this.request("GET","/api/queue/".concat(e))).item}async cancelQueueItem(e){return(await this.request("DELETE","/api/queue/".concat(e))).item}async getQueueStats(){return(await this.request("GET","/api/queue/stats")).stats}async listUsageEvents(e){let t=new URLSearchParams;(null==e?void 0:e.sessionId)&&t.set("sessionId",e.sessionId),(null==e?void 0:e.agentName)&&t.set("agentName",e.agentName),(null==e?void 0:e.limit)&&t.set("limit",String(e.limit));let s=t.toString();return(await this.request("GET","/api/usage".concat(s?"?".concat(s):""))).events}async getUsageStats(e){let t=new URLSearchParams;(null==e?void 0:e.sessionId)&&t.set("sessionId",e.sessionId),(null==e?void 0:e.agentName)&&t.set("agentName",e.agentName);let s=t.toString();return(await this.request("GET","/api/usage/stats".concat(s?"?".concat(s):""))).stats}async listFiles(){return(await this.request("GET","/api/files")).files}async uploadFile(e){return(await this.request("POST","/api/files",e)).file}async getFileUrl(e){return(await this.request("GET","/api/files/".concat(e,"/url"))).url}async deleteFile(e){await this.request("DELETE","/api/files/".concat(e))}async health(){return this.request("GET","/health")}constructor(e){this.serverUrl=e.serverUrl.replace(/\/$/,""),this.apiKey=e.apiKey}}parseInt(s(9819).env.ASH_SANDBOX_MEMORY_MB||"",10),s(9819);let l=null;function c(){if(!l){var e,t;l=new o({serverUrl:(null==(e=window.__ASH_CONFIG__)?void 0:e.serverUrl)||window.location.origin,apiKey:a=null==(t=window.__ASH_CONFIG__)?void 0:t.apiKey})}return l}function u(){return c(),a?{Authorization:"Bearer ".concat(a)}:{}}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[929],{3929:(e,t,s)=>{let a;async function*n(e){let t=e.getReader(),s=new TextDecoder,a="",n="";try{for(;;){let{done:e,value:i}=await t.read();if(e)break;let r=(a+=s.decode(i,{stream:!0})).split("\n");for(let e of(a=r.pop()||"",r))if(e.startsWith("event: "))n=e.slice(7).trim();else if(e.startsWith("data: ")){let t=e.slice(6);try{yield{type:n,data:JSON.parse(t)}}catch(e){}}}}finally{t.releaseLock()}}s.d(t,{z5:()=>u,KU:()=>l});var i=s(1053).hp;class r extends Error{constructor(e,t){super(t),this.name="AshApiError",this.statusCode=e}}class o{headers(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={};return e&&(t["Content-Type"]="application/json"),this.apiKey&&(t.Authorization="Bearer ".concat(this.apiKey)),t}async request(e,t,s){let a=await fetch("".concat(this.serverUrl).concat(t),{method:e,headers:this.headers(!!s),body:s?JSON.stringify(s):void 0});if(!a.ok){let e=await a.json().catch(()=>({})),t=e.message||e.error||a.statusText;throw new r(a.status,t)}return await a.json()}async deployAgent(e,t,s){let a={name:e,path:t};return(null==s?void 0:s.env)&&(a.env=s.env),(await this.request("POST","/api/agents",a)).agent}async createAgent(e,t){let s={name:e};return(null==t?void 0:t.slug)&&(s.slug=t.slug),(null==t?void 0:t.description)&&(s.description=t.description),(null==t?void 0:t.model)&&(s.model=t.model),(null==t?void 0:t.backend)&&(s.backend=t.backend),(null==t?void 0:t.systemPrompt)&&(s.systemPrompt=t.systemPrompt),(null==t?void 0:t.config)&&(s.config=t.config),(null==t?void 0:t.files)&&(s.files=t.files),(await this.request("POST","/api/agents",s)).agent}async listAgents(){return(await this.request("GET","/api/agents")).agents}async getAgent(e){return(await this.request("GET","/api/agents/".concat(e))).agent}async deleteAgent(e){await this.request("DELETE","/api/agents/".concat(e))}async updateAgent(e,t){return(await this.request("PATCH","/api/agents/".concat(e),t)).agent}async listAgentFiles(e){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/files"))}async getAgentFile(e,t){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/files/").concat(t,"?format=json"))}async createSession(e,t){let s={agent:e};return(null==t?void 0:t.credentialId)&&(s.credentialId=t.credentialId),(null==t?void 0:t.extraEnv)&&(s.extraEnv=t.extraEnv),(null==t?void 0:t.model)&&(s.model=t.model),(null==t?void 0:t.mcpServers)&&(s.mcpServers=t.mcpServers),(null==t?void 0:t.systemPrompt)!=null&&(s.systemPrompt=t.systemPrompt),(null==t?void 0:t.allowedTools)&&(s.allowedTools=t.allowedTools),(null==t?void 0:t.disallowedTools)&&(s.disallowedTools=t.disallowedTools),(null==t?void 0:t.betas)&&(s.betas=t.betas),(null==t?void 0:t.subagents)&&(s.subagents=t.subagents),(null==t?void 0:t.initialAgent)&&(s.initialAgent=t.initialAgent),(await this.request("POST","/api/sessions",s)).session}async listSessions(e){let t="string"==typeof e?{agent:e}:null!=e?e:{},s=new URLSearchParams;t.agent&&s.set("agent",t.agent),t.status&&s.set("status",t.status),t.limit&&s.set("limit",String(t.limit)),t.offset&&s.set("offset",String(t.offset));let a=s.toString();return(await this.request("GET","/api/sessions".concat(a?"?".concat(a):""))).sessions}async listSessionsWithTotal(e){let t=new URLSearchParams;(null==e?void 0:e.agent)&&t.set("agent",e.agent),(null==e?void 0:e.status)&&t.set("status",e.status),(null==e?void 0:e.limit)&&t.set("limit",String(e.limit)),(null==e?void 0:e.offset)&&t.set("offset",String(e.offset)),t.set("includeTotal","true");let s=t.toString();return this.request("GET","/api/sessions?".concat(s))}async getSession(e){return(await this.request("GET","/api/sessions/".concat(e))).session}async sendMessage(e,t,s){let a={content:t};(null==s?void 0:s.includePartialMessages)&&(a.includePartialMessages=!0),(null==s?void 0:s.model)&&(a.model=s.model),(null==s?void 0:s.maxTurns)!=null&&(a.maxTurns=s.maxTurns),(null==s?void 0:s.maxBudgetUsd)!=null&&(a.maxBudgetUsd=s.maxBudgetUsd),(null==s?void 0:s.effort)&&(a.effort=s.effort),(null==s?void 0:s.thinking)&&(a.thinking=s.thinking),(null==s?void 0:s.outputFormat)&&(a.outputFormat=s.outputFormat);let n=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/messages"),{method:"POST",headers:this.headers(!0),body:JSON.stringify(a)});if(!n.ok){let e=await n.json().catch(()=>({})),t=e.message||e.error||n.statusText;throw new r(n.status,t)}return n}async *sendMessageStream(e,t,s){let a=await this.sendMessage(e,t,s);a.body&&(yield*n(a.body))}async updateSessionConfig(e,t){return(await this.request("PATCH","/api/sessions/".concat(e,"/config"),t)).session}async stopSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/stop"))).session}async forkSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/fork"))).session}async pauseSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/pause"))).session}async resumeSession(e){return(await this.request("POST","/api/sessions/".concat(e,"/resume"))).session}async endSession(e){return(await this.request("DELETE","/api/sessions/".concat(e))).session}async exec(e,t,s){let a={command:t};return(null==s?void 0:s.timeout)&&(a.timeout=s.timeout),this.request("POST","/api/sessions/".concat(e,"/exec"),a)}async listMessages(e,t){let s=new URLSearchParams;(null==t?void 0:t.limit)&&s.set("limit",String(t.limit)),(null==t?void 0:t.afterSequence)&&s.set("after",String(t.afterSequence));let a=s.toString(),n="/api/sessions/".concat(e,"/messages").concat(a?"?".concat(a):"");return(await this.request("GET",n)).messages}async listSessionEvents(e,t){let s=new URLSearchParams;(null==t?void 0:t.limit)&&s.set("limit",String(t.limit)),(null==t?void 0:t.afterSequence)&&s.set("after",String(t.afterSequence)),(null==t?void 0:t.type)&&s.set("type",t.type);let a=s.toString(),n="/api/sessions/".concat(e,"/events").concat(a?"?".concat(a):"");return(await this.request("GET",n)).events}async getSessionLogs(e,t){let s=new URLSearchParams;(null==t?void 0:t.after)!=null&&s.set("after",String(t.after));let a=s.toString(),n="/api/sessions/".concat(e,"/logs").concat(a?"?".concat(a):"");return this.request("GET",n)}async getSessionFiles(e,t){var s;let a=new URLSearchParams;null==(s=null==t?void 0:t.includeHidden)||s||a.set("includeHidden","false");let n=a.toString();return this.request("GET","/api/sessions/".concat(e,"/files").concat(n?"?".concat(n):""))}async getSessionFile(e,t){return this.request("GET","/api/sessions/".concat(e,"/files/").concat(t,"?format=json"))}async downloadSessionFile(e,t){let s=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/files/").concat(t),{headers:this.headers()});if(!s.ok){let e=await s.json().catch(()=>({})),t=e.message||e.error||s.statusText;throw new r(s.status,t)}return{buffer:i.from(await s.arrayBuffer()),mimeType:s.headers.get("Content-Type")||"application/octet-stream",source:s.headers.get("X-Ash-Source")||"unknown"}}async downloadSessionFileRaw(e,t){let s=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/files/").concat(t),{headers:this.headers()});if(!s.ok){let e=await s.json().catch(()=>({})),t=e.message||e.error||s.statusText;throw new r(s.status,t)}return s}async writeSessionFiles(e,t,s){let a={files:t};return s&&(a.targetPath=s),this.request("POST","/api/sessions/".concat(e,"/files"),a)}async deleteSessionFile(e,t){return this.request("DELETE","/api/sessions/".concat(e,"/files/").concat(t))}async storeCredential(e,t,s){let a={type:e,key:t};return s&&(a.label=s),(await this.request("POST","/api/credentials",a)).credential}async storeBedrockCredential(e){let t=JSON.stringify({accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,region:e.region,...e.sessionToken&&{sessionToken:e.sessionToken}});return this.storeCredential("bedrock",t,e.label)}async listCredentials(){return(await this.request("GET","/api/credentials")).credentials}async deleteCredential(e){await this.request("DELETE","/api/credentials/".concat(e))}async uploadAttachment(e,t,s,a){let n={filename:t,content:s.toString("base64")};return(null==a?void 0:a.mimeType)&&(n.mimeType=a.mimeType),(null==a?void 0:a.messageId)&&(n.messageId=a.messageId),(await this.request("POST","/api/sessions/".concat(e,"/attachments"),n)).attachment}async listAttachments(e){return(await this.request("GET","/api/sessions/".concat(e,"/attachments"))).attachments}async downloadAttachment(e){let t=await fetch("".concat(this.serverUrl,"/api/attachments/").concat(e),{headers:this.headers()});if(!t.ok){let e=await t.json().catch(()=>({})),s=e.message||e.error||t.statusText;throw new r(t.status,s)}return i.from(await t.arrayBuffer())}async deleteAttachment(e){await this.request("DELETE","/api/attachments/".concat(e))}async downloadWorkspace(e){let t=await fetch("".concat(this.serverUrl,"/api/sessions/").concat(e,"/workspace"),{headers:this.headers()});if(!t.ok){let e=await t.json().catch(()=>({})),s=e.message||e.error||t.statusText;throw new r(t.status,s)}return i.from(await t.arrayBuffer())}async uploadWorkspace(e,t){await this.request("POST","/api/sessions/".concat(e,"/workspace"),{bundle:t.toString("base64")})}async enqueue(e,t,s){let a={agentName:e,prompt:t};return(null==s?void 0:s.sessionId)&&(a.sessionId=s.sessionId),(null==s?void 0:s.priority)!==void 0&&(a.priority=s.priority),(null==s?void 0:s.maxRetries)!==void 0&&(a.maxRetries=s.maxRetries),(await this.request("POST","/api/queue",a)).item}async listQueueItems(e){let t=new URLSearchParams;(null==e?void 0:e.status)&&t.set("status",e.status),(null==e?void 0:e.limit)&&t.set("limit",String(e.limit));let s=t.toString();return(await this.request("GET","/api/queue".concat(s?"?".concat(s):""))).items}async getQueueItem(e){return(await this.request("GET","/api/queue/".concat(e))).item}async cancelQueueItem(e){return(await this.request("DELETE","/api/queue/".concat(e))).item}async getQueueStats(){return(await this.request("GET","/api/queue/stats")).stats}async listUsageEvents(e){let t=new URLSearchParams;(null==e?void 0:e.sessionId)&&t.set("sessionId",e.sessionId),(null==e?void 0:e.agentName)&&t.set("agentName",e.agentName),(null==e?void 0:e.limit)&&t.set("limit",String(e.limit));let s=t.toString();return(await this.request("GET","/api/usage".concat(s?"?".concat(s):""))).events}async getUsageStats(e){let t=new URLSearchParams;(null==e?void 0:e.sessionId)&&t.set("sessionId",e.sessionId),(null==e?void 0:e.agentName)&&t.set("agentName",e.agentName);let s=t.toString();return(await this.request("GET","/api/usage/stats".concat(s?"?".concat(s):""))).stats}async listFiles(){return(await this.request("GET","/api/files")).files}async uploadFile(e){return(await this.request("POST","/api/files",e)).file}async getFileUrl(e){return(await this.request("GET","/api/files/".concat(e,"/url"))).url}async deleteFile(e){await this.request("DELETE","/api/files/".concat(e))}async health(){return this.request("GET","/health")}async listAgentVersions(e){return(await this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/versions"))).versions}async createAgentVersion(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request("POST","/api/agents/".concat(encodeURIComponent(e),"/versions"),t)}async getAgentVersion(e,t){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/versions/").concat(t))}async updateAgentVersion(e,t,s){return this.request("PATCH","/api/agents/".concat(encodeURIComponent(e),"/versions/").concat(t),s)}async deleteAgentVersion(e,t){await this.request("DELETE","/api/agents/".concat(encodeURIComponent(e),"/versions/").concat(t))}async activateAgentVersion(e,t){await this.request("POST","/api/agents/".concat(encodeURIComponent(e),"/versions/").concat(t,"/activate"))}async uploadAgentFiles(e,t){return this.request("POST","/api/agents/".concat(encodeURIComponent(e),"/files"),{files:t})}async deleteAgentFile(e,t){return this.request("DELETE","/api/agents/".concat(encodeURIComponent(e),"/files/").concat(t))}async listEvalCases(e,t){let s=new URLSearchParams;(null==t?void 0:t.category)&&s.set("category",t.category),(null==t?void 0:t.isActive)!==void 0&&s.set("isActive",String(t.isActive));let a=s.toString();return(await this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/eval-cases").concat(a?"?"+a:""))).cases}async createEvalCase(e,t){return this.request("POST","/api/agents/".concat(encodeURIComponent(e),"/eval-cases"),t)}async getEvalCase(e,t){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/eval-cases/").concat(t))}async updateEvalCase(e,t,s){return this.request("PATCH","/api/agents/".concat(encodeURIComponent(e),"/eval-cases/").concat(t),s)}async deleteEvalCase(e,t){await this.request("DELETE","/api/agents/".concat(encodeURIComponent(e),"/eval-cases/").concat(t))}async importEvalCases(e,t){return this.request("POST","/api/agents/".concat(encodeURIComponent(e),"/eval-cases/import"),{cases:t})}async exportEvalCases(e){return(await this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/eval-cases/export"))).cases}async startEvalRun(e,t){return this.request("POST","/api/agents/".concat(encodeURIComponent(e),"/eval-runs"),t||{})}async listEvalRuns(e){return(await this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/eval-runs"))).runs}async getEvalRun(e,t){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/eval-runs/").concat(t))}async getEvalRunResults(e,t){return(await this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/eval-runs/").concat(t,"/results"))).results}async compareEvalRuns(e,t,s){return this.request("GET","/api/agents/".concat(encodeURIComponent(e),"/eval-runs/compare?runA=").concat(t,"&runB=").concat(s))}constructor(e){this.serverUrl=e.serverUrl.replace(/\/$/,""),this.apiKey=e.apiKey}}parseInt(s(9819).env.ASH_SANDBOX_MEMORY_MB||"",10),s(9819);let c=null;function l(){if(!c){var e,t;c=new o({serverUrl:(null==(e=window.__ASH_CONFIG__)?void 0:e.serverUrl)||window.location.origin,apiKey:a=null==(t=window.__ASH_CONFIG__)?void 0:t.apiKey})}return c}function u(){return l(),a?{Authorization:"Bearer ".concat(a)}:{}}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[319],{3:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(8154).A)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},50:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(8154).A)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},286:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>b});var s=n(534),a=n(4166),r=n(9197),i=n(8968),c=n.n(i),l=n(3929),o=n(4765),d=n(5968),h=n(7964),x=n(1804),u=n(2737),m=n(50),f=n(3701),g=n(4275),p=n(3);let v=(0,n(8154).A)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);var j=n(1924);function y(){let e=(0,r.useSearchParams)().get("name"),[t,n]=(0,a.useState)(null),[i,y]=(0,a.useState)(!0),[b,w]=(0,a.useState)(null);if((0,a.useEffect)(()=>{if(!e)return void y(!1);!async function(){try{let t=(await (0,l.KU)().listAgents()).find(t=>t.name===e);t?n(t):w('Agent "'.concat(e,'" not found'))}catch(e){w(e instanceof Error?e.message:"Failed to fetch agent")}finally{y(!1)}}()},[e]),!e)return(0,s.jsxs)("div",{className:"text-center py-16",children:[(0,s.jsx)("p",{className:"text-white/50",children:"No agent name specified."}),(0,s.jsx)(c(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]});if(i)return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(h.X,{height:80}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[1,2,3].map(e=>(0,s.jsx)(h.X,{height:120},e))})]});if(b||!t)return(0,s.jsxs)("div",{className:"text-center py-16",children:[(0,s.jsx)("p",{className:"text-red-400",children:b||"Agent not found"}),(0,s.jsx)(c(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]});let k=[{label:"Versions",href:"/agents/versions?name=".concat(encodeURIComponent(t.name)),icon:u.A,description:"Manage agent versions and system prompts"},{label:"Knowledge",href:"/agents/knowledge?name=".concat(encodeURIComponent(t.name)),icon:m.A,description:"Upload and manage knowledge base files"},{label:"Evals",href:"/agents/evals?name=".concat(encodeURIComponent(t.name)),icon:f.A,description:"Define and run evaluation test cases"}];return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)(c(),{href:"/agents",className:"inline-flex items-center gap-1.5 text-sm text-white/50 hover:text-white transition-colors",children:[(0,s.jsx)(g.A,{className:"h-4 w-4"}),"Back to agents"]}),(0,s.jsx)(o.Zp,{children:(0,s.jsx)(o.Wu,{children:(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-indigo-500/10",children:(0,s.jsx)(p.A,{className:"h-6 w-6 text-indigo-400"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("h1",{className:"text-xl font-bold text-white",children:t.name}),t.description&&(0,s.jsx)("p",{className:"mt-1 text-sm text-white/50",children:t.description}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[t.model&&(0,s.jsx)(d.E,{variant:"info",children:t.model}),t.status&&(0,s.jsx)(d.E,{variant:"active"===t.status?"success":"default",children:t.status}),t.path&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-white/30",children:[(0,s.jsx)(v,{className:"h-3 w-3"}),t.path]}),t.createdAt&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-white/30",children:[(0,s.jsx)(j.A,{className:"h-3 w-3"}),"Created ",(0,x.fw)(t.createdAt)]})]})]})]})})}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:k.map(e=>(0,s.jsx)(c(),{href:e.href,children:(0,s.jsx)(o.Zp,{className:"hover:border-white/20 hover:bg-white/[0.02] transition-all cursor-pointer h-full",children:(0,s.jsxs)(o.Wu,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,s.jsx)(e.icon,{className:"h-5 w-5 text-indigo-400"}),(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:e.label})]}),(0,s.jsx)("p",{className:"text-xs text-white/40",children:e.description})]})})},e.label))})]})}function b(){return(0,s.jsx)(a.Suspense,{fallback:(0,s.jsx)(h.X,{height:200}),children:(0,s.jsx)(y,{})})}},1804:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>o,ZV:()=>c,a3:()=>l,cn:()=>r,fw:()=>i});var s=n(6862),a=n(3690);function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,a.QP)((0,s.$)(t))}function i(e){let t=Date.now(),n=Math.floor((t-new Date(e).getTime())/1e3);if(n<60)return"".concat(n,"s ago");let s=Math.floor(n/60);if(s<60)return"".concat(s,"m ago");let a=Math.floor(s/60);if(a<24)return"".concat(a,"h ago");let r=Math.floor(a/24);return r<30?"".concat(r,"d ago"):new Date(e).toLocaleDateString()}function c(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function l(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let n=Math.floor(t/60);return"".concat(n,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},1924:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(8154).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},2737:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(8154).A)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},2965:(e,t,n)=>{Promise.resolve().then(n.bind(n,286))},3701:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(8154).A)("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]])},4275:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(8154).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},4765:(e,t,n)=>{"use strict";n.d(t,{Wu:()=>l,ZB:()=>c,Zp:()=>r,aR:()=>i});var s=n(534),a=n(1804);function r(e){let{children:t,className:n}=e;return(0,s.jsx)("div",{className:(0,a.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",n),children:t})}function i(e){let{children:t,className:n}=e;return(0,s.jsx)("div",{className:(0,a.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",n),children:t})}function c(e){let{children:t,className:n}=e;return(0,s.jsx)("h3",{className:(0,a.cn)("text-lg font-semibold leading-none tracking-tight text-white",n),children:t})}function l(e){let{children:t,className:n}=e;return(0,s.jsx)("div",{className:(0,a.cn)("p-4 sm:p-6",n),children:t})}},5968:(e,t,n)=>{"use strict";n.d(t,{E:()=>i,W:()=>c});var s=n(534),a=n(1804);let r={default:"bg-white/10 text-white/70 border border-white/10",success:"bg-green-500/20 text-green-400 border border-green-500/30",warning:"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",error:"bg-red-500/20 text-red-400 border border-red-500/30",info:"bg-blue-500/20 text-blue-400 border border-blue-500/30"};function i(e){let{children:t,variant:n="default",className:i}=e;return(0,s.jsx)("span",{className:(0,a.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",r[n],i),children:t})}function c(e){let{status:t}=e;return(0,s.jsx)(i,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},7964:(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var s=n(534),a=n(1804);function r(e){let{width:t="100%",height:n=100,className:r}=e;return(0,s.jsx)("div",{className:(0,a.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",r),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:n}})}},9197:(e,t,n)=>{"use strict";var s=n(4841);n.o(s,"usePathname")&&n.d(t,{usePathname:function(){return s.usePathname}}),n.o(s,"useSearchParams")&&n.d(t,{useSearchParams:function(){return s.useSearchParams}})}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=2965)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[582],{1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>c,a3:()=>i,cn:()=>n,fw:()=>r});var a=s(6862),l=s(3690);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,l.QP)((0,a.$)(t))}function r(e){let t=Date.now(),s=Math.floor((t-new Date(e).getTime())/1e3);if(s<60)return"".concat(s,"s ago");let a=Math.floor(s/60);if(a<60)return"".concat(a,"m ago");let l=Math.floor(a/60);if(l<24)return"".concat(l,"h ago");let n=Math.floor(l/24);return n<30?"".concat(n,"d ago"):new Date(e).toLocaleDateString()}function c(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function i(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let s=Math.floor(t/60);return"".concat(s,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},3544:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},3634:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},4275:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},4541:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var a=s(534),l=s(4166),n=s(9197),r=s(8968),c=s.n(r),i=s(3929),o=s(4765),x=s(5968),d=s(7964),m=s(1804),u=s(8154);let h=(0,u.A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),f=(0,u.A)("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),p=(0,u.A)("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);var j=s(4275),v=s(3544),N=s(3634);function y(e){return null===e?"text-white/30":e>=.8?"text-green-400":e>=.5?"text-yellow-400":"text-red-400"}function w(e){let{a:t,b:s}=e;if(null===t||null===s)return(0,a.jsx)(h,{className:"h-3 w-3 text-white/20"});let l=s-t;return .01>Math.abs(l)?(0,a.jsx)(h,{className:"h-3 w-3 text-white/30"}):l>0?(0,a.jsx)(f,{className:"h-3 w-3 text-green-400"}):(0,a.jsx)(p,{className:"h-3 w-3 text-red-400"})}function b(){let e=(0,n.useSearchParams)(),t=e.get("name"),s=e.get("runA"),r=e.get("runB"),[u,h]=(0,l.useState)(null),[f,p]=(0,l.useState)(!0),[b,S]=(0,l.useState)(null),[A,F]=(0,l.useState)(null);if((0,l.useEffect)(()=>{if(!t||!s||!r)return void p(!1);!async function(){try{let e=await (0,i.KU)().compareEvalRuns(t,s,r);h(e)}catch(e){S(e instanceof Error?e.message:"Failed to load comparison")}finally{p(!1)}}()},[t,s,r]),!t||!s||!r)return(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("p",{className:"text-white/50",children:"Missing comparison parameters."}),(0,a.jsx)(c(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]});if(f)return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(d.X,{height:120}),(0,a.jsx)(d.X,{height:200})]});if(b||!u)return(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("p",{className:"text-red-400",children:b||"Failed to load comparison"}),(0,a.jsx)(c(),{href:"/agents/eval-runs?name=".concat(encodeURIComponent(t)),className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to eval runs"})]});let{runA:k,runB:R,results:B}=u;return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(c(),{href:"/agents/eval-runs?name=".concat(encodeURIComponent(t)),className:"inline-flex items-center gap-1.5 text-sm text-white/50 hover:text-white transition-colors",children:[(0,a.jsx)(j.A,{className:"h-4 w-4"}),"Back to eval runs"]}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Run Comparison"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[(0,a.jsx)(o.Zp,{children:(0,a.jsxs)(o.Wu,{children:[(0,a.jsx)("div",{className:"text-xs text-white/40 mb-2",children:"Run A"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:(0,m.Ct)(k.id)}),null!==k.versionNumber&&void 0!==k.versionNumber&&(0,a.jsxs)(x.E,{variant:"default",children:["v",k.versionNumber]})]}),(0,a.jsx)("div",{className:"text-xs text-white/30",children:(0,m.fw)(k.createdAt)}),k.summary&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-white/5 space-y-1",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Pass Rate"}),(0,a.jsxs)("span",{className:"text-xs font-semibold ".concat(y(k.summary.passRate)),children:[(100*k.summary.passRate).toFixed(0),"%"]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Topic"}),(0,a.jsx)("span",{className:"text-xs font-semibold ".concat(y(k.summary.avgTopicScore)),children:k.summary.avgTopicScore.toFixed(2)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Safety"}),(0,a.jsx)("span",{className:"text-xs font-semibold ".concat(y(k.summary.avgSafetyScore)),children:k.summary.avgSafetyScore.toFixed(2)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Latency"}),(0,a.jsxs)("span",{className:"text-xs font-semibold text-white",children:[k.summary.avgLatencyMs.toFixed(0),"ms"]})]})]})]})}),(0,a.jsx)(o.Zp,{className:"bg-white/[0.02]",children:(0,a.jsxs)(o.Wu,{children:[(0,a.jsx)("div",{className:"text-xs text-white/40 mb-2",children:"Difference (B - A)"}),k.summary&&R.summary?(0,a.jsxs)("div",{className:"space-y-3 mt-3",children:[(0,a.jsx)(g,{label:"Pass Rate",a:k.summary.passRate,b:R.summary.passRate,format:e=>"".concat((100*e).toFixed(0),"%"),formatDiff:e=>"".concat((100*e).toFixed(1),"pp")}),(0,a.jsx)(g,{label:"Topic Score",a:k.summary.avgTopicScore,b:R.summary.avgTopicScore}),(0,a.jsx)(g,{label:"Safety Score",a:k.summary.avgSafetyScore,b:R.summary.avgSafetyScore}),(0,a.jsx)(g,{label:"Latency",a:k.summary.avgLatencyMs,b:R.summary.avgLatencyMs,format:e=>"".concat(e.toFixed(0),"ms"),formatDiff:e=>"".concat(e>0?"+":"").concat(e.toFixed(0),"ms"),invertColor:!0})]}):(0,a.jsx)("p",{className:"text-xs text-white/30 mt-4",children:"Summary data not available for both runs."})]})}),(0,a.jsx)(o.Zp,{children:(0,a.jsxs)(o.Wu,{children:[(0,a.jsx)("div",{className:"text-xs text-white/40 mb-2",children:"Run B"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:(0,m.Ct)(R.id)}),null!==R.versionNumber&&void 0!==R.versionNumber&&(0,a.jsxs)(x.E,{variant:"default",children:["v",R.versionNumber]})]}),(0,a.jsx)("div",{className:"text-xs text-white/30",children:(0,m.fw)(R.createdAt)}),R.summary&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-white/5 space-y-1",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Pass Rate"}),(0,a.jsxs)("span",{className:"text-xs font-semibold ".concat(y(R.summary.passRate)),children:[(100*R.summary.passRate).toFixed(0),"%"]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Topic"}),(0,a.jsx)("span",{className:"text-xs font-semibold ".concat(y(R.summary.avgTopicScore)),children:R.summary.avgTopicScore.toFixed(2)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Safety"}),(0,a.jsx)("span",{className:"text-xs font-semibold ".concat(y(R.summary.avgSafetyScore)),children:R.summary.avgSafetyScore.toFixed(2)})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Latency"}),(0,a.jsxs)("span",{className:"text-xs font-semibold text-white",children:[R.summary.avgLatencyMs.toFixed(0),"ms"]})]})]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-white mb-3",children:"Per-Case Comparison"}),0===B.length?(0,a.jsx)("p",{className:"text-sm text-white/40",children:"No per-case results available."}):(0,a.jsx)("div",{className:"space-y-2",children:B.map(e=>{var t,s,l,n,r,c,i,x,d,m,u,h,f,p,j,b,g,S,k,R,B,M,C,P,T,_,D,E,L,Z;let W=A===e.caseId;return(0,a.jsx)(o.Zp,{children:(0,a.jsxs)(o.Wu,{className:"!py-3",children:[(0,a.jsxs)("button",{onClick:()=>F(W?null:e.caseId),className:"flex items-center justify-between w-full text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[W?(0,a.jsx)(v.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}):(0,a.jsx)(N.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-white truncate",children:e.question})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4 flex-shrink-0 ml-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs ".concat(y(null!=(k=null==(t=e.resultA)?void 0:t.topicScore)?k:null)),children:null!=(R=null==(l=e.resultA)||null==(s=l.topicScore)?void 0:s.toFixed(2))?R:"--"}),(0,a.jsx)(w,{a:null!=(B=null==(n=e.resultA)?void 0:n.topicScore)?B:null,b:null!=(M=null==(r=e.resultB)?void 0:r.topicScore)?M:null}),(0,a.jsx)("span",{className:"text-xs ".concat(y(null!=(C=null==(c=e.resultB)?void 0:c.topicScore)?C:null)),children:null!=(P=null==(x=e.resultB)||null==(i=x.topicScore)?void 0:i.toFixed(2))?P:"--"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs ".concat(y(null!=(T=null==(d=e.resultA)?void 0:d.safetyScore)?T:null)),children:null!=(_=null==(u=e.resultA)||null==(m=u.safetyScore)?void 0:m.toFixed(2))?_:"--"}),(0,a.jsx)(w,{a:null!=(D=null==(h=e.resultA)?void 0:h.safetyScore)?D:null,b:null!=(E=null==(f=e.resultB)?void 0:f.safetyScore)?E:null}),(0,a.jsx)("span",{className:"text-xs ".concat(y(null!=(L=null==(p=e.resultB)?void 0:p.safetyScore)?L:null)),children:null!=(Z=null==(b=e.resultB)||null==(j=b.safetyScore)?void 0:j.toFixed(2))?Z:"--"})]})]})]}),W&&(0,a.jsx)("div",{className:"mt-3 pt-3 border-t border-white/5",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-medium text-white/40 mb-1",children:"Run A Response"}),(null==(g=e.resultA)?void 0:g.agentResponse)?(0,a.jsx)("div",{className:"text-xs text-white/60 bg-black/20 rounded-lg p-3 whitespace-pre-wrap max-h-40 overflow-y-auto",children:e.resultA.agentResponse}):(0,a.jsx)("p",{className:"text-xs text-white/20 italic",children:"No response"}),e.resultA&&(0,a.jsxs)("div",{className:"flex gap-3 mt-2",children:[null!==e.resultA.topicScore&&(0,a.jsxs)("span",{className:"text-xs ".concat(y(e.resultA.topicScore)),children:["Topic: ",e.resultA.topicScore.toFixed(2)]}),null!==e.resultA.safetyScore&&(0,a.jsxs)("span",{className:"text-xs ".concat(y(e.resultA.safetyScore)),children:["Safety: ",e.resultA.safetyScore.toFixed(2)]}),null!==e.resultA.latencyMs&&(0,a.jsxs)("span",{className:"text-xs text-white/30",children:[e.resultA.latencyMs.toFixed(0),"ms"]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-medium text-white/40 mb-1",children:"Run B Response"}),(null==(S=e.resultB)?void 0:S.agentResponse)?(0,a.jsx)("div",{className:"text-xs text-white/60 bg-black/20 rounded-lg p-3 whitespace-pre-wrap max-h-40 overflow-y-auto",children:e.resultB.agentResponse}):(0,a.jsx)("p",{className:"text-xs text-white/20 italic",children:"No response"}),e.resultB&&(0,a.jsxs)("div",{className:"flex gap-3 mt-2",children:[null!==e.resultB.topicScore&&(0,a.jsxs)("span",{className:"text-xs ".concat(y(e.resultB.topicScore)),children:["Topic: ",e.resultB.topicScore.toFixed(2)]}),null!==e.resultB.safetyScore&&(0,a.jsxs)("span",{className:"text-xs ".concat(y(e.resultB.safetyScore)),children:["Safety: ",e.resultB.safetyScore.toFixed(2)]}),null!==e.resultB.latencyMs&&(0,a.jsxs)("span",{className:"text-xs text-white/30",children:[e.resultB.latencyMs.toFixed(0),"ms"]})]})]})]})})]})},e.caseId)})})]})]})}function g(e){let{label:t,a:s,b:l,format:n=e=>e.toFixed(2),formatDiff:r,invertColor:c=!1}=e,i=l-s,o=Math.abs(i),x=i>0,d=o<.01,m="text-white/30";d||(m=c?x?"text-red-400":"text-green-400":x?"text-green-400":"text-red-400");let u=r?r(i):"".concat(i>=0?"+":"").concat(i.toFixed(2));return(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/50",children:t}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[!d&&(!c===x?(0,a.jsx)(f,{className:"h-3 w-3 ".concat(m)}):(0,a.jsx)(p,{className:"h-3 w-3 ".concat(m)})),(0,a.jsx)("span",{className:"text-xs font-semibold ".concat(m),children:u})]})]})}function S(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(d.X,{height:200}),children:(0,a.jsx)(b,{})})}},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>i,ZB:()=>c,Zp:()=>n,aR:()=>r});var a=s(534),l=s(1804);function n(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function r(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",s),children:t})}function c(e){let{children:t,className:s}=e;return(0,a.jsx)("h3",{className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight text-white",s),children:t})}function i(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("p-4 sm:p-6",s),children:t})}},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>r,W:()=>c});var a=s(534),l=s(1804);let n={default:"bg-white/10 text-white/70 border border-white/10",success:"bg-green-500/20 text-green-400 border border-green-500/30",warning:"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",error:"bg-red-500/20 text-red-400 border border-red-500/30",info:"bg-blue-500/20 text-blue-400 border border-blue-500/30"};function r(e){let{children:t,variant:s="default",className:r}=e;return(0,a.jsx)("span",{className:(0,l.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",n[s],r),children:t})}function c(e){let{status:t}=e;return(0,a.jsx)(r,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>n});var a=s(534),l=s(1804);function n(e){let{width:t="100%",height:s=100,className:n}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",n),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8286:(e,t,s)=>{Promise.resolve().then(s.bind(s,4541))},9197:(e,t,s)=>{"use strict";var a=s(4841);s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=8286)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[996],{989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>u,_F:()=>i,_o:()=>h,aA:()=>x,aX:()=>d,l3:()=>m,te:()=>o,xV:()=>g,yu:()=>f});var a=s(4166),l=s(3929);function r(e,t){let s=(0,a.useRef)(e);(0,a.useEffect)(()=>{s.current=e},[e]),(0,a.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function n(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function c(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function i(){let e=n("ash:agents"),[t,s]=(0,a.useState)(null!=e?e:[]),[r,i]=(0,a.useState)(!e),[o,u]=(0,a.useState)(null),d=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().listAgents();s(e),c("ash:agents",e),u(null)}catch(e){u(e)}finally{i(!1)}},[]);return(0,a.useEffect)(()=>{d()},[d]),{agents:t,loading:r,error:o,refetch:d}}function o(e){var t;let s="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),i=n(s),[o,u]=(0,a.useState)(null!=i?i:[]),[d,x]=(0,a.useState)(!i),[h,m]=(0,a.useState)(null),f=(0,a.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);u(t),c(s,t),m(null)}catch(e){m(e)}finally{x(!1)}},[null==e?void 0:e.agent,s]);return(0,a.useEffect)(()=>{f()},[f]),r(()=>f(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:o,loading:d,error:h,refetch:f}}function u(){let[e,t]=(0,a.useState)(()=>n("ash:health")),[s,i]=(0,a.useState)(null),o=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),i(null),c("ash:health",e)}catch(e){i(e)}},[]);return(0,a.useEffect)(()=>{o()},[o]),r(()=>o(),3e4),{health:e,error:s,refetch:o}}function d(){let[e,t]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),[n,c]=(0,a.useState)(null),i=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().listCredentials();t(e),c(null)}catch(e){c(e)}finally{r(!1)}},[]);return(0,a.useEffect)(()=>{i()},[i]),{credentials:e,loading:s,error:n,refetch:i}}function x(e){let[t,s]=(0,a.useState)([]),[r,n]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{if(e)try{n(!0);let t=await (0,l.KU)().listAgentVersions(e);s(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{n(!1)}},[e]);return(0,a.useEffect)(()=>{c()},[c]),{versions:t,loading:r,refresh:c}}function h(e){let[t,s]=(0,a.useState)([]),[r,n]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{if(e)try{n(!0);let t=await (0,l.KU)().listAgentFiles(e);s(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{n(!1)}},[e]);return(0,a.useEffect)(()=>{c()},[c]),{files:t,loading:r,refresh:c}}function m(e){let[t,s]=(0,a.useState)([]),[r,n]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{if(e)try{n(!0);let t=await (0,l.KU)().listEvalCases(e);s(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{n(!1)}},[e]);return(0,a.useEffect)(()=>{c()},[c]),{cases:t,loading:r,refresh:c}}function f(e){let[t,s]=(0,a.useState)([]),[r,n]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{if(e)try{n(!0);let t=await (0,l.KU)().listEvalRuns(e);s(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{n(!1)}},[e]);return(0,a.useEffect)(()=>{c()},[c]),{runs:t,loading:r,refresh:c}}function g(e,t){let[s,r]=(0,a.useState)([]),[n,c]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e&&t)try{c(!0);let s=await (0,l.KU)().getEvalRunResults(e,t);r(s)}catch(e){console.error("Failed to fetch eval results:",e)}finally{c(!1)}},[e,t]);return(0,a.useEffect)(()=>{i()},[i]),{results:s,loading:n,refresh:i}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>c,a3:()=>i,cn:()=>r,fw:()=>n});var a=s(6862),l=s(3690);function r(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,l.QP)((0,a.$)(t))}function n(e){let t=Date.now(),s=Math.floor((t-new Date(e).getTime())/1e3);if(s<60)return"".concat(s,"s ago");let a=Math.floor(s/60);if(a<60)return"".concat(a,"m ago");let l=Math.floor(a/60);if(l<24)return"".concat(l,"h ago");let r=Math.floor(l/24);return r<30?"".concat(r,"d ago"):new Date(e).toLocaleDateString()}function c(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function i(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let s=Math.floor(t/60);return"".concat(s,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},1924:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},3544:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},3634:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},4275:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},4740:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var a=s(534),l=s(4166),r=s(9197),n=s(8968),c=s.n(n),i=s(989),o=s(3929),u=s(4765),d=s(5968),x=s(8314),h=s(7964),m=s(1804),f=s(4275),g=s(8408),v=s(6211),p=s(3544),y=s(3634),j=s(6379),w=s(6135),b=s(1924);function N(e){switch(e){case"completed":return"success";case"running":return"info";case"error":return"error";case"pending":return"warning";default:return"default"}}function S(e){return null===e?"text-white/30":e>=.8?"text-green-400":e>=.5?"text-yellow-400":"text-red-400"}function k(){let e=(0,r.useSearchParams)(),t=e.get("name"),s=e.get("runId"),{results:n,loading:k,refresh:C}=(0,i.xV)(t,s),[E,F]=(0,l.useState)(null),[M,R]=(0,l.useState)(!0),[L,K]=(0,l.useState)(null);return((0,l.useEffect)(()=>{if(!t||!s)return void R(!1);!async function(){try{let e=await (0,o.KU)().getEvalRun(t,s);F(e)}catch(e){console.error("Failed to fetch eval run:",e)}finally{R(!1)}}()},[t,s]),(0,l.useEffect)(()=>{if(!E||"running"!==E.status&&"pending"!==E.status)return;let e=setInterval(()=>{C(),t&&s&&(0,o.KU)().getEvalRun(t,s).then(F).catch(()=>{})},5e3);return()=>clearInterval(e)},[E,C,t,s]),t&&s)?M||k?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(h.X,{height:120}),(0,a.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,a.jsx)(h.X,{height:70},e))})]}):(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(c(),{href:"/agents/eval-runs?name=".concat(encodeURIComponent(t)),className:"inline-flex items-center gap-1.5 text-sm text-white/50 hover:text-white transition-colors",children:[(0,a.jsx)(f.A,{className:"h-4 w-4"}),"Back to eval runs"]}),(0,a.jsx)(u.Zp,{children:(0,a.jsxs)(u.Wu,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("h1",{className:"text-xl font-bold text-white",children:["Run ",(0,m.Ct)(s)]}),E&&(0,a.jsxs)(d.E,{variant:N(E.status),children:["running"===E.status&&(0,a.jsx)(g.A,{className:"h-3 w-3 mr-1 animate-spin"}),E.status]}),(null==E?void 0:E.versionNumber)!==null&&(null==E?void 0:E.versionNumber)!==void 0&&(0,a.jsxs)(d.E,{variant:"default",children:["v",E.versionNumber]})]}),E&&(0,a.jsxs)("p",{className:"text-xs text-white/30 mt-1",children:["Started ",(0,m.fw)(E.createdAt),E.completedAt&&" | Completed ".concat((0,m.fw)(E.completedAt))]})]}),E&&(0,a.jsxs)("div",{className:"text-sm text-white/50",children:[E.completedCases,"/",E.totalCases," cases completed"]})]}),(null==E?void 0:E.summary)&&(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-4 mt-4 pt-4 border-t border-white/5",children:[(0,a.jsx)(A,{label:"Pass Rate",value:"".concat((100*E.summary.passRate).toFixed(0),"%"),color:E.summary.passRate>=.8?"text-green-400":E.summary.passRate>=.5?"text-yellow-400":"text-red-400"}),(0,a.jsx)(A,{label:"Avg Topic Score",value:E.summary.avgTopicScore.toFixed(2),color:S(E.summary.avgTopicScore)}),(0,a.jsx)(A,{label:"Avg Safety Score",value:E.summary.avgSafetyScore.toFixed(2),color:S(E.summary.avgSafetyScore)}),null!==E.summary.avgLlmJudgeScore&&(0,a.jsx)(A,{label:"LLM Judge Score",value:E.summary.avgLlmJudgeScore.toFixed(2),color:S(E.summary.avgLlmJudgeScore)}),(0,a.jsx)(A,{label:"Avg Latency",value:"".concat(E.summary.avgLatencyMs.toFixed(0),"ms"),color:"text-white"})]})]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-white mb-3",children:"Results"}),0===n.length?(0,a.jsx)(x.p,{icon:(0,a.jsx)(v.A,{className:"h-12 w-12"}),title:"No results yet",description:(null==E?void 0:E.status)==="pending"||(null==E?void 0:E.status)==="running"?"Results will appear as the eval run progresses.":"No results were recorded for this run."}):(0,a.jsx)("div",{className:"space-y-2",children:n.map(e=>{let t=L===e.id;return(0,a.jsx)(u.Zp,{children:(0,a.jsxs)(u.Wu,{className:"!py-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("button",{onClick:()=>K(t?null:e.id),className:"flex items-center gap-2 min-w-0 flex-1 text-left",children:[t?(0,a.jsx)(p.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}):(0,a.jsx)(y.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}),"completed"===e.status?(0,a.jsx)(j.A,{className:"h-4 w-4 text-green-400 flex-shrink-0"}):"error"===e.status?(0,a.jsx)(w.A,{className:"h-4 w-4 text-red-400 flex-shrink-0"}):"running"===e.status?(0,a.jsx)(g.A,{className:"h-4 w-4 text-blue-400 animate-spin flex-shrink-0"}):(0,a.jsx)(b.A,{className:"h-4 w-4 text-yellow-400 flex-shrink-0"}),(0,a.jsxs)("span",{className:"text-sm text-white truncate",children:["Case ",(0,m.Ct)(e.evalCaseId)]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-shrink-0 ml-2",children:[(0,a.jsx)(d.E,{variant:N(e.status),children:e.status}),null!==e.topicScore&&(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-[10px] text-white/30",children:"Topic"}),(0,a.jsx)("div",{className:"text-xs font-semibold ".concat(S(e.topicScore)),children:e.topicScore.toFixed(2)})]}),null!==e.safetyScore&&(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-[10px] text-white/30",children:"Safety"}),(0,a.jsx)("div",{className:"text-xs font-semibold ".concat(S(e.safetyScore)),children:e.safetyScore.toFixed(2)})]}),null!==e.latencyMs&&(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-[10px] text-white/30",children:"Latency"}),(0,a.jsxs)("div",{className:"text-xs font-semibold text-white",children:[e.latencyMs.toFixed(0),"ms"]})]})]})]}),t&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-white/5 space-y-3",children:[e.agentResponse&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-medium text-white/40 mb-1",children:"Agent Response"}),(0,a.jsx)("div",{className:"text-sm text-white/70 bg-black/20 rounded-lg p-3 whitespace-pre-wrap max-h-48 overflow-y-auto",children:e.agentResponse})]}),e.error&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-medium text-red-400 mb-1",children:"Error"}),(0,a.jsx)("div",{className:"text-sm text-red-300 bg-red-500/10 rounded-lg p-3",children:e.error})]}),null!==e.llmJudgeScore&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"LLM Judge Score:"}),(0,a.jsx)("span",{className:"text-sm font-semibold ".concat(S(e.llmJudgeScore)),children:e.llmJudgeScore.toFixed(2)})]}),null!==e.humanScore&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-white/40",children:"Human Score:"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-white",children:e.humanScore}),e.humanNotes&&(0,a.jsxs)("span",{className:"text-xs text-white/50",children:["- ",e.humanNotes]})]})]})]})},e.id)})})]})]}):(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("p",{className:"text-white/50",children:"Missing agent name or run ID."}),(0,a.jsx)(c(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]})}function A(e){let{label:t,value:s,color:l}=e;return(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-xs text-white/40 mb-1",children:t}),(0,a.jsx)("div",{className:"text-lg font-bold ".concat(l),children:s})]})}function C(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(h.X,{height:200}),children:(0,a.jsx)(k,{})})}},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>i,ZB:()=>c,Zp:()=>r,aR:()=>n});var a=s(534),l=s(1804);function r(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function n(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",s),children:t})}function c(e){let{children:t,className:s}=e;return(0,a.jsx)("h3",{className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight text-white",s),children:t})}function i(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("p-4 sm:p-6",s),children:t})}},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>n,W:()=>c});var a=s(534),l=s(1804);let r={default:"bg-white/10 text-white/70 border border-white/10",success:"bg-green-500/20 text-green-400 border border-green-500/30",warning:"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",error:"bg-red-500/20 text-red-400 border border-red-500/30",info:"bg-blue-500/20 text-blue-400 border border-blue-500/30"};function n(e){let{children:t,variant:s="default",className:n}=e;return(0,a.jsx)("span",{className:(0,l.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",r[s],n),children:t})}function c(e){let{status:t}=e;return(0,a.jsx)(n,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},6135:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},6211:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},6379:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>r});var a=s(534),l=s(1804);function r(e){let{width:t="100%",height:s=100,className:r}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",r),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8314:(e,t,s)=>{"use strict";s.d(t,{p:()=>r});var a=s(534),l=s(1804);function r(e){let{icon:t,title:s,description:r,action:n,className:c}=e;return(0,a.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center justify-center py-16 text-center",c),children:[t&&(0,a.jsx)("div",{className:"mb-4 text-white/30",children:t}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:s}),(0,a.jsx)("p",{className:"mt-1 max-w-sm text-sm text-white/50",children:r}),n&&(0,a.jsx)("div",{className:"mt-4",children:n})]})}},8408:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},9140:(e,t,s)=>{Promise.resolve().then(s.bind(s,4740))},9197:(e,t,s)=>{"use strict";var a=s(4841);s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=9140)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[253],{989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>d,_F:()=>c,_o:()=>x,aA:()=>h,aX:()=>u,l3:()=>m,te:()=>o,xV:()=>v,yu:()=>f});var a=s(4166),n=s(3929);function r(e,t){let s=(0,a.useRef)(e);(0,a.useEffect)(()=>{s.current=e},[e]),(0,a.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function l(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function i(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function c(){let e=l("ash:agents"),[t,s]=(0,a.useState)(null!=e?e:[]),[r,c]=(0,a.useState)(!e),[o,d]=(0,a.useState)(null),u=(0,a.useCallback)(async()=>{try{let e=await (0,n.KU)().listAgents();s(e),i("ash:agents",e),d(null)}catch(e){d(e)}finally{c(!1)}},[]);return(0,a.useEffect)(()=>{u()},[u]),{agents:t,loading:r,error:o,refetch:u}}function o(e){var t;let s="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),c=l(s),[o,d]=(0,a.useState)(null!=c?c:[]),[u,h]=(0,a.useState)(!c),[x,m]=(0,a.useState)(null),f=(0,a.useCallback)(async()=>{try{let t=await (0,n.KU)().listSessions(null==e?void 0:e.agent);d(t),i(s,t),m(null)}catch(e){m(e)}finally{h(!1)}},[null==e?void 0:e.agent,s]);return(0,a.useEffect)(()=>{f()},[f]),r(()=>f(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:o,loading:u,error:x,refetch:f}}function d(){let[e,t]=(0,a.useState)(()=>l("ash:health")),[s,c]=(0,a.useState)(null),o=(0,a.useCallback)(async()=>{try{let e=await (0,n.KU)().health();t(e),c(null),i("ash:health",e)}catch(e){c(e)}},[]);return(0,a.useEffect)(()=>{o()},[o]),r(()=>o(),3e4),{health:e,error:s,refetch:o}}function u(){let[e,t]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),[l,i]=(0,a.useState)(null),c=(0,a.useCallback)(async()=>{try{let e=await (0,n.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{r(!1)}},[]);return(0,a.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:l,refetch:c}}function h(e){let[t,s]=(0,a.useState)([]),[r,l]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{l(!0);let t=await (0,n.KU)().listAgentVersions(e);s(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{l(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{versions:t,loading:r,refresh:i}}function x(e){let[t,s]=(0,a.useState)([]),[r,l]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{l(!0);let t=await (0,n.KU)().listAgentFiles(e);s(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{l(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{files:t,loading:r,refresh:i}}function m(e){let[t,s]=(0,a.useState)([]),[r,l]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{l(!0);let t=await (0,n.KU)().listEvalCases(e);s(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{l(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{cases:t,loading:r,refresh:i}}function f(e){let[t,s]=(0,a.useState)([]),[r,l]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{l(!0);let t=await (0,n.KU)().listEvalRuns(e);s(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{l(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{runs:t,loading:r,refresh:i}}function v(e,t){let[s,r]=(0,a.useState)([]),[l,i]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{if(e&&t)try{i(!0);let s=await (0,n.KU)().getEvalRunResults(e,t);r(s)}catch(e){console.error("Failed to fetch eval results:",e)}finally{i(!1)}},[e,t]);return(0,a.useEffect)(()=>{c()},[c]),{results:s,loading:l,refresh:c}}},1080:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>i,a3:()=>c,cn:()=>r,fw:()=>l});var a=s(6862),n=s(3690);function r(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,n.QP)((0,a.$)(t))}function l(e){let t=Date.now(),s=Math.floor((t-new Date(e).getTime())/1e3);if(s<60)return"".concat(s,"s ago");let a=Math.floor(s/60);if(a<60)return"".concat(a,"m ago");let n=Math.floor(a/60);if(n<24)return"".concat(n,"h ago");let r=Math.floor(n/24);return r<30?"".concat(r,"d ago"):new Date(e).toLocaleDateString()}function i(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function c(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let s=Math.floor(t/60);return"".concat(s,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},1924:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},3007:(e,t,s)=>{"use strict";s.d(t,{l:()=>r});var a=s(534),n=s(1804);let r=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:r,options:l,placeholder:i,id:c,...o}=e;return(0,a.jsxs)("div",{className:"space-y-1.5",children:[r&&(0,a.jsx)("label",{htmlFor:c,className:"block text-sm font-medium text-white/70",children:r}),(0,a.jsxs)("select",{ref:t,id:c,className:(0,n.cn)("flex h-9 w-full rounded-xl border px-3 py-1 text-sm transition-all duration-200","bg-white/5 border-white/10 text-white","focus-visible:outline-none focus-visible:border-indigo-500/50",s),...o,children:[i&&(0,a.jsx)("option",{value:"",className:"bg-[#1c2129]",children:i}),l.map(e=>(0,a.jsx)("option",{value:e.value,disabled:e.disabled,className:"bg-[#1c2129]",children:e.label},e.value))]})]})});r.displayName="Select"},3811:(e,t,s)=>{Promise.resolve().then(s.bind(s,4664))},4275:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},4664:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>M});var a=s(534),n=s(4166),r=s(9197),l=s(8968),i=s.n(l),c=s(989),o=s(3929),d=s(4765),u=s(6719),h=s(3007),x=s(5968),m=s(8314),f=s(7964),v=s(1804),g=s(6379),p=s(8408),b=s(6135),y=s(1924),w=s(8154);let j=(0,w.A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var N=s(4275);let k=(0,w.A)("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);var S=s(6211),A=s(1080),C=s(6650);function E(){let e=(0,r.useSearchParams)().get("name"),{runs:t,loading:s,refresh:l}=(0,c.yu)(e),{versions:o}=(0,c.aA)(e),[h,w]=(0,n.useState)(!1),[C,E]=(0,n.useState)(!1),[M,F]=(0,n.useState)([]),[U,_]=(0,n.useState)(null);return((0,n.useEffect)(()=>{if(!t.some(e=>"running"===e.status||"pending"===e.status))return;let e=setInterval(()=>l(),5e3);return()=>clearInterval(e)},[t,l]),e)?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(i(),{href:"/agents/evals?name=".concat(encodeURIComponent(e)),className:"inline-flex items-center gap-1.5 text-sm text-white/50 hover:text-white transition-colors",children:[(0,a.jsx)(N.A,{className:"h-4 w-4"}),"Back to eval cases"]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Eval Runs"}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-white/50",children:["Run history for ",(0,a.jsx)("span",{className:"text-white/70",children:e})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[t.length>=2&&(0,a.jsxs)(u.$,{variant:C?"primary":"secondary",onClick:()=>{E(!C),F([])},children:[(0,a.jsx)(k,{className:"h-4 w-4 mr-2"}),C?"Cancel Compare":"Compare"]}),C&&2===M.length&&(0,a.jsx)(i(),{href:"/agents/eval-compare?name=".concat(encodeURIComponent(e),"&runA=").concat(M[0],"&runB=").concat(M[1]),children:(0,a.jsxs)(u.$,{children:[(0,a.jsx)(S.A,{className:"h-4 w-4 mr-2"}),"Compare Selected"]})}),!C&&(0,a.jsxs)(u.$,{onClick:()=>w(!0),children:[(0,a.jsx)(A.A,{className:"h-4 w-4 mr-2"}),"Run Evals"]})]})]}),U&&(0,a.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-4 py-2",children:U}),C&&(0,a.jsxs)("div",{className:"text-sm text-white/50 bg-indigo-500/5 border border-indigo-500/20 rounded-lg px-4 py-2",children:["Select 2 runs to compare. Selected: ",M.length,"/2"]}),s?(0,a.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,a.jsx)(f.X,{height:80},e))}):0===t.length?(0,a.jsx)(m.p,{icon:(0,a.jsx)(S.A,{className:"h-12 w-12"}),title:"No eval runs yet",description:"Start an eval run to test your agent against the defined eval cases.",action:(0,a.jsxs)(u.$,{onClick:()=>w(!0),children:[(0,a.jsx)(A.A,{className:"h-4 w-4 mr-2"}),"Run Evals"]})}):(0,a.jsx)("div",{className:"space-y-3",children:t.map(t=>{let s=M.includes(t.id);return(0,a.jsx)(d.Zp,{className:C&&s?"border-indigo-500/50 bg-indigo-500/5":"",children:(0,a.jsx)(d.Wu,{children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[C&&(0,a.jsx)("button",{onClick:()=>{var e;return e=t.id,void F(t=>t.includes(e)?t.filter(t=>t!==e):t.length>=2?[t[1],e]:[...t,e])},className:"flex-shrink-0 h-5 w-5 rounded border-2 transition-colors ".concat(s?"bg-indigo-500 border-indigo-500":"border-white/20 hover:border-white/40"),children:s&&(0,a.jsx)(g.A,{className:"h-4 w-4 text-white"})}),function(e){switch(e){case"completed":return(0,a.jsx)(g.A,{className:"h-4 w-4 text-green-400"});case"running":return(0,a.jsx)(p.A,{className:"h-4 w-4 text-blue-400 animate-spin"});case"failed":return(0,a.jsx)(b.A,{className:"h-4 w-4 text-red-400"});case"pending":return(0,a.jsx)(y.A,{className:"h-4 w-4 text-yellow-400"});default:return(0,a.jsx)(j,{className:"h-4 w-4 text-white/40"})}}(t.status),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[C?(0,a.jsxs)("span",{className:"text-sm font-semibold text-white",children:["Run ",(0,v.Ct)(t.id)]}):(0,a.jsxs)(i(),{href:"/agents/eval-run?name=".concat(encodeURIComponent(e),"&runId=").concat(t.id),className:"text-sm font-semibold text-white hover:text-indigo-400 transition-colors",children:["Run ",(0,v.Ct)(t.id)]}),(0,a.jsx)(x.E,{variant:function(e){switch(e){case"completed":return"success";case"running":return"info";case"failed":return"error";case"pending":return"warning";default:return"default"}}(t.status),children:t.status}),null!==t.versionNumber&&void 0!==t.versionNumber&&(0,a.jsxs)(x.E,{variant:"default",children:["v",t.versionNumber]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,a.jsx)("span",{className:"text-xs text-white/30",children:(0,v.fw)(t.createdAt)}),(0,a.jsxs)("span",{className:"text-xs text-white/30",children:[t.completedCases,"/",t.totalCases," cases"]})]})]})]}),t.summary&&(0,a.jsxs)("div",{className:"flex items-center gap-4 flex-shrink-0",children:[(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-xs text-white/40",children:"Pass Rate"}),(0,a.jsxs)("div",{className:"text-sm font-semibold ".concat(t.summary.passRate>=.8?"text-green-400":t.summary.passRate>=.5?"text-yellow-400":"text-red-400"),children:[(100*t.summary.passRate).toFixed(0),"%"]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-xs text-white/40",children:"Topic"}),(0,a.jsx)("div",{className:"text-sm font-semibold text-white",children:t.summary.avgTopicScore.toFixed(2)})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-xs text-white/40",children:"Safety"}),(0,a.jsx)("div",{className:"text-sm font-semibold text-white",children:t.summary.avgSafetyScore.toFixed(2)})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-xs text-white/40",children:"Latency"}),(0,a.jsxs)("div",{className:"text-sm font-semibold text-white",children:[t.summary.avgLatencyMs.toFixed(0),"ms"]})]})]})]})})},t.id)})}),h&&(0,a.jsx)(R,{agentName:e,versions:o,onClose:()=>w(!1),onStarted:()=>{w(!1),l()}})]}):(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("p",{className:"text-white/50",children:"No agent name specified."}),(0,a.jsx)(i(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]})}function R(e){let{agentName:t,versions:s,onClose:r,onStarted:l}=e,[i,c]=(0,n.useState)(""),[x,m]=(0,n.useState)(!1),[f,v]=(0,n.useState)(null);async function g(){m(!0),v(null);try{await (0,o.KU)().startEvalRun(t,{versionNumber:i?Number(i):void 0}),l()}catch(e){v(e instanceof Error?e.message:"Failed to start eval run")}finally{m(!1)}}let b=s.map(e=>({value:String(e.versionNumber),label:"v".concat(e.versionNumber).concat(e.name?" - ".concat(e.name):"").concat(e.isActive?" (active)":"")}));return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,a.jsx)(d.Zp,{className:"w-full max-w-md",children:(0,a.jsxs)(d.Wu,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Run Evals"}),(0,a.jsx)("button",{onClick:r,className:"text-white/40 hover:text-white",children:(0,a.jsx)(C.A,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(h.l,{label:"Version (optional)",placeholder:"Use active version",options:b,value:i,onChange:e=>c(e.target.value)}),(0,a.jsx)("p",{className:"text-xs text-white/40",children:"This will run all active eval cases against the selected version of the agent."}),f&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:f}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,a.jsx)(u.$,{variant:"ghost",onClick:r,children:"Cancel"}),(0,a.jsx)(u.$,{onClick:g,disabled:x,children:x?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.A,{className:"h-4 w-4 mr-2 animate-spin"}),"Starting..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A.A,{className:"h-4 w-4 mr-2"}),"Start Run"]})})]})]})]})})})}function M(){return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(f.X,{height:200}),children:(0,a.jsx)(E,{})})}},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>c,ZB:()=>i,Zp:()=>r,aR:()=>l});var a=s(534),n=s(1804);function r(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,n.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function l(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,n.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",s),children:t})}function i(e){let{children:t,className:s}=e;return(0,a.jsx)("h3",{className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight text-white",s),children:t})}function c(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,n.cn)("p-4 sm:p-6",s),children:t})}},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>l,W:()=>i});var a=s(534),n=s(1804);let r={default:"bg-white/10 text-white/70 border border-white/10",success:"bg-green-500/20 text-green-400 border border-green-500/30",warning:"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",error:"bg-red-500/20 text-red-400 border border-red-500/30",info:"bg-blue-500/20 text-blue-400 border border-blue-500/30"};function l(e){let{children:t,variant:s="default",className:l}=e;return(0,a.jsx)("span",{className:(0,n.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",r[s],l),children:t})}function i(e){let{status:t}=e;return(0,a.jsx)(l,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},6135:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},6211:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},6379:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},6650:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},6719:(e,t,s)=>{"use strict";s.d(t,{$:()=>c});var a=s(534),n=s(1804),r=s(4166);let l={primary:"bg-indigo-500 text-white font-medium hover:bg-indigo-400",secondary:"border border-white/20 bg-white/5 text-white hover:bg-white/10 hover:border-white/30",ghost:"text-white/70 hover:text-white hover:bg-white/10",danger:"bg-red-500/20 text-red-400 border border-red-500/30 hover:bg-red-500/30"},i={sm:"h-8 px-3 text-xs rounded-lg",md:"h-9 px-4 text-sm rounded-xl",lg:"h-10 px-6 text-sm rounded-xl"},c=(0,r.forwardRef)((e,t)=>{let{className:s,variant:r="primary",size:c="md",disabled:o,...d}=e;return(0,a.jsx)("button",{ref:t,className:(0,n.cn)("inline-flex items-center justify-center font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50","disabled:pointer-events-none disabled:opacity-50",l[r],i[c],s),disabled:o,...d})});c.displayName="Button"},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>r});var a=s(534),n=s(1804);function r(e){let{width:t="100%",height:s=100,className:r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",r),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8314:(e,t,s)=>{"use strict";s.d(t,{p:()=>r});var a=s(534),n=s(1804);function r(e){let{icon:t,title:s,description:r,action:l,className:i}=e;return(0,a.jsxs)("div",{className:(0,n.cn)("flex flex-col items-center justify-center py-16 text-center",i),children:[t&&(0,a.jsx)("div",{className:"mb-4 text-white/30",children:t}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:s}),(0,a.jsx)("p",{className:"mt-1 max-w-sm text-sm text-white/50",children:r}),l&&(0,a.jsx)("div",{className:"mt-4",children:l})]})}},8408:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},9197:(e,t,s)=>{"use strict";var a=s(4841);s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=3811)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[237],{599:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},858:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>d,_F:()=>c,_o:()=>x,aA:()=>h,aX:()=>u,l3:()=>m,te:()=>o,xV:()=>p,yu:()=>f});var a=s(4166),l=s(3929);function n(e,t){let s=(0,a.useRef)(e);(0,a.useEffect)(()=>{s.current=e},[e]),(0,a.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function i(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function r(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function c(){let e=i("ash:agents"),[t,s]=(0,a.useState)(null!=e?e:[]),[n,c]=(0,a.useState)(!e),[o,d]=(0,a.useState)(null),u=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().listAgents();s(e),r("ash:agents",e),d(null)}catch(e){d(e)}finally{c(!1)}},[]);return(0,a.useEffect)(()=>{u()},[u]),{agents:t,loading:n,error:o,refetch:u}}function o(e){var t;let s="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),c=i(s),[o,d]=(0,a.useState)(null!=c?c:[]),[u,h]=(0,a.useState)(!c),[x,m]=(0,a.useState)(null),f=(0,a.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);d(t),r(s,t),m(null)}catch(e){m(e)}finally{h(!1)}},[null==e?void 0:e.agent,s]);return(0,a.useEffect)(()=>{f()},[f]),n(()=>f(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:o,loading:u,error:x,refetch:f}}function d(){let[e,t]=(0,a.useState)(()=>i("ash:health")),[s,c]=(0,a.useState)(null),o=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),c(null),r("ash:health",e)}catch(e){c(e)}},[]);return(0,a.useEffect)(()=>{o()},[o]),n(()=>o(),3e4),{health:e,error:s,refetch:o}}function u(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!0),[i,r]=(0,a.useState)(null),c=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().listCredentials();t(e),r(null)}catch(e){r(e)}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:i,refetch:c}}function h(e){let[t,s]=(0,a.useState)([]),[n,i]=(0,a.useState)(!0),r=(0,a.useCallback)(async()=>{if(e)try{i(!0);let t=await (0,l.KU)().listAgentVersions(e);s(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{i(!1)}},[e]);return(0,a.useEffect)(()=>{r()},[r]),{versions:t,loading:n,refresh:r}}function x(e){let[t,s]=(0,a.useState)([]),[n,i]=(0,a.useState)(!0),r=(0,a.useCallback)(async()=>{if(e)try{i(!0);let t=await (0,l.KU)().listAgentFiles(e);s(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{i(!1)}},[e]);return(0,a.useEffect)(()=>{r()},[r]),{files:t,loading:n,refresh:r}}function m(e){let[t,s]=(0,a.useState)([]),[n,i]=(0,a.useState)(!0),r=(0,a.useCallback)(async()=>{if(e)try{i(!0);let t=await (0,l.KU)().listEvalCases(e);s(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{i(!1)}},[e]);return(0,a.useEffect)(()=>{r()},[r]),{cases:t,loading:n,refresh:r}}function f(e){let[t,s]=(0,a.useState)([]),[n,i]=(0,a.useState)(!0),r=(0,a.useCallback)(async()=>{if(e)try{i(!0);let t=await (0,l.KU)().listEvalRuns(e);s(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{i(!1)}},[e]);return(0,a.useEffect)(()=>{r()},[r]),{runs:t,loading:n,refresh:r}}function p(e,t){let[s,n]=(0,a.useState)([]),[i,r]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{if(e&&t)try{r(!0);let s=await (0,l.KU)().getEvalRunResults(e,t);n(s)}catch(e){console.error("Failed to fetch eval results:",e)}finally{r(!1)}},[e,t]);return(0,a.useEffect)(()=>{c()},[c]),{results:s,loading:i,refresh:c}}},1080:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>r,a3:()=>c,cn:()=>n,fw:()=>i});var a=s(6862),l=s(3690);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,l.QP)((0,a.$)(t))}function i(e){let t=Date.now(),s=Math.floor((t-new Date(e).getTime())/1e3);if(s<60)return"".concat(s,"s ago");let a=Math.floor(s/60);if(a<60)return"".concat(a,"m ago");let l=Math.floor(a/60);if(l<24)return"".concat(l,"h ago");let n=Math.floor(l/24);return n<30?"".concat(n,"d ago"):new Date(e).toLocaleDateString()}function r(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function c(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let s=Math.floor(t/60);return"".concat(s,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},2505:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var a=s(534),l=s(1804);let n=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:n,error:i,id:r,...c}=e;return(0,a.jsxs)("div",{className:"space-y-1.5",children:[n&&(0,a.jsx)("label",{htmlFor:r,className:"block text-sm font-medium text-white/70",children:n}),(0,a.jsx)("input",{ref:t,id:r,className:(0,l.cn)("flex h-9 w-full rounded-xl border px-3 py-1 text-sm transition-all duration-200","bg-white/5 border-white/10 text-white placeholder:text-white/40","focus-visible:outline-none focus-visible:border-indigo-500/50 focus-visible:bg-white/10","disabled:cursor-not-allowed disabled:opacity-50",i&&"border-red-500/50 focus-visible:border-red-400",s),...c}),i&&(0,a.jsx)("p",{className:"text-xs text-red-400",children:i})]})});n.displayName="Input"},3234:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>M});var a=s(534),l=s(4166),n=s(9197),i=s(8968),r=s.n(i),c=s(989),o=s(3929),d=s(4765),u=s(6719),h=s(2505),x=s(5968),m=s(8314),f=s(7964),p=s(4275),v=s(1080),g=s(9266),b=s(599),w=s(858),y=s(3701),j=s(3544),N=s(3634);let k=(0,s(8154).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var C=s(7691),S=s(6650);function A(){let e=(0,n.useSearchParams)().get("name"),{cases:t,loading:s,refresh:i}=(0,c.l3)(e),[h,S]=(0,l.useState)(!1),[A,M]=(0,l.useState)(null),[U,T]=(0,l.useState)(null),[R,F]=(0,l.useState)(null),[K,_]=(0,l.useState)(!1),[P,$]=(0,l.useState)(null);async function z(t){if(e){$(null);try{await (0,o.KU)().deleteEvalCase(e,t),T(null),i()}catch(e){$(e instanceof Error?e.message:"Failed to delete eval case"),T(null)}}}async function q(){if(e){$(null);try{let t=await (0,o.KU)().exportEvalCases(e),s=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),a=URL.createObjectURL(s),l=document.createElement("a");l.href=a,l.download="".concat(e,"-eval-cases.json"),l.click(),URL.revokeObjectURL(a)}catch(e){$(e instanceof Error?e.message:"Failed to export eval cases")}}}async function I(t){if(e&&0!==t.length){_(!0),$(null);try{let s=await t[0].text(),a=JSON.parse(s),l=Array.isArray(a)?a:a.cases||[];await (0,o.KU)().importEvalCases(e,l),i()}catch(e){$(e instanceof Error?e.message:"Failed to import eval cases")}finally{_(!1)}}}return e?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(r(),{href:"/agents/detail?name=".concat(encodeURIComponent(e)),className:"inline-flex items-center gap-1.5 text-sm text-white/50 hover:text-white transition-colors",children:[(0,a.jsx)(p.A,{className:"h-4 w-4"}),"Back to ",e]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Eval Cases"}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-white/50",children:["Test cases for ",(0,a.jsx)("span",{className:"text-white/70",children:e})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r(),{href:"/agents/eval-runs?name=".concat(encodeURIComponent(e)),children:(0,a.jsxs)(u.$,{variant:"secondary",children:[(0,a.jsx)(v.A,{className:"h-4 w-4 mr-2"}),"Eval Runs"]})}),(0,a.jsxs)(u.$,{variant:"secondary",onClick:q,children:[(0,a.jsx)(g.A,{className:"h-4 w-4 mr-2"}),"Export"]}),(0,a.jsxs)("label",{className:"cursor-pointer",children:[(0,a.jsxs)("span",{className:"inline-flex items-center justify-center font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50 disabled:pointer-events-none disabled:opacity-50 border border-white/20 bg-white/5 text-white hover:bg-white/10 hover:border-white/30 h-9 px-4 text-sm rounded-xl",children:[(0,a.jsx)(b.A,{className:"h-4 w-4 mr-2"}),K?"Importing...":"Import"]}),(0,a.jsx)("input",{type:"file",accept:".json",className:"hidden",onChange:e=>{e.target.files&&(I(e.target.files),e.target.value="")}})]}),(0,a.jsxs)(u.$,{onClick:()=>S(!0),children:[(0,a.jsx)(w.A,{className:"h-4 w-4 mr-2"}),"Add Case"]})]})]}),P&&(0,a.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-4 py-2",children:P}),s?(0,a.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,a.jsx)(f.X,{height:70},e))}):0===t.length?(0,a.jsx)(m.p,{icon:(0,a.jsx)(y.A,{className:"h-12 w-12"}),title:"No eval cases yet",description:"Create test cases to evaluate your agent's responses. Define questions, expected topics, and reference answers.",action:(0,a.jsxs)(u.$,{onClick:()=>S(!0),children:[(0,a.jsx)(w.A,{className:"h-4 w-4 mr-2"}),"Add Eval Case"]})}):(0,a.jsx)("div",{className:"space-y-2",children:t.map(e=>{let t=R===e.id;return(0,a.jsx)(d.Zp,{children:(0,a.jsxs)(d.Wu,{className:"!py-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("button",{onClick:()=>F(t?null:e.id),className:"flex items-center gap-2 min-w-0 flex-1 text-left",children:[t?(0,a.jsx)(j.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}):(0,a.jsx)(N.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-white truncate",children:e.question})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0 ml-2",children:[e.category&&(0,a.jsx)(x.E,{variant:"info",children:e.category}),!e.isActive&&(0,a.jsx)(x.E,{variant:"warning",children:"Inactive"}),(0,a.jsx)(u.$,{variant:"ghost",size:"sm",onClick:()=>M(e),className:"text-white/30 hover:text-white",children:(0,a.jsx)(k,{className:"h-3.5 w-3.5"})}),(0,a.jsx)(u.$,{variant:"ghost",size:"sm",onClick:()=>T(e.id),className:"text-white/30 hover:text-red-400",children:(0,a.jsx)(C.A,{className:"h-3.5 w-3.5"})})]})]}),t&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-white/5 space-y-2",children:[e.expectedTopics&&e.expectedTopics.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-medium text-white/40",children:"Expected topics: "}),(0,a.jsx)("span",{className:"text-xs text-white/60",children:e.expectedTopics.join(", ")})]}),e.expectedNotTopics&&e.expectedNotTopics.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-medium text-white/40",children:"Should NOT mention: "}),(0,a.jsx)("span",{className:"text-xs text-white/60",children:e.expectedNotTopics.join(", ")})]}),e.referenceAnswer&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-medium text-white/40",children:"Reference answer: "}),(0,a.jsx)("p",{className:"text-xs text-white/60 mt-0.5",children:e.referenceAnswer})]}),e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"flex items-center gap-1 mt-1",children:e.tags.map(e=>(0,a.jsx)(x.E,{variant:"default",children:e},e))})]})]})},e.id)})}),(h||A)&&(0,a.jsx)(E,{agentName:e,evalCase:A,onClose:()=>{S(!1),M(null)},onSaved:()=>{S(!1),M(null),i()}}),U&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,a.jsx)(d.Zp,{className:"w-full max-w-md",children:(0,a.jsxs)(d.Wu,{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-white mb-2",children:"Delete Eval Case"}),(0,a.jsx)("p",{className:"text-sm text-white/60 mb-6",children:"Are you sure you want to delete this eval case? This action cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,a.jsx)(u.$,{variant:"ghost",onClick:()=>T(null),children:"Cancel"}),(0,a.jsx)(u.$,{variant:"danger",onClick:()=>z(U),children:"Delete"})]})]})})})]}):(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("p",{className:"text-white/50",children:"No agent name specified."}),(0,a.jsx)(r(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]})}function E(e){var t,s,n;let{agentName:i,evalCase:r,onClose:c,onSaved:x}=e,m=!!r,[f,p]=(0,l.useState)((null==r?void 0:r.question)||""),[v,g]=(0,l.useState)((null==r||null==(t=r.expectedTopics)?void 0:t.join(", "))||""),[b,w]=(0,l.useState)((null==r||null==(s=r.expectedNotTopics)?void 0:s.join(", "))||""),[y,j]=(0,l.useState)((null==r?void 0:r.referenceAnswer)||""),[N,k]=(0,l.useState)((null==r?void 0:r.category)||""),[C,A]=(0,l.useState)((null==r||null==(n=r.tags)?void 0:n.join(", "))||""),[E,M]=(0,l.useState)(!1),[U,T]=(0,l.useState)(null);function R(e){return e.split(",").map(e=>e.trim()).filter(Boolean)}async function F(){if(!f.trim())return void T("Question is required");M(!0),T(null);try{let e={question:f.trim(),expectedTopics:v?R(v):void 0,expectedNotTopics:b?R(b):void 0,referenceAnswer:y||void 0,category:N||void 0,tags:C?R(C):void 0};m?await (0,o.KU)().updateEvalCase(i,r.id,e):await (0,o.KU)().createEvalCase(i,e),x()}catch(e){T(e instanceof Error?e.message:"Failed to save eval case")}finally{M(!1)}}return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,a.jsx)(d.Zp,{className:"w-full max-w-lg max-h-[90vh] overflow-auto",children:(0,a.jsxs)(d.Wu,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-white",children:m?"Edit Eval Case":"Add Eval Case"}),(0,a.jsx)("button",{onClick:c,className:"text-white/40 hover:text-white",children:(0,a.jsx)(S.A,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-white/70",children:"Question"}),(0,a.jsx)("textarea",{value:f,onChange:e=>p(e.target.value),rows:3,placeholder:"What question should the agent answer?",className:"flex w-full rounded-xl border px-3 py-2 text-sm bg-white/5 border-white/10 text-white placeholder:text-white/40 focus-visible:outline-none focus-visible:border-indigo-500/50 resize-none"})]}),(0,a.jsx)(h.p,{label:"Expected Topics (comma-separated)",placeholder:"e.g. pricing, features, support",value:v,onChange:e=>g(e.target.value)}),(0,a.jsx)(h.p,{label:"Should NOT Mention (comma-separated)",placeholder:"e.g. competitor names, internal details",value:b,onChange:e=>w(e.target.value)}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-white/70",children:"Reference Answer (optional)"}),(0,a.jsx)("textarea",{value:y,onChange:e=>j(e.target.value),rows:3,placeholder:"The ideal answer for comparison...",className:"flex w-full rounded-xl border px-3 py-2 text-sm bg-white/5 border-white/10 text-white placeholder:text-white/40 focus-visible:outline-none focus-visible:border-indigo-500/50 resize-none"})]}),(0,a.jsx)(h.p,{label:"Category",placeholder:"e.g. accuracy, safety, edge_case",value:N,onChange:e=>k(e.target.value)}),(0,a.jsx)(h.p,{label:"Tags (comma-separated)",placeholder:"e.g. regression, critical",value:C,onChange:e=>A(e.target.value)}),U&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:U}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,a.jsx)(u.$,{variant:"ghost",onClick:c,children:"Cancel"}),(0,a.jsx)(u.$,{onClick:F,disabled:E,children:E?"Saving...":m?"Update":"Create"})]})]})]})})})}function M(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(f.X,{height:200}),children:(0,a.jsx)(A,{})})}},3544:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},3634:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},3701:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]])},4275:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>c,ZB:()=>r,Zp:()=>n,aR:()=>i});var a=s(534),l=s(1804);function n(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function i(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",s),children:t})}function r(e){let{children:t,className:s}=e;return(0,a.jsx)("h3",{className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight text-white",s),children:t})}function c(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("p-4 sm:p-6",s),children:t})}},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>i,W:()=>r});var a=s(534),l=s(1804);let n={default:"bg-white/10 text-white/70 border border-white/10",success:"bg-green-500/20 text-green-400 border border-green-500/30",warning:"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",error:"bg-red-500/20 text-red-400 border border-red-500/30",info:"bg-blue-500/20 text-blue-400 border border-blue-500/30"};function i(e){let{children:t,variant:s="default",className:i}=e;return(0,a.jsx)("span",{className:(0,l.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",n[s],i),children:t})}function r(e){let{status:t}=e;return(0,a.jsx)(i,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},6650:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},6719:(e,t,s)=>{"use strict";s.d(t,{$:()=>c});var a=s(534),l=s(1804),n=s(4166);let i={primary:"bg-indigo-500 text-white font-medium hover:bg-indigo-400",secondary:"border border-white/20 bg-white/5 text-white hover:bg-white/10 hover:border-white/30",ghost:"text-white/70 hover:text-white hover:bg-white/10",danger:"bg-red-500/20 text-red-400 border border-red-500/30 hover:bg-red-500/30"},r={sm:"h-8 px-3 text-xs rounded-lg",md:"h-9 px-4 text-sm rounded-xl",lg:"h-10 px-6 text-sm rounded-xl"},c=(0,n.forwardRef)((e,t)=>{let{className:s,variant:n="primary",size:c="md",disabled:o,...d}=e;return(0,a.jsx)("button",{ref:t,className:(0,l.cn)("inline-flex items-center justify-center font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50","disabled:pointer-events-none disabled:opacity-50",i[n],r[c],s),disabled:o,...d})});c.displayName="Button"},7075:(e,t,s)=>{Promise.resolve().then(s.bind(s,3234))},7691:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>n});var a=s(534),l=s(1804);function n(e){let{width:t="100%",height:s=100,className:n}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",n),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8314:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var a=s(534),l=s(1804);function n(e){let{icon:t,title:s,description:n,action:i,className:r}=e;return(0,a.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center justify-center py-16 text-center",r),children:[t&&(0,a.jsx)("div",{className:"mb-4 text-white/30",children:t}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:s}),(0,a.jsx)("p",{className:"mt-1 max-w-sm text-sm text-white/50",children:n}),i&&(0,a.jsx)("div",{className:"mt-4",children:i})]})}},9197:(e,t,s)=>{"use strict";var a=s(4841);s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},9266:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=7075)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[882],{50:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8154).A)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},599:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8154).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},989:(e,t,a)=>{"use strict";a.d(t,{Wz:()=>u,_F:()=>c,_o:()=>f,aA:()=>d,aX:()=>h,l3:()=>x,te:()=>o,xV:()=>y,yu:()=>m});var s=a(4166),l=a(3929);function n(e,t){let a=(0,s.useRef)(e);(0,s.useEffect)(()=>{a.current=e},[e]),(0,s.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>a.current(),t);return()=>clearInterval(e)},[t])}function r(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function i(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function c(){let e=r("ash:agents"),[t,a]=(0,s.useState)(null!=e?e:[]),[n,c]=(0,s.useState)(!e),[o,u]=(0,s.useState)(null),h=(0,s.useCallback)(async()=>{try{let e=await (0,l.KU)().listAgents();a(e),i("ash:agents",e),u(null)}catch(e){u(e)}finally{c(!1)}},[]);return(0,s.useEffect)(()=>{h()},[h]),{agents:t,loading:n,error:o,refetch:h}}function o(e){var t;let a="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),c=r(a),[o,u]=(0,s.useState)(null!=c?c:[]),[h,d]=(0,s.useState)(!c),[f,x]=(0,s.useState)(null),m=(0,s.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);u(t),i(a,t),x(null)}catch(e){x(e)}finally{d(!1)}},[null==e?void 0:e.agent,a]);return(0,s.useEffect)(()=>{m()},[m]),n(()=>m(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:o,loading:h,error:f,refetch:m}}function u(){let[e,t]=(0,s.useState)(()=>r("ash:health")),[a,c]=(0,s.useState)(null),o=(0,s.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),c(null),i("ash:health",e)}catch(e){c(e)}},[]);return(0,s.useEffect)(()=>{o()},[o]),n(()=>o(),3e4),{health:e,error:a,refetch:o}}function h(){let[e,t]=(0,s.useState)([]),[a,n]=(0,s.useState)(!0),[r,i]=(0,s.useState)(null),c=(0,s.useCallback)(async()=>{try{let e=await (0,l.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{n(!1)}},[]);return(0,s.useEffect)(()=>{c()},[c]),{credentials:e,loading:a,error:r,refetch:c}}function d(e){let[t,a]=(0,s.useState)([]),[n,r]=(0,s.useState)(!0),i=(0,s.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listAgentVersions(e);a(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{r(!1)}},[e]);return(0,s.useEffect)(()=>{i()},[i]),{versions:t,loading:n,refresh:i}}function f(e){let[t,a]=(0,s.useState)([]),[n,r]=(0,s.useState)(!0),i=(0,s.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listAgentFiles(e);a(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{r(!1)}},[e]);return(0,s.useEffect)(()=>{i()},[i]),{files:t,loading:n,refresh:i}}function x(e){let[t,a]=(0,s.useState)([]),[n,r]=(0,s.useState)(!0),i=(0,s.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listEvalCases(e);a(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{r(!1)}},[e]);return(0,s.useEffect)(()=>{i()},[i]),{cases:t,loading:n,refresh:i}}function m(e){let[t,a]=(0,s.useState)([]),[n,r]=(0,s.useState)(!0),i=(0,s.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listEvalRuns(e);a(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{r(!1)}},[e]);return(0,s.useEffect)(()=>{i()},[i]),{runs:t,loading:n,refresh:i}}function y(e,t){let[a,n]=(0,s.useState)([]),[r,i]=(0,s.useState)(!0),c=(0,s.useCallback)(async()=>{if(e&&t)try{i(!0);let a=await (0,l.KU)().getEvalRunResults(e,t);n(a)}catch(e){console.error("Failed to fetch eval results:",e)}finally{i(!1)}},[e,t]);return(0,s.useEffect)(()=>{c()},[c]),{results:a,loading:r,refresh:c}}},1804:(e,t,a)=>{"use strict";a.d(t,{Ct:()=>o,ZV:()=>i,a3:()=>c,cn:()=>n,fw:()=>r});var s=a(6862),l=a(3690);function n(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,l.QP)((0,s.$)(t))}function r(e){let t=Date.now(),a=Math.floor((t-new Date(e).getTime())/1e3);if(a<60)return"".concat(a,"s ago");let s=Math.floor(a/60);if(s<60)return"".concat(s,"m ago");let l=Math.floor(s/60);if(l<24)return"".concat(l,"h ago");let n=Math.floor(l/24);return n<30?"".concat(n,"d ago"):new Date(e).toLocaleDateString()}function i(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function c(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let a=Math.floor(t/60);return"".concat(a,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},2029:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>k});var s=a(534),l=a(4166),n=a(9197),r=a(8968),i=a.n(r),c=a(989),o=a(3929),u=a(4765),h=a(6719),d=a(8314),f=a(7964),x=a(4275),m=a(8408),y=a(599),p=a(50),g=a(3544),v=a(3634);let w=(0,a(8154).A)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);var b=a(7691);function j(){let e=(0,n.useSearchParams)().get("name"),{files:t,loading:a,refresh:r}=(0,c._o)(e),[j,k]=(0,l.useState)(null),[N,S]=(0,l.useState)(null),[A,C]=(0,l.useState)(!1),[M,E]=(0,l.useState)(null),F=(0,l.useRef)(null),U=(0,l.useCallback)(async t=>{if(e){C(!0),E(null);try{let a=[];for(let e of Array.from(t)){let t=await e.text();a.push({path:e.name,content:t})}await (0,o.KU)().uploadAgentFiles(e,a),r()}catch(e){E(e instanceof Error?e.message:"Failed to upload files")}finally{C(!1)}}},[e,r]);async function K(t){if(e){S(t),E(null);try{await (0,o.KU)().deleteAgentFile(e,t),k(null),r()}catch(e){E(e instanceof Error?e.message:"Failed to delete file")}finally{S(null)}}}return e?(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)(i(),{href:"/agents/detail?name=".concat(encodeURIComponent(e)),className:"inline-flex items-center gap-1.5 text-sm text-white/50 hover:text-white transition-colors",children:[(0,s.jsx)(x.A,{className:"h-4 w-4"}),"Back to ",e]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Knowledge Base"}),(0,s.jsxs)("p",{className:"mt-1 text-sm text-white/50",children:["Files for ",(0,s.jsx)("span",{className:"text-white/70",children:e})]})]}),(0,s.jsxs)(h.$,{onClick:()=>{var e;return null==(e=F.current)?void 0:e.click()},disabled:A,children:[A?(0,s.jsx)(m.A,{className:"h-4 w-4 mr-2 animate-spin"}):(0,s.jsx)(y.A,{className:"h-4 w-4 mr-2"}),A?"Uploading...":"Upload Files"]}),(0,s.jsx)("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&e.target.files.length>0&&(U(e.target.files),e.target.value="")}})]}),M&&(0,s.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-4 py-2",children:M}),a?(0,s.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,s.jsx)(f.X,{height:60},e))}):0===t.length?(0,s.jsx)(d.p,{icon:(0,s.jsx)(p.A,{className:"h-12 w-12"}),title:"No files yet",description:"Upload knowledge base files for your agent. These files will be available in the agent's working directory.",action:(0,s.jsxs)(h.$,{onClick:()=>{var e;return null==(e=F.current)?void 0:e.click()},children:[(0,s.jsx)(y.A,{className:"h-4 w-4 mr-2"}),"Upload Files"]})}):(0,s.jsx)("div",{className:"space-y-2",children:t.map(e=>{let t="string"==typeof e?e:e.path||e.name,a=j===t;return(0,s.jsx)(u.Zp,{children:(0,s.jsxs)(u.Wu,{className:"!py-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("button",{onClick:()=>k(a?null:t),className:"flex items-center gap-2 min-w-0 flex-1 text-left",children:[a?(0,s.jsx)(g.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}):(0,s.jsx)(v.A,{className:"h-4 w-4 text-white/40 flex-shrink-0"}),(0,s.jsx)(w,{className:"h-4 w-4 text-indigo-400 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-sm text-white truncate",children:t})]}),(0,s.jsx)(h.$,{variant:"ghost",size:"sm",onClick:()=>K(t),disabled:N===t,className:"text-white/30 hover:text-red-400 flex-shrink-0 ml-2",children:N===t?(0,s.jsx)(m.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(b.A,{className:"h-3.5 w-3.5"})})]}),a&&"object"==typeof e&&e.content&&(0,s.jsx)("div",{className:"mt-3 pt-3 border-t border-white/5",children:(0,s.jsx)("pre",{className:"text-xs text-white/60 bg-black/20 rounded-lg p-3 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap",children:e.content})})]})},t)})})]}):(0,s.jsxs)("div",{className:"text-center py-16",children:[(0,s.jsx)("p",{className:"text-white/50",children:"No agent name specified."}),(0,s.jsx)(i(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]})}function k(){return(0,s.jsx)(l.Suspense,{fallback:(0,s.jsx)(f.X,{height:200}),children:(0,s.jsx)(j,{})})}},2922:(e,t,a)=>{Promise.resolve().then(a.bind(a,2029))},3544:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8154).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},3634:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8154).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},4275:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8154).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},4765:(e,t,a)=>{"use strict";a.d(t,{Wu:()=>c,ZB:()=>i,Zp:()=>n,aR:()=>r});var s=a(534),l=a(1804);function n(e){let{children:t,className:a}=e;return(0,s.jsx)("div",{className:(0,l.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",a),children:t})}function r(e){let{children:t,className:a}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",a),children:t})}function i(e){let{children:t,className:a}=e;return(0,s.jsx)("h3",{className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight text-white",a),children:t})}function c(e){let{children:t,className:a}=e;return(0,s.jsx)("div",{className:(0,l.cn)("p-4 sm:p-6",a),children:t})}},6719:(e,t,a)=>{"use strict";a.d(t,{$:()=>c});var s=a(534),l=a(1804),n=a(4166);let r={primary:"bg-indigo-500 text-white font-medium hover:bg-indigo-400",secondary:"border border-white/20 bg-white/5 text-white hover:bg-white/10 hover:border-white/30",ghost:"text-white/70 hover:text-white hover:bg-white/10",danger:"bg-red-500/20 text-red-400 border border-red-500/30 hover:bg-red-500/30"},i={sm:"h-8 px-3 text-xs rounded-lg",md:"h-9 px-4 text-sm rounded-xl",lg:"h-10 px-6 text-sm rounded-xl"},c=(0,n.forwardRef)((e,t)=>{let{className:a,variant:n="primary",size:c="md",disabled:o,...u}=e;return(0,s.jsx)("button",{ref:t,className:(0,l.cn)("inline-flex items-center justify-center font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50","disabled:pointer-events-none disabled:opacity-50",r[n],i[c],a),disabled:o,...u})});c.displayName="Button"},7691:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8154).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},7964:(e,t,a)=>{"use strict";a.d(t,{X:()=>n});var s=a(534),l=a(1804);function n(e){let{width:t="100%",height:a=100,className:n}=e;return(0,s.jsx)("div",{className:(0,l.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",n),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:a}})}},8314:(e,t,a)=>{"use strict";a.d(t,{p:()=>n});var s=a(534),l=a(1804);function n(e){let{icon:t,title:a,description:n,action:r,className:i}=e;return(0,s.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center justify-center py-16 text-center",i),children:[t&&(0,s.jsx)("div",{className:"mb-4 text-white/30",children:t}),(0,s.jsx)("h3",{className:"text-lg font-semibold text-white",children:a}),(0,s.jsx)("p",{className:"mt-1 max-w-sm text-sm text-white/50",children:n}),r&&(0,s.jsx)("div",{className:"mt-4",children:r})]})}},8408:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8154).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},9197:(e,t,a)=>{"use strict";var s=a(4841);a.o(s,"usePathname")&&a.d(t,{usePathname:function(){return s.usePathname}}),a.o(s,"useSearchParams")&&a.d(t,{useSearchParams:function(){return s.useSearchParams}})}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=2922)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{3:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},599:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},647:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},858:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>d,_F:()=>c,_o:()=>x,aA:()=>h,aX:()=>u,l3:()=>m,te:()=>o,xV:()=>g,yu:()=>f});var l=s(4166),a=s(3929);function n(e,t){let s=(0,l.useRef)(e);(0,l.useEffect)(()=>{s.current=e},[e]),(0,l.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function r(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function i(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function c(){let e=r("ash:agents"),[t,s]=(0,l.useState)(null!=e?e:[]),[n,c]=(0,l.useState)(!e),[o,d]=(0,l.useState)(null),u=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().listAgents();s(e),i("ash:agents",e),d(null)}catch(e){d(e)}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{u()},[u]),{agents:t,loading:n,error:o,refetch:u}}function o(e){var t;let s="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),c=r(s),[o,d]=(0,l.useState)(null!=c?c:[]),[u,h]=(0,l.useState)(!c),[x,m]=(0,l.useState)(null),f=(0,l.useCallback)(async()=>{try{let t=await (0,a.KU)().listSessions(null==e?void 0:e.agent);d(t),i(s,t),m(null)}catch(e){m(e)}finally{h(!1)}},[null==e?void 0:e.agent,s]);return(0,l.useEffect)(()=>{f()},[f]),n(()=>f(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:o,loading:u,error:x,refetch:f}}function d(){let[e,t]=(0,l.useState)(()=>r("ash:health")),[s,c]=(0,l.useState)(null),o=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().health();t(e),c(null),i("ash:health",e)}catch(e){c(e)}},[]);return(0,l.useEffect)(()=>{o()},[o]),n(()=>o(),3e4),{health:e,error:s,refetch:o}}function u(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!0),[r,i]=(0,l.useState)(null),c=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{n(!1)}},[]);return(0,l.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:r,refetch:c}}function h(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listAgentVersions(e);s(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{versions:t,loading:n,refresh:i}}function x(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listAgentFiles(e);s(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{files:t,loading:n,refresh:i}}function m(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listEvalCases(e);s(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{cases:t,loading:n,refresh:i}}function f(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listEvalRuns(e);s(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{runs:t,loading:n,refresh:i}}function g(e,t){let[s,n]=(0,l.useState)([]),[r,i]=(0,l.useState)(!0),c=(0,l.useCallback)(async()=>{if(e&&t)try{i(!0);let s=await (0,a.KU)().getEvalRunResults(e,t);n(s)}catch(e){console.error("Failed to fetch eval results:",e)}finally{i(!1)}},[e,t]);return(0,l.useEffect)(()=>{c()},[c]),{results:s,loading:r,refresh:c}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>i,a3:()=>c,cn:()=>n,fw:()=>r});var l=s(6862),a=s(3690);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,a.QP)((0,l.$)(t))}function r(e){let t=Date.now(),s=Math.floor((t-new Date(e).getTime())/1e3);if(s<60)return"".concat(s,"s ago");let l=Math.floor(s/60);if(l<60)return"".concat(l,"m ago");let a=Math.floor(l/60);if(a<24)return"".concat(a,"h ago");let n=Math.floor(a/24);return n<30?"".concat(n,"d ago"):new Date(e).toLocaleDateString()}function i(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function c(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let s=Math.floor(t/60);return"".concat(s,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},2505:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var l=s(534),a=s(1804);let n=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:n,error:r,id:i,...c}=e;return(0,l.jsxs)("div",{className:"space-y-1.5",children:[n&&(0,l.jsx)("label",{htmlFor:i,className:"block text-sm font-medium text-white/70",children:n}),(0,l.jsx)("input",{ref:t,id:i,className:(0,a.cn)("flex h-9 w-full rounded-xl border px-3 py-1 text-sm transition-all duration-200","bg-white/5 border-white/10 text-white placeholder:text-white/40","focus-visible:outline-none focus-visible:border-indigo-500/50 focus-visible:bg-white/10","disabled:cursor-not-allowed disabled:opacity-50",r&&"border-red-500/50 focus-visible:border-red-400",s),...c}),r&&(0,l.jsx)("p",{className:"text-xs text-red-400",children:r})]})});n.displayName="Input"},2625:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var l=s(534),a=s(4166),n=s(989),r=s(3929),i=s(4765),c=s(6719),o=s(2505),d=s(5968),u=s(8314),h=s(7964),x=s(1804),m=s(858),f=s(3);let g=(0,s(8154).A)("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var p=s(7955),y=s(7691),b=s(647),w=s(6650),v=s(599),j=s(8842),N=s(8968),k=s.n(N);function C(){let{agents:e,loading:t,refetch:s}=(0,n._F)(),[o,d]=(0,a.useState)(!1),[x,g]=(0,a.useState)(null),[p,y]=(0,a.useState)(null);async function b(e){y(null);try{await (0,r.KU)().deleteAgent(e),g(null),s()}catch(e){y(e instanceof Error?e.message:"Failed to delete agent"),g(null)}}return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Agents"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Deploy and manage your AI agents"})]}),(0,l.jsxs)(c.$,{onClick:()=>d(!0),children:[(0,l.jsx)(m.A,{className:"h-4 w-4 mr-2"}),"Create Agent"]})]}),p&&(0,l.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-4 py-2",children:p}),t?(0,l.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(e=>(0,l.jsx)(h.X,{height:160},e))}):0===e.length?(0,l.jsx)(u.p,{icon:(0,l.jsx)(f.A,{className:"h-12 w-12"}),title:"No agents yet",description:"Create your first agent to get started. You can upload files or deploy from the CLI.",action:(0,l.jsxs)(c.$,{onClick:()=>d(!0),children:[(0,l.jsx)(m.A,{className:"h-4 w-4 mr-2"}),"Create Agent"]})}):(0,l.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:e.map(e=>(0,l.jsx)(A,{agent:e,onDelete:()=>g(e.name)},e.id||e.name))}),o&&(0,l.jsx)(S,{onClose:()=>d(!1),onCreated:()=>{d(!1),s()}}),x&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,l.jsx)(i.Zp,{className:"w-full max-w-md",children:(0,l.jsxs)(i.Wu,{children:[(0,l.jsx)("h3",{className:"text-lg font-semibold text-white mb-2",children:"Delete Agent"}),(0,l.jsxs)("p",{className:"text-sm text-white/60 mb-6",children:["Are you sure you want to delete ",(0,l.jsx)("span",{className:"text-white font-medium",children:x}),"? This action cannot be undone."]}),(0,l.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,l.jsx)(c.$,{variant:"ghost",onClick:()=>g(null),children:"Cancel"}),(0,l.jsx)(c.$,{variant:"danger",onClick:()=>b(x),children:"Delete"})]})]})})})]})}function A(e){let{agent:t,onDelete:s}=e,[n,r]=(0,a.useState)(!1);return(0,l.jsx)(i.Zp,{className:"relative group",children:(0,l.jsxs)(i.Wu,{children:[(0,l.jsxs)("div",{className:"flex items-start justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)(k(),{href:"/agents/detail?name=".concat(encodeURIComponent(t.name)),children:(0,l.jsx)("h3",{className:"text-sm font-semibold text-white truncate hover:text-indigo-400 transition-colors cursor-pointer",children:t.name})}),t.description&&(0,l.jsx)("p",{className:"text-xs text-white/40 mt-1 line-clamp-2",children:t.description})]}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("button",{onClick:()=>r(!n),className:"p-1 text-white/30 hover:text-white/70 transition-colors rounded",children:(0,l.jsx)(g,{className:"h-4 w-4"})}),n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"fixed inset-0",onClick:()=>r(!1)}),(0,l.jsxs)("div",{className:"absolute right-0 mt-1 w-40 rounded-lg border border-white/10 bg-[#1c2129] shadow-xl z-10 py-1",children:[(0,l.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(t.name),r(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-sm text-white/70 hover:bg-white/5",children:[(0,l.jsx)(p.A,{className:"h-3.5 w-3.5"})," Copy Name"]}),(0,l.jsxs)("button",{onClick:()=>{r(!1),s()},className:"flex w-full items-center gap-2 px-3 py-2 text-sm text-red-400 hover:bg-red-500/10",children:[(0,l.jsx)(y.A,{className:"h-3.5 w-3.5"})," Delete"]})]})]})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 mt-3",children:[t.model&&(0,l.jsx)(d.E,{variant:"info",children:t.model}),t.status&&(0,l.jsx)(d.W,{status:t.status})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-3 border-t border-white/5",children:[(0,l.jsx)("span",{className:"text-xs text-white/30",children:t.createdAt?(0,x.fw)(t.createdAt):"Unknown"}),(0,l.jsx)("div",{className:"flex items-center gap-2",children:(0,l.jsxs)(k(),{href:"/playground?agent=".concat(t.slug||t.name),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-indigo-500/10 text-indigo-400 hover:bg-indigo-500/20 transition-colors",children:[(0,l.jsx)(b.A,{className:"h-3 w-3"}),"Try"]})})]})]})})}function S(e){let{onClose:t,onCreated:s}=e,[n,d]=(0,a.useState)("upload"),[u,h]=(0,a.useState)(""),[x,m]=(0,a.useState)(""),[f,g]=(0,a.useState)(""),[p,y]=(0,a.useState)([]),[b,N]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),A=(0,a.useRef)(null),S=(0,a.useCallback)(async e=>{let t=[],s=["node_modules/",".git/","__pycache__/",".venv/",".DS_Store"];for(let l of Array.from(e)){let e=l.webkitRelativePath||l.name;if(s.some(t=>e.includes(t)))continue;let a=await l.text();t.push({path:e,content:a})}y(t)},[]);async function E(){if(!u.trim())return void C("Agent name is required");N(!0),C(null);try{await (0,r.KU)().createAgent(u.trim(),{systemPrompt:f||void 0,files:p.length>0?p:void 0}),s()}catch(e){C(e instanceof Error?e.message:"Failed to create agent")}finally{N(!1)}}return(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,l.jsx)(i.Zp,{className:"w-full max-w-lg max-h-[90vh] overflow-auto",children:(0,l.jsxs)(i.Wu,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Create Agent"}),(0,l.jsx)("button",{onClick:t,className:"text-white/40 hover:text-white",children:(0,l.jsx)(w.A,{className:"h-5 w-5"})})]}),(0,l.jsxs)("div",{className:"flex gap-1 p-1 bg-white/5 rounded-lg mb-6",children:[(0,l.jsxs)("button",{onClick:()=>d("upload"),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm font-medium rounded-md transition-colors ".concat("upload"===n?"bg-white/10 text-white":"text-white/50 hover:text-white"),children:[(0,l.jsx)(v.A,{className:"h-4 w-4"})," Upload"]}),(0,l.jsxs)("button",{onClick:()=>d("cli"),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm font-medium rounded-md transition-colors ".concat("cli"===n?"bg-white/10 text-white":"text-white/50 hover:text-white"),children:[(0,l.jsx)(j.A,{className:"h-4 w-4"})," CLI"]})]}),"upload"===n?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)(o.p,{label:"Name",placeholder:"my-agent",value:u,onChange:e=>h(e.target.value)}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-white/70",children:"System Prompt (optional)"}),(0,l.jsx)("textarea",{value:f,onChange:e=>g(e.target.value),rows:3,placeholder:"You are a helpful assistant...",className:"flex w-full rounded-xl border px-3 py-2 text-sm bg-white/5 border-white/10 text-white placeholder:text-white/40 focus-visible:outline-none focus-visible:border-indigo-500/50 resize-none"})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-white/70",children:"Agent Files (optional)"}),(0,l.jsxs)("div",{onClick:()=>{var e;return null==(e=A.current)?void 0:e.click()},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.files.length>0&&S(e.dataTransfer.files)},className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-white/10 py-8 cursor-pointer hover:border-white/20 hover:bg-white/[0.02] transition-colors",children:[(0,l.jsx)(v.A,{className:"h-8 w-8 text-white/20 mb-2"}),(0,l.jsx)("p",{className:"text-sm text-white/40",children:"Drop files or click to upload"}),(0,l.jsx)("p",{className:"text-xs text-white/20 mt-1",children:"CLAUDE.md, tools, and agent source files"})]}),(0,l.jsx)("input",{ref:A,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&S(e.target.files)}}),p.length>0&&(0,l.jsxs)("p",{className:"text-xs text-white/50",children:[p.length," file",1!==p.length?"s":""," selected"]})]}),k&&(0,l.jsx)("p",{className:"text-sm text-red-400",children:k}),(0,l.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,l.jsx)(c.$,{variant:"ghost",onClick:t,children:"Cancel"}),(0,l.jsx)(c.$,{onClick:E,disabled:b,children:b?"Creating...":"Create Agent"})]})]}):(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("p",{className:"text-sm text-white/60",children:"Deploy an agent from your local machine using the Ash CLI:"}),(0,l.jsxs)("div",{className:"rounded-lg bg-black/30 p-4 font-mono text-sm text-white/80",children:[(0,l.jsx)("div",{className:"text-white/40 mb-2",children:"# Install the CLI"}),(0,l.jsx)("div",{children:"npm install -g @ash-ai/cli"}),(0,l.jsx)("div",{className:"text-white/40 mt-4 mb-2",children:"# Deploy an agent"}),(0,l.jsx)("div",{children:"ash deploy ./my-agent --name my-agent"})]}),(0,l.jsx)("div",{className:"flex justify-end pt-2",children:(0,l.jsx)(c.$,{variant:"ghost",onClick:t,children:"Close"})})]})]})})})}},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>c,ZB:()=>i,Zp:()=>n,aR:()=>r});var l=s(534),a=s(1804);function n(e){let{children:t,className:s}=e;return(0,l.jsx)("div",{className:(0,a.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function r(e){let{children:t,className:s}=e;return(0,l.jsx)("div",{className:(0,a.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",s),children:t})}function i(e){let{children:t,className:s}=e;return(0,l.jsx)("h3",{className:(0,a.cn)("text-lg font-semibold leading-none tracking-tight text-white",s),children:t})}function c(e){let{children:t,className:s}=e;return(0,l.jsx)("div",{className:(0,a.cn)("p-4 sm:p-6",s),children:t})}},5373:(e,t,s)=>{Promise.resolve().then(s.bind(s,2625))},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>r,W:()=>i});var l=s(534),a=s(1804);let n={default:"bg-white/10 text-white/70 border border-white/10",success:"bg-green-500/20 text-green-400 border border-green-500/30",warning:"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",error:"bg-red-500/20 text-red-400 border border-red-500/30",info:"bg-blue-500/20 text-blue-400 border border-blue-500/30"};function r(e){let{children:t,variant:s="default",className:r}=e;return(0,l.jsx)("span",{className:(0,a.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",n[s],r),children:t})}function i(e){let{status:t}=e;return(0,l.jsx)(r,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},6650:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},6719:(e,t,s)=>{"use strict";s.d(t,{$:()=>c});var l=s(534),a=s(1804),n=s(4166);let r={primary:"bg-indigo-500 text-white font-medium hover:bg-indigo-400",secondary:"border border-white/20 bg-white/5 text-white hover:bg-white/10 hover:border-white/30",ghost:"text-white/70 hover:text-white hover:bg-white/10",danger:"bg-red-500/20 text-red-400 border border-red-500/30 hover:bg-red-500/30"},i={sm:"h-8 px-3 text-xs rounded-lg",md:"h-9 px-4 text-sm rounded-xl",lg:"h-10 px-6 text-sm rounded-xl"},c=(0,n.forwardRef)((e,t)=>{let{className:s,variant:n="primary",size:c="md",disabled:o,...d}=e;return(0,l.jsx)("button",{ref:t,className:(0,a.cn)("inline-flex items-center justify-center font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50","disabled:pointer-events-none disabled:opacity-50",r[n],i[c],s),disabled:o,...d})});c.displayName="Button"},7691:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},7955:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>n});var l=s(534),a=s(1804);function n(e){let{width:t="100%",height:s=100,className:n}=e;return(0,l.jsx)("div",{className:(0,a.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",n),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8314:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var l=s(534),a=s(1804);function n(e){let{icon:t,title:s,description:n,action:r,className:i}=e;return(0,l.jsxs)("div",{className:(0,a.cn)("flex flex-col items-center justify-center py-16 text-center",i),children:[t&&(0,l.jsx)("div",{className:"mb-4 text-white/30",children:t}),(0,l.jsx)("h3",{className:"text-lg font-semibold text-white",children:s}),(0,l.jsx)("p",{className:"mt-1 max-w-sm text-sm text-white/50",children:n}),r&&(0,l.jsx)("div",{className:"mt-4",children:r})]})}},8842:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=5373)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[955],{858:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>d,_F:()=>c,_o:()=>x,aA:()=>h,aX:()=>u,l3:()=>m,te:()=>o,xV:()=>b,yu:()=>f});var a=s(4166),l=s(3929);function n(e,t){let s=(0,a.useRef)(e);(0,a.useEffect)(()=>{s.current=e},[e]),(0,a.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function r(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function i(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function c(){let e=r("ash:agents"),[t,s]=(0,a.useState)(null!=e?e:[]),[n,c]=(0,a.useState)(!e),[o,d]=(0,a.useState)(null),u=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().listAgents();s(e),i("ash:agents",e),d(null)}catch(e){d(e)}finally{c(!1)}},[]);return(0,a.useEffect)(()=>{u()},[u]),{agents:t,loading:n,error:o,refetch:u}}function o(e){var t;let s="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),c=r(s),[o,d]=(0,a.useState)(null!=c?c:[]),[u,h]=(0,a.useState)(!c),[x,m]=(0,a.useState)(null),f=(0,a.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);d(t),i(s,t),m(null)}catch(e){m(e)}finally{h(!1)}},[null==e?void 0:e.agent,s]);return(0,a.useEffect)(()=>{f()},[f]),n(()=>f(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:o,loading:u,error:x,refetch:f}}function d(){let[e,t]=(0,a.useState)(()=>r("ash:health")),[s,c]=(0,a.useState)(null),o=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),c(null),i("ash:health",e)}catch(e){c(e)}},[]);return(0,a.useEffect)(()=>{o()},[o]),n(()=>o(),3e4),{health:e,error:s,refetch:o}}function u(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!0),[r,i]=(0,a.useState)(null),c=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:r,refetch:c}}function h(e){let[t,s]=(0,a.useState)([]),[n,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listAgentVersions(e);s(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{versions:t,loading:n,refresh:i}}function x(e){let[t,s]=(0,a.useState)([]),[n,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listAgentFiles(e);s(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{files:t,loading:n,refresh:i}}function m(e){let[t,s]=(0,a.useState)([]),[n,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listEvalCases(e);s(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{cases:t,loading:n,refresh:i}}function f(e){let[t,s]=(0,a.useState)([]),[n,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,l.KU)().listEvalRuns(e);s(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{runs:t,loading:n,refresh:i}}function b(e,t){let[s,n]=(0,a.useState)([]),[r,i]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{if(e&&t)try{i(!0);let s=await (0,l.KU)().getEvalRunResults(e,t);n(s)}catch(e){console.error("Failed to fetch eval results:",e)}finally{i(!1)}},[e,t]);return(0,a.useEffect)(()=>{c()},[c]),{results:s,loading:r,refresh:c}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>i,a3:()=>c,cn:()=>n,fw:()=>r});var a=s(6862),l=s(3690);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,l.QP)((0,a.$)(t))}function r(e){let t=Date.now(),s=Math.floor((t-new Date(e).getTime())/1e3);if(s<60)return"".concat(s,"s ago");let a=Math.floor(s/60);if(a<60)return"".concat(a,"m ago");let l=Math.floor(a/60);if(l<24)return"".concat(l,"h ago");let n=Math.floor(l/24);return n<30?"".concat(n,"d ago"):new Date(e).toLocaleDateString()}function i(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function c(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let s=Math.floor(t/60);return"".concat(s,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},2505:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var a=s(534),l=s(1804);let n=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:n,error:r,id:i,...c}=e;return(0,a.jsxs)("div",{className:"space-y-1.5",children:[n&&(0,a.jsx)("label",{htmlFor:i,className:"block text-sm font-medium text-white/70",children:n}),(0,a.jsx)("input",{ref:t,id:i,className:(0,l.cn)("flex h-9 w-full rounded-xl border px-3 py-1 text-sm transition-all duration-200","bg-white/5 border-white/10 text-white placeholder:text-white/40","focus-visible:outline-none focus-visible:border-indigo-500/50 focus-visible:bg-white/10","disabled:cursor-not-allowed disabled:opacity-50",r&&"border-red-500/50 focus-visible:border-red-400",s),...c}),r&&(0,a.jsx)("p",{className:"text-xs text-red-400",children:r})]})});n.displayName="Input"},2737:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},4275:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>c,ZB:()=>i,Zp:()=>n,aR:()=>r});var a=s(534),l=s(1804);function n(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function r(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",s),children:t})}function i(e){let{children:t,className:s}=e;return(0,a.jsx)("h3",{className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight text-white",s),children:t})}function c(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("p-4 sm:p-6",s),children:t})}},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>r,W:()=>i});var a=s(534),l=s(1804);let n={default:"bg-white/10 text-white/70 border border-white/10",success:"bg-green-500/20 text-green-400 border border-green-500/30",warning:"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",error:"bg-red-500/20 text-red-400 border border-red-500/30",info:"bg-blue-500/20 text-blue-400 border border-blue-500/30"};function r(e){let{children:t,variant:s="default",className:r}=e;return(0,a.jsx)("span",{className:(0,l.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",n[s],r),children:t})}function i(e){let{status:t}=e;return(0,a.jsx)(r,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},6379:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},6650:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},6719:(e,t,s)=>{"use strict";s.d(t,{$:()=>c});var a=s(534),l=s(1804),n=s(4166);let r={primary:"bg-indigo-500 text-white font-medium hover:bg-indigo-400",secondary:"border border-white/20 bg-white/5 text-white hover:bg-white/10 hover:border-white/30",ghost:"text-white/70 hover:text-white hover:bg-white/10",danger:"bg-red-500/20 text-red-400 border border-red-500/30 hover:bg-red-500/30"},i={sm:"h-8 px-3 text-xs rounded-lg",md:"h-9 px-4 text-sm rounded-xl",lg:"h-10 px-6 text-sm rounded-xl"},c=(0,n.forwardRef)((e,t)=>{let{className:s,variant:n="primary",size:c="md",disabled:o,...d}=e;return(0,a.jsx)("button",{ref:t,className:(0,l.cn)("inline-flex items-center justify-center font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50","disabled:pointer-events-none disabled:opacity-50",r[n],i[c],s),disabled:o,...d})});c.displayName="Button"},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>n});var a=s(534),l=s(1804);function n(e){let{width:t="100%",height:s=100,className:n}=e;return(0,a.jsx)("div",{className:(0,l.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",n),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8314:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var a=s(534),l=s(1804);function n(e){let{icon:t,title:s,description:n,action:r,className:i}=e;return(0,a.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center justify-center py-16 text-center",i),children:[t&&(0,a.jsx)("div",{className:"mb-4 text-white/30",children:t}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:s}),(0,a.jsx)("p",{className:"mt-1 max-w-sm text-sm text-white/50",children:n}),r&&(0,a.jsx)("div",{className:"mt-4",children:r})]})}},8408:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(8154).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},8497:(e,t,s)=>{Promise.resolve().then(s.bind(s,9107))},9107:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var a=s(534),l=s(4166),n=s(9197),r=s(8968),i=s.n(r),c=s(989),o=s(3929),d=s(4765),u=s(6719),h=s(2505),x=s(5968),m=s(8314),f=s(7964),b=s(1804),g=s(4275),v=s(858),p=s(2737),w=s(6379),y=s(8408),j=s(6650);function N(){let e=(0,n.useSearchParams)().get("name"),{versions:t,loading:s,refresh:r}=(0,c.aA)(e),[h,j]=(0,l.useState)(!1),[N,S]=(0,l.useState)(null),[C,A]=(0,l.useState)(null);async function E(t){if(e){S(t),A(null);try{await (0,o.KU)().activateAgentVersion(e,t),r()}catch(e){A(e instanceof Error?e.message:"Failed to activate version")}finally{S(null)}}}return e?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(i(),{href:"/agents/detail?name=".concat(encodeURIComponent(e)),className:"inline-flex items-center gap-1.5 text-sm text-white/50 hover:text-white transition-colors",children:[(0,a.jsx)(g.A,{className:"h-4 w-4"}),"Back to ",e]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Versions"}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-white/50",children:["Manage versions for ",(0,a.jsx)("span",{className:"text-white/70",children:e})]})]}),(0,a.jsxs)(u.$,{onClick:()=>j(!0),children:[(0,a.jsx)(v.A,{className:"h-4 w-4 mr-2"}),"Create Version"]})]}),C&&(0,a.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-4 py-2",children:C}),s?(0,a.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,a.jsx)(f.X,{height:80},e))}):0===t.length?(0,a.jsx)(m.p,{icon:(0,a.jsx)(p.A,{className:"h-12 w-12"}),title:"No versions yet",description:"Create your first version to snapshot the agent's configuration.",action:(0,a.jsxs)(u.$,{onClick:()=>j(!0),children:[(0,a.jsx)(v.A,{className:"h-4 w-4 mr-2"}),"Create Version"]})}):(0,a.jsx)("div",{className:"space-y-3",children:t.map(e=>(0,a.jsx)(d.Zp,{children:(0,a.jsx)(d.Wu,{children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-white",children:["v",e.versionNumber]}),e.name&&(0,a.jsx)("span",{className:"text-sm text-white/50",children:e.name}),e.isActive&&(0,a.jsxs)(x.E,{variant:"success",children:[(0,a.jsx)(w.A,{className:"h-3 w-3 mr-1"}),"Active"]})]}),e.releaseNotes&&(0,a.jsx)("p",{className:"text-xs text-white/40 mt-1",children:e.releaseNotes}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,a.jsx)("span",{className:"text-xs text-white/30",children:(0,b.fw)(e.createdAt)}),e.systemPrompt&&(0,a.jsx)("span",{className:"text-xs text-white/30",children:"Has system prompt"}),e.knowledgeFiles&&e.knowledgeFiles.length>0&&(0,a.jsxs)("span",{className:"text-xs text-white/30",children:[e.knowledgeFiles.length," knowledge file",1!==e.knowledgeFiles.length?"s":""]})]})]}),!e.isActive&&(0,a.jsxs)(u.$,{variant:"secondary",size:"sm",onClick:()=>E(e.versionNumber),disabled:N===e.versionNumber,children:[N===e.versionNumber?(0,a.jsx)(y.A,{className:"h-3 w-3 animate-spin mr-1"}):(0,a.jsx)(w.A,{className:"h-3 w-3 mr-1"}),"Activate"]})]})})},e.id))}),h&&(0,a.jsx)(k,{agentName:e,onClose:()=>j(!1),onCreated:()=>{j(!1),r()}})]}):(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("p",{className:"text-white/50",children:"No agent name specified."}),(0,a.jsx)(i(),{href:"/agents",className:"text-indigo-400 hover:text-indigo-300 text-sm mt-2 inline-block",children:"Back to agents"})]})}function k(e){let{agentName:t,onClose:s,onCreated:n}=e,[r,i]=(0,l.useState)(""),[c,x]=(0,l.useState)(""),[m,f]=(0,l.useState)(""),[b,g]=(0,l.useState)(!1),[v,p]=(0,l.useState)(null);async function w(){g(!0),p(null);try{await (0,o.KU)().createAgentVersion(t,{name:r||void 0,systemPrompt:c||void 0,releaseNotes:m||void 0}),n()}catch(e){p(e instanceof Error?e.message:"Failed to create version")}finally{g(!1)}}return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,a.jsx)(d.Zp,{className:"w-full max-w-lg max-h-[90vh] overflow-auto",children:(0,a.jsxs)(d.Wu,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Create Version"}),(0,a.jsx)("button",{onClick:s,className:"text-white/40 hover:text-white",children:(0,a.jsx)(j.A,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(h.p,{label:"Version Name (optional)",placeholder:"e.g. v2 - improved grounding",value:r,onChange:e=>i(e.target.value)}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-white/70",children:"System Prompt (optional)"}),(0,a.jsx)("textarea",{value:c,onChange:e=>x(e.target.value),rows:4,placeholder:"System prompt for this version...",className:"flex w-full rounded-xl border px-3 py-2 text-sm bg-white/5 border-white/10 text-white placeholder:text-white/40 focus-visible:outline-none focus-visible:border-indigo-500/50 resize-none"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-white/70",children:"Release Notes (optional)"}),(0,a.jsx)("textarea",{value:m,onChange:e=>f(e.target.value),rows:2,placeholder:"What changed in this version...",className:"flex w-full rounded-xl border px-3 py-2 text-sm bg-white/5 border-white/10 text-white placeholder:text-white/40 focus-visible:outline-none focus-visible:border-indigo-500/50 resize-none"})]}),v&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:v}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,a.jsx)(u.$,{variant:"ghost",onClick:s,children:"Cancel"}),(0,a.jsx)(u.$,{onClick:w,disabled:b,children:b?"Creating...":"Create Version"})]})]})]})})})}function S(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(f.X,{height:200}),children:(0,a.jsx)(N,{})})}},9197:(e,t,s)=>{"use strict";var a=s(4841);s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})}},e=>{e.O(0,[513,53,839,929,705,522,358],()=>e(e.s=8497)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[745],{989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>u,_F:()=>c,_o:()=>x,aA:()=>d,aX:()=>h,l3:()=>f,te:()=>o,xV:()=>p,yu:()=>m});var l=s(4166),a=s(3929);function n(e,t){let s=(0,l.useRef)(e);(0,l.useEffect)(()=>{s.current=e},[e]),(0,l.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function r(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function i(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function c(){let e=r("ash:agents"),[t,s]=(0,l.useState)(null!=e?e:[]),[n,c]=(0,l.useState)(!e),[o,u]=(0,l.useState)(null),h=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().listAgents();s(e),i("ash:agents",e),u(null)}catch(e){u(e)}finally{c(!1)}},[]);return(0,l.useEffect)(()=>{h()},[h]),{agents:t,loading:n,error:o,refetch:h}}function o(e){var t;let s="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),c=r(s),[o,u]=(0,l.useState)(null!=c?c:[]),[h,d]=(0,l.useState)(!c),[x,f]=(0,l.useState)(null),m=(0,l.useCallback)(async()=>{try{let t=await (0,a.KU)().listSessions(null==e?void 0:e.agent);u(t),i(s,t),f(null)}catch(e){f(e)}finally{d(!1)}},[null==e?void 0:e.agent,s]);return(0,l.useEffect)(()=>{m()},[m]),n(()=>m(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:o,loading:h,error:x,refetch:m}}function u(){let[e,t]=(0,l.useState)(()=>r("ash:health")),[s,c]=(0,l.useState)(null),o=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().health();t(e),c(null),i("ash:health",e)}catch(e){c(e)}},[]);return(0,l.useEffect)(()=>{o()},[o]),n(()=>o(),3e4),{health:e,error:s,refetch:o}}function h(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!0),[r,i]=(0,l.useState)(null),c=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{n(!1)}},[]);return(0,l.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:r,refetch:c}}function d(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listAgentVersions(e);s(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{versions:t,loading:n,refresh:i}}function x(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listAgentFiles(e);s(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{files:t,loading:n,refresh:i}}function f(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listEvalCases(e);s(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{cases:t,loading:n,refresh:i}}function m(e){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),i=(0,l.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,a.KU)().listEvalRuns(e);s(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{r(!1)}},[e]);return(0,l.useEffect)(()=>{i()},[i]),{runs:t,loading:n,refresh:i}}function p(e,t){let[s,n]=(0,l.useState)([]),[r,i]=(0,l.useState)(!0),c=(0,l.useCallback)(async()=>{if(e&&t)try{i(!0);let s=await (0,a.KU)().getEvalRunResults(e,t);n(s)}catch(e){console.error("Failed to fetch eval results:",e)}finally{i(!1)}},[e,t]);return(0,l.useEffect)(()=>{c()},[c]),{results:s,loading:r,refresh:c}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>i,a3:()=>c,cn:()=>n,fw:()=>r});var l=s(6862),a=s(3690);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,a.QP)((0,l.$)(t))}function r(e){let t=Date.now(),s=Math.floor((t-new Date(e).getTime())/1e3);if(s<60)return"".concat(s,"s ago");let l=Math.floor(s/60);if(l<60)return"".concat(l,"m ago");let a=Math.floor(l/60);if(a<24)return"".concat(a,"h ago");let n=Math.floor(a/24);return n<30?"".concat(n,"d ago"):new Date(e).toLocaleDateString()}function i(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function c(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let s=Math.floor(t/60);return"".concat(s,"h ").concat(t%60,"m")}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},1924:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},3238:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},4195:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>c,ZB:()=>i,Zp:()=>n,aR:()=>r});var l=s(534),a=s(1804);function n(e){let{children:t,className:s}=e;return(0,l.jsx)("div",{className:(0,a.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function r(e){let{children:t,className:s}=e;return(0,l.jsx)("div",{className:(0,a.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",s),children:t})}function i(e){let{children:t,className:s}=e;return(0,l.jsx)("h3",{className:(0,a.cn)("text-lg font-semibold leading-none tracking-tight text-white",s),children:t})}function c(e){let{children:t,className:s}=e;return(0,l.jsx)("div",{className:(0,a.cn)("p-4 sm:p-6",s),children:t})}},6664:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(8154).A)("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]])},6813:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>f});var l=s(534),a=s(4166),n=s(989),r=s(3929),i=s(4765),c=s(7964),o=s(1804),u=s(4195),h=s(3238),d=s(6664),x=s(1924);function f(){let[e,t]=(0,a.useState)("7d"),{agents:s}=(0,n._F)(),{sessions:f}=(0,n.te)({autoRefresh:!1}),[p,y]=(0,a.useState)([]),[g,w]=(0,a.useState)(!0),[v,j]=(0,a.useState)({sessions:0,tokens:0,toolCalls:0,computeSeconds:0});return(0,a.useEffect)(()=>{async function t(){w(!0),function(e){let t=new Date;t.setDate(t.getDate()-("7d"===e?7:"30d"===e?30:90)),t.toISOString()}(e);let t=(0,r.KU)();try{let e=await t.getUsageStats({}).catch(()=>null);e&&j({sessions:f.length,tokens:(e.totalInputTokens||0)+(e.totalOutputTokens||0),toolCalls:e.totalToolCalls||0,computeSeconds:e.totalComputeSeconds||0});let l=[];for(let e of s.slice(0,10))try{let s=await t.getUsageStats({agentName:e.name}),a=f.filter(t=>t.agentName===e.name);l.push({name:e.name,sessions:a.length,inputTokens:(null==s?void 0:s.totalInputTokens)||0,outputTokens:(null==s?void 0:s.totalOutputTokens)||0,toolCalls:(null==s?void 0:s.totalToolCalls)||0,computeSeconds:(null==s?void 0:s.totalComputeSeconds)||0})}catch(t){l.push({name:e.name,sessions:0,inputTokens:0,outputTokens:0,toolCalls:0,computeSeconds:0})}l.sort((e,t)=>t.sessions-e.sessions),y(l)}catch(e){}finally{w(!1)}}s.length>0?t():w(!1)},[e,s,f]),(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Analytics"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Usage and performance metrics"})]}),(0,l.jsx)("div",{className:"flex gap-1 p-1 bg-white/5 rounded-lg",children:["7d","30d","90d"].map(s=>(0,l.jsx)("button",{onClick:()=>t(s),className:"px-3 py-1.5 text-sm font-medium rounded-md transition-colors ".concat(e===s?"bg-white/10 text-white":"text-white/40 hover:text-white/70"),children:s},s))})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,l.jsx)(m,{icon:(0,l.jsx)(u.A,{className:"h-5 w-5"}),label:"Sessions",value:g?"-":v.sessions.toString()}),(0,l.jsx)(m,{icon:(0,l.jsx)(h.A,{className:"h-5 w-5"}),label:"Total Tokens",value:g?"-":(0,o.ZV)(v.tokens)}),(0,l.jsx)(m,{icon:(0,l.jsx)(d.A,{className:"h-5 w-5"}),label:"Tool Calls",value:g?"-":(0,o.ZV)(v.toolCalls)}),(0,l.jsx)(m,{icon:(0,l.jsx)(x.A,{className:"h-5 w-5"}),label:"Compute Time",value:g?"-":(0,o.a3)(v.computeSeconds)})]}),(0,l.jsxs)(i.Zp,{children:[(0,l.jsx)(i.aR,{children:(0,l.jsx)(i.ZB,{children:"Top Agents"})}),(0,l.jsx)(i.Wu,{className:"p-0",children:g?(0,l.jsx)("div",{className:"p-4 space-y-2",children:[1,2,3].map(e=>(0,l.jsx)(c.X,{height:40},e))}):0===p.length?(0,l.jsx)("p",{className:"text-sm text-white/40 text-center py-8",children:"No usage data for this period"}):(0,l.jsxs)("table",{className:"w-full text-sm",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"border-b border-white/10",children:[(0,l.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Agent"}),(0,l.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Sessions"}),(0,l.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Tokens"}),(0,l.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Tool Calls"}),(0,l.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Compute"})]})}),(0,l.jsx)("tbody",{className:"divide-y divide-white/5",children:p.map(e=>(0,l.jsxs)("tr",{className:"hover:bg-white/[0.02]",children:[(0,l.jsx)("td",{className:"px-6 py-3 text-white/80 font-medium",children:e.name}),(0,l.jsx)("td",{className:"px-6 py-3 text-right text-white/60",children:e.sessions}),(0,l.jsx)("td",{className:"px-6 py-3 text-right text-white/60",children:(0,o.ZV)(e.inputTokens+e.outputTokens)}),(0,l.jsx)("td",{className:"px-6 py-3 text-right text-white/60",children:e.toolCalls}),(0,l.jsx)("td",{className:"px-6 py-3 text-right text-white/60",children:(0,o.a3)(e.computeSeconds)})]},e.name))})]})})]})]})}function m(e){let{icon:t,label:s,value:a}=e;return(0,l.jsx)(i.Zp,{children:(0,l.jsx)(i.Wu,{children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm text-white/50",children:s}),(0,l.jsx)("p",{className:"text-2xl font-bold text-white mt-1",children:a})]}),(0,l.jsx)("div",{className:"text-white/20",children:t})]})})})}},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>n});var l=s(534),a=s(1804);function n(e){let{width:t="100%",height:s=100,className:n}=e;return(0,l.jsx)("div",{className:(0,a.cn)("rounded-xl","bg-gradient-to-r from-white/5 via-white/10 to-white/5","bg-[length:200%_100%]","animate-[shimmer_1.5s_ease-in-out_infinite]",n),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8154:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var l=s(4166);let a=function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let r=(0,l.forwardRef)((e,t)=>{let{color:s="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:o="",children:u,iconNode:h,...d}=e;return(0,l.createElement)("svg",{ref:t,...n,width:r,height:r,stroke:s,strokeWidth:c?24*Number(i)/Number(r):i,className:a("lucide",o),...d},[...h.map(e=>{let[t,s]=e;return(0,l.createElement)(t,s)}),...Array.isArray(u)?u:[u]])}),i=(e,t)=>{let s=(0,l.forwardRef)((s,n)=>{let{className:i,...c}=s;return(0,l.createElement)(r,{ref:n,iconNode:t,className:a("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),i),...c})});return s.displayName="".concat(e),s}},8593:(e,t,s)=>{Promise.resolve().then(s.bind(s,6813))}},e=>{e.O(0,[513,53,929,705,522,358],()=>e(e.s=8593)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{989:(e,t,l)=>{"use strict";l.d(t,{Wz:()=>u,_F:()=>o,_o:()=>d,aA:()=>h,aX:()=>f,l3:()=>x,te:()=>c,xV:()=>b,yu:()=>g});var a=l(4166),n=l(3929);function s(e,t){let l=(0,a.useRef)(e);(0,a.useEffect)(()=>{l.current=e},[e]),(0,a.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>l.current(),t);return()=>clearInterval(e)},[t])}function r(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}function i(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}function o(){let e=r("ash:agents"),[t,l]=(0,a.useState)(null!=e?e:[]),[s,o]=(0,a.useState)(!e),[c,u]=(0,a.useState)(null),f=(0,a.useCallback)(async()=>{try{let e=await (0,n.KU)().listAgents();l(e),i("ash:agents",e),u(null)}catch(e){u(e)}finally{o(!1)}},[]);return(0,a.useEffect)(()=>{f()},[f]),{agents:t,loading:s,error:c,refetch:f}}function c(e){var t;let l="ash:sessions:".concat(null!=(t=null==e?void 0:e.agent)?t:"all"),o=r(l),[c,u]=(0,a.useState)(null!=o?o:[]),[f,h]=(0,a.useState)(!o),[d,x]=(0,a.useState)(null),g=(0,a.useCallback)(async()=>{try{let t=await (0,n.KU)().listSessions(null==e?void 0:e.agent);u(t),i(l,t),x(null)}catch(e){x(e)}finally{h(!1)}},[null==e?void 0:e.agent,l]);return(0,a.useEffect)(()=>{g()},[g]),s(()=>g(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:c,loading:f,error:d,refetch:g}}function u(){let[e,t]=(0,a.useState)(()=>r("ash:health")),[l,o]=(0,a.useState)(null),c=(0,a.useCallback)(async()=>{try{let e=await (0,n.KU)().health();t(e),o(null),i("ash:health",e)}catch(e){o(e)}},[]);return(0,a.useEffect)(()=>{c()},[c]),s(()=>c(),3e4),{health:e,error:l,refetch:c}}function f(){let[e,t]=(0,a.useState)([]),[l,s]=(0,a.useState)(!0),[r,i]=(0,a.useState)(null),o=(0,a.useCallback)(async()=>{try{let e=await (0,n.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{s(!1)}},[]);return(0,a.useEffect)(()=>{o()},[o]),{credentials:e,loading:l,error:r,refetch:o}}function h(e){let[t,l]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,n.KU)().listAgentVersions(e);l(t)}catch(e){console.error("Failed to fetch versions:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{versions:t,loading:s,refresh:i}}function d(e){let[t,l]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,n.KU)().listAgentFiles(e);l(t.files)}catch(e){console.error("Failed to fetch files:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{files:t,loading:s,refresh:i}}function x(e){let[t,l]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,n.KU)().listEvalCases(e);l(t)}catch(e){console.error("Failed to fetch eval cases:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{cases:t,loading:s,refresh:i}}function g(e){let[t,l]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),i=(0,a.useCallback)(async()=>{if(e)try{r(!0);let t=await (0,n.KU)().listEvalRuns(e);l(t)}catch(e){console.error("Failed to fetch eval runs:",e)}finally{r(!1)}},[e]);return(0,a.useEffect)(()=>{i()},[i]),{runs:t,loading:s,refresh:i}}function b(e,t){let[l,s]=(0,a.useState)([]),[r,i]=(0,a.useState)(!0),o=(0,a.useCallback)(async()=>{if(e&&t)try{i(!0);let l=await (0,n.KU)().getEvalRunResults(e,t);s(l)}catch(e){console.error("Failed to fetch eval results:",e)}finally{i(!1)}},[e,t]);return(0,a.useEffect)(()=>{o()},[o]),{results:l,loading:r,refresh:o}}},1804:(e,t,l)=>{"use strict";l.d(t,{Ct:()=>c,ZV:()=>i,a3:()=>o,cn:()=>s,fw:()=>r});var a=l(6862),n=l(3690);function s(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return(0,n.QP)((0,a.$)(t))}function r(e){let t=Date.now(),l=Math.floor((t-new Date(e).getTime())/1e3);if(l<60)return"".concat(l,"s ago");let a=Math.floor(l/60);if(a<60)return"".concat(a,"m ago");let n=Math.floor(a/60);if(n<24)return"".concat(n,"h ago");let s=Math.floor(n/24);return s<30?"".concat(s,"d ago"):new Date(e).toLocaleDateString()}function i(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString()}function o(e){if(e<60)return"".concat(e.toFixed(1),"s");let t=Math.floor(e/60);if(t<60)return"".concat(t,"m ").concat(Math.floor(e%60),"s");let l=Math.floor(t/60);return"".concat(l,"h ").concat(t%60,"m")}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},2553:(e,t,l)=>{"use strict";l.d(t,{DashboardNav:()=>w});var a=l(534),n=l(8968),s=l.n(n),r=l(9197),i=l(1804),o=l(989),c=l(8785),u=l(647),f=l(3),h=l(4195),d=l(7413),x=l(2087),g=l(5689),b=l(4193),m=l(8530);let v=[{href:"/",label:"Dashboard",icon:c.A},{href:"/playground",label:"Playground",icon:u.A},{href:"/agents",label:"Agents",icon:f.A},{href:"/sessions",label:"Sessions",icon:h.A},{href:"/logs",label:"Logs",icon:d.A},{href:"/analytics",label:"Analytics",icon:x.A}],y=[{href:"/settings/api-keys",label:"API Keys",icon:g.A},{href:"/settings/credentials",label:"Credentials",icon:b.A},{href:"/queue",label:"Queue",icon:m.A}];function w(e){let{extraItems:t,extraBottomLinks:l,branding:n}=e,c=(0,r.usePathname)(),{health:u}=(0,o.Wz)(),f=t?[...v,...t]:v,h=l?[...y,...l]:y,d=(null==u?void 0:u.status)==="ok";return(0,a.jsxs)("nav",{className:"fixed inset-y-0 left-0 z-50 w-64 flex flex-col border-r border-white/10 bg-[#0d1117]",children:[(0,a.jsxs)("div",{className:"flex h-16 items-center gap-3 px-5 border-b border-white/10",children:[(0,a.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-indigo-500",children:(0,a.jsx)("span",{className:"text-sm font-bold text-white",children:"A"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-white font-bold tracking-tight block",children:n||"Ash"}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-white/40 text-xs font-mono",children:[(0,a.jsx)("span",{className:(0,i.cn)("w-1.5 h-1.5 rounded-full",d?"bg-green-400 animate-pulse":"bg-red-400")}),d?"ONLINE":"OFFLINE"]})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-auto px-3 py-4 scrollbar-thin",children:(0,a.jsx)("div",{className:"space-y-0.5",children:f.map(e=>{let t=c===e.href||"/"!==e.href&&c.startsWith(e.href);return(0,a.jsxs)(s(),{href:e.href,className:(0,i.cn)("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200",t?"bg-indigo-500/10 text-indigo-400 border border-indigo-500/30":"text-white/60 hover:text-white hover:bg-white/5 border border-transparent"),children:[(0,a.jsx)(e.icon,{className:"h-4 w-4"}),e.label,t&&(0,a.jsx)("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-indigo-400 animate-pulse"})]},e.href)})})}),(0,a.jsxs)("div",{className:"border-t border-white/10 px-3 py-3 space-y-0.5",children:[h.map(e=>{let t=!e.external&&c.startsWith(e.href);return e.external?(0,a.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium text-white/40 hover:text-white hover:bg-white/5 transition-all duration-200",children:[(0,a.jsx)(e.icon,{className:"h-4 w-4"}),e.label]},e.label):(0,a.jsxs)(s(),{href:e.href,className:(0,i.cn)("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200",t?"text-indigo-400":"text-white/40 hover:text-white hover:bg-white/5"),children:[(0,a.jsx)(e.icon,{className:"h-4 w-4"}),e.label]},e.label)}),(null==u?void 0:u.version)&&(0,a.jsxs)("div",{className:"px-3 py-2 text-xs text-white/20 font-mono",children:["v",u.version]})]})]})}},6121:(e,t,l)=>{Promise.resolve().then(l.t.bind(l,9061,23)),Promise.resolve().then(l.t.bind(l,9480,23)),Promise.resolve().then(l.bind(l,2553)),Promise.resolve().then(l.bind(l,6412))},6412:(e,t,l)=>{"use strict";l.d(t,{AshProvider:()=>i});var a=l(534),n=l(4166),s=l(3929);let r=(0,n.createContext)(null);function i(e){let{children:t}=e,l=(0,s.KU)();return(0,a.jsx)(r.Provider,{value:l,children:t})}},9480:()=>{}},e=>{e.O(0,[827,513,53,839,90,929,705,522,358],()=>e(e.s=6121)),_N_E=e.O()}]);