@ash-ai/dashboard 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/app/agents/page.tsx +408 -0
  3. package/app/analytics/page.tsx +226 -0
  4. package/app/globals.css +33 -0
  5. package/app/layout.tsx +38 -0
  6. package/app/logs/page.tsx +233 -0
  7. package/app/page.tsx +140 -0
  8. package/app/playground/page.tsx +44 -0
  9. package/app/queue/page.tsx +295 -0
  10. package/app/sessions/page.tsx +529 -0
  11. package/app/settings/api-keys/page.tsx +222 -0
  12. package/app/settings/credentials/page.tsx +250 -0
  13. package/components/nav.tsx +151 -0
  14. package/components/providers.tsx +18 -0
  15. package/components/ui/badge.tsx +43 -0
  16. package/components/ui/button.tsx +44 -0
  17. package/components/ui/card.tsx +43 -0
  18. package/components/ui/empty-state.tsx +20 -0
  19. package/components/ui/input.tsx +36 -0
  20. package/components/ui/select.tsx +50 -0
  21. package/components/ui/shimmer.tsx +53 -0
  22. package/lib/client.ts +41 -0
  23. package/lib/exports.ts +55 -0
  24. package/lib/hooks.ts +169 -0
  25. package/lib/utils.ts +44 -0
  26. package/next.config.ts +28 -0
  27. package/out/404/index.html +1 -0
  28. package/out/404.html +1 -0
  29. package/out/_next/static/J9asKIV7Gq221ygeAP958/_buildManifest.js +1 -0
  30. package/out/_next/static/J9asKIV7Gq221ygeAP958/_ssgManifest.js +1 -0
  31. package/out/_next/static/chunks/322-bab4df5c5188e993.js +1 -0
  32. package/out/_next/static/chunks/432-11ec8af7ccfbd019.js +1 -0
  33. package/out/_next/static/chunks/447.6d3368efa2d996b0.js +1 -0
  34. package/out/_next/static/chunks/513-c4683887323154aa.js +1 -0
  35. package/out/_next/static/chunks/522-cf174cf1bbbe9557.js +1 -0
  36. package/out/_next/static/chunks/53-b012ce05184a4754.js +1 -0
  37. package/out/_next/static/chunks/929-6faf1adeb65ee383.js +1 -0
  38. package/out/_next/static/chunks/app/_not-found/page-04f9d3958a76bc38.js +1 -0
  39. package/out/_next/static/chunks/app/agents/page-8d68e3019b4d7077.js +1 -0
  40. package/out/_next/static/chunks/app/analytics/page-6b725a46e9c48019.js +1 -0
  41. package/out/_next/static/chunks/app/layout-9cae773a790a15b2.js +1 -0
  42. package/out/_next/static/chunks/app/logs/page-2efd945345a44a0e.js +1 -0
  43. package/out/_next/static/chunks/app/page-06f62e11f9cd82d5.js +1 -0
  44. package/out/_next/static/chunks/app/playground/page-10d3461f118bfb21.js +1 -0
  45. package/out/_next/static/chunks/app/queue/page-38e79b84cbd59335.js +1 -0
  46. package/out/_next/static/chunks/app/sessions/page-2a67c9eddfac029e.js +1 -0
  47. package/out/_next/static/chunks/app/settings/api-keys/page-619682cf8a1c26eb.js +1 -0
  48. package/out/_next/static/chunks/app/settings/credentials/page-106d0ba4f12afe81.js +1 -0
  49. package/out/_next/static/chunks/b59f762a-cea625f74e98e0aa.js +1 -0
  50. package/out/_next/static/chunks/framework-5a02266cf144994c.js +1 -0
  51. package/out/_next/static/chunks/main-994a6af9cdcd7fb9.js +1 -0
  52. package/out/_next/static/chunks/main-app-5bcd4dcc44c4ae09.js +1 -0
  53. package/out/_next/static/chunks/pages/_app-9fd734050704698a.js +1 -0
  54. package/out/_next/static/chunks/pages/_error-310ed5880fd5d5e6.js +1 -0
  55. package/out/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  56. package/out/_next/static/chunks/webpack-a50a78a04aed446d.js +1 -0
  57. package/out/_next/static/css/4b2beada31dbc623.css +1 -0
  58. package/out/agents/index.html +1 -0
  59. package/out/agents/index.txt +22 -0
  60. package/out/analytics/index.html +1 -0
  61. package/out/analytics/index.txt +22 -0
  62. package/out/index.html +1 -0
  63. package/out/index.txt +22 -0
  64. package/out/logs/index.html +1 -0
  65. package/out/logs/index.txt +22 -0
  66. package/out/playground/index.html +1 -0
  67. package/out/playground/index.txt +22 -0
  68. package/out/queue/index.html +1 -0
  69. package/out/queue/index.txt +22 -0
  70. package/out/sessions/index.html +1 -0
  71. package/out/sessions/index.txt +22 -0
  72. package/out/settings/api-keys/index.html +1 -0
  73. package/out/settings/api-keys/index.txt +22 -0
  74. package/out/settings/credentials/index.html +1 -0
  75. package/out/settings/credentials/index.txt +22 -0
  76. package/package.json +40 -0
  77. package/postcss.config.mjs +7 -0
  78. package/tsconfig.json +27 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{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:()=>c,_F:()=>a,aX:()=>o,te:()=>r});var l=s(4166),n=s(3929);function i(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 a(){let[e,t]=(0,l.useState)([]),[s,i]=(0,l.useState)(!0),[a,r]=(0,l.useState)(null),c=(0,l.useCallback)(async()=>{try{let e=await (0,n.KU)().listAgents();t(e),r(null)}catch(e){r(e)}finally{i(!1)}},[]);return(0,l.useEffect)(()=>{c()},[c]),{agents:e,loading:s,error:a,refetch:c}}function r(e){let[t,s]=(0,l.useState)([]),[a,r]=(0,l.useState)(!0),[c,o]=(0,l.useState)(null),d=(0,l.useCallback)(async()=>{try{let t=await (0,n.KU)().listSessions(null==e?void 0:e.agent);s(t),o(null)}catch(e){o(e)}finally{r(!1)}},[null==e?void 0:e.agent]);return(0,l.useEffect)(()=>{d()},[d]),i(()=>d(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:a,error:c,refetch:d}}function c(){let[e,t]=(0,l.useState)(null),[s,a]=(0,l.useState)(null),r=(0,l.useCallback)(async()=>{try{let e=await (0,n.KU)().health();t(e),a(null)}catch(e){a(e)}},[]);return(0,l.useEffect)(()=>{r()},[r]),i(()=>r(),3e4),{health:e,error:s,refetch:r}}function o(){let[e,t]=(0,l.useState)([]),[s,i]=(0,l.useState)(!0),[a,r]=(0,l.useState)(null),c=(0,l.useCallback)(async()=>{try{let e=await (0,n.KU)().listCredentials();t(e),r(null)}catch(e){r(e)}finally{i(!1)}},[]);return(0,l.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:a,refetch:c}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>r,a3:()=>c,cn:()=>i,fw:()=>a});var l=s(6862),n=s(3690);function i(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,n.QP)((0,l.$)(t))}function a(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 n=Math.floor(l/60);if(n<24)return"".concat(n,"h ago");let i=Math.floor(n/24);return i<30?"".concat(i,"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:()=>i});var l=s(534),n=s(1804);let i=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:i,error:a,id:r,...c}=e;return(0,l.jsxs)("div",{className:"space-y-1.5",children:[i&&(0,l.jsx)("label",{htmlFor:r,className:"block text-sm font-medium text-white/70",children:i}),(0,l.jsx)("input",{ref:t,id:r,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 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",a&&"border-red-500/50 focus-visible:border-red-400",s),...c}),a&&(0,l.jsx)("p",{className:"text-xs text-red-400",children:a})]})});i.displayName="Input"},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>c,ZB:()=>r,Zp:()=>i,aR:()=>a});var l=s(534),n=s(1804);function i(e){let{children:t,className:s}=e;return(0,l.jsx)("div",{className:(0,n.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",s),children:t})}function a(e){let{children:t,className:s}=e;return(0,l.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 r(e){let{children:t,className:s}=e;return(0,l.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,l.jsx)("div",{className:(0,n.cn)("p-4 sm:p-6",s),children:t})}},5065:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>A});var l=s(534),n=s(4166),i=s(989),a=s(3929),r=s(4765),c=s(6719),o=s(2505),d=s(5968),x=s(8314),h=s(7964),u=s(1804),m=s(858),f=s(3),p=s(8154);let g=(0,p.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 b=s(7955),w=s(7691),y=s(647),j=s(6650);let v=(0,p.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"}]]);var N=s(8842),k=s(8968),C=s.n(k);function A(){let{agents:e,loading:t,refetch:s}=(0,i._F)(),[o,d]=(0,n.useState)(!1),[u,p]=(0,n.useState)(null),[g,b]=(0,n.useState)(null);async function w(e){b(null);try{await (0,a.KU)().deleteAgent(e),p(null),s()}catch(e){b(e instanceof Error?e.message:"Failed to delete agent"),p(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"]})]}),g&&(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:g}),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)(x.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)(S,{agent:e,onDelete:()=>p(e.name)},e.id||e.name))}),o&&(0,l.jsx)(D,{onClose:()=>d(!1),onCreated:()=>{d(!1),s()}}),u&&(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)(r.Zp,{className:"w-full max-w-md",children:(0,l.jsxs)(r.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:u}),"? This action cannot be undone."]}),(0,l.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,l.jsx)(c.$,{variant:"ghost",onClick:()=>p(null),children:"Cancel"}),(0,l.jsx)(c.$,{variant:"danger",onClick:()=>w(u),children:"Delete"})]})]})})})]})}function S(e){let{agent:t,onDelete:s}=e,[i,a]=(0,n.useState)(!1);return(0,l.jsx)(r.Zp,{className:"relative group",children:(0,l.jsxs)(r.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)("h3",{className:"text-sm font-semibold text-white truncate",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:()=>a(!i),className:"p-1 text-white/30 hover:text-white/70 transition-colors rounded",children:(0,l.jsx)(g,{className:"h-4 w-4"})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"fixed inset-0",onClick:()=>a(!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),a(!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)(b.A,{className:"h-3.5 w-3.5"})," Copy Name"]}),(0,l.jsxs)("button",{onClick:()=>{a(!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)(w.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,u.fw)(t.createdAt):"Unknown"}),(0,l.jsx)("div",{className:"flex items-center gap-2",children:(0,l.jsxs)(C(),{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)(y.A,{className:"h-3 w-3"}),"Try"]})})]})]})})}function D(e){let{onClose:t,onCreated:s}=e,[i,d]=(0,n.useState)("upload"),[x,h]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),[f,p]=(0,n.useState)(""),[g,b]=(0,n.useState)([]),[w,y]=(0,n.useState)(!1),[k,C]=(0,n.useState)(null),A=(0,n.useRef)(null),S=(0,n.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 n=await l.text();t.push({path:e,content:n})}b(t)},[]);async function D(){if(!x.trim())return void C("Agent name is required");y(!0),C(null);try{await (0,a.KU)().createAgent(x.trim(),{systemPrompt:f||void 0,files:g.length>0?g:void 0}),s()}catch(e){C(e instanceof Error?e.message:"Failed to create agent")}finally{y(!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)(r.Zp,{className:"w-full max-w-lg max-h-[90vh] overflow-auto",children:(0,l.jsxs)(r.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)(j.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"===i?"bg-white/10 text-white":"text-white/50 hover:text-white"),children:[(0,l.jsx)(v,{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"===i?"bg-white/10 text-white":"text-white/50 hover:text-white"),children:[(0,l.jsx)(N.A,{className:"h-4 w-4"})," CLI"]})]}),"upload"===i?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)(o.p,{label:"Name",placeholder:"my-agent",value:x,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=>p(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,{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)}}),g.length>0&&(0,l.jsxs)("p",{className:"text-xs text-white/50",children:[g.length," file",1!==g.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:D,disabled:w,children:w?"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"})})]})]})})})}},5373:(e,t,s)=>{Promise.resolve().then(s.bind(s,5065))},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>a,W:()=>r});var l=s(534),n=s(1804);let i={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 a(e){let{children:t,variant:s="default",className:a}=e;return(0,l.jsx)("span",{className:(0,n.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",i[s],a),children:t})}function r(e){let{status:t}=e;return(0,l.jsx)(a,{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),n=s(1804),i=s(4166);let a={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,i.forwardRef)((e,t)=>{let{className:s,variant:i="primary",size:c="md",disabled:o,...d}=e;return(0,l.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",a[i],r[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:()=>i});var l=s(534),n=s(1804);function i(e){let{width:t="100%",height:s=100,className:i}=e;return(0,l.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]",i),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8314:(e,t,s)=>{"use strict";s.d(t,{p:()=>i});var l=s(534),n=s(1804);function i(e){let{icon:t,title:s,description:i,action:a,className:r}=e;return(0,l.jsxs)("div",{className:(0,n.cn)("flex flex-col items-center justify-center py-16 text-center",r),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:i}),a&&(0,l.jsx)("div",{className:"mt-4",children:a})]})}},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,322,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([[745],{989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>c,_F:()=>i,aX:()=>o,te:()=>r});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 i(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!0),[i,r]=(0,l.useState)(null),c=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().listAgents();t(e),r(null)}catch(e){r(e)}finally{n(!1)}},[]);return(0,l.useEffect)(()=>{c()},[c]),{agents:e,loading:s,error:i,refetch:c}}function r(e){let[t,s]=(0,l.useState)([]),[i,r]=(0,l.useState)(!0),[c,o]=(0,l.useState)(null),u=(0,l.useCallback)(async()=>{try{let t=await (0,a.KU)().listSessions(null==e?void 0:e.agent);s(t),o(null)}catch(e){o(e)}finally{r(!1)}},[null==e?void 0:e.agent]);return(0,l.useEffect)(()=>{u()},[u]),n(()=>u(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:i,error:c,refetch:u}}function c(){let[e,t]=(0,l.useState)(null),[s,i]=(0,l.useState)(null),r=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().health();t(e),i(null)}catch(e){i(e)}},[]);return(0,l.useEffect)(()=>{r()},[r]),n(()=>r(),3e4),{health:e,error:s,refetch:r}}function o(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!0),[i,r]=(0,l.useState)(null),c=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().listCredentials();t(e),r(null)}catch(e){r(e)}finally{n(!1)}},[]);return(0,l.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:i,refetch:c}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>r,a3:()=>c,cn:()=>n,fw:()=>i});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 i(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 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}},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:()=>r,Zp:()=>n,aR:()=>i});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 i(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 r(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"}]])},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:()=>r});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 i=(0,l.forwardRef)((e,t)=>{let{color:s="currentColor",size:i=24,strokeWidth:r=2,absoluteStrokeWidth:c,className:o="",children:u,iconNode:h,...d}=e;return(0,l.createElement)("svg",{ref:t,...n,width:i,height:i,stroke:s,strokeWidth:c?24*Number(r)/Number(i):r,className:a("lucide",o),...d},[...h.map(e=>{let[t,s]=e;return(0,l.createElement)(t,s)}),...Array.isArray(u)?u:[u]])}),r=(e,t)=>{let s=(0,l.forwardRef)((s,n)=>{let{className:r,...c}=s;return(0,l.createElement)(i,{ref:n,iconNode:t,className:a("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),r),...c})});return s.displayName="".concat(e),s}},8593:(e,t,s)=>{Promise.resolve().then(s.bind(s,9305))},9305:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var l=s(534),a=s(4166),n=s(989),i=s(3929),r=s(4765),c=s(7964),o=s(1804),u=s(4195),h=s(3238),d=s(6664);let x=(0,s(8154).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);function m(){let[e,t]=(0,a.useState)("7d"),{agents:s}=(0,n._F)(),{sessions:m}=(0,n.te)({autoRefresh:!1}),[f,g]=(0,a.useState)([]),[y,w]=(0,a.useState)(!0),[j,v]=(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,i.KU)();try{let e=await t.getUsageStats({}).catch(()=>null);e&&v({sessions:m.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=m.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),g(l)}catch(e){}finally{w(!1)}}s.length>0?t():w(!1)},[e,s,m]),(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)(p,{icon:(0,l.jsx)(u.A,{className:"h-5 w-5"}),label:"Sessions",value:y?"-":j.sessions.toString()}),(0,l.jsx)(p,{icon:(0,l.jsx)(h.A,{className:"h-5 w-5"}),label:"Total Tokens",value:y?"-":(0,o.ZV)(j.tokens)}),(0,l.jsx)(p,{icon:(0,l.jsx)(d.A,{className:"h-5 w-5"}),label:"Tool Calls",value:y?"-":(0,o.ZV)(j.toolCalls)}),(0,l.jsx)(p,{icon:(0,l.jsx)(x,{className:"h-5 w-5"}),label:"Compute Time",value:y?"-":(0,o.a3)(j.computeSeconds)})]}),(0,l.jsxs)(r.Zp,{children:[(0,l.jsx)(r.aR,{children:(0,l.jsx)(r.ZB,{children:"Top Agents"})}),(0,l.jsx)(r.Wu,{className:"p-0",children:y?(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===f.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:f.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 p(e){let{icon:t,label:s,value:a}=e;return(0,l.jsx)(r.Zp,{children:(0,l.jsx)(r.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})]})})})}}},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,n)=>{"use strict";n.d(t,{Wz:()=>o,_F:()=>s,aX:()=>c,te:()=>i});var l=n(4166),r=n(3929);function a(e,t){let n=(0,l.useRef)(e);(0,l.useEffect)(()=>{n.current=e},[e]),(0,l.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>n.current(),t);return()=>clearInterval(e)},[t])}function s(){let[e,t]=(0,l.useState)([]),[n,a]=(0,l.useState)(!0),[s,i]=(0,l.useState)(null),o=(0,l.useCallback)(async()=>{try{let e=await (0,r.KU)().listAgents();t(e),i(null)}catch(e){i(e)}finally{a(!1)}},[]);return(0,l.useEffect)(()=>{o()},[o]),{agents:e,loading:n,error:s,refetch:o}}function i(e){let[t,n]=(0,l.useState)([]),[s,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),u=(0,l.useCallback)(async()=>{try{let t=await (0,r.KU)().listSessions(null==e?void 0:e.agent);n(t),c(null)}catch(e){c(e)}finally{i(!1)}},[null==e?void 0:e.agent]);return(0,l.useEffect)(()=>{u()},[u]),a(()=>u(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:s,error:o,refetch:u}}function o(){let[e,t]=(0,l.useState)(null),[n,s]=(0,l.useState)(null),i=(0,l.useCallback)(async()=>{try{let e=await (0,r.KU)().health();t(e),s(null)}catch(e){s(e)}},[]);return(0,l.useEffect)(()=>{i()},[i]),a(()=>i(),3e4),{health:e,error:n,refetch:i}}function c(){let[e,t]=(0,l.useState)([]),[n,a]=(0,l.useState)(!0),[s,i]=(0,l.useState)(null),o=(0,l.useCallback)(async()=>{try{let e=await (0,r.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{a(!1)}},[]);return(0,l.useEffect)(()=>{o()},[o]),{credentials:e,loading:n,error:s,refetch:o}}},1804:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>c,ZV:()=>i,a3:()=>o,cn:()=>a,fw:()=>s});var l=n(6862),r=n(3690);function a(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,r.QP)((0,l.$)(t))}function s(e){let t=Date.now(),n=Math.floor((t-new Date(e).getTime())/1e3);if(n<60)return"".concat(n,"s ago");let l=Math.floor(n/60);if(l<60)return"".concat(l,"m ago");let r=Math.floor(l/60);if(r<24)return"".concat(r,"h ago");let a=Math.floor(r/24);return a<30?"".concat(a,"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 n=Math.floor(t/60);return"".concat(n,"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,n)=>{"use strict";n.d(t,{DashboardNav:()=>p});var l=n(534),r=n(8968),a=n.n(r),s=n(9197),i=n(1804),o=n(989),c=n(8785),u=n(647),h=n(3),d=n(4195),f=n(7413),x=n(2087),m=n(5689),b=n(4193),g=n(8530);let v=[{href:"/",label:"Dashboard",icon:c.A},{href:"/playground",label:"Playground",icon:u.A},{href:"/agents",label:"Agents",icon:h.A},{href:"/sessions",label:"Sessions",icon:d.A},{href:"/logs",label:"Logs",icon:f.A},{href:"/analytics",label:"Analytics",icon:x.A}],w=[{href:"/settings/api-keys",label:"API Keys",icon:m.A},{href:"/settings/credentials",label:"Credentials",icon:b.A},{href:"/queue",label:"Queue",icon:g.A}];function p(e){let{extraItems:t,extraBottomLinks:n,branding:r}=e,c=(0,s.usePathname)(),{health:u}=(0,o.Wz)(),h=t?[...v,...t]:v,d=n?[...w,...n]:w,f=(null==u?void 0:u.status)==="ok";return(0,l.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,l.jsxs)("div",{className:"flex h-16 items-center gap-3 px-5 border-b border-white/10",children:[(0,l.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-indigo-500",children:(0,l.jsx)("span",{className:"text-sm font-bold text-white",children:"A"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("span",{className:"text-white font-bold tracking-tight block",children:r||"Ash"}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 text-white/40 text-xs font-mono",children:[(0,l.jsx)("span",{className:(0,i.cn)("w-1.5 h-1.5 rounded-full",f?"bg-green-400 animate-pulse":"bg-red-400")}),f?"ONLINE":"OFFLINE"]})]})]}),(0,l.jsx)("div",{className:"flex-1 overflow-auto px-3 py-4 scrollbar-thin",children:(0,l.jsx)("div",{className:"space-y-0.5",children:h.map(e=>{let t=c===e.href||"/"!==e.href&&c.startsWith(e.href);return(0,l.jsxs)(a(),{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,l.jsx)(e.icon,{className:"h-4 w-4"}),e.label,t&&(0,l.jsx)("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-indigo-400 animate-pulse"})]},e.href)})})}),(0,l.jsxs)("div",{className:"border-t border-white/10 px-3 py-3 space-y-0.5",children:[d.map(e=>{let t=!e.external&&c.startsWith(e.href);return e.external?(0,l.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,l.jsx)(e.icon,{className:"h-4 w-4"}),e.label]},e.label):(0,l.jsxs)(a(),{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,l.jsx)(e.icon,{className:"h-4 w-4"}),e.label]},e.label)}),(null==u?void 0:u.version)&&(0,l.jsxs)("div",{className:"px-3 py-2 text-xs text-white/20 font-mono",children:["v",u.version]})]})]})}},6121:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,9061,23)),Promise.resolve().then(n.t.bind(n,9480,23)),Promise.resolve().then(n.bind(n,2553)),Promise.resolve().then(n.bind(n,6412))},6412:(e,t,n)=>{"use strict";n.d(t,{AshProvider:()=>i});var l=n(534),r=n(4166),a=n(3929);let s=(0,r.createContext)(null);function i(e){let{children:t}=e,n=(0,a.KU)();return(0,l.jsx)(s.Provider,{value:n,children:t})}},9480:()=>{}},e=>{e.O(0,[827,513,53,322,432,929,705,522,358],()=>e(e.s=6121)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[524],{989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>c,_F:()=>r,aX:()=>o,te:()=>i});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(){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)().listAgents();t(e),i(null)}catch(e){i(e)}finally{n(!1)}},[]);return(0,a.useEffect)(()=>{c()},[c]),{agents:e,loading:s,error:r,refetch:c}}function i(e){let[t,s]=(0,a.useState)([]),[r,i]=(0,a.useState)(!0),[c,o]=(0,a.useState)(null),d=(0,a.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);s(t),o(null)}catch(e){o(e)}finally{i(!1)}},[null==e?void 0:e.agent]);return(0,a.useEffect)(()=>{d()},[d]),n(()=>d(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:r,error:c,refetch:d}}function c(){let[e,t]=(0,a.useState)(null),[s,r]=(0,a.useState)(null),i=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),r(null)}catch(e){r(e)}},[]);return(0,a.useEffect)(()=>{i()},[i]),n(()=>i(),3e4),{health:e,error:s,refetch:i}}function o(){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}}},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}},2998:(e,t,s)=>{Promise.resolve().then(s.bind(s,3345))},3007:(e,t,s)=>{"use strict";s.d(t,{l:()=>n});var a=s(534),l=s(1804);let n=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:n,options:r,placeholder:i,id:c,...o}=e;return(0,a.jsxs)("div",{className:"space-y-1.5",children:[n&&(0,a.jsx)("label",{htmlFor:c,className:"block text-sm font-medium text-white/70",children:n}),(0,a.jsxs)("select",{ref:t,id:c,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","focus-visible:outline-none focus-visible:border-indigo-500/50",s),...o,children:[i&&(0,a.jsx)("option",{value:"",className:"bg-[#1c2129]",children:i}),r.map(e=>(0,a.jsx)("option",{value:e.value,disabled:e.disabled,className:"bg-[#1c2129]",children:e.label},e.value))]})]})});n.displayName="Select"},3345:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var a=s(534),l=s(4166),n=s(989),r=s(3929),i=s(4765),c=s(6719),o=s(5968),d=s(3007),u=s(7964),h=s(1804),x=s(8154);let m=(0,x.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"}]]),f=(0,x.A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),v=(0,x.A)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);var p=s(3544),w=s(3634);function b(){let{agents:e}=(0,n._F)(),[t,s]=(0,l.useState)(""),[r,o]=(0,l.useState)(""),[x,p]=(0,l.useState)(""),[w,b]=(0,l.useState)(!0),{sessions:y,loading:j,refetch:N}=(0,n.te)({agent:t||void 0,autoRefresh:w}),k=y.filter(e=>{if(r&&e.status!==r)return!1;if(x){let t=x.toLowerCase();return e.id.toLowerCase().includes(t)||e.agentName.toLowerCase().includes(t)||e.status.toLowerCase().includes(t)}return!0});return(0,a.jsxs)("div",{className:"space-y-6",children:[(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:"Logs"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Session activity and event explorer"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(c.$,{variant:"ghost",size:"sm",onClick:function(){let e=new Blob([["Session ID,Agent,Status,Created",...k.map(e=>[e.id,e.agentName,e.status,e.createdAt].join(","))].join("\n")],{type:"text/csv"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="sessions.csv",s.click(),URL.revokeObjectURL(t)},children:[(0,a.jsx)(m,{className:"h-4 w-4 mr-1"})," CSV"]}),(0,a.jsxs)(c.$,{variant:"ghost",size:"sm",onClick:function(){let e=new Blob([JSON.stringify(k,null,2)],{type:"application/json"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="sessions.json",s.click(),URL.revokeObjectURL(t)},children:[(0,a.jsx)(m,{className:"h-4 w-4 mr-1"})," JSON"]}),(0,a.jsx)(c.$,{variant:w?"secondary":"ghost",size:"sm",onClick:()=>b(!w),children:(0,a.jsx)(f,{className:(0,h.cn)("h-4 w-4",w&&"animate-spin")})})]})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsxs)("div",{className:"flex-1 relative",children:[(0,a.jsx)(v,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-white/30"}),(0,a.jsx)("input",{type:"text",placeholder:"Search sessions...",value:x,onChange:e=>p(e.target.value),className:"w-full h-9 pl-9 pr-3 rounded-xl border bg-white/5 border-white/10 text-sm text-white placeholder:text-white/40 focus-visible:outline-none focus-visible:border-indigo-500/50"})]}),(0,a.jsx)(d.l,{options:[{value:"",label:"All Agents"},...e.map(e=>({value:e.name,label:e.name}))],value:t,onChange:e=>s(e.target.value),className:"w-40 h-9 text-xs"}),(0,a.jsx)(d.l,{options:[{value:"",label:"All Statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"ended",label:"Ended"},{value:"error",label:"Error"}],value:r,onChange:e=>o(e.target.value),className:"w-36 h-9 text-xs"})]}),(0,a.jsx)(i.Zp,{children:(0,a.jsx)(i.Wu,{className:"p-0",children:j?(0,a.jsx)("div",{className:"p-4 space-y-2",children:[1,2,3,4,5].map(e=>(0,a.jsx)(u.X,{height:40},e))}):0===k.length?(0,a.jsx)("p",{className:"text-sm text-white/40 text-center py-12",children:"No sessions found"}):(0,a.jsx)("div",{className:"divide-y divide-white/5",children:k.map(e=>(0,a.jsx)(g,{session:e},e.id))})})})]})}function g(e){let{session:t}=e,[s,n]=(0,l.useState)(!1),[i,c]=(0,l.useState)([]),[d,x]=(0,l.useState)(!1);async function m(){if(!s&&0===i.length){x(!0);try{let e=await (0,r.KU)().listSessionEvents(t.id,{limit:50});c(e)}catch(e){}finally{x(!1)}}n(!s)}return(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{onClick:m,"aria-expanded":s,className:"flex items-center gap-4 w-full px-4 py-3 text-sm hover:bg-white/[0.02] transition-colors",children:[s?(0,a.jsx)(p.A,{className:"h-4 w-4 text-white/30 shrink-0"}):(0,a.jsx)(w.A,{className:"h-4 w-4 text-white/30 shrink-0"}),(0,a.jsx)("span",{className:"text-xs text-white/30 w-24",children:(0,h.fw)(t.createdAt)}),(0,a.jsx)("span",{className:"text-xs font-mono text-white/50 w-20",children:(0,h.Ct)(t.id)}),(0,a.jsx)("span",{className:"text-sm text-white/70 flex-1 text-left truncate",children:t.agentName}),(0,a.jsx)(o.W,{status:t.status})]}),s&&(0,a.jsx)("div",{className:"pl-12 pr-4 pb-4",children:d?(0,a.jsx)("div",{className:"space-y-1",children:[1,2,3].map(e=>(0,a.jsx)(u.X,{height:24},e))}):0===i.length?(0,a.jsx)("p",{className:"text-xs text-white/30 py-2",children:"No events"}):(0,a.jsx)("div",{className:"space-y-0.5 max-h-64 overflow-auto scrollbar-thin",children:i.map((e,t)=>{let s="";try{var l,n;let t="string"==typeof e.data?JSON.parse(e.data):e.data;s=(null==t||null==(l=t.text)?void 0:l.slice(0,80))||(null==t?void 0:t.name)||(null==t||null==(n=t.error)?void 0:n.slice(0,80))||""}catch(e){}return(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs py-1",children:[(0,a.jsxs)("span",{className:"text-white/20 font-mono w-6",children:["#",e.sequence]}),(0,a.jsx)(o.E,{children:e.type}),(0,a.jsx)("span",{className:"text-white/40 truncate",children:s})]},e.id||t)})})})]})}},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"}]])},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})}},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}})}},8154:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var a=s(4166);let l=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,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...n,width:r,height:r,stroke:s,strokeWidth:c?24*Number(i)/Number(r):i,className:l("lucide",o),...h},[...u.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let s=(0,a.forwardRef)((s,n)=>{let{className:i,...c}=s;return(0,a.createElement)(r,{ref:n,iconNode:t,className:l("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),i),...c})});return s.displayName="".concat(e),s}}},e=>{e.O(0,[513,53,929,705,522,358],()=>e(e.s=2998)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>c,_F:()=>r,aX:()=>o,te:()=>i});var n=s(4166),l=s(3929);function a(e,t){let s=(0,n.useRef)(e);(0,n.useEffect)(()=>{s.current=e},[e]),(0,n.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function r(){let[e,t]=(0,n.useState)([]),[s,a]=(0,n.useState)(!0),[r,i]=(0,n.useState)(null),c=(0,n.useCallback)(async()=>{try{let e=await (0,l.KU)().listAgents();t(e),i(null)}catch(e){i(e)}finally{a(!1)}},[]);return(0,n.useEffect)(()=>{c()},[c]),{agents:e,loading:s,error:r,refetch:c}}function i(e){let[t,s]=(0,n.useState)([]),[r,i]=(0,n.useState)(!0),[c,o]=(0,n.useState)(null),d=(0,n.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);s(t),o(null)}catch(e){o(e)}finally{i(!1)}},[null==e?void 0:e.agent]);return(0,n.useEffect)(()=>{d()},[d]),a(()=>d(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:r,error:c,refetch:d}}function c(){let[e,t]=(0,n.useState)(null),[s,r]=(0,n.useState)(null),i=(0,n.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),r(null)}catch(e){r(e)}},[]);return(0,n.useEffect)(()=>{i()},[i]),a(()=>i(),3e4),{health:e,error:s,refetch:i}}function o(){let[e,t]=(0,n.useState)([]),[s,a]=(0,n.useState)(!0),[r,i]=(0,n.useState)(null),c=(0,n.useCallback)(async()=>{try{let e=await (0,l.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{a(!1)}},[]);return(0,n.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:r,refetch:c}}},1710:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var n=s(534),l=s(989),a=s(4765),r=s(5968),i=s(7964),c=s(1804),o=s(3),d=s(4195),u=s(3238),h=s(6664),x=s(8968),f=s.n(x);function m(){var e,t;let{agents:s,loading:x}=(0,l._F)(),{sessions:m,loading:b}=(0,l.te)({limit:5}),{health:p}=(0,l.Wz)(),v=m.filter(e=>"active"===e.status);return(0,n.jsxs)("div",{className:"space-y-8",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Dashboard"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Overview of your Ash server"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,n.jsx)(g,{icon:(0,n.jsx)(o.A,{className:"h-5 w-5"}),label:"Agents",value:x?"-":s.length.toString(),href:"/agents"}),(0,n.jsx)(g,{icon:(0,n.jsx)(d.A,{className:"h-5 w-5"}),label:"Active Sessions",value:b?"-":v.length.toString(),href:"/sessions"}),(0,n.jsx)(g,{icon:(0,n.jsx)(u.A,{className:"h-5 w-5"}),label:"Total Sessions",value:b?"-":m.length.toString(),href:"/sessions"}),(0,n.jsx)(g,{icon:(0,n.jsx)(h.A,{className:"h-5 w-5"}),label:"Sandboxes",value:null!=(t=null==p||null==(e=p.activeSandboxes)?void 0:e.toString())?t:"-"})]}),(0,n.jsxs)(a.Zp,{children:[(0,n.jsx)(a.aR,{children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)(a.ZB,{children:"Recent Sessions"}),(0,n.jsx)(f(),{href:"/sessions",className:"text-sm text-indigo-400 hover:text-indigo-300 transition-colors",children:"View all"})]})}),(0,n.jsx)(a.Wu,{children:b?(0,n.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,n.jsx)(i.X,{height:48},e))}):0===m.length?(0,n.jsx)("p",{className:"text-sm text-white/40 py-8 text-center",children:"No sessions yet. Create an agent and start a session in the Playground."}):(0,n.jsx)("div",{className:"space-y-2",children:m.slice(0,5).map(e=>(0,n.jsxs)(f(),{href:"/sessions?id=".concat(e.id),className:"flex items-center justify-between rounded-lg border border-white/5 bg-white/[0.02] px-4 py-3 hover:bg-white/5 transition-colors",children:[(0,n.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white truncate",children:e.agentName}),(0,n.jsx)("p",{className:"text-xs text-white/40 font-mono",children:e.id.slice(0,8)})]})}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(r.W,{status:e.status}),(0,n.jsx)("span",{className:"text-xs text-white/30",children:(0,c.fw)(e.createdAt)})]})]},e.id))})})]})]})}function g(e){let{icon:t,label:s,value:l,href:r}=e,i=(0,n.jsx)(a.Zp,{className:r?"hover:border-white/20 cursor-pointer":"",children:(0,n.jsx)(a.Wu,{children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm text-white/50",children:s}),(0,n.jsx)("p",{className:"text-2xl font-bold text-white mt-1",children:l})]}),(0,n.jsx)("div",{className:"text-white/20",children:t})]})})});return r?(0,n.jsx)(f(),{href:r,children:i}):i}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>i,a3:()=>c,cn:()=>a,fw:()=>r});var n=s(6862),l=s(3690);function a(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,l.QP)((0,n.$)(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 n=Math.floor(s/60);if(n<60)return"".concat(n,"m ago");let l=Math.floor(n/60);if(l<24)return"".concat(l,"h ago");let a=Math.floor(l/24);return a<30?"".concat(a,"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}},3238:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(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:()=>n});let n=(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:()=>a,aR:()=>r});var n=s(534),l=s(1804);function a(e){let{children:t,className:s}=e;return(0,n.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,n.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,n.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,n.jsx)("div",{className:(0,l.cn)("p-4 sm:p-6",s),children:t})}},4854:(e,t,s)=>{Promise.resolve().then(s.bind(s,1710))},5968:(e,t,s)=>{"use strict";s.d(t,{E:()=>r,W:()=>i});var n=s(534),l=s(1804);let a={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,n.jsx)("span",{className:(0,l.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",a[s],r),children:t})}function i(e){let{status:t}=e;return(0,n.jsx)(r,{variant:{active:"success",starting:"info",paused:"warning",stopped:"default",ended:"default",error:"error"}[t]||"default",children:t})}},6664:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(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"}]])},7964:(e,t,s)=>{"use strict";s.d(t,{X:()=>a});var n=s(534),l=s(1804);function a(e){let{width:t="100%",height:s=100,className:a}=e;return(0,n.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]",a),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}}},e=>{e.O(0,[513,53,322,929,705,522,358],()=>e(e.s=4854)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[882],{191:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(403)._(n(919));function u(e,t){var n;let u={};"function"==typeof e&&(u.loader=e);let l={...u,...t};return(0,r.default)({...l,modules:null==(n=l.loadableGenerated)?void 0:n.modules})}("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)},345:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(8919).createAsyncLocalStorage)()},919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(534),u=n(4166),l=n(5452);function a(e){return{default:e&&"default"in e?e.default:e}}n(1649);let o={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},s=function(e){let t={...o,...e},n=(0,u.lazy)(()=>t.loader().then(a)),s=t.loading;function i(e){let a=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,i=o?u.Suspense:u.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(l.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(i,{...o?{fallback:a}:{},children:c})}return i.displayName="LoadableComponent",i}},1649:(e,t,n)=>{"use strict";function r(e){let{moduleIds:t}=e;return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(534),n(7763),n(6890),n(2959)},4083:(e,t,n)=>{Promise.resolve().then(n.bind(n,5619))},5452:(e,t,n)=>{"use strict";function r(e){let{reason:t,children:n}=e;return n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(8560)},5619:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(534),u=n(4166),l=n(9197),a=n(3929),o=n(191);let s=n.n(o)()(()=>Promise.all([n.e(513),n.e(447)]).then(n.bind(n,6447)).then(e=>({default:e.Playground})),{loadableGenerated:{webpack:()=>[null]},ssr:!1,loading:()=>(0,r.jsx)(i,{})});function i(){return(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)("div",{className:"text-sm text-white/40",children:"Loading playground..."})})}function c(){let e=(0,l.useSearchParams)().get("agent")||void 0,t=(0,a.KU)();return(0,r.jsx)("div",{className:"h-[calc(100vh-5rem)]",children:(0,r.jsx)(s,{client:t,...e?{initialAgent:e}:{}})})}function d(){return(0,r.jsx)(u.Suspense,{fallback:(0,r.jsx)(i,{}),children:(0,r.jsx)(c,{})})}},6890:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(345)},8919:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{bindSnapshot:function(){return a},createAsyncLocalStorage:function(){return l},createSnapshot:function(){return o}});let n=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class r{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}static bind(e){return e}}let u="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function l(){return u?new u:new r}function a(e){return u?u.bind(e):r.bind(e)}function o(){return u?u.snapshot():function(e,...t){return e(...t)}}},9197:(e,t,n)=>{"use strict";var r=n(4841);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})}},e=>{e.O(0,[53,929,705,522,358],()=>e(e.s=4083)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[166],{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:()=>c,_F:()=>r,aX:()=>d,te:()=>i});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(){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)().listAgents();t(e),i(null)}catch(e){i(e)}finally{n(!1)}},[]);return(0,l.useEffect)(()=>{c()},[c]),{agents:e,loading:s,error:r,refetch:c}}function i(e){let[t,s]=(0,l.useState)([]),[r,i]=(0,l.useState)(!0),[c,d]=(0,l.useState)(null),o=(0,l.useCallback)(async()=>{try{let t=await (0,a.KU)().listSessions(null==e?void 0:e.agent);s(t),d(null)}catch(e){d(e)}finally{i(!1)}},[null==e?void 0:e.agent]);return(0,l.useEffect)(()=>{o()},[o]),n(()=>o(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:r,error:c,refetch:o}}function c(){let[e,t]=(0,l.useState)(null),[s,r]=(0,l.useState)(null),i=(0,l.useCallback)(async()=>{try{let e=await (0,a.KU)().health();t(e),r(null)}catch(e){r(e)}},[]);return(0,l.useEffect)(()=>{i()},[i]),n(()=>i(),3e4),{health:e,error:s,refetch:i}}function d(){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}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>d,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 d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.length>t?e.slice(0,t):e}},3007:(e,t,s)=>{"use strict";s.d(t,{l:()=>n});var l=s(534),a=s(1804);let n=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:n,options:r,placeholder:i,id:c,...d}=e;return(0,l.jsxs)("div",{className:"space-y-1.5",children:[n&&(0,l.jsx)("label",{htmlFor:c,className:"block text-sm font-medium text-white/70",children:n}),(0,l.jsxs)("select",{ref:t,id:c,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","focus-visible:outline-none focus-visible:border-indigo-500/50",s),...d,children:[i&&(0,l.jsx)("option",{value:"",className:"bg-[#1c2129]",children:i}),r.map(e=>(0,l.jsx)("option",{value:e.value,disabled:e.disabled,className:"bg-[#1c2129]",children:e.label},e.value))]})]})});n.displayName="Select"},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})}},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:d,...o}=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:d,...o})});c.displayName="Button"},7357:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var l=s(534),a=s(4166),n=s(989),r=s(3929),i=s(4765),c=s(6719),d=s(3007),o=s(8314),u=s(7964),x=s(1804),h=s(858),m=s(8530);let p=(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"}]]);var f=s(6650);let b={pending:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",processing:"bg-blue-500/20 text-blue-400 border-blue-500/30",completed:"bg-green-500/20 text-green-400 border-green-500/30",failed:"bg-red-500/20 text-red-400 border-red-500/30",cancelled:"bg-zinc-500/20 text-zinc-400 border-zinc-500/30"};function g(){let{agents:e}=(0,n._F)(),[t,s]=(0,a.useState)([]),[f,g]=(0,a.useState)(null),[w,j]=(0,a.useState)(!0),[y,N]=(0,a.useState)(""),[k,S]=(0,a.useState)(!1),[C,A]=(0,a.useState)(null),E=(0,a.useCallback)(async()=>{try{let e=(0,r.KU)(),[t,l]=await Promise.all([e.listQueueItems(y?{status:y}:{}),e.getQueueStats()]);s(t),g(l)}catch(e){}finally{j(!1)}},[y]);async function M(e){A(null);try{await (0,r.KU)().cancelQueueItem(e),E()}catch(e){A(e instanceof Error?e.message:"Failed to cancel job")}}return(0,a.useEffect)(()=>{E();let e=setInterval(E,5e3);return()=>clearInterval(e)},[E]),(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:"Queue"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Async job queue for agent tasks"})]}),(0,l.jsxs)(c.$,{onClick:()=>S(!0),children:[(0,l.jsx)(h.A,{className:"h-4 w-4 mr-2"}),"Enqueue Job"]})]}),C&&(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:C}),f&&(0,l.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-5",children:["pending","processing","completed","failed","cancelled"].map(e=>(0,l.jsx)(i.Zp,{children:(0,l.jsxs)(i.Wu,{className:"py-3",children:[(0,l.jsx)("p",{className:"text-xs text-white/40 capitalize",children:e}),(0,l.jsx)("p",{className:"text-xl font-bold text-white",children:f[e]})]})},e))}),(0,l.jsx)("div",{className:"flex gap-3",children:(0,l.jsx)(d.l,{options:[{value:"",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"processing",label:"Processing"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],value:y,onChange:e=>N(e.target.value),className:"w-40"})}),(0,l.jsx)(i.Zp,{children:(0,l.jsx)(i.Wu,{className:"p-0",children:w?(0,l.jsx)("div",{className:"p-4 space-y-2",children:[1,2,3].map(e=>(0,l.jsx)(u.X,{height:48},e))}):0===t.length?(0,l.jsx)(o.p,{icon:(0,l.jsx)(m.A,{className:"h-12 w-12"}),title:"Queue is empty",description:"Enqueue a job to process it asynchronously.",action:(0,l.jsxs)(c.$,{onClick:()=>S(!0),children:[(0,l.jsx)(h.A,{className:"h-4 w-4 mr-2"}),"Enqueue Job"]})}):(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:"ID"}),(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-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Prompt"}),(0,l.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Status"}),(0,l.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Age"}),(0,l.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Actions"})]})}),(0,l.jsx)("tbody",{className:"divide-y divide-white/5",children:t.map(e=>(0,l.jsxs)("tr",{className:"hover:bg-white/[0.02]",children:[(0,l.jsx)("td",{className:"px-6 py-3 font-mono text-xs text-white/50",children:(0,x.Ct)(e.id)}),(0,l.jsx)("td",{className:"px-6 py-3 text-white/80",children:e.agentName}),(0,l.jsx)("td",{className:"px-6 py-3 text-white/60 max-w-xs truncate",children:e.prompt}),(0,l.jsx)("td",{className:"px-6 py-3",children:(0,l.jsx)("span",{className:(0,x.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium border",b[e.status]||b.pending),children:e.status})}),(0,l.jsx)("td",{className:"px-6 py-3 text-white/40 text-xs",children:(0,x.fw)(e.createdAt)}),(0,l.jsx)("td",{className:"px-6 py-3 text-right",children:"pending"===e.status&&(0,l.jsx)(c.$,{variant:"ghost",size:"sm",onClick:()=>M(e.id),className:"text-red-400",children:(0,l.jsx)(p,{className:"h-3.5 w-3.5"})})})]},e.id))})]})})}),k&&(0,l.jsx)(v,{agents:e,onClose:()=>S(!1),onCreated:()=>{S(!1),E()}})]})}function v(e){var t;let{agents:s,onClose:n,onCreated:o}=e,[u,x]=(0,a.useState)((null==(t=s[0])?void 0:t.name)||""),[h,m]=(0,a.useState)(""),[p,b]=(0,a.useState)(!1),[g,v]=(0,a.useState)(null);async function w(){if(!u||!h.trim())return void v("Agent and prompt are required");b(!0),v(null);try{await (0,r.KU)().enqueue(u,h.trim()),o()}catch(e){v(e instanceof Error?e.message:"Failed to enqueue")}finally{b(!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-md",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:"Enqueue Job"}),(0,l.jsx)("button",{onClick:n,className:"text-white/40 hover:text-white",children:(0,l.jsx)(f.A,{className:"h-5 w-5"})})]}),(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)(d.l,{label:"Agent",options:s.map(e=>({value:e.name,label:e.name})),value:u,onChange:e=>x(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:"Prompt"}),(0,l.jsx)("textarea",{value:h,onChange:e=>m(e.target.value),rows:4,placeholder:"What should the agent do?",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"})]}),g&&(0,l.jsx)("p",{className:"text-sm text-red-400",children:g}),(0,l.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,l.jsx)(c.$,{variant:"ghost",onClick:n,children:"Cancel"}),(0,l.jsx)(c.$,{onClick:w,disabled:p,children:p?"Enqueuing...":"Enqueue"})]})]})]})})})}},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:d="",children:o,iconNode:u,...x}=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",d),...x},[...u.map(e=>{let[t,s]=e;return(0,l.createElement)(t,s)}),...Array.isArray(o)?o:[o]])}),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}},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})]})}},8530:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});let l=(0,s(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"}]])},9204:(e,t,s)=>{Promise.resolve().then(s.bind(s,7357))}},e=>{e.O(0,[513,53,929,705,522,358],()=>e(e.s=9204)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[898],{989:(e,t,s)=>{"use strict";s.d(t,{Wz:()=>c,_F:()=>n,aX:()=>o,te:()=>i});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(){let[e,t]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),[n,i]=(0,a.useState)(null),c=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().listAgents();t(e),i(null)}catch(e){i(e)}finally{r(!1)}},[]);return(0,a.useEffect)(()=>{c()},[c]),{agents:e,loading:s,error:n,refetch:c}}function i(e){let[t,s]=(0,a.useState)([]),[n,i]=(0,a.useState)(!0),[c,o]=(0,a.useState)(null),d=(0,a.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);s(t),o(null)}catch(e){o(e)}finally{i(!1)}},[null==e?void 0:e.agent]);return(0,a.useEffect)(()=>{d()},[d]),r(()=>d(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:n,error:c,refetch:d}}function c(){let[e,t]=(0,a.useState)(null),[s,n]=(0,a.useState)(null),i=(0,a.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),n(null)}catch(e){n(e)}},[]);return(0,a.useEffect)(()=>{i()},[i]),r(()=>i(),3e4),{health:e,error:s,refetch:i}}function o(){let[e,t]=(0,a.useState)([]),[s,r]=(0,a.useState)(!0),[n,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{r(!1)}},[]);return(0,a.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:n,refetch:c}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>o,ZV:()=>i,a3:()=>c,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 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}},2304:(e,t,s)=>{Promise.resolve().then(s.bind(s,3787))},3007:(e,t,s)=>{"use strict";s.d(t,{l:()=>r});var a=s(534),l=s(1804);let r=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:r,options:n,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,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","focus-visible:outline-none focus-visible:border-indigo-500/50",s),...o,children:[i&&(0,a.jsx)("option",{value:"",className:"bg-[#1c2129]",children:i}),n.map(e=>(0,a.jsx)("option",{value:e.value,disabled:e.disabled,className:"bg-[#1c2129]",children:e.label},e.value))]})]})});r.displayName="Select"},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"}]])},3787:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var a=s(534),l=s(4166),r=s(9197),n=s(989),i=s(3929),c=s(4765),o=s(6719),d=s(5968),u=s(8314),x=s(3007),h=s(7964),m=s(1804),f=s(4195),p=s(8154);let g=(0,p.A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]),w=(0,p.A)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),v=(0,p.A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);var b=s(7955);let j=(0,p.A)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);var y=s(8842),N=s(3544),k=s(3634);function S(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)("div",{className:"text-sm text-white/40",children:"Loading..."}),children:(0,a.jsx)(A,{})})}function A(){let e=(0,r.useSearchParams)().get("id"),{agents:t}=(0,n._F)(),[s,i]=(0,l.useState)(""),[c,o]=(0,l.useState)(""),{sessions:p,loading:g,refetch:w}=(0,n.te)({agent:s||void 0,autoRefresh:!0}),[v,b]=(0,l.useState)(e);(0,l.useEffect)(()=>{!v&&p.length>0&&b(p[0].id)},[p,v]);let j=p.filter(e=>!c||e.status===c),y=p.find(e=>e.id===v),N=[{value:"",label:"All Agents"},...t.map(e=>({value:e.name,label:e.name}))];return(0,a.jsxs)("div",{className:"flex h-[calc(100vh-5rem)] gap-4",children:[(0,a.jsxs)("div",{className:"w-80 shrink-0 flex flex-col",children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Sessions"})}),(0,a.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,a.jsx)(x.l,{options:N,value:s,onChange:e=>i(e.target.value),className:"flex-1 h-8 text-xs"}),(0,a.jsx)(x.l,{options:[{value:"",label:"All Statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"ended",label:"Ended"},{value:"error",label:"Error"}],value:c,onChange:e=>o(e.target.value),className:"flex-1 h-8 text-xs"})]}),(0,a.jsx)("div",{className:"flex-1 overflow-auto space-y-1 scrollbar-thin",children:g?(0,a.jsx)("div",{className:"space-y-2",children:[1,2,3,4,5].map(e=>(0,a.jsx)(h.X,{height:64},e))}):0===j.length?(0,a.jsx)("p",{className:"text-sm text-white/40 text-center py-8",children:"No sessions found"}):j.map(e=>(0,a.jsxs)("button",{onClick:()=>b(e.id),className:(0,m.cn)("w-full text-left rounded-lg border px-3 py-2.5 transition-colors",v===e.id?"bg-indigo-500/10 border-indigo-500/30":"border-transparent hover:bg-white/5"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-white truncate",children:e.agentName}),(0,a.jsx)(d.W,{status:e.status})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsx)("span",{className:"text-xs text-white/30 font-mono",children:(0,m.Ct)(e.id)}),(0,a.jsx)("span",{className:"text-xs text-white/30",children:(0,m.fw)(e.createdAt)})]})]},e.id))})]}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:y?(0,a.jsx)(C,{session:y}):(0,a.jsx)(u.p,{icon:(0,a.jsx)(f.A,{className:"h-12 w-12"}),title:"Select a session",description:"Choose a session from the list to view details"})})]})}function C(e){let{session:t}=e,[s,r]=(0,l.useState)("messages"),[n,u]=(0,l.useState)([]),[x,p]=(0,l.useState)([]),[N,k]=(0,l.useState)([]),[S,A]=(0,l.useState)(!0),C=(0,l.useCallback)(async()=>{A(!0);try{let e=(0,i.KU)(),[s,a]=await Promise.all([e.listMessages(t.id).catch(()=>[]),e.listSessionEvents(t.id).catch(()=>[])]);u(s),p(a)}catch(e){}finally{A(!1)}},[t.id]);async function _(e){let s=(0,i.KU)();try{"pause"===e?await s.pauseSession(t.id):"resume"===e?await s.resumeSession(t.id):"stop"===e?await s.stopSession(t.id):"end"===e&&await s.endSession(t.id)}catch(t){console.error("Failed to ".concat(e," session:"),t)}}return(0,l.useEffect)(()=>{C()},[C]),(0,l.useEffect)(()=>{if("active"!==t.status)return;let e=setInterval(C,5e3);return()=>clearInterval(e)},[t.status,C]),(0,l.useEffect)(()=>{if("terminal"!==s)return;let e=async()=>{try{let e=await (0,i.KU)().getSessionLogs(t.id);(null==e?void 0:e.logs)&&k(e.logs.map(e=>e.text))}catch(e){k(["Failed to load logs"])}};if(e(),"active"===t.status){let t=setInterval(e,2e3);return()=>clearInterval(t)}},[s,t.id,t.status]),(0,a.jsxs)(c.Zp,{className:"h-full flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-white/10",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-white",children:t.agentName}),(0,a.jsx)(d.W,{status:t.status})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4 mt-1",children:[(0,a.jsx)("span",{className:"text-xs text-white/30 font-mono",children:t.id}),(0,a.jsx)("span",{className:"text-xs text-white/30",children:(0,m.fw)(t.createdAt)}),t.model&&(0,a.jsx)(d.E,{variant:"info",children:t.model})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:["active"===t.status&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:()=>_("pause"),title:"Pause",children:(0,a.jsx)(g,{className:"h-4 w-4"})}),(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:()=>_("stop"),title:"Stop",children:(0,a.jsx)(w,{className:"h-4 w-4"})})]}),("paused"===t.status||"stopped"===t.status)&&(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:()=>_("resume"),title:"Resume",children:(0,a.jsx)(v,{className:"h-4 w-4"})}),(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:()=>navigator.clipboard.writeText(t.id),title:"Copy ID",children:(0,a.jsx)(b.A,{className:"h-4 w-4"})})]})]}),(0,a.jsx)("div",{className:"flex gap-1 px-6 py-2 border-b border-white/10",children:[{key:"messages",label:"Messages",icon:j,count:n.length},{key:"events",label:"Events",icon:f.A,count:x.length},{key:"terminal",label:"Terminal",icon:y.A}].map(e=>{let{key:t,label:l,icon:n,count:i}=e;return(0,a.jsxs)("button",{onClick:()=>r(t),className:(0,m.cn)("flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md transition-colors",s===t?"bg-white/10 text-white":"text-white/40 hover:text-white/70"),children:[(0,a.jsx)(n,{className:"h-3.5 w-3.5"}),l,void 0!==i&&i>0&&(0,a.jsx)("span",{className:"text-xs text-white/30",children:i})]},t)})}),(0,a.jsx)("div",{className:"flex-1 overflow-auto p-6 scrollbar-thin",children:S?(0,a.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,a.jsx)(h.X,{height:60},e))}):"messages"===s?(0,a.jsx)(E,{messages:n}):"events"===s?(0,a.jsx)(P,{events:x}):(0,a.jsx)(R,{logs:N})})]})}function E(e){let{messages:t}=e,s=(0,l.useRef)(null);return((0,l.useEffect)(()=>{var e;null==(e=s.current)||e.scrollIntoView({behavior:"smooth"})},[t.length]),0===t.length)?(0,a.jsx)("p",{className:"text-sm text-white/40 text-center py-8",children:"No messages yet"}):(0,a.jsxs)("div",{className:"space-y-4",children:[t.map((e,t)=>(0,a.jsx)(_,{message:e},e.id||t)),(0,a.jsx)("div",{ref:s})]})}function _(e){let{message:t}=e,s="user"===t.role,[r,n]=(0,l.useState)(!1),i="",c=[];try{let e=JSON.parse(t.content);if(Array.isArray(e)){let t=e.filter(e=>"text"===e.type);c=e.filter(e=>"tool_use"===e.type),i=t.map(e=>String(e.text||"")).join("\n")}else i="string"==typeof e?e:t.content}catch(e){i=t.content}return(0,a.jsxs)("div",{className:(0,m.cn)("rounded-lg border p-4",s?"border-blue-500/20 bg-blue-500/5":"border-white/5 bg-white/[0.02]"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(d.E,{variant:s?"info":"default",children:s?"User":"Assistant"}),t.createdAt&&(0,a.jsx)("span",{className:"text-xs text-white/30",children:(0,m.fw)(t.createdAt)})]}),i&&(0,a.jsx)("div",{className:"text-sm text-white/80 whitespace-pre-wrap",children:i}),c.length>0&&(0,a.jsx)("div",{className:"mt-3 space-y-2",children:c.map((e,t)=>(0,a.jsx)(M,{toolCall:e},e.id||t))})]})}function M(e){let{toolCall:t}=e,[s,r]=(0,l.useState)(!1);return(0,a.jsxs)("div",{className:"rounded-md border border-white/10 bg-black/20 overflow-hidden",children:[(0,a.jsxs)("button",{onClick:()=>r(!s),"aria-expanded":s,className:"flex items-center gap-2 w-full px-3 py-2 text-sm text-white/60 hover:text-white/80 transition-colors",children:[s?(0,a.jsx)(N.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(k.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{className:"font-mono text-indigo-400",children:t.name})]}),s&&(0,a.jsxs)("div",{className:"px-3 pb-3",children:[(0,a.jsx)("div",{className:"text-xs text-white/40 mb-1",children:"Input:"}),(0,a.jsx)("pre",{className:"text-xs text-white/60 overflow-auto max-h-48 bg-black/30 rounded p-2",children:JSON.stringify(t.input,null,2)})]})]})}function P(e){let{events:t}=e;if(0===t.length)return(0,a.jsx)("p",{className:"text-sm text-white/40 text-center py-8",children:"No events recorded"});let s={text:"text-blue-400",tool_start:"text-purple-400",tool_result:"text-purple-400",reasoning:"text-amber-400",error:"text-red-400",turn_complete:"text-green-400",lifecycle:"text-zinc-400"};return(0,a.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,a.jsx)(z,{event:e,typeColors:s},e.id||t))})}function z(e){let{event:t,typeColors:s}=e,[r,n]=(0,l.useState)(!1),i=s[t.type]||"text-white/40",c="";try{let e="string"==typeof t.data?JSON.parse(t.data):t.data;e&&"object"==typeof e&&("string"==typeof e.text?c=e.text.slice(0,100):"string"==typeof e.name?c=e.name:"string"==typeof e.error&&(c=e.error.slice(0,100)))}catch(e){}return(0,a.jsxs)("div",{className:"rounded-md border border-white/5 bg-white/[0.01]",children:[(0,a.jsxs)("button",{onClick:()=>n(!r),"aria-expanded":r,className:"flex items-center gap-3 w-full px-3 py-2 text-sm hover:bg-white/[0.02] transition-colors",children:[r?(0,a.jsx)(N.A,{className:"h-3 w-3 text-white/30"}):(0,a.jsx)(k.A,{className:"h-3 w-3 text-white/30"}),(0,a.jsxs)("span",{className:"text-xs text-white/20 font-mono w-8",children:["#",t.sequence]}),(0,a.jsx)(d.E,{className:i,children:t.type}),(0,a.jsx)("span",{className:"text-xs text-white/40 truncate flex-1 text-left",children:c}),(0,a.jsx)("span",{className:"text-xs text-white/20",children:t.createdAt?(0,m.fw)(t.createdAt):""})]}),r&&(0,a.jsx)("div",{className:"px-3 pb-3 pt-1",children:(0,a.jsx)("pre",{className:"text-xs text-white/50 overflow-auto max-h-64 bg-black/30 rounded p-2",children:"string"==typeof t.data?t.data:JSON.stringify(t.data,null,2)})})]})}function R(e){let{logs:t}=e,s=(0,l.useRef)(null);return((0,l.useEffect)(()=>{var e;null==(e=s.current)||e.scrollIntoView({behavior:"smooth"})},[t.length]),0===t.length)?(0,a.jsx)("p",{className:"text-sm text-white/40 text-center py-8",children:"No terminal output"}):(0,a.jsxs)("div",{className:"bg-black/40 rounded-lg p-4 font-mono text-xs",children:[t.map((e,t)=>(0,a.jsx)("div",{className:"text-white/60 whitespace-pre-wrap",children:e},t)),(0,a.jsx)("div",{ref:s})]})}},4195:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(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:()=>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 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:()=>n,W:()=>i});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 i(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})}},6719:(e,t,s)=>{"use strict";s.d(t,{$:()=>c});var a=s(534),l=s(1804),r=s(4166);let n={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,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",n[r],i[c],s),disabled:o,...d})});c.displayName="Button"},7955:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(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:()=>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}})}},8154:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var a=s(4166);let l=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 r={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 n=(0,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...x}=e;return(0,a.createElement)("svg",{ref:t,...r,width:n,height:n,stroke:s,strokeWidth:c?24*Number(i)/Number(n):i,className:l("lucide",o),...x},[...u.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let s=(0,a.forwardRef)((s,r)=>{let{className:i,...c}=s;return(0,a.createElement)(n,{ref:r,iconNode:t,className:l("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),i),...c})});return s.displayName="".concat(e),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: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:r}),n&&(0,a.jsx)("div",{className:"mt-4",children:n})]})}},8842:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(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"}]])},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,929,705,522,358],()=>e(e.s=2304)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[648],{858:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(8154).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},948:(e,t,r)=>{Promise.resolve().then(r.bind(r,9336))},1804:(e,t,r)=>{"use strict";r.d(t,{Ct:()=>o,ZV:()=>l,a3:()=>c,cn:()=>a,fw:()=>n});var s=r(6862),i=r(3690);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,i.QP)((0,s.$)(t))}function n(e){let t=Date.now(),r=Math.floor((t-new Date(e).getTime())/1e3);if(r<60)return"".concat(r,"s ago");let s=Math.floor(r/60);if(s<60)return"".concat(s,"m ago");let i=Math.floor(s/60);if(i<24)return"".concat(i,"h ago");let a=Math.floor(i/24);return a<30?"".concat(a,"d ago"):new Date(e).toLocaleDateString()}function l(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 r=Math.floor(t/60);return"".concat(r,"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,r)=>{"use strict";r.d(t,{p:()=>a});var s=r(534),i=r(1804);let a=(0,r(4166).forwardRef)((e,t)=>{let{className:r,label:a,error:n,id:l,...c}=e;return(0,s.jsxs)("div",{className:"space-y-1.5",children:[a&&(0,s.jsx)("label",{htmlFor:l,className:"block text-sm font-medium text-white/70",children:a}),(0,s.jsx)("input",{ref:t,id:l,className:(0,i.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",n&&"border-red-500/50 focus-visible:border-red-400",r),...c}),n&&(0,s.jsx)("p",{className:"text-xs text-red-400",children:n})]})});a.displayName="Input"},4765:(e,t,r)=>{"use strict";r.d(t,{Wu:()=>c,ZB:()=>l,Zp:()=>a,aR:()=>n});var s=r(534),i=r(1804);function a(e){let{children:t,className:r}=e;return(0,s.jsx)("div",{className:(0,i.cn)("rounded-2xl border border-white/10 bg-[#1c2129] transition-all duration-200",r),children:t})}function n(e){let{children:t,className:r}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 px-4 pt-4 pb-0 sm:px-6 sm:pt-6 sm:pb-0",r),children:t})}function l(e){let{children:t,className:r}=e;return(0,s.jsx)("h3",{className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight text-white",r),children:t})}function c(e){let{children:t,className:r}=e;return(0,s.jsx)("div",{className:(0,i.cn)("p-4 sm:p-6",r),children:t})}},5689:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(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"}]])},6719:(e,t,r)=>{"use strict";r.d(t,{$:()=>c});var s=r(534),i=r(1804),a=r(4166);let n={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"},l={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,a.forwardRef)((e,t)=>{let{className:r,variant:a="primary",size:c="md",disabled:o,...d}=e;return(0,s.jsx)("button",{ref:t,className:(0,i.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",n[a],l[c],r),disabled:o,...d})});c.displayName="Button"},7691:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(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,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(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,r)=>{"use strict";r.d(t,{X:()=>a});var s=r(534),i=r(1804);function a(e){let{width:t="100%",height:r=100,className:a}=e;return(0,s.jsx)("div",{className:(0,i.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]",a),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:r}})}},8154:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var s=r(4166);let i=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()};var a={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 n=(0,s.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:h,...x}=e;return(0,s.createElement)("svg",{ref:t,...a,width:n,height:n,stroke:r,strokeWidth:c?24*Number(l)/Number(n):l,className:i("lucide",o),...x},[...h.map(e=>{let[t,r]=e;return(0,s.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,s.forwardRef)((r,a)=>{let{className:l,...c}=r;return(0,s.createElement)(n,{ref:a,iconNode:t,className:i("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),l),...c})});return r.displayName="".concat(e),r}},9336:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>p});var s=r(534),i=r(4166),a=r(3929),n=r(4765),l=r(6719),c=r(2505),o=r(7964),d=r(1804),h=r(858),x=r(5689),m=r(7955),u=r(7691);function p(){let[e,t]=(0,i.useState)([]),[r,p]=(0,i.useState)(!0),[f,y]=(0,i.useState)(""),[w,g]=(0,i.useState)(null),[j,b]=(0,i.useState)(!1),[v,N]=(0,i.useState)(null);async function k(){try{let e=await fetch("/api/api-keys",{headers:(0,a.z5)()});if(e.ok){let r=await e.json();t(r.keys||r||[])}}catch(e){}finally{p(!1)}}async function A(){if(!f.trim())return void N("Key name is required");b(!0),N(null);try{let e=await fetch("/api/api-keys",{method:"POST",headers:{"Content-Type":"application/json",...(0,a.z5)()},body:JSON.stringify({label:f.trim()})});if(!e.ok)throw Error("Failed to create key");let t=await e.json();g(t.key),y(""),k()}catch(e){N(e instanceof Error?e.message:"Failed to create key")}finally{b(!1)}}async function C(e){try{if(!(await fetch("/api/api-keys/".concat(e),{method:"DELETE",headers:(0,a.z5)()})).ok)throw Error("Failed to revoke key");k()}catch(e){N(e instanceof Error?e.message:"Failed to revoke key")}}return(0,i.useEffect)(()=>{k()},[]),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white",children:"API Keys"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Create API keys to authenticate with the Ash server"})]}),(0,s.jsx)(n.Zp,{children:(0,s.jsxs)(n.Wu,{children:[(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)(c.p,{placeholder:"Key name (e.g. production)",value:f,onChange:e=>y(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&A()}),(0,s.jsxs)(l.$,{onClick:A,disabled:j,children:[(0,s.jsx)(h.A,{className:"h-4 w-4 mr-2"}),j?"Creating...":"Create Key"]})]}),v&&(0,s.jsx)("p",{className:"text-sm text-red-400 mt-2",children:v})]})}),w&&(0,s.jsx)(n.Zp,{className:"border-green-500/30",children:(0,s.jsxs)(n.Wu,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(x.A,{className:"h-4 w-4 text-green-400"}),(0,s.jsx)("p",{className:"text-sm font-medium text-green-400",children:"Key created! Copy it now — it won't be shown again."})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 bg-black/30 rounded-lg px-4 py-3",children:[(0,s.jsx)("code",{className:"flex-1 text-sm text-white font-mono break-all",children:w}),(0,s.jsx)(l.$,{variant:"ghost",size:"sm",onClick:()=>{navigator.clipboard.writeText(w)},children:(0,s.jsx)(m.A,{className:"h-4 w-4"})})]})]})}),(0,s.jsxs)(n.Zp,{children:[(0,s.jsx)(n.aR,{children:(0,s.jsx)(n.ZB,{children:"Getting Started"})}),(0,s.jsx)(n.Wu,{children:(0,s.jsxs)("div",{className:"rounded-lg bg-black/30 p-4 font-mono text-sm text-white/80 space-y-1",children:[(0,s.jsx)("div",{className:"text-white/40",children:"# Set your API key"}),(0,s.jsx)("div",{children:"export ASH_API_KEY=ash_sk_..."}),(0,s.jsx)("div",{className:"text-white/40 mt-3",children:"# Deploy an agent"}),(0,s.jsx)("div",{children:"ash deploy ./my-agent --name my-agent"})]})})]}),(0,s.jsxs)(n.Zp,{children:[(0,s.jsx)(n.aR,{children:(0,s.jsx)(n.ZB,{children:"Active Keys"})}),(0,s.jsx)(n.Wu,{className:"p-0",children:r?(0,s.jsx)("div",{className:"p-4 space-y-2",children:[1,2,3].map(e=>(0,s.jsx)(o.X,{height:40},e))}):0===e.length?(0,s.jsx)("p",{className:"text-sm text-white/40 text-center py-8",children:"No API keys yet"}):(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-white/10",children:[(0,s.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Name"}),(0,s.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Key"}),(0,s.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Created"}),(0,s.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Actions"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-white/5",children:e.map(e=>(0,s.jsxs)("tr",{className:"hover:bg-white/[0.02]",children:[(0,s.jsx)("td",{className:"px-6 py-3 text-white/80 font-medium",children:e.label}),(0,s.jsx)("td",{className:"px-6 py-3 text-white/40 font-mono text-xs",children:e.keyPrefix||"••••••••"}),(0,s.jsx)("td",{className:"px-6 py-3 text-white/40",children:(0,d.fw)(e.createdAt)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:(0,s.jsx)(l.$,{variant:"ghost",size:"sm",onClick:()=>C(e.id),className:"text-red-400 hover:text-red-300",children:(0,s.jsx)(u.A,{className:"h-3.5 w-3.5"})})})]},e.id))})]})})]})]})}}},e=>{e.O(0,[513,53,929,705,522,358],()=>e(e.s=948)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[167],{858:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(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:()=>c,_F:()=>n,aX:()=>d,te:()=>i});var r=s(4166),l=s(3929);function a(e,t){let s=(0,r.useRef)(e);(0,r.useEffect)(()=>{s.current=e},[e]),(0,r.useEffect)(()=>{if(null===t)return;let e=setInterval(()=>s.current(),t);return()=>clearInterval(e)},[t])}function n(){let[e,t]=(0,r.useState)([]),[s,a]=(0,r.useState)(!0),[n,i]=(0,r.useState)(null),c=(0,r.useCallback)(async()=>{try{let e=await (0,l.KU)().listAgents();t(e),i(null)}catch(e){i(e)}finally{a(!1)}},[]);return(0,r.useEffect)(()=>{c()},[c]),{agents:e,loading:s,error:n,refetch:c}}function i(e){let[t,s]=(0,r.useState)([]),[n,i]=(0,r.useState)(!0),[c,d]=(0,r.useState)(null),o=(0,r.useCallback)(async()=>{try{let t=await (0,l.KU)().listSessions(null==e?void 0:e.agent);s(t),d(null)}catch(e){d(e)}finally{i(!1)}},[null==e?void 0:e.agent]);return(0,r.useEffect)(()=>{o()},[o]),a(()=>o(),(null==e?void 0:e.autoRefresh)!==!1?1e4:null),{sessions:t,loading:n,error:c,refetch:o}}function c(){let[e,t]=(0,r.useState)(null),[s,n]=(0,r.useState)(null),i=(0,r.useCallback)(async()=>{try{let e=await (0,l.KU)().health();t(e),n(null)}catch(e){n(e)}},[]);return(0,r.useEffect)(()=>{i()},[i]),a(()=>i(),3e4),{health:e,error:s,refetch:i}}function d(){let[e,t]=(0,r.useState)([]),[s,a]=(0,r.useState)(!0),[n,i]=(0,r.useState)(null),c=(0,r.useCallback)(async()=>{try{let e=await (0,l.KU)().listCredentials();t(e),i(null)}catch(e){i(e)}finally{a(!1)}},[]);return(0,r.useEffect)(()=>{c()},[c]),{credentials:e,loading:s,error:n,refetch:c}}},1804:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>d,ZV:()=>i,a3:()=>c,cn:()=>a,fw:()=>n});var r=s(6862),l=s(3690);function a(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,l.QP)((0,r.$)(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 r=Math.floor(s/60);if(r<60)return"".concat(r,"m ago");let l=Math.floor(r/60);if(l<24)return"".concat(l,"h ago");let a=Math.floor(l/24);return a<30?"".concat(a,"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 d(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:()=>a});var r=s(534),l=s(1804);let a=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:a,error:n,id:i,...c}=e;return(0,r.jsxs)("div",{className:"space-y-1.5",children:[a&&(0,r.jsx)("label",{htmlFor:i,className:"block text-sm font-medium text-white/70",children:a}),(0,r.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",n&&"border-red-500/50 focus-visible:border-red-400",s),...c}),n&&(0,r.jsx)("p",{className:"text-xs text-red-400",children:n})]})});a.displayName="Input"},3007:(e,t,s)=>{"use strict";s.d(t,{l:()=>a});var r=s(534),l=s(1804);let a=(0,s(4166).forwardRef)((e,t)=>{let{className:s,label:a,options:n,placeholder:i,id:c,...d}=e;return(0,r.jsxs)("div",{className:"space-y-1.5",children:[a&&(0,r.jsx)("label",{htmlFor:c,className:"block text-sm font-medium text-white/70",children:a}),(0,r.jsxs)("select",{ref:t,id:c,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","focus-visible:outline-none focus-visible:border-indigo-500/50",s),...d,children:[i&&(0,r.jsx)("option",{value:"",className:"bg-[#1c2129]",children:i}),n.map(e=>(0,r.jsx)("option",{value:e.value,disabled:e.disabled,className:"bg-[#1c2129]",children:e.label},e.value))]})]})});a.displayName="Select"},4193:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(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"}]])},4765:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>c,ZB:()=>i,Zp:()=>a,aR:()=>n});var r=s(534),l=s(1804);function a(e){let{children:t,className:s}=e;return(0,r.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,r.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,r.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,r.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:()=>i});var r=s(534),l=s(1804);let a={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,r.jsx)("span",{className:(0,l.cn)("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",a[s],n),children:t})}function i(e){let{status:t}=e;return(0,r.jsx)(n,{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:()=>r});let r=(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 r=s(534),l=s(1804),a=s(4166);let n={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,a.forwardRef)((e,t)=>{let{className:s,variant:a="primary",size:c="md",disabled:d,...o}=e;return(0,r.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",n[a],i[c],s),disabled:d,...o})});c.displayName="Button"},7689:(e,t,s)=>{Promise.resolve().then(s.bind(s,8031))},7691:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(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:()=>a});var r=s(534),l=s(1804);function a(e){let{width:t="100%",height:s=100,className:a}=e;return(0,r.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]",a),style:{width:"number"==typeof t?"".concat(t,"px"):t,height:s}})}},8031:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var r=s(534),l=s(4166),a=s(989),n=s(3929),i=s(4765),c=s(6719),d=s(2505),o=s(3007),u=s(5968),h=s(8314),x=s(7964),m=s(1804),f=s(858),p=s(4193),b=s(7691),v=s(6650);let w=[{value:"anthropic",label:"Anthropic"},{value:"openai",label:"OpenAI"},{value:"bedrock",label:"AWS Bedrock"},{value:"custom",label:"Custom"}];function g(){let{credentials:e,loading:t,refetch:s}=(0,a.aX)(),[d,o]=(0,l.useState)(!1),[v,w]=(0,l.useState)(null);async function g(e){w(null);try{await (0,n.KU)().deleteCredential(e),s()}catch(e){w(e instanceof Error?e.message:"Failed to delete credential")}}return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Credentials"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Store API keys for LLM providers. Encrypted at rest."})]}),(0,r.jsxs)(c.$,{onClick:()=>o(!0),children:[(0,r.jsx)(f.A,{className:"h-4 w-4 mr-2"}),"Add Credential"]})]}),v&&(0,r.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-4 py-2",children:v}),(0,r.jsx)(i.Zp,{children:(0,r.jsx)(i.Wu,{className:"p-0",children:t?(0,r.jsx)("div",{className:"p-4 space-y-2",children:[1,2,3].map(e=>(0,r.jsx)(x.X,{height:48},e))}):0===e.length?(0,r.jsx)(h.p,{icon:(0,r.jsx)(p.A,{className:"h-12 w-12"}),title:"No credentials stored",description:"Add API keys for LLM providers to use with your agents.",action:(0,r.jsxs)(c.$,{onClick:()=>o(!0),children:[(0,r.jsx)(f.A,{className:"h-4 w-4 mr-2"}),"Add Credential"]})}):(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"border-b border-white/10",children:[(0,r.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Provider"}),(0,r.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Label"}),(0,r.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Status"}),(0,r.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Last Used"}),(0,r.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-white/40 uppercase",children:"Actions"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-white/5",children:e.map(e=>(0,r.jsxs)("tr",{className:"hover:bg-white/[0.02]",children:[(0,r.jsx)("td",{className:"px-6 py-3",children:(0,r.jsx)(u.E,{variant:"info",children:e.type})}),(0,r.jsx)("td",{className:"px-6 py-3 text-white/80",children:e.label||"-"}),(0,r.jsx)("td",{className:"px-6 py-3",children:(0,r.jsx)(u.E,{variant:e.active?"success":"default",children:e.active?"Active":"Inactive"})}),(0,r.jsx)("td",{className:"px-6 py-3 text-white/40",children:e.lastUsedAt?(0,m.fw)(e.lastUsedAt):"Never"}),(0,r.jsx)("td",{className:"px-6 py-3 text-right",children:(0,r.jsx)(c.$,{variant:"ghost",size:"sm",onClick:()=>g(e.id),className:"text-red-400 hover:text-red-300",children:(0,r.jsx)(b.A,{className:"h-3.5 w-3.5"})})})]},e.id))})]})})}),d&&(0,r.jsx)(y,{onClose:()=>o(!1),onCreated:()=>{o(!1),s()}})]})}function y(e){let{onClose:t,onCreated:s}=e,[a,u]=(0,l.useState)("anthropic"),[h,x]=(0,l.useState)(""),[m,f]=(0,l.useState)(""),[p,b]=(0,l.useState)(""),[g,y]=(0,l.useState)(""),[j,N]=(0,l.useState)("us-east-1"),[k,A]=(0,l.useState)(!1),[C,S]=(0,l.useState)(null);async function E(){A(!0),S(null);try{let e=(0,n.KU)();"bedrock"===a?await e.storeBedrockCredential({accessKeyId:p,secretAccessKey:g,region:j,label:h||void 0}):await e.storeCredential(a,m,h||void 0),s()}catch(e){S(e instanceof Error?e.message:"Failed to store credential")}finally{A(!1)}}return(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,r.jsx)(i.Zp,{className:"w-full max-w-md",children:(0,r.jsxs)(i.Wu,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Add Credential"}),(0,r.jsx)("button",{onClick:t,className:"text-white/40 hover:text-white",children:(0,r.jsx)(v.A,{className:"h-5 w-5"})})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(o.l,{label:"Provider",options:w,value:a,onChange:e=>u(e.target.value)}),(0,r.jsx)(d.p,{label:"Label (optional)",placeholder:"e.g. production",value:h,onChange:e=>x(e.target.value)}),"bedrock"===a?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.p,{label:"Access Key ID",placeholder:"AKIA...",value:p,onChange:e=>b(e.target.value)}),(0,r.jsx)(d.p,{label:"Secret Access Key",type:"password",value:g,onChange:e=>y(e.target.value)}),(0,r.jsx)(d.p,{label:"Region",placeholder:"us-east-1",value:j,onChange:e=>N(e.target.value)})]}):(0,r.jsx)(d.p,{label:"API Key",type:"password",placeholder:"anthropic"===a?"sk-ant-...":"sk-...",value:m,onChange:e=>f(e.target.value)}),C&&(0,r.jsx)("p",{className:"text-sm text-red-400",children:C}),(0,r.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,r.jsx)(c.$,{variant:"ghost",onClick:t,children:"Cancel"}),(0,r.jsx)(c.$,{onClick:E,disabled:k,children:k?"Saving...":"Save"})]})]})]})})})}},8154:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var r=s(4166);let l=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 a={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 n=(0,r.forwardRef)((e,t)=>{let{color:s="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:d="",children:o,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...a,width:n,height:n,stroke:s,strokeWidth:c?24*Number(i)/Number(n):i,className:l("lucide",d),...h},[...u.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(o)?o:[o]])}),i=(e,t)=>{let s=(0,r.forwardRef)((s,a)=>{let{className:i,...c}=s;return(0,r.createElement)(n,{ref:a,iconNode:t,className:l("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),i),...c})});return s.displayName="".concat(e),s}},8314:(e,t,s)=>{"use strict";s.d(t,{p:()=>a});var r=s(534),l=s(1804);function a(e){let{icon:t,title:s,description:a,action:n,className:i}=e;return(0,r.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center justify-center py-16 text-center",i),children:[t&&(0,r.jsx)("div",{className:"mb-4 text-white/30",children:t}),(0,r.jsx)("h3",{className:"text-lg font-semibold text-white",children:s}),(0,r.jsx)("p",{className:"mt-1 max-w-sm text-sm text-white/50",children:a}),n&&(0,r.jsx)("div",{className:"mt-4",children:n})]})}}},e=>{e.O(0,[513,53,929,705,522,358],()=>e(e.s=7689)),_N_E=e.O()}]);