kanbaii 0.3.3 → 0.3.5
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.
- package/README.md +8 -0
- package/dashboard/404.html +1 -1
- package/dashboard/_next/static/chunks/app/layout-ccc8d24485f54bd6.js +1 -0
- package/dashboard/index.html +1 -1
- package/dashboard/index.txt +2 -2
- package/dist/cli/index.js +3 -0
- package/dist/server/mcp/kanbaii-mcp-server.js +496 -0
- package/package.json +4 -4
- package/dashboard/_next/static/chunks/app/layout-5b89132efd82b0a2.js +0 -1
- /package/dashboard/_next/static/{Tp6HPn---FNpuYm3B24fA → hTyF4xO8N7w2cEHRx7q75}/_buildManifest.js +0 -0
- /package/dashboard/_next/static/{Tp6HPn---FNpuYm3B24fA → hTyF4xO8N7w2cEHRx7q75}/_ssgManifest.js +0 -0
package/README.md
CHANGED
|
@@ -215,6 +215,14 @@ npm test
|
|
|
215
215
|
|
|
216
216
|
---
|
|
217
217
|
|
|
218
|
+
## Support
|
|
219
|
+
|
|
220
|
+
If you find KANBAII useful, consider giving it a star on GitHub — it helps others discover the project.
|
|
221
|
+
|
|
222
|
+
[](https://github.com/martinmsaavedra/kanbaii)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
218
226
|
<p align="center">
|
|
219
227
|
<sub>Built by <a href="https://github.com/martinmsaavedra">Martin Saavedra</a></sub>
|
|
220
228
|
<br />
|
package/dashboard/404.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/85ce8ef4f13f9778.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-5c1d03322d6ecf76.js"/><script src="/_next/static/chunks/fd9d1056-1f1f859026f5f0fa.js" async=""></script><script src="/_next/static/chunks/117-749dc8b5f56031ab.js" async=""></script><script src="/_next/static/chunks/main-app-2f313c3206a6e049.js" async=""></script><script src="/_next/static/chunks/184-15d72b1991c86ab9.js" async=""></script><script src="/_next/static/chunks/23-4a72ba4a90f008a6.js" async=""></script><script src="/_next/static/chunks/app/layout-
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/85ce8ef4f13f9778.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-5c1d03322d6ecf76.js"/><script src="/_next/static/chunks/fd9d1056-1f1f859026f5f0fa.js" async=""></script><script src="/_next/static/chunks/117-749dc8b5f56031ab.js" async=""></script><script src="/_next/static/chunks/main-app-2f313c3206a6e049.js" async=""></script><script src="/_next/static/chunks/184-15d72b1991c86ab9.js" async=""></script><script src="/_next/static/chunks/23-4a72ba4a90f008a6.js" async=""></script><script src="/_next/static/chunks/app/layout-ccc8d24485f54bd6.js" async=""></script><meta name="robots" content="noindex"/><meta name="theme-color" content="#6366f1"/><title>KANBAII</title><meta name="description" content="Structure for your ideas. AI to move them forward."/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.svg" type="image/svg+xml"/><link rel="icon" href="/favicon-16x16.svg" sizes="16x16" type="image/svg+xml"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/_next/static/chunks/webpack-5c1d03322d6ecf76.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/css/85ce8ef4f13f9778.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"2:I[2846,[],\"\"]\n4:I[4707,[],\"\"]\n5:I[6423,[],\"\"]\n6:I[792,[\"184\",\"static/chunks/184-15d72b1991c86ab9.js\",\"23\",\"static/chunks/23-4a72ba4a90f008a6.js\",\"185\",\"static/chunks/app/layout-ccc8d24485f54bd6.js\"],\"AppShell\"]\nc:I[1060,[],\"\"]\n7:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n8:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\n9:{\"display\":\"inline-block\"}\na:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\nd:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L2\",null,{\"buildId\":\"hTyF4xO8N7w2cEHRx7q75\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"_not-found\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L3\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/85ce8ef4f13f9778.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"children\":[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$7\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$8\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$9\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$a\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$Lb\"],\"globalErrorComponent\":\"$c\",\"missingSlots\":\"$Wd\"}]\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"name\":\"theme-color\",\"content\":\"#6366f1\"}],[\"$\",\"meta\",\"2\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"3\",{\"children\":\"KANBAII\"}],[\"$\",\"meta\",\"4\",{\"name\":\"description\",\"content\":\"Structure for your ideas. AI to move them forward.\"}],[\"$\",\"link\",\"5\",{\"rel\":\"manifest\",\"href\":\"/manifest.json\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"link\",\"6\",{\"rel\":\"icon\",\"href\":\"/favicon.svg\",\"type\":\"image/svg+xml\"}],[\"$\",\"link\",\"7\",{\"rel\":\"icon\",\"href\":\"/favicon-16x16.svg\",\"sizes\":\"16x16\",\"type\":\"image/svg+xml\"}]]\n3:null\n"])</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{4732:function(e,t,s){Promise.resolve().then(s.t.bind(s,7960,23)),Promise.resolve().then(s.bind(s,792))},792:function(e,t,s){"use strict";s.d(t,{AppShell:function(){return ek}});var a=s(7437),n=s(2265);let r=(0,n.createContext)(void 0);function o(e){let{children:t}=e,[s,o]=(0,n.useState)("dark"),[l,i]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{let e=localStorage.getItem("kanbaii-theme");"light"===e||"dark"===e?o(e):o("dark"),i(!0)},[]),(0,n.useEffect)(()=>{l&&(document.documentElement.setAttribute("data-theme",s),localStorage.setItem("kanbaii-theme",s))},[s,l]),l)?(0,a.jsx)(r.Provider,{value:{theme:s,toggleTheme:()=>{o(e=>"dark"===e?"light":"dark")}},children:t}):null}function l(){let e=(0,n.useContext)(r);if(!e)throw Error("useTheme must be used within ThemeProvider");return e}var i=s(2829);let c=(0,i.Z)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var d=s(9397);let x=(0,i.Z)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),u=(0,i.Z)("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);var p=s(8930),m=s(407),h=s(9076);let f=(0,i.Z)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);var b=s(8728),g=s(9747),v=s(9449),j=s(2569),y=s(9405),k=s(1347);function N(){let{theme:e,toggleTheme:t}=l();return(0,a.jsxs)("button",{className:"relative w-12 h-[26px] rounded-[13px] border border-border bg-surface cursor-pointer p-0 transition-all duration-250 ease-out-expo overflow-hidden shrink-0 hover:border-accent hover:bg-surface-hover hover:shadow-[0_0_8px_var(--accent-glow)]",onClick:t,title:"Switch to ".concat("dark"===e?"light":"dark"," theme"),children:[(0,a.jsx)(k.E.div,{className:"absolute top-0.5 left-0.5 w-5 h-5 rounded-[10px] bg-accent shadow-[0_2px_6px_rgba(0,0,0,0.3)] flex items-center justify-center",initial:!1,animate:{x:"dark"===e?0:22},transition:{type:"spring",stiffness:300,damping:30},children:"dark"===e?(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,a.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,a.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),(0,a.jsx)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),(0,a.jsx)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),(0,a.jsx)("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),(0,a.jsx)("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),(0,a.jsx)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),(0,a.jsx)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}),(0,a.jsxs)("div",{className:"absolute inset-0 flex items-center justify-between px-1.5 pointer-events-none",children:[(0,a.jsx)("div",{className:"ml-0.5 transition-opacity duration-250 ease-out-expo ".concat("dark"===e?"opacity-30":"opacity-0"),children:(0,a.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}),(0,a.jsx)("div",{className:"mr-0.5 transition-opacity duration-250 ease-out-expo ".concat("light"===e?"opacity-30":"opacity-0"),children:(0,a.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,a.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,a.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"})]})})]})]})}var w=s(2489),C=s(1171),S=s(9116);let T=["#6366f1","#ef4444","#f59e0b","#22c55e","#3b82f6","#8b5cf6","#ec4899","#14b8a6"];function z(e){let{onClose:t}=e,s=(0,v.U)(e=>e.goToProject),r=(0,g.i)(e=>e.createProject),[o,l]=(0,n.useState)(""),[i,c]=(0,n.useState)(""),[d,x]=(0,n.useState)(""),[u,p]=(0,n.useState)(T[0]),[m,h]=(0,n.useState)(!1),{overlayProps:f}=(0,C.N)(t,{disabled:m});(0,n.useEffect)(()=>{S.h.getHealth().then(e=>{e.cwd&&!d&&x(e.cwd)}).catch(()=>{})},[]);let b=async e=>{if(e.preventDefault(),o.trim()){h(!0);try{let e=await r({title:o.trim(),description:i.trim()||void 0,color:u,workingDir:d.trim()||void 0});t(),s(e.slug)}catch(e){h(!1)}}};return(0,a.jsx)("div",{className:"glass-overlay",...f,children:(0,a.jsxs)("div",{className:"modal-box w-[440px] max-w-[92%] p-7",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-7",children:[(0,a.jsx)("span",{className:"text-h2 font-semibold tracking-tight",children:"New Project"}),(0,a.jsx)("button",{className:"btn-icon",onClick:t,children:(0,a.jsx)(w.Z,{size:16})})]}),(0,a.jsxs)("form",{className:"flex flex-col gap-5",onSubmit:b,children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Title"}),(0,a.jsx)("input",{value:o,onChange:e=>l(e.target.value),placeholder:"Project name...",autoFocus:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Description (optional)"}),(0,a.jsx)("input",{value:i,onChange:e=>c(e.target.value),placeholder:"Brief description..."})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Working Directory"}),(0,a.jsx)("input",{value:d,onChange:e=>x(e.target.value),placeholder:"C:\\Users\\...\\my-project"}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted mt-1 opacity-60",children:"Where Claude runs commands. Defaults to where kanbaii was started."})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Color"}),(0,a.jsx)("div",{className:"flex gap-2",children:T.map(e=>(0,a.jsx)("button",{type:"button",className:"w-6 h-6 rounded-full border-2 cursor-pointer transition-all duration-150 ease-out-expo\n ".concat(u===e?"border-text shadow-[0_0_8px_currentColor]":"border-transparent shadow-[0_0_0_0_transparent]","\n hover:scale-[1.2] hover:shadow-[0_0_12px_currentColor]"),style:{background:e},onClick:()=>p(e)},e))})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,a.jsx)("button",{type:"button",className:"btn-ghost",onClick:t,children:"Cancel"}),(0,a.jsx)("button",{type:"submit",className:"btn-primary",disabled:!o.trim()||m,children:m?"Creating...":"Create"})]})]})]})})}let E=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555",P=[{key:"general",label:"General"},{key:"ralph",label:"Ralph"},{key:"scheduler",label:"Scheduler"},{key:"terminal",label:"Terminal"},{key:"auth",label:"Auth"},{key:"integrations",label:"Integrations"}];function M(e){let{onClose:t}=e,s=(0,y.E)(e=>e.addToast),[r,o]=(0,n.useState)("general"),[l,i]=(0,n.useState)(null),[c,d]=(0,n.useState)(!1),{overlayProps:x}=(0,C.N)(t),u=(0,n.useCallback)(async()=>{try{let e=await fetch("".concat(E,"/api/settings")),t=await e.json();t.ok&&i(t.data)}catch(e){}},[]);(0,n.useEffect)(()=>{u()},[u]);let p=async(e,t)=>{d(!0);try{await fetch("".concat(E,"/api/settings/").concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s("Settings saved","success"),u()}catch(e){s("Failed to save","error")}d(!1)};return l?(0,a.jsx)("div",{className:"glass-overlay",...x,children:(0,a.jsxs)("div",{className:"modal-box max-w-[680px] w-[95%] max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 pt-5 pb-4 shrink-0",children:[(0,a.jsxs)("div",{className:"text-h2 font-semibold tracking-tight flex items-center gap-2",children:[(0,a.jsx)(b.Z,{size:16})," Settings"]}),(0,a.jsx)("button",{className:"btn-icon",onClick:t,children:(0,a.jsx)(w.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,a.jsx)("div",{className:"w-40 shrink-0 border-r border-border p-2 flex flex-col gap-0.5 bg-bg-subtle",children:P.map(e=>(0,a.jsx)("button",{className:"px-3 py-2 text-xs font-medium text-text-muted rounded-sm text-left transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat(r===e.key?"text-text bg-accent-muted":""),onClick:()=>o(e.key),children:e.label},e.key))}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:["general"===r&&(0,a.jsxs)(_,{title:"General",onSave:e=>p("general",e),saving:c,children:[(0,a.jsx)(I,{label:"Default Model",type:"select",value:l.general.defaultModel,options:["haiku","sonnet","opus"],field:"defaultModel"}),(0,a.jsx)(I,{label:"Timezone",value:l.general.timezone,field:"timezone"}),(0,a.jsx)(I,{label:"Port",type:"number",value:l.general.port,field:"port"})]}),"ralph"===r&&(0,a.jsxs)(_,{title:"Ralph",onSave:e=>p("ralph",e),saving:c,children:[(0,a.jsx)(I,{label:"Max Iterations",type:"number",value:l.ralph.maxIterations,field:"maxIterations"}),(0,a.jsx)(I,{label:"Circuit Breaker (max errors)",type:"number",value:l.ralph.circuitBreaker,field:"circuitBreaker"}),(0,a.jsx)(I,{label:"Task Filter",type:"select",value:l.ralph.taskFilter,options:["todo-only","all"],field:"taskFilter"})]}),"scheduler"===r&&(0,a.jsxs)(_,{title:"Scheduler",onSave:e=>p("scheduler",e),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.scheduler.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"Max Concurrent",type:"number",value:l.scheduler.maxConcurrent,field:"maxConcurrent"}),(0,a.jsx)(I,{label:"Timeout (ms)",type:"number",value:l.scheduler.timeout,field:"timeout"}),(0,a.jsx)(I,{label:"Stale Threshold (min)",type:"number",value:l.scheduler.staleThreshold,field:"staleThreshold"})]}),"terminal"===r&&(0,a.jsxs)(_,{title:"Terminal",onSave:e=>p("terminal",e),saving:c,children:[(0,a.jsx)(I,{label:"Inactivity Warn (min)",type:"number",value:l.terminal.inactivityWarn,field:"inactivityWarn"}),(0,a.jsx)(I,{label:"Inactivity Kill (min)",type:"number",value:l.terminal.inactivityKill,field:"inactivityKill"}),(0,a.jsx)(I,{label:"Max Timeout (min)",type:"number",value:l.terminal.maxTimeout,field:"maxTimeout"})]}),"auth"===r&&(0,a.jsxs)(_,{title:"Authentication",onSave:e=>p("auth",e),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.auth.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"Secret Key",value:l.auth.secret,field:"secret",placeholder:"auto-generated if empty"}),(0,a.jsx)(I,{label:"Token Expiry",value:l.auth.tokenExpiry,field:"tokenExpiry",placeholder:"24h"})]}),"integrations"===r&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(_,{title:"Telegram",onSave:e=>p("integrations",{telegram:e}),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.integrations.telegram.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"Bot Token",value:l.integrations.telegram.botToken,field:"botToken",placeholder:"123456:ABC-DEF..."}),(0,a.jsx)(I,{label:"Chat ID",value:l.integrations.telegram.chatId,field:"chatId",placeholder:"-100123456789"})]}),(0,a.jsxs)(_,{title:"Voice Input",onSave:e=>p("integrations",{voice:e}),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.integrations.voice.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"OpenAI API Key",value:l.integrations.voice.openaiApiKey||"",field:"openaiApiKey",placeholder:"sk-... (for Whisper fallback)"})]})]})]})]})]})}):null}function _(e){let{title:t,children:s,onSave:r,saving:o}=e,[l,i]=(0,n.useState)({});(0,n.useEffect)(()=>{let e={};n.Children.forEach(s,t=>{var s;(null==t?void 0:null===(s=t.props)||void 0===s?void 0:s.field)&&(e[t.props.field]=t.props.value)}),i(e)},[s]);let c=(e,t)=>{i(s=>({...s,[e]:t}))};return(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-body font-semibold text-text tracking-tight",children:t}),(0,a.jsx)("button",{className:"btn-primary",onClick:()=>r(l),disabled:o,children:o?"Saving...":"Save"})]}),(0,a.jsx)("div",{className:"flex flex-col gap-3",children:n.Children.map(s,e=>{var t,s;return(null==e?void 0:null===(t=e.props)||void 0===t?void 0:t.field)?n.cloneElement(e,{value:null!==(s=l[e.props.field])&&void 0!==s?s:e.props.value,onChange:t=>c(e.props.field,t)}):e})})]})}function I(e){let{label:t,value:s,field:n,type:r,options:o,placeholder:l,onChange:i}=e;return"toggle"===r?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-secondary min-w-[140px] shrink-0",children:t}),(0,a.jsx)("button",{className:"px-3 py-1 text-data font-semibold rounded-xs font-mono border transition-all duration-150 ease-out-expo tracking-wide ".concat(s?"text-success border-success-dim bg-success-dim":"text-text-muted border-border"),onClick:()=>null==i?void 0:i(!s),children:s?"ON":"OFF"})]}):"select"===r&&o?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-secondary min-w-[140px] shrink-0",children:t}),(0,a.jsx)("div",{className:"flex gap-1",children:o.map(e=>(0,a.jsx)("button",{className:"px-2.5 py-1 text-data font-medium rounded-full border font-mono transition-all duration-150 ease-out-expo ".concat(s===e?"border-accent-dim text-accent bg-accent-muted":"border-border text-text-muted hover:border-border-light hover:text-text-secondary"),onClick:()=>null==i?void 0:i(e),children:e},e))})]}):(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-secondary min-w-[140px] shrink-0",children:t}),(0,a.jsx)("input",{type:r||"text",value:null!=s?s:"",onChange:e=>null==i?void 0:i("number"===r?Number(e.target.value):e.target.value),placeholder:l,className:"flex-1 max-w-[200px] text-right font-mono text-xs"})]})}let A=(0,i.Z)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var Z=s(1239),R=s(1723);let D=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555";function F(e){return e<.01?"$".concat(e.toFixed(4)):"$".concat(e.toFixed(2))}function L(e){var t;let{projectSlug:s}=e,r=(0,y.E)(e=>e.addToast),[o,l]=(0,n.useState)(null),[i,c]=(0,n.useState)([]),[d,x]=(0,n.useState)("30d"),[u,m]=(0,n.useState)(s?"project":"global"),h=(0,n.useCallback)(async()=>{let e="project"===u&&s?s:void 0,t="7d"===d?7:"30d"===d?30:void 0,[a,n]=await Promise.all([fetch("".concat(D,"/api/costs/summary").concat(e?"?projectSlug=".concat(e):"")).then(e=>e.json()).catch(()=>({data:null})),fetch("".concat(D,"/api/costs/executions?limit=50").concat(e?"&projectSlug=".concat(e):"").concat(t?"&days=".concat(t):"")).then(e=>e.json()).catch(()=>({data:[]}))]);l(a.data||null),c(n.data||[])},[s,u,d]);(0,n.useEffect)(()=>{h()},[h]);let b=async()=>{let e="project"===u&&s?"?projectSlug=".concat(s):"";await fetch("".concat(D,"/api/costs/clear").concat(e),{method:"DELETE"}),r("Execution history cleared","info"),h()},g={opus:"#a855f7",sonnet:"#6366f1",haiku:"#22c55e"};return(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-y-auto gap-5 p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("div",{className:"text-h2 font-semibold tracking-tight flex items-center gap-2",children:[(0,a.jsx)(f,{size:18})," Costs & Analytics"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[s&&(0,a.jsxs)("div",{className:"flex border border-border rounded-sm overflow-hidden",children:[(0,a.jsx)("button",{className:"px-2.5 py-1 text-xxs font-semibold font-mono tracking-wide uppercase text-text-muted transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat("project"===u?"text-accent bg-accent-muted":""),onClick:()=>m("project"),children:"Project"}),(0,a.jsx)("button",{className:"px-2.5 py-1 text-xxs font-semibold font-mono tracking-wide uppercase text-text-muted transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat("global"===u?"text-accent bg-accent-muted":""),onClick:()=>m("global"),children:"Global"})]}),(0,a.jsx)("div",{className:"flex border border-border rounded-sm overflow-hidden",children:["7d","30d","all"].map(e=>(0,a.jsx)("button",{className:"px-2.5 py-1 text-xxs font-semibold font-mono tracking-wide uppercase text-text-muted transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat(d===e?"text-accent bg-accent-muted":""),onClick:()=>x(e),children:e},e))})]})]}),o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-4 gap-2 max-md:grid-cols-2",children:[(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(A,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:F(o.todayCost)}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"Today"})]}),(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(A,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:F(o.monthlyCost)}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"This Month"})]}),(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(Z.Z,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:(t=o.monthlyTokens)>=1e6?"".concat((t/1e6).toFixed(1),"M"):t>=1e3?"".concat((t/1e3).toFixed(0),"K"):"".concat(t)}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"Tokens (Month)"})]}),(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(R.Z,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:o.monthlyExecutions}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"Executions (Month)"})]})]}),Object.keys(o.byModel).length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("div",{className:"text-data font-semibold text-text-muted uppercase tracking-widest font-mono",children:"Model Breakdown"}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:Object.entries(o.byModel).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2.5 border border-border rounded-sm bg-card",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:g[t]||"#6366f1"}}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text",children:t}),(0,a.jsxs)("span",{className:"text-data text-text-muted font-mono ml-2",children:[s.count," runs — ",F(s.cost)]})]}),(0,a.jsx)("div",{className:"w-20 h-1 rounded-full overflow-hidden",style:{background:"rgba(148, 163, 242, 0.06)"},children:(0,a.jsx)("div",{className:"h-full rounded-full transition-[width] duration-500 ease-out-expo",style:{width:"".concat(o.totalExecutions>0?s.count/o.totalExecutions*100:0,"%"),background:g[t]||"#6366f1"}})})]},t)})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"text-data font-semibold text-text-muted uppercase tracking-widest font-mono",children:"Recent Executions"}),(0,a.jsxs)("button",{className:"inline-flex items-center gap-[3px] text-xxs text-text-muted px-2 py-[3px] rounded-xs font-mono border border-border transition-all duration-120 ease-out-expo hover:text-danger hover:border-danger-dim",onClick:b,children:[(0,a.jsx)(p.Z,{size:10})," Clear"]})]}),0===i.length?(0,a.jsx)("div",{className:"text-text-muted text-label text-center py-8 font-mono opacity-50",children:"No executions recorded yet"}):(0,a.jsxs)("div",{className:"border border-border rounded-md overflow-hidden bg-card",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_70px_70px_60px_40px] px-3.5 py-2 text-xxs font-semibold text-text-muted uppercase tracking-wide font-mono border-b border-border bg-bg-subtle",children:[(0,a.jsx)("span",{children:"Task"}),(0,a.jsx)("span",{children:"Model"}),(0,a.jsx)("span",{children:"Duration"}),(0,a.jsx)("span",{children:"Cost"}),(0,a.jsx)("span",{children:"Status"})]}),i.map(e=>{var t;return(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_70px_70px_60px_40px] px-3.5 py-2 text-label border-b border-b-[rgba(148,163,242,0.03)] last:border-b-0 transition-colors duration-120 ease-out-expo hover:bg-surface-hover",children:[(0,a.jsx)("span",{className:"text-text overflow-hidden text-ellipsis whitespace-nowrap",children:e.taskTitle||e.projectSlug}),(0,a.jsx)("span",{className:"font-mono text-data font-semibold",style:{color:g[e.model]||"#6366f1"},children:e.model}),(0,a.jsx)("span",{className:"text-text-muted font-mono text-data",children:(t=e.duration)<1e3?"".concat(t,"ms"):"".concat((t/1e3).toFixed(1),"s")}),(0,a.jsx)("span",{className:"text-text-secondary font-mono text-data font-medium",children:F(e.costUsd)}),(0,a.jsx)("span",{className:"text-center ".concat("success"===e.status?"text-success":"text-danger"),children:"success"===e.status?"✓":"✗"})]},e.id)})]})]})]})}var q=s(7168),U=s(4401),B=s(6766);let O=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555",K="kanbaii-claude-usage";function W(e){return e>=80?"#ef4444":e>=60?"#f59e0b":"#6366f1"}function G(){try{var e;let t=sessionStorage.getItem(K);if(!t)return null;let s=JSON.parse(t);if((null==s?void 0:null===(e=s.entries)||void 0===e?void 0:e.length)>0&&Date.now()-new Date(s.timestamp).getTime()<3e5)return s}catch(e){}return null}function H(e){let{isExpanded:t}=e,[s,r]=(0,n.useState)(G),[o,l]=(0,n.useState)(!1),i=(0,n.useRef)(!0),c=(0,n.useCallback)(e=>{if(i.current){r(e),l(!1);try{sessionStorage.setItem(K,JSON.stringify(e))}catch(e){}}},[]),d=(0,n.useCallback)(async()=>{try{var e;let t=await fetch("".concat(O,"/api/costs/claude-usage")),s=await t.json(),a=(null==s?void 0:s.data)||s;if((null==a?void 0:null===(e=a.entries)||void 0===e?void 0:e.length)>0)return c(a),!0}catch(e){}return!1},[c]);(0,n.useEffect)(()=>{i.current=!0;let e=null,t=null,a=null,n=()=>{t=setInterval(async()=>{await d()&&t&&(clearInterval(t),t=null)},3e3),a=setTimeout(()=>{t&&(clearInterval(t),t=null),i.current&&!s&&l(!0)},3e4)};return e=setInterval(d,6e4),d().then(e=>{e||n()}),()=>{i.current=!1,e&&clearInterval(e),t&&clearInterval(t),a&&clearTimeout(a)}},[]),(0,n.useEffect)(()=>{let e=(0,B.h)(),t=e=>{var t;(null==e?void 0:null===(t=e.entries)||void 0===t?void 0:t.length)>0&&c(e)};return e.on("claude-usage",t),e.on("connect",()=>{d()}),()=>{e.off("claude-usage",t)}},[c,d]);let x=s?Math.max(...s.entries.map(e=>e.percent),0):0;return t?s?(0,a.jsxs)("div",{className:"px-3 py-2 flex flex-col gap-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-0.5",children:[(0,a.jsx)(U.Z,{size:10,className:"text-text-muted opacity-50"}),(0,a.jsx)("span",{className:"text-[8px] font-semibold text-text-muted uppercase tracking-[0.1em] font-mono opacity-60",children:"Rate Limits"})]}),s.entries.map((e,t)=>{var s;let n=W(e.percent),r=(s=e.percent)>=80?"rgba(239,68,68,0.3)":s>=60?"rgba(245,158,11,0.2)":"rgba(99,102,241,0.15)";return(0,a.jsxs)("div",{className:"flex flex-col gap-[3px]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-baseline",children:[(0,a.jsx)("span",{className:"text-[9px] text-text-muted truncate max-w-[110px] font-mono",children:e.label}),(0,a.jsxs)("span",{className:"text-[10px] font-bold font-mono tabular-nums ".concat(e.percent>=80?"animate-breathe":""),style:{color:n},children:[e.percent,"%"]})]}),(0,a.jsx)("div",{className:"w-full h-[3px] rounded-full overflow-hidden",style:{background:"rgba(148,163,242,0.06)"},children:(0,a.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:"".concat(Math.min(e.percent,100),"%"),background:n,boxShadow:e.percent>40?"0 0 6px ".concat(r):"none"}})}),e.resetsAt&&(0,a.jsxs)("span",{className:"text-[7px] text-text-muted font-mono opacity-40",children:["Resets ",e.resetsAt]})]},t)})]}):o?(0,a.jsxs)("div",{className:"px-3 py-2 flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"text-[8px] text-text-muted font-mono opacity-40",children:"Unavailable"}),(0,a.jsxs)("button",{className:"text-[8px] text-accent font-mono opacity-60 hover:opacity-100 transition-opacity flex items-center gap-1",onClick:()=>{l(!1),d()},children:[(0,a.jsx)(q.Z,{size:8})," Retry"]})]}):(0,a.jsxs)("div",{className:"px-3 py-2 flex items-center justify-center gap-2",children:[(0,a.jsx)("div",{className:"w-2.5 h-2.5 border border-text-muted/20 border-t-accent/50 rounded-full animate-spin"}),(0,a.jsx)("span",{className:"text-[8px] text-text-muted font-mono opacity-40",children:"Loading usage..."})]}):s?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1 py-1",title:s.entries.map(e=>"".concat(e.label,": ").concat(e.percent,"%")).join("\n"),children:[(0,a.jsx)("div",{className:"w-[5px] h-5 rounded-full overflow-hidden flex flex-col-reverse",style:{background:"rgba(148, 163, 242, 0.06)"},children:(0,a.jsx)("div",{className:"w-full rounded-full transition-[height] duration-500",style:{height:"".concat(Math.min(x,100),"%"),background:W(x)}})}),(0,a.jsxs)("span",{className:"text-[7px] text-text-muted font-mono opacity-50",children:[x,"%"]})]}):null}let V=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555";function J(){let{projects:e,fetchProjects:t,setActiveSlug:s,deleteProject:r,permanentDeleteProject:o,updateProject:l}=(0,g.i)(),{projectSlug:i,goToProject:k,goHome:w}=(0,v.U)(),C=(0,j.q)(e=>e.ralph),S=(0,j.q)(e=>e.teams),T=(0,y.E)(e=>e.addToast),[E,P]=(0,n.useState)(!1),[_,I]=(0,n.useState)(!1),[A,Z]=(0,n.useState)(!1),[R,D]=(0,n.useState)(null),[F,q]=(0,n.useState)(null),[U,B]=(0,n.useState)(null),[O,K]=(0,n.useState)(!1),[W,G]=(0,n.useState)(!1),[J,$]=(0,n.useState)(!0),[Q,Y]=(0,n.useState)(!1),ee=(0,n.useRef)(null),et=J||Q,es=(0,j.q)(e=>e.terminal.status),ea=(0,j.q)(e=>e.planner.active),en="running"===C.status||"paused"===C.status||S.active||"running"===es||ea;(0,n.useEffect)(()=>{t()},[t]),(0,n.useEffect)(()=>{if(!U)return;let e=()=>B(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[U]);let er=e=>{s(e.slug),k(e.slug)},eo=async(e,t)=>{e.stopPropagation(),B(null);try{await l(t.slug,{status:"archived"}),i===t.slug&&w(),T("".concat(t.title," archived"),"success")}catch(e){T("Failed to archive","error")}},el=async(e,t)=>{e.stopPropagation(),B(null);try{await r(t.slug),i===t.slug&&w(),T("".concat(t.title," moved to trash"),"success")}catch(e){T("Failed to move to trash","error")}},ei=async(e,t)=>{if(e.stopPropagation(),F!==t.slug){q(t.slug),setTimeout(()=>q(null),3e3);return}B(null);try{await o(t.slug),T("".concat(t.title," permanently deleted"),"success"),q(null)}catch(e){T("Failed to delete","error")}},ec=async(e,t)=>{e.stopPropagation(),B(null);try{await l(t.slug,{status:"active"}),T("".concat(t.title," restored"),"success")}catch(e){T("Failed to restore","error")}},ed=(e,t)=>{e.stopPropagation(),fetch("".concat(V,"/api/system/open-folder"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.workingDir})}).catch(()=>T("Failed to open folder","error"))},ex=e.filter(e=>"active"===e.status),eu=e.filter(e=>"archived"===e.status),ep=e.filter(e=>"deleted"===e.status);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("aside",{className:"flex-shrink-0 border-r border-border bg-bg-subtle flex flex-col overflow-hidden relative z-10\n transition-all duration-300 ease-out-expo ".concat(et?"w-sidebar":"w-sidebar-collapsed"),onMouseEnter:()=>{ee.current&&clearTimeout(ee.current),Y(!0)},onMouseLeave:()=>{ee.current=setTimeout(()=>Y(!1),200)},children:[(0,a.jsxs)("div",{className:"flex items-center flex-shrink-0 min-h-[48px]\n ".concat(et?"px-3 pt-3.5 pb-2.5 justify-between":"px-0 pt-3.5 pb-[18px] justify-center"),children:[(0,a.jsxs)("div",{className:"flex items-center ".concat(et?"gap-2.5":"gap-0"),children:[(0,a.jsx)("div",{className:"rounded-sm flex items-center justify-center flex-shrink-0 overflow-hidden relative\n transition-all duration-400\n ".concat(et?"w-[26px] h-[26px]":"w-7 h-7","\n ").concat(en?"bg-gradient-to-br from-emerald-800 to-emerald-500 shadow-[0_0_10px_rgba(16,185,129,0.3),0_0_20px_rgba(16,185,129,0.1)] border border-emerald-500/35 animate-breathe":"bg-gradient-to-br from-indigo-800 to-indigo-400 shadow-[0_0_8px_rgba(99,102,241,0.15),inset_0_0_6px_rgba(99,102,241,0.06)] border border-indigo-500/12"),children:(0,a.jsxs)("svg",{width:et?26:28,height:et?26:28,viewBox:"0 0 32 32",className:"block",children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"kc1",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:en?"#d1fae5":"#e0e7ff"}),(0,a.jsx)("stop",{offset:"100%",stopColor:en?"#a7f3d0":"#c7d2fe"})]}),(0,a.jsxs)("linearGradient",{id:"kc2",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:en?"#f0fdf4":"#f5f3ff"}),(0,a.jsx)("stop",{offset:"100%",stopColor:en?"#d1fae5":"#e0e7ff"})]}),(0,a.jsxs)("filter",{id:"kglow",children:[(0,a.jsx)("feGaussianBlur",{stdDeviation:"1.5",result:"b"}),(0,a.jsxs)("feMerge",{children:[(0,a.jsx)("feMergeNode",{in:"b"}),(0,a.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})]}),(0,a.jsxs)("g",{filter:"url(#kglow)",children:[(0,a.jsx)("rect",{x:"7",y:"10",width:"4.5",height:"12",fill:"url(#kc1)",rx:"1.5"}),(0,a.jsx)("rect",{x:"13.75",y:"7.5",width:"4.5",height:"17",fill:"url(#kc2)",rx:"1.5"}),(0,a.jsx)("rect",{x:"20.5",y:"11",width:"4.5",height:"10",fill:"url(#kc1)",rx:"1.5"})]})]})}),et&&(0,a.jsx)("span",{className:"text-[17px] font-light tracking-[0.15em] uppercase text-gradient opacity-90",children:"KANBAII"})]}),et&&(0,a.jsx)("button",{className:"w-[26px] h-[26px] flex items-center justify-center rounded-md transition-all duration-200\n ".concat(J?"text-accent bg-accent-muted":"text-text-muted bg-transparent opacity-50 hover:opacity-100 hover:bg-surface hover:text-text"),onClick:()=>$(!J),title:J?"Unpin sidebar":"Pin sidebar",children:(0,a.jsx)(c,{size:13,fill:J?"currentColor":"none",className:"transition-transform duration-300 ".concat(J?"rotate-0":"-rotate-45")})})]}),(0,a.jsx)("div",{className:"h-px flex-shrink-0 opacity-50 ".concat(et?"mx-3 my-[2px_12px_6px]":"mx-2.5 my-[2px_10px_6px]"),style:{background:"linear-gradient(90deg, transparent 10%, var(--border-glow) 50%, transparent 90%)",margin:et?"2px 12px 6px":"2px 10px 6px"}}),(0,a.jsx)("div",{className:"flex-shrink-0 px-2 py-1",children:(0,a.jsxs)("button",{className:"w-full rounded-sm border border-dashed border-border-light bg-transparent text-text-muted text-xs font-medium\n flex items-center gap-2 cursor-pointer transition-all duration-200 ease-out-expo\n hover:bg-accent-muted hover:border-accent/25 hover:text-accent\n ".concat(et?"py-2 px-2.5 justify-start":"py-2 px-0 justify-center"),onClick:()=>P(!0),children:[(0,a.jsx)(d.Z,{size:14}),et&&"New Project"]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden px-2 py-1 pb-4",children:0===ex.length&&0===eu.length&&0===ep.length?(0,a.jsx)("div",{className:"text-center text-text-muted text-body py-8 px-3 transition-opacity duration-150 ".concat(et?"opacity-100":"opacity-0"),children:"No projects yet"}):(0,a.jsxs)(a.Fragment,{children:[ex.map(e=>{let t=i===e.slug,s=C.projectSlug===e.slug&&("running"===C.status||"paused"===C.status),n=S.active&&S.projectSlug===e.slug,r=ea&&j.q.getState().planner.projectSlug===e.slug,o=s||n||r,l=function(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:99,g:102,b:241}}(e.color);return(0,a.jsxs)("div",{className:"relative mb-0.5 group ".concat(U===e.slug?"z-[200]":""),children:[(0,a.jsxs)("button",{className:"w-full rounded-sm text-left flex items-center transition-all duration-200 cursor-pointer\n ".concat(et?"py-3 px-3.5 justify-start gap-3":"py-2.5 px-0 justify-center gap-0","\n ").concat(t?"bg-surface border border-border":"bg-transparent border border-transparent hover:bg-surface"),onClick:()=>er(e),children:[(0,a.jsx)("div",{className:"rounded-full flex-shrink-0 transition-all duration-400\n ".concat(et?"w-2.5 h-2.5":"w-3 h-3","\n ").concat(o?"!bg-emerald-500 animate-dot-pulse":""),style:{"--dot-r":l.r,"--dot-g":l.g,"--dot-b":l.b,...o?{}:{background:e.color,boxShadow:t?"0 0 8px ".concat(e.color,"50"):"none"}}}),et&&(0,a.jsxs)("div",{className:"flex-1 min-w-0 pr-6",children:[(0,a.jsx)("div",{className:"text-sm font-medium whitespace-nowrap overflow-hidden text-ellipsis tracking-tight\n ".concat(t?"text-text":"text-text-secondary"),children:e.title}),e.workingDir?(0,a.jsxs)("button",{className:"text-label flex items-center gap-1 mt-0.5 whitespace-nowrap overflow-hidden text-ellipsis text-text-muted hover:text-accent transition-colors duration-150",onClick:t=>ed(t,e),title:"Open folder in explorer",children:[(0,a.jsx)(x,{size:10}),e.workingDir.split(/[/\\]/).slice(-2).join("/")]}):(0,a.jsxs)("button",{className:"text-label flex items-center gap-1 mt-0.5 text-warning hover:text-accent transition-colors duration-150",onClick:t=>{t.stopPropagation(),D({slug:e.slug,current:""})},title:"Click to set project folder",children:[(0,a.jsx)(x,{size:10})," Set folder"]})]})]}),et&&(0,a.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[e.workingDir&&(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-accent",onClick:t=>ed(t,e),title:"Open folder",children:(0,a.jsx)(x,{size:11})}),(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-text-secondary",onClick:t=>{t.stopPropagation(),B(U===e.slug?null:e.slug),q(null)},children:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,a.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"19",r:"2"})]})})]}),U===e.slug&&et&&(0,a.jsxs)("div",{className:"absolute right-1 top-full mt-0.5 min-w-[160px] bg-glass backdrop-blur-[12px] backdrop-saturate-[160%] border border-glass-border rounded-md shadow-elevated z-[100] py-1 overflow-hidden animate-filter-in",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>{t.stopPropagation(),B(null),D({slug:e.slug,current:e.workingDir||""})},children:[(0,a.jsx)(x,{size:14})," ",e.workingDir?"Change Folder":"Set Folder"]}),e.workingDir&&(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>{t.stopPropagation(),B(null),ed(t,e)},children:[(0,a.jsx)(x,{size:14})," Open Folder"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>eo(t,e),children:[(0,a.jsx)(u,{size:14})," Archive"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 text-danger text-xs text-left transition-colors duration-100 bg-transparent hover:bg-danger-dim",onClick:t=>el(t,e),children:[(0,a.jsx)(p.Z,{size:14})," Move to Trash"]})]})]},e.id)}),eu.length>0&&et&&(0,a.jsxs)("div",{className:"mt-3 pt-2 border-t border-border/20",children:[(0,a.jsxs)("button",{className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-[10px] font-medium uppercase tracking-wider text-text-muted/50 hover:text-text-muted transition-colors",onClick:()=>K(!O),children:[(0,a.jsx)(m.Z,{size:10,className:"transition-transform duration-200 ".concat(O?"rotate-90":"")}),(0,a.jsx)(u,{size:10}),"Archived (",eu.length,")"]}),O&&eu.map(e=>(0,a.jsxs)("div",{className:"relative mb-0.5 group opacity-50 hover:opacity-70 transition-opacity ".concat(U===e.slug?"z-[200]":""),children:[(0,a.jsxs)("button",{className:"w-full rounded-sm text-left flex items-center transition-all duration-200 cursor-pointer py-2 px-3.5 justify-start gap-3 bg-transparent border border-transparent hover:bg-surface",onClick:()=>er(e),children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:e.color}}),(0,a.jsx)("span",{className:"text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis tracking-tight text-text-secondary flex-1 min-w-0",children:e.title})]}),(0,a.jsx)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-text-secondary",onClick:t=>{t.stopPropagation(),B(U===e.slug?null:e.slug),q(null)},children:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,a.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"19",r:"2"})]})})}),U===e.slug&&(0,a.jsxs)("div",{className:"absolute right-1 top-full mt-0.5 min-w-[160px] bg-glass backdrop-blur-[12px] backdrop-saturate-[160%] border border-glass-border rounded-md shadow-elevated z-[100] py-1 overflow-hidden animate-filter-in",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>ec(t,e),children:[(0,a.jsx)(h.Z,{size:14})," Unarchive"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 text-danger text-xs text-left transition-colors duration-100 bg-transparent hover:bg-danger-dim",onClick:t=>el(t,e),children:[(0,a.jsx)(p.Z,{size:14})," Move to Trash"]})]})]},e.id))]}),ep.length>0&&et&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-border/20",children:[(0,a.jsxs)("button",{className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-[10px] font-medium uppercase tracking-wider text-text-muted/50 hover:text-text-muted transition-colors",onClick:()=>G(!W),children:[(0,a.jsx)(m.Z,{size:10,className:"transition-transform duration-200 ".concat(W?"rotate-90":"")}),(0,a.jsx)(p.Z,{size:10}),"Trash (",ep.length,")"]}),W&&ep.map(e=>(0,a.jsxs)("div",{className:"relative mb-0.5 group opacity-40 hover:opacity-60 transition-opacity ".concat(U===e.slug?"z-[200]":""),children:[(0,a.jsxs)("div",{className:"w-full rounded-sm text-left flex items-center py-2 px-3.5 justify-start gap-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full flex-shrink-0 opacity-50",style:{background:e.color}}),(0,a.jsx)("span",{className:"text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis tracking-tight text-text-muted line-through flex-1 min-w-0",children:e.title})]}),(0,a.jsx)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-text-secondary",onClick:t=>{t.stopPropagation(),B(U===e.slug?null:e.slug),q(null)},children:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,a.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"19",r:"2"})]})})}),U===e.slug&&(0,a.jsxs)("div",{className:"absolute right-1 top-full mt-0.5 min-w-[160px] bg-glass backdrop-blur-[12px] backdrop-saturate-[160%] border border-glass-border rounded-md shadow-elevated z-[100] py-1 overflow-hidden animate-filter-in",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>ec(t,e),children:[(0,a.jsx)(h.Z,{size:14})," Restore"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 text-xs text-left transition-colors duration-100\n ".concat(F===e.slug?"text-danger bg-danger-dim":"text-danger bg-transparent hover:bg-danger-dim"),onClick:t=>ei(t,e),children:[(0,a.jsx)(p.Z,{size:14})," ",F===e.slug?"Confirm Delete?":"Delete Permanently"]})]})]},e.id))]})]})}),(0,a.jsx)("div",{className:"border-t border-[rgba(148,163,242,0.03)] flex-shrink-0",children:(0,a.jsx)(H,{isExpanded:et})}),(0,a.jsxs)("div",{className:"border-t border-[rgba(148,163,242,0.03)] flex-shrink-0 flex items-center\n ".concat(et?"px-3 py-2.5 flex-row gap-1 justify-center":"px-0 py-3 flex-col gap-3 justify-center"),children:[(0,a.jsx)("button",{className:"inline-flex items-center justify-center w-7 h-7 rounded-sm text-text-muted transition-all duration-150 hover:text-accent hover:bg-accent-muted",onClick:()=>Z(!0),title:"Costs & Analytics",children:(0,a.jsx)(f,{size:14})}),(0,a.jsx)("button",{className:"inline-flex items-center justify-center w-7 h-7 rounded-sm text-text-muted transition-all duration-150 hover:text-text-secondary hover:bg-surface-hover",onClick:()=>I(!0),title:"Settings",children:(0,a.jsx)(b.Z,{size:14})}),(0,a.jsx)(N,{}),et&&(0,a.jsx)("span",{className:"text-data text-text-muted opacity-30 font-mono ml-auto",children:"H"})]})]}),E&&(0,a.jsx)(z,{onClose:()=>P(!1)}),R&&(0,a.jsx)(X,{currentPath:R.current,onSave:async e=>{try{await l(R.slug,{workingDir:e}),T("Folder linked","success")}catch(e){T("Failed to set folder","error")}D(null)},onClose:()=>D(null)}),_&&(0,a.jsx)(M,{onClose:()=>I(!1)}),A&&(0,a.jsx)("div",{className:"fixed inset-0 z-[200] bg-overlay backdrop-blur-[16px] backdrop-saturate-[180%] flex items-center justify-center animate-overlay-in",onClick:()=>Z(!1),children:(0,a.jsxs)("div",{className:"bg-modal border border-glass-border rounded-lg shadow-modal max-w-[800px] w-[95%] max-h-[85vh] overflow-hidden animate-spring-pop",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[(0,a.jsxs)("span",{className:"text-h2 font-semibold flex items-center gap-2",children:[(0,a.jsx)(f,{size:16})," Costs & Analytics"]}),(0,a.jsx)("button",{className:"btn-icon",onClick:()=>Z(!1),children:(0,a.jsx)("span",{className:"text-text-muted",children:"\xd7"})})]}),(0,a.jsx)("div",{className:"overflow-y-auto max-h-[calc(85vh-52px)]",children:(0,a.jsx)(L,{projectSlug:i||void 0})})]})})]})}function X(e){let{currentPath:t,onSave:s,onClose:r}=e,[o,l]=(0,n.useState)(t),i=(0,n.useRef)(null);return(0,n.useEffect)(()=>{var e,t;null===(e=i.current)||void 0===e||e.focus(),null===(t=i.current)||void 0===t||t.select()},[]),(0,a.jsx)("div",{className:"fixed inset-0 z-[200] bg-overlay backdrop-blur-[16px] backdrop-saturate-[180%] flex items-center justify-center animate-overlay-in",onClick:r,children:(0,a.jsxs)("div",{className:"bg-modal border border-glass-border rounded-lg shadow-modal max-w-[440px] w-[92%] animate-spring-pop relative overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("div",{className:"absolute top-0 left-[15%] right-[15%] h-px pointer-events-none",style:{background:"linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.2), transparent)"}}),(0,a.jsxs)("div",{className:"px-6 pt-5 pb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)(x,{size:16,className:"text-accent"}),(0,a.jsx)("span",{className:"text-h2 font-semibold tracking-tight",children:t?"Change Folder":"Link Project Folder"})]}),(0,a.jsx)("p",{className:"text-label text-text-muted leading-relaxed",children:"Set the local directory where this project's code lives. Ralph and the terminal will use this path."})]}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.trim()&&s(o.trim())},className:"px-6 pb-5 flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-data font-semibold text-text-muted uppercase tracking-widest font-mono",children:"Folder Path"}),(0,a.jsx)("input",{ref:i,value:o,onChange:e=>l(e.target.value),placeholder:"C:\\Users\\marti\\projects\\my-app",className:"w-full font-mono text-xs",spellCheck:!1})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",className:"btn-ghost",onClick:r,children:"Cancel"}),(0,a.jsxs)("button",{type:"submit",className:"btn-primary",disabled:!o.trim(),children:[(0,a.jsx)(x,{size:12})," ",t?"Update":"Link Folder"]})]})]})]})})}var $=s(401);let Q=(0,i.Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Y=(0,i.Z)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),ee={success:{accent:"border-l-success",iconColor:"text-success",icon:(0,a.jsx)($.Z,{size:14})},error:{accent:"border-l-danger",iconColor:"text-danger",icon:(0,a.jsx)(Q,{size:14})},info:{accent:"border-l-accent",iconColor:"text-accent",icon:(0,a.jsx)(Y,{size:14})}};function et(){let{toasts:e,removeToast:t}=(0,y.E)();return 0===e.length?null:(0,a.jsx)("div",{className:"fixed bottom-4 right-4 flex flex-col gap-1.5 z-[400] pointer-events-none",children:e.map((s,n)=>{let r=ee[s.type]||ee.info,o=n<e.length-1;return(0,a.jsxs)("div",{className:"bg-glass backdrop-blur-[16px] backdrop-saturate-[160%] border border-glass-border rounded-md\n px-3.5 py-2.5 text-xs font-medium text-text shadow-elevated\n flex items-center gap-2.5 animate-toast-in pointer-events-auto min-w-[220px]\n relative overflow-hidden border-l-2 ".concat(r.accent,"\n transition-all duration-200 ease-out-expo\n ").concat(o?"scale-[0.97] opacity-80":""),children:[(0,a.jsx)("div",{className:"absolute top-0 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-white/[0.04] to-transparent pointer-events-none"}),(0,a.jsx)("span",{className:"flex flex-shrink-0 ".concat(r.iconColor),children:r.icon}),(0,a.jsx)("span",{className:"flex-1",children:s.message}),(0,a.jsx)("button",{className:"text-text-muted p-0.5 flex rounded-xs transition-all duration-120 ease-out-expo hover:text-text hover:bg-surface-hover",onClick:()=>t(s.id),children:(0,a.jsx)(w.Z,{size:12})})]},s.id)})})}let es=[{title:"Navigation",shortcuts:[{keys:["↑","↓"],desc:"Previous / next project"},{keys:["B"],desc:"Board view"},{keys:["C"],desc:"Console / Terminal"},{keys:["R"],desc:"Ralph / Agents"},{keys:["S"],desc:"Soul"}]},{title:"Actions",shortcuts:[{keys:["N"],desc:"New task"},{keys:["Ctrl","F"],desc:"Toggle filter bar"}]},{title:"General",shortcuts:[{keys:["H"],desc:"Show this help"},{keys:["Esc"],desc:"Close modal / go back"}]}];function ea(e){let{onClose:t}=e,{overlayProps:s}=(0,C.N)(t);return(0,a.jsx)("div",{className:"glass-overlay",...s,children:(0,a.jsxs)("div",{className:"modal-box w-[400px] max-w-[90%] p-7",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("span",{className:"text-h2 font-semibold tracking-tight",children:"Keyboard Shortcuts"}),(0,a.jsx)("button",{className:"btn-icon",onClick:t,children:(0,a.jsx)(w.Z,{size:16})})]}),(0,a.jsx)("div",{className:"flex flex-col gap-[22px]",children:es.map(e=>(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mb-1",children:e.title}),e.shortcuts.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,a.jsx)("div",{className:"flex items-center gap-[3px]",children:e.keys.map((t,s)=>(0,a.jsxs)("span",{children:[(0,a.jsx)("kbd",{className:"inline-flex items-center justify-center min-w-[24px] h-6 px-[7px] bg-[rgba(148,163,242,0.04)] border border-[rgba(148,163,242,0.08)] border-b-2 border-b-[rgba(148,163,242,0.1)] rounded-[5px] text-[10px] font-semibold text-text font-mono",children:t}),s<e.keys.length-1&&(0,a.jsx)("span",{className:"text-xxs text-text-muted opacity-50",children:"+"})]},s))}),(0,a.jsx)("span",{className:"text-xs text-text-secondary",children:e.desc})]},e.desc))]},e.title))})]})})}let en=(0,i.Z)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),er=(0,i.Z)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),eo=(0,i.Z)("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);var el=s(3468),ei=s(2222),ec=s(221),ed=s(5805),ex=s(2208),eu=s(3247),ep=s(15);function em(e){let{onClose:t,onShowCreateProject:s,onShowCreateWorkItem:r,onShowHelp:o}=e,[i,c]=(0,n.useState)(""),[u,p]=(0,n.useState)(0),m=(0,n.useRef)(null),h=(0,n.useRef)(null),f=(0,g.i)(e=>e.projects),b=(0,ep.o)(e=>e.workItems),{goToProject:j,goToWorkItem:y,setView:k,projectSlug:N,workItemSlug:w}=(0,v.U)(),{theme:C,toggleTheme:S}=l(),T=(0,n.useMemo)(()=>{let e=[];return e.push({id:"create-project",label:"Create Project",section:"Actions",icon:(0,a.jsx)(d.Z,{size:14}),action:()=>{t(),null==s||s()}}),N&&e.push({id:"create-wi",label:"Create Work Item",section:"Actions",icon:(0,a.jsx)(d.Z,{size:14}),action:()=>{t(),null==r||r()}}),e.push({id:"toggle-theme",label:"Switch to ".concat("dark"===C?"Light":"Dark"," mode"),section:"Actions",icon:"dark"===C?(0,a.jsx)(en,{size:14}):(0,a.jsx)(er,{size:14}),action:()=>{S(),t()}}),e.push({id:"keyboard-shortcuts",label:"Keyboard Shortcuts",section:"Actions",icon:(0,a.jsx)(eo,{size:14}),shortcut:"H",action:()=>{t(),null==o||o()}}),N&&(w?[{key:"board",label:"Go to Board",icon:(0,a.jsx)(el.Z,{size:14}),shortcut:"B"},{key:"ralph",label:"Go to Ralph",icon:(0,a.jsx)(ei.Z,{size:14}),shortcut:"R"}]:[{key:"work-items",label:"Go to Work Items",icon:(0,a.jsx)(el.Z,{size:14}),shortcut:"W"},{key:"console",label:"Go to Console",icon:(0,a.jsx)(ec.Z,{size:14}),shortcut:"C"},{key:"teams",label:"Go to Teams",icon:(0,a.jsx)(ed.Z,{size:14}),shortcut:"T"},{key:"soul",label:"Go to Soul",icon:(0,a.jsx)(ex.Z,{size:14}),shortcut:"S"}]).forEach(s=>{e.push({id:"nav-".concat(s.key),label:s.label,section:"Navigation",icon:s.icon,shortcut:s.shortcut,action:()=>{k(s.key),t()}})}),f.forEach(s=>{e.push({id:"project-".concat(s.slug),label:s.title,section:"Projects",icon:(0,a.jsx)(x,{size:14}),action:()=>{j(s.slug),t()}})}),N&&b.forEach(s=>{e.push({id:"wi-".concat(s.slug),label:s.title,section:"Work Items",icon:(0,a.jsx)(Z.Z,{size:14}),action:()=>{y(N,s.slug),t()}})}),e},[f,b,N,C,t,s,r,o,j,y,k,S]),z=(0,n.useMemo)(()=>{if(!i.trim())return T;let e=i.toLowerCase();return T.filter(t=>t.label.toLowerCase().includes(e)||t.section.toLowerCase().includes(e))},[T,i]);(0,n.useEffect)(()=>{p(0)},[z.length]),(0,n.useEffect)(()=>{var e;null===(e=m.current)||void 0===e||e.focus()},[]);let E=(0,n.useCallback)(e=>{"ArrowDown"===e.key?(e.preventDefault(),p(e=>Math.min(e+1,z.length-1))):"ArrowUp"===e.key?(e.preventDefault(),p(e=>Math.max(e-1,0))):"Enter"===e.key&&z[u]?(e.preventDefault(),z[u].action()):"Escape"===e.key&&t()},[z,u,t]);(0,n.useEffect)(()=>{var e;let t=null===(e=h.current)||void 0===e?void 0:e.querySelector('[data-selected="true"]');null==t||t.scrollIntoView({block:"nearest"})},[u]);let P=(0,n.useMemo)(()=>{let e=new Map;return z.forEach(t=>{let s=e.get(t.section)||[];s.push(t),e.set(t.section,s)}),e},[z]),M=-1;return(0,a.jsx)("div",{className:"fixed inset-0 z-[500] flex items-start justify-center pt-[20vh] animate-overlay-in",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(8px)"},onClick:t,children:(0,a.jsxs)("div",{className:"w-full max-w-[520px] bg-modal rounded-xl overflow-hidden shadow-modal animate-spring-pop border border-glass-border relative",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("div",{className:"absolute top-0 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-[rgba(129,140,248,0.2)] to-transparent pointer-events-none z-10"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[(0,a.jsx)(eu.Z,{size:16,className:"text-text-muted flex-shrink-0"}),(0,a.jsx)("input",{ref:m,type:"text",value:i,onChange:e=>c(e.target.value),onKeyDown:E,placeholder:"Type a command or search...",className:"flex-1 bg-transparent border-none outline-none text-body text-text placeholder:text-text-muted p-0 shadow-none"}),(0,a.jsx)("kbd",{className:"text-data font-mono text-text-muted bg-surface px-1.5 py-0.5 rounded border border-border",children:"ESC"})]}),(0,a.jsx)("div",{ref:h,className:"max-h-[320px] overflow-y-auto py-1",children:0===z.length?(0,a.jsx)("div",{className:"px-4 py-8 text-center text-text-muted text-xs",children:"No results found"}):Array.from(P.entries()).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"px-4 pt-2 pb-1 text-xxs font-semibold text-text-muted uppercase tracking-[0.08em]",children:t}),s.map(e=>{let t=++M===u,s=M;return(0,a.jsxs)("button",{"data-selected":t,className:"w-full flex items-center gap-3 px-4 py-2 text-xs text-left transition-colors duration-75\n ".concat(t?"bg-accent-muted text-text":"text-text-secondary hover:bg-surface-hover hover:text-text"),onClick:e.action,onMouseEnter:()=>p(s),children:[(0,a.jsx)("span",{className:"flex-shrink-0 ".concat(t?"text-accent":"text-text-muted"),children:e.icon}),(0,a.jsx)("span",{className:"flex-1 truncate",children:e.label}),e.shortcut&&(0,a.jsx)("kbd",{className:"text-data font-mono text-text-muted bg-surface px-1.5 py-0.5 rounded border border-border",children:e.shortcut})]},e.id)})]},t)})})]})})}var eh=s(4822);let ef=(0,i.Z)("skip-forward",[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]);var eb=s(1094),eg=s(4743);let ev=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555";function ej(){let e=(0,j.q)(e=>e.escalation),t=(0,y.E)(e=>e.addToast),[s,r]=(0,n.useState)(""),[o,l]=(0,n.useState)(!1),i=(0,n.useRef)(null);if((0,n.useEffect)(()=>{e&&(r(""),setTimeout(()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.focus()},100),"undefined"!=typeof Notification&&("granted"===Notification.permission?new Notification("KANBAII — ".concat("ralph"===e.source?"Ralph":"Teams"," needs input"),{body:e.question.slice(0,120),icon:"/favicon.svg"}):"denied"!==Notification.permission&&Notification.requestPermission()))},[e]),!e||"planner"===e.source)return null;let c=async a=>{let n=a||s.trim();if(n&&!o){l(!0);try{await fetch("".concat(ev,"/api/escalation/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id,response:n})}),t("Response sent to Claude","success")}catch(e){t("Failed to send response","error")}l(!1)}},d="ralph"===e.source,x=d?eh.Z:ed.Z,u=d?"Ralph":"Teams",p=function(e){try{let t=JSON.parse(e);if(t.questions&&Array.isArray(t.questions)&&t.questions.length>0){let s=t.questions[0];return{question:s.question||s.header||e,options:(s.options||[]).map(e=>({label:"string"==typeof e?e:e.label||e.text||"",description:e.description}))}}if(t.question)return{question:t.question,options:(t.options||[]).map(e=>({label:"string"==typeof e?e:e.label||""}))}}catch(e){}return{question:e,options:[]}}(e.question),m=p.question,h=p.options.length>0?p.options:e.options;return(0,a.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center animate-overlay-in",style:{background:"rgba(3, 3, 8, 0.85)",backdropFilter:"blur(20px) saturate(180%)"},children:(0,a.jsxs)("div",{className:"max-w-[520px] w-[94%] animate-spring-pop relative",children:[(0,a.jsx)("div",{className:"absolute -inset-px rounded-lg animate-breathe",style:{background:d?"linear-gradient(135deg, rgba(99,102,241,0.3), rgba(129,140,248,0.1), rgba(99,102,241,0.3))":"linear-gradient(135deg, rgba(16,185,129,0.3), rgba(52,211,153,0.1), rgba(16,185,129,0.3))"}}),(0,a.jsxs)("div",{className:"relative bg-modal border border-glass-border rounded-lg shadow-modal overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute top-0 left-[10%] right-[10%] h-px pointer-events-none",style:{background:d?"linear-gradient(90deg, transparent, rgba(99,102,241,0.4), transparent)":"linear-gradient(90deg, transparent, rgba(52,211,153,0.4), transparent)"}}),(0,a.jsxs)("div",{className:"flex items-center gap-3 px-6 pt-5 pb-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center animate-breathe\n ".concat(d?"bg-accent-muted border border-accent/20":"bg-success-dim border border-success/20"),children:(0,a.jsx)(x,{size:16,className:d?"text-accent":"text-success"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-sm font-semibold text-text tracking-tight",children:[u," needs your input"]}),e.taskTitle&&(0,a.jsxs)("div",{className:"text-xxs text-text-muted font-mono mt-0.5",children:["Task: ",e.taskTitle]})]})]}),(0,a.jsx)("div",{className:"mx-6 mb-4 p-3 bg-bg border border-border rounded-md shadow-inset",children:(0,a.jsx)("div",{className:"text-sm text-text leading-relaxed",children:m})}),h.length>0&&(0,a.jsx)("div",{className:"mx-6 mb-3 flex flex-col gap-1.5",children:h.map((e,t)=>(0,a.jsxs)("button",{className:"flex flex-col gap-0.5 px-3 py-2.5 text-left rounded-sm border border-border transition-all duration-150 hover:border-accent hover:bg-accent-muted group",onClick:()=>c("string"==typeof e?e:e.label),disabled:o,children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text group-hover:text-accent transition-colors",children:"string"==typeof e?e:e.label}),"string"!=typeof e&&e.description&&(0,a.jsx)("span",{className:"text-xxs text-text-muted leading-snug",children:e.description})]},t))}),(0,a.jsxs)("div",{className:"px-6 pb-5",children:[(0,a.jsx)("textarea",{ref:i,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),c())},placeholder:"Type your response... (Enter to send)",rows:2,className:"w-full resize-none text-xs",disabled:o}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-3",children:[(0,a.jsxs)("button",{className:"inline-flex items-center gap-1.5 text-xxs text-text-muted font-mono px-3 py-1.5 rounded-sm border border-border transition-all duration-150 hover:text-text-secondary hover:bg-surface-hover",onClick:()=>c("yes"),disabled:o,children:[(0,a.jsx)(ef,{size:11})," Skip (yes)"]}),(0,a.jsxs)("button",{className:"inline-flex items-center gap-1.5 text-xxs text-danger font-mono px-3 py-1.5 rounded-sm border border-danger/20 transition-all duration-150 hover:bg-danger-dim",onClick:async()=>{await fetch(d?"".concat(ev,"/api/ralph/stop"):"".concat(ev,"/api/teams/stop"),{method:"POST"}),c("STOP"),t("".concat(u," stopped"),"info")},disabled:o,children:[(0,a.jsx)(eb.Z,{size:11})," Stop ",u]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)("button",{className:"inline-flex items-center gap-1.5 px-4 py-1.5 text-white text-xs font-semibold rounded-sm\n bg-gradient-to-br ".concat(d?"from-indigo-600 to-indigo-400":"from-emerald-600 to-emerald-400","\n relative overflow-hidden\n before:absolute before:inset-0 before:bg-gradient-to-b before:from-white/15 before:to-transparent before:pointer-events-none\n transition-all duration-150 hover:shadow-glow-accent hover:-translate-y-px disabled:opacity-40"),onClick:()=>c(),disabled:!s.trim()||o,children:[o?(0,a.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-white/20 border-t-white rounded-full animate-spin"}):(0,a.jsx)(eg.Z,{size:12}),"Send"]})]})]})]})]})})}function ey(e){let{children:t}=e;!function(){let e=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(e.current)return;e.current=!0;let t=(0,B.h)(),s=j.q.getState,a=g.i.getState,n=ep.o.getState;return t.on("project:updated",e=>{let{project:t}=e;return a().onProjectUpdated(t)}),t.on("project:deleted",e=>{let{slug:t}=e;return a().onProjectDeleted(t)}),t.on("workItem:updated",e=>{let{projectSlug:t,workItem:s}=e;return n().onWorkItemUpdated(t,s)}),t.on("workItem:deleted",e=>{let{projectSlug:t,workItemId:s}=e;return n().onWorkItemDeleted(t,s)}),t.on("ralph:started",e=>s().onRalphStarted(e)),t.on("ralph:progress",e=>s().onRalphProgress(e)),t.on("ralph:output",e=>s().onRalphOutput(e)),t.on("ralph:completed",e=>s().onRalphCompleted(e)),t.on("ralph:error",e=>s().onRalphError(e)),t.on("ralph:input-needed",e=>s().onRalphInputNeeded(e)),t.on("live:started",e=>s().onTeamsStarted(e)),t.on("live:worker-assigned",e=>s().onTeamsWorkerAssigned(e)),t.on("live:worker-completed",e=>s().onTeamsWorkerCompleted(e)),t.on("live:metrics",e=>s().onTeamsMetrics(e)),t.on("live:output",e=>s().onTeamsOutput(e)),t.on("live:stopped",e=>s().onTeamsStopped(e)),t.on("teams:input-needed",e=>s().onTeamsInputNeeded(e)),t.on("coordinator:thinking",e=>s().onCoordinatorThinking(e)),t.on("coordinator:tool_call",e=>s().onCoordinatorToolCall(e)),t.on("coordinator:completed",e=>s().onCoordinatorCompleted(e)),t.on("escalation:created",e=>{if("planner"===e.source){s().onPlannerEscalation({id:e.id,source:"planner",taskId:e.taskId||"planner",taskTitle:e.taskTitle||"AI Planner",question:e.question,options:e.options||[],timeoutMs:e.timeoutMs||18e5});return}s().onEscalationCreated(e)}),t.on("escalation:responded",e=>{s().planner.escalation?s().onPlannerEscalationResponded((null==e?void 0:e.response)||"responded"):s().onEscalationResponded()}),t.on("escalation:timeout",()=>{s().planner.escalation?s().onPlannerEscalationResponded("(timed out)"):s().onEscalationTimeout()}),t.on("planner:started",e=>s().onPlannerStarted(e)),t.on("planner:message",e=>s().onPlannerMessage(e)),t.on("planner:item-discovered",e=>s().onPlannerItemDiscovered(e)),t.on("planner:item-updated",e=>s().onPlannerItemUpdated(e)),t.on("planner:escalation",e=>s().onPlannerEscalation(e)),t.on("planner:item-approved",e=>s().onPlannerItemApproved(e)),t.on("planner:stopped",()=>s().onPlannerStopped()),t.on("terminal:output",e=>{let t=v.U.getState().projectSlug;e.projectSlug&&e.projectSlug!==t||(s().appendTerminalOutput(e.text),s().setTerminalStatus("running"))}),t.on("terminal:closed",e=>{let t=v.U.getState().projectSlug;null!=e&&e.projectSlug&&e.projectSlug!==t||s().setTerminalStatus("idle")}),t.on("terminal:error",e=>{let t=v.U.getState().projectSlug;null!=e&&e.projectSlug&&e.projectSlug!==t||(s().appendTerminalOutput("ERROR: ".concat(e.message)),s().setTerminalStatus("error"))}),s().rehydrate(),t.on("connect",()=>s().rehydrate()),()=>{(0,B.l)(),e.current=!1}},[])}();let[s,r]=(0,n.useState)(!1),[o,l]=(0,n.useState)(!1),i=(0,n.useCallback)(()=>r(e=>!e),[]),c=(0,n.useCallback)(()=>r(!1),[]),d=(0,n.useCallback)(()=>l(e=>!e),[]),x=(0,n.useCallback)(()=>l(!1),[]);return!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{projectSlug:t,workItemSlug:s,setView:a,goToProject:r}=(0,v.U)(),o=(0,g.i)(e=>e.projects);(0,n.useEffect)(()=>{let n=n=>{var l,i,c,d,x;let u=n.target.tagName;if("INPUT"!==u&&"TEXTAREA"!==u&&"SELECT"!==u&&!n.target.isContentEditable){if((n.ctrlKey||n.metaKey)&&"k"===n.key){n.preventDefault(),null===(l=e.onToggleCommandPalette)||void 0===l||l.call(e);return}if((n.ctrlKey||n.metaKey)&&"f"===n.key){n.preventDefault(),null===(i=e.onToggleFilter)||void 0===i||i.call(e);return}if(!n.ctrlKey&&!n.metaKey&&!n.altKey)switch(n.key.toLowerCase()){case"w":t&&!s&&a("work-items");break;case"c":t&&!s&&a("console");break;case"t":t&&!s&&a("teams");break;case"s":t&&!s&&a("soul");break;case"b":s&&a("board");break;case"r":s&&a("ralph");break;case"n":null===(c=e.onNewTask)||void 0===c||c.call(e);break;case"h":null===(d=e.onToggleHelp)||void 0===d||d.call(e);break;case"escape":null===(x=e.onEscape)||void 0===x||x.call(e);break;case"arrowup":{n.preventDefault();let e=o.findIndex(e=>e.slug===t);e>0&&r(o[e-1].slug);break}case"arrowdown":{n.preventDefault();let e=o.findIndex(e=>e.slug===t);e<o.length-1&&r(o[e+1].slug)}}}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,s,o,a,r,e])}({onToggleHelp:i,onToggleCommandPalette:d,onEscape:()=>{o?x():c()}}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden",children:[(0,a.jsx)(J,{}),(0,a.jsx)("div",{className:"w-px flex-shrink-0 bg-gradient-to-b from-transparent via-border-glow to-transparent"}),(0,a.jsx)("main",{className:"flex-1 overflow-hidden flex flex-col surface-gradient",children:t})]}),(0,a.jsx)(et,{}),(0,a.jsx)(ej,{}),s&&(0,a.jsx)(ea,{onClose:c}),o&&(0,a.jsx)(em,{onClose:x,onShowHelp:()=>{x(),i()}})]})}function ek(e){let{children:t}=e;return(0,a.jsx)(o,{children:(0,a.jsx)(ey,{children:t})})}},7960:function(){}},function(e){e.O(0,[587,184,23,971,117,744],function(){return e(e.s=4732)}),_N_E=e.O()}]);
|
package/dashboard/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/85ce8ef4f13f9778.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-5c1d03322d6ecf76.js"/><script src="/_next/static/chunks/fd9d1056-1f1f859026f5f0fa.js" async=""></script><script src="/_next/static/chunks/117-749dc8b5f56031ab.js" async=""></script><script src="/_next/static/chunks/main-app-2f313c3206a6e049.js" async=""></script><script src="/_next/static/chunks/184-15d72b1991c86ab9.js" async=""></script><script src="/_next/static/chunks/759-3d8fc7952548ec08.js" async=""></script><script src="/_next/static/chunks/23-4a72ba4a90f008a6.js" async=""></script><script src="/_next/static/chunks/app/page-e96878de09e0c519.js" async=""></script><script src="/_next/static/chunks/app/layout-
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/85ce8ef4f13f9778.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-5c1d03322d6ecf76.js"/><script src="/_next/static/chunks/fd9d1056-1f1f859026f5f0fa.js" async=""></script><script src="/_next/static/chunks/117-749dc8b5f56031ab.js" async=""></script><script src="/_next/static/chunks/main-app-2f313c3206a6e049.js" async=""></script><script src="/_next/static/chunks/184-15d72b1991c86ab9.js" async=""></script><script src="/_next/static/chunks/759-3d8fc7952548ec08.js" async=""></script><script src="/_next/static/chunks/23-4a72ba4a90f008a6.js" async=""></script><script src="/_next/static/chunks/app/page-e96878de09e0c519.js" async=""></script><script src="/_next/static/chunks/app/layout-ccc8d24485f54bd6.js" async=""></script><meta name="theme-color" content="#6366f1"/><title>KANBAII</title><meta name="description" content="Structure for your ideas. AI to move them forward."/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.svg" type="image/svg+xml"/><link rel="icon" href="/favicon-16x16.svg" sizes="16x16" type="image/svg+xml"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/_next/static/chunks/webpack-5c1d03322d6ecf76.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/css/85ce8ef4f13f9778.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"2:I[2846,[],\"\"]\n4:I[9107,[],\"ClientPageRoot\"]\n5:I[2039,[\"184\",\"static/chunks/184-15d72b1991c86ab9.js\",\"759\",\"static/chunks/759-3d8fc7952548ec08.js\",\"23\",\"static/chunks/23-4a72ba4a90f008a6.js\",\"931\",\"static/chunks/app/page-e96878de09e0c519.js\"],\"default\",1]\n6:I[792,[\"184\",\"static/chunks/184-15d72b1991c86ab9.js\",\"23\",\"static/chunks/23-4a72ba4a90f008a6.js\",\"185\",\"static/chunks/app/layout-ccc8d24485f54bd6.js\"],\"AppShell\"]\n7:I[4707,[],\"\"]\n8:I[6423,[],\"\"]\na:I[1060,[],\"\"]\nb:[]\n0:[\"$\",\"$L2\",null,{\"buildId\":\"hTyF4xO8N7w2cEHRx7q75\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"\"],\"initialTree\":[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"__PAGE__\",{},[[\"$L3\",[\"$\",\"$L4\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$5\"}],null],null],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/85ce8ef4f13f9778.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"children\":[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L8\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"pad"])</script><script>self.__next_f.push([1,"ding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$L9\"],\"globalErrorComponent\":\"$a\",\"missingSlots\":\"$Wb\"}]\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"name\":\"theme-color\",\"content\":\"#6366f1\"}],[\"$\",\"meta\",\"2\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"3\",{\"children\":\"KANBAII\"}],[\"$\",\"meta\",\"4\",{\"name\":\"description\",\"content\":\"Structure for your ideas. AI to move them forward.\"}],[\"$\",\"link\",\"5\",{\"rel\":\"manifest\",\"href\":\"/manifest.json\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"link\",\"6\",{\"rel\":\"icon\",\"href\":\"/favicon.svg\",\"type\":\"image/svg+xml\"}],[\"$\",\"link\",\"7\",{\"rel\":\"icon\",\"href\":\"/favicon-16x16.svg\",\"sizes\":\"16x16\",\"type\":\"image/svg+xml\"}]]\n3:null\n"])</script></body></html>
|
package/dashboard/index.txt
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
2:I[9107,[],"ClientPageRoot"]
|
|
2
2
|
3:I[2039,["184","static/chunks/184-15d72b1991c86ab9.js","759","static/chunks/759-3d8fc7952548ec08.js","23","static/chunks/23-4a72ba4a90f008a6.js","931","static/chunks/app/page-e96878de09e0c519.js"],"default",1]
|
|
3
|
-
4:I[792,["184","static/chunks/184-15d72b1991c86ab9.js","23","static/chunks/23-4a72ba4a90f008a6.js","185","static/chunks/app/layout-
|
|
3
|
+
4:I[792,["184","static/chunks/184-15d72b1991c86ab9.js","23","static/chunks/23-4a72ba4a90f008a6.js","185","static/chunks/app/layout-ccc8d24485f54bd6.js"],"AppShell"]
|
|
4
4
|
5:I[4707,[],""]
|
|
5
5
|
6:I[6423,[],""]
|
|
6
|
-
0:["
|
|
6
|
+
0:["hTyF4xO8N7w2cEHRx7q75",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/85ce8ef4f13f9778.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L4",null,{"children":["$","$L5",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L6",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]}]}]}]],null],null],["$L7",null]]]]
|
|
7
7
|
7:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#6366f1"}],["$","meta","2",{"charSet":"utf-8"}],["$","title","3",{"children":"KANBAII"}],["$","meta","4",{"name":"description","content":"Structure for your ideas. AI to move them forward."}],["$","link","5",{"rel":"manifest","href":"/manifest.json","crossOrigin":"use-credentials"}],["$","link","6",{"rel":"icon","href":"/favicon.svg","type":"image/svg+xml"}],["$","link","7",{"rel":"icon","href":"/favicon-16x16.svg","sizes":"16x16","type":"image/svg+xml"}]]
|
|
8
8
|
1:null
|
package/dist/cli/index.js
CHANGED
|
@@ -75,6 +75,9 @@ program
|
|
|
75
75
|
console.log(` \x1b[32m◇\x1b[0m Server running on \x1b[1mhttp://localhost:${port}\x1b[0m`);
|
|
76
76
|
console.log(` \x1b[2mData: ${dataDir}\x1b[0m`);
|
|
77
77
|
console.log('');
|
|
78
|
+
console.log(' \x1b[2mEnjoy KANBAII? Give it a star:\x1b[0m');
|
|
79
|
+
console.log(' \x1b[2mhttps://github.com/martinmsaavedra/kanbaii\x1b[0m');
|
|
80
|
+
console.log('');
|
|
78
81
|
// Open browser (unless --no-open)
|
|
79
82
|
if (opts.open !== false) {
|
|
80
83
|
const url = `http://localhost:${port}`;
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* KANBAII MCP Server — Orchestration tools for Claude agents.
|
|
5
|
+
*
|
|
6
|
+
* This runs as a stdio MCP server that Claude CLI connects to.
|
|
7
|
+
* Tools available:
|
|
8
|
+
* - escalate_to_human : blocking poll for human response via dashboard
|
|
9
|
+
* - send_notification : fire-and-forget message to dashboard
|
|
10
|
+
* - list_tasks : GET /api/teams/tasks → tasks grouped by column
|
|
11
|
+
* - assign_task : POST /api/teams/assign → spin up a worker
|
|
12
|
+
* - check_workers : GET /api/teams/workers → worker pool status
|
|
13
|
+
* - wait_for_completion : poll workers until taskIds complete (or timeout)
|
|
14
|
+
* - send_message : POST /api/escalation/create (teams source, non-blocking)
|
|
15
|
+
*
|
|
16
|
+
* Supports both transports:
|
|
17
|
+
* - JSONL (newline-delimited JSON) — used by Claude CLI 2.x+
|
|
18
|
+
* - Content-Length (LSP-style) — used by older MCP clients
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const http = require('http');
|
|
22
|
+
|
|
23
|
+
const KANBAII_PORT = process.env.KANBAII_PORT || '5555';
|
|
24
|
+
const KANBAII_HOST = process.env.KANBAII_HOST || 'localhost';
|
|
25
|
+
const POLL_INTERVAL = 3000;
|
|
26
|
+
|
|
27
|
+
// ─── HTTP helpers ───
|
|
28
|
+
|
|
29
|
+
function post(path, body) {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
const data = JSON.stringify(body);
|
|
32
|
+
const req = http.request({
|
|
33
|
+
hostname: KANBAII_HOST, port: KANBAII_PORT, path, method: 'POST',
|
|
34
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) },
|
|
35
|
+
}, (res) => {
|
|
36
|
+
let buf = '';
|
|
37
|
+
res.on('data', c => buf += c);
|
|
38
|
+
res.on('end', () => { try { resolve(JSON.parse(buf)); } catch { resolve({ ok: false }); } });
|
|
39
|
+
});
|
|
40
|
+
req.on('error', reject);
|
|
41
|
+
req.write(data);
|
|
42
|
+
req.end();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function get(path) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const req = http.request({
|
|
49
|
+
hostname: KANBAII_HOST, port: KANBAII_PORT, path, method: 'GET',
|
|
50
|
+
}, (res) => {
|
|
51
|
+
let buf = '';
|
|
52
|
+
res.on('data', c => buf += c);
|
|
53
|
+
res.on('end', () => { try { resolve(JSON.parse(buf)); } catch { resolve({ ok: false }); } });
|
|
54
|
+
});
|
|
55
|
+
req.on('error', reject);
|
|
56
|
+
req.end();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ─── MCP Protocol (stdio JSON-RPC, auto-detect JSONL vs Content-Length) ───
|
|
61
|
+
|
|
62
|
+
let buffer = '';
|
|
63
|
+
let useJsonl = null; // Auto-detect on first message
|
|
64
|
+
|
|
65
|
+
process.stdin.setEncoding('utf8');
|
|
66
|
+
process.stdin.on('data', (chunk) => {
|
|
67
|
+
buffer += chunk;
|
|
68
|
+
processBuffer();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
function processBuffer() {
|
|
72
|
+
// Auto-detect format on first meaningful data
|
|
73
|
+
if (useJsonl === null) {
|
|
74
|
+
const trimmed = buffer.trimStart();
|
|
75
|
+
if (trimmed.startsWith('{')) {
|
|
76
|
+
useJsonl = true;
|
|
77
|
+
} else if (trimmed.startsWith('Content-Length:')) {
|
|
78
|
+
useJsonl = false;
|
|
79
|
+
} else {
|
|
80
|
+
return; // Wait for more data
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (useJsonl) {
|
|
85
|
+
processJsonl();
|
|
86
|
+
} else {
|
|
87
|
+
processContentLength();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function processJsonl() {
|
|
92
|
+
const lines = buffer.split('\n');
|
|
93
|
+
buffer = lines.pop() || ''; // Keep incomplete line in buffer
|
|
94
|
+
for (const line of lines) {
|
|
95
|
+
const trimmed = line.trim();
|
|
96
|
+
if (!trimmed) continue;
|
|
97
|
+
try {
|
|
98
|
+
handleMessage(JSON.parse(trimmed));
|
|
99
|
+
} catch {}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function processContentLength() {
|
|
104
|
+
while (true) {
|
|
105
|
+
const headerEnd = buffer.indexOf('\r\n\r\n');
|
|
106
|
+
if (headerEnd === -1) return;
|
|
107
|
+
const header = buffer.substring(0, headerEnd);
|
|
108
|
+
const match = header.match(/Content-Length:\s*(\d+)/i);
|
|
109
|
+
if (!match) { buffer = buffer.substring(headerEnd + 4); continue; }
|
|
110
|
+
const contentLength = parseInt(match[1], 10);
|
|
111
|
+
const bodyStart = headerEnd + 4;
|
|
112
|
+
if (buffer.length < bodyStart + contentLength) return;
|
|
113
|
+
const body = buffer.substring(bodyStart, bodyStart + contentLength);
|
|
114
|
+
buffer = buffer.substring(bodyStart + contentLength);
|
|
115
|
+
try { handleMessage(JSON.parse(body)); } catch {}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function sendResponse(msg) {
|
|
120
|
+
const body = JSON.stringify(msg);
|
|
121
|
+
if (useJsonl) {
|
|
122
|
+
process.stdout.write(body + '\n');
|
|
123
|
+
} else {
|
|
124
|
+
process.stdout.write(`Content-Length: ${Buffer.byteLength(body)}\r\n\r\n${body}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ─── Tool Definitions ───
|
|
129
|
+
|
|
130
|
+
const TOOLS = [
|
|
131
|
+
{
|
|
132
|
+
name: 'escalate_to_human',
|
|
133
|
+
description: 'Escalate a question or decision to the human operator. Posts the question to the KANBAII dashboard and Telegram. If blocking=true (default), waits for the human response before returning. Use this whenever you need human input, approval, or a decision.',
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: 'object',
|
|
136
|
+
properties: {
|
|
137
|
+
question: { type: 'string', description: 'The question to present to the human' },
|
|
138
|
+
options: { type: 'array', items: { type: 'string' }, description: 'Optional response options' },
|
|
139
|
+
blocking: { type: 'boolean', description: 'If true (default), wait for response. If false, fire-and-forget.' },
|
|
140
|
+
timeout_seconds: { type: 'number', description: 'Timeout in seconds (default 1800 = 30 min)' },
|
|
141
|
+
},
|
|
142
|
+
required: ['question'],
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'send_notification',
|
|
147
|
+
description: 'Send a notification message to the KANBAII dashboard. Use for progress updates or important messages that do not require a response.',
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
properties: {
|
|
151
|
+
message: { type: 'string', description: 'The message to display' },
|
|
152
|
+
type: { type: 'string', enum: ['info', 'warning', 'error', 'success'], description: 'Message type' },
|
|
153
|
+
},
|
|
154
|
+
required: ['message'],
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: 'list_tasks',
|
|
159
|
+
description: 'List all tasks in the Teams queue, grouped by column (Backlog, Todo, In Progress, Review, Done). Use this to understand what work is available or in progress before assigning tasks.',
|
|
160
|
+
inputSchema: {
|
|
161
|
+
type: 'object',
|
|
162
|
+
properties: {
|
|
163
|
+
projectSlug: { type: 'string', description: 'Optional project slug to filter tasks' },
|
|
164
|
+
workItemSlug: { type: 'string', description: 'Optional work item slug to filter tasks' },
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'assign_task',
|
|
170
|
+
description: 'Assign a task to an agent worker. Posts to the Teams engine to spin up a worker for the given task. Returns the workerId that can be tracked via check_workers or wait_for_completion.',
|
|
171
|
+
inputSchema: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
properties: {
|
|
174
|
+
taskId: { type: 'string', description: 'The task ID to assign' },
|
|
175
|
+
agent: { type: 'string', description: 'Optional agent name to assign the task to' },
|
|
176
|
+
model: { type: 'string', description: 'Optional model override (e.g. claude-opus-4-5)' },
|
|
177
|
+
additionalContext: { type: 'string', description: 'Optional additional context or instructions for the worker' },
|
|
178
|
+
},
|
|
179
|
+
required: ['taskId'],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'check_workers',
|
|
184
|
+
description: 'Check the current worker pool status. Returns all active, completed, and failed workers with their task assignments and output summaries.',
|
|
185
|
+
inputSchema: {
|
|
186
|
+
type: 'object',
|
|
187
|
+
properties: {},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'wait_for_completion',
|
|
192
|
+
description: 'Poll the worker pool every 3 seconds until the specified taskIds appear in completedResults, or until timeout. If no taskIds are provided, waits for the next ANY new completion. Returns the completed worker results.',
|
|
193
|
+
inputSchema: {
|
|
194
|
+
type: 'object',
|
|
195
|
+
properties: {
|
|
196
|
+
taskIds: {
|
|
197
|
+
type: 'array',
|
|
198
|
+
items: { type: 'string' },
|
|
199
|
+
description: 'Task IDs to wait for. If omitted, waits for any new completion.',
|
|
200
|
+
},
|
|
201
|
+
timeout_seconds: {
|
|
202
|
+
type: 'number',
|
|
203
|
+
description: 'Max seconds to wait (default 900 = 15 min)',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'send_message',
|
|
210
|
+
description: 'Send a simple message or status update to the KANBAII dashboard from a teams agent. Unlike escalate_to_human, this never blocks — it is purely informational.',
|
|
211
|
+
inputSchema: {
|
|
212
|
+
type: 'object',
|
|
213
|
+
properties: {
|
|
214
|
+
message: { type: 'string', description: 'The message to send to the dashboard' },
|
|
215
|
+
},
|
|
216
|
+
required: ['message'],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: 'report_work_item',
|
|
221
|
+
description: 'Register a discovered work item (feature, bug, or refactor) in the KANBAII planner dashboard. The item appears on the discovery board for the user to see. Call this as soon as you identify a work item.',
|
|
222
|
+
inputSchema: {
|
|
223
|
+
type: 'object',
|
|
224
|
+
properties: {
|
|
225
|
+
id: { type: 'string', description: 'Unique ID for this item (e.g. disc-1, disc-2)' },
|
|
226
|
+
title: { type: 'string', description: 'Short descriptive title' },
|
|
227
|
+
category: { type: 'string', enum: ['feature', 'bug', 'refactor'], description: 'Type of work item' },
|
|
228
|
+
},
|
|
229
|
+
required: ['id', 'title', 'category'],
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'update_work_item',
|
|
234
|
+
description: 'Update a work item with plan and/or tasks. Use status "planning" when you start working on it, and "ready" when plan + tasks are complete. The user can then approve it from the dashboard.',
|
|
235
|
+
inputSchema: {
|
|
236
|
+
type: 'object',
|
|
237
|
+
properties: {
|
|
238
|
+
id: { type: 'string', description: 'The item ID (e.g. disc-1) from report_work_item' },
|
|
239
|
+
status: { type: 'string', enum: ['planning', 'ready'], description: '"planning" = working on it, "ready" = plan + tasks complete' },
|
|
240
|
+
plan: { type: 'string', description: 'Markdown plan content (Objective, Approach, Key Decisions)' },
|
|
241
|
+
tasks: {
|
|
242
|
+
type: 'array',
|
|
243
|
+
description: 'Array of tasks (required when status is "ready")',
|
|
244
|
+
items: {
|
|
245
|
+
type: 'object',
|
|
246
|
+
properties: {
|
|
247
|
+
title: { type: 'string' },
|
|
248
|
+
description: { type: 'string' },
|
|
249
|
+
model: { type: 'string', description: 'Claude model: sonnet, opus, or haiku' },
|
|
250
|
+
priority: { type: 'string', enum: ['low', 'medium', 'high', 'urgent'] },
|
|
251
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
252
|
+
},
|
|
253
|
+
required: ['title', 'description'],
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
required: ['id', 'status'],
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
];
|
|
261
|
+
|
|
262
|
+
// ─── Message Handler ───
|
|
263
|
+
|
|
264
|
+
async function handleMessage(msg) {
|
|
265
|
+
if (msg.method === 'initialize') {
|
|
266
|
+
// Mirror the protocol version the client sends
|
|
267
|
+
const clientVersion = msg.params?.protocolVersion || '2024-11-05';
|
|
268
|
+
sendResponse({
|
|
269
|
+
jsonrpc: '2.0', id: msg.id,
|
|
270
|
+
result: {
|
|
271
|
+
protocolVersion: clientVersion,
|
|
272
|
+
serverInfo: { name: 'kanbaii', version: '1.0.0' },
|
|
273
|
+
capabilities: { tools: { listChanged: false } },
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
} else if (msg.method === 'notifications/initialized') {
|
|
277
|
+
// No response needed
|
|
278
|
+
} else if (msg.method === 'tools/list') {
|
|
279
|
+
sendResponse({
|
|
280
|
+
jsonrpc: '2.0', id: msg.id,
|
|
281
|
+
result: { tools: TOOLS },
|
|
282
|
+
});
|
|
283
|
+
} else if (msg.method === 'tools/call') {
|
|
284
|
+
const { name, arguments: args } = msg.params;
|
|
285
|
+
try {
|
|
286
|
+
const result = await dispatchTool(name, args || {});
|
|
287
|
+
sendResponse({
|
|
288
|
+
jsonrpc: '2.0', id: msg.id,
|
|
289
|
+
result: { content: [{ type: 'text', text: typeof result === 'string' ? result : JSON.stringify(result, null, 2) }] },
|
|
290
|
+
});
|
|
291
|
+
} catch (e) {
|
|
292
|
+
sendResponse({
|
|
293
|
+
jsonrpc: '2.0', id: msg.id,
|
|
294
|
+
result: { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true },
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
} else if (msg.id) {
|
|
298
|
+
sendResponse({ jsonrpc: '2.0', id: msg.id, error: { code: -32601, message: `Unknown method: ${msg.method}` } });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// ─── Tool Dispatcher ───
|
|
303
|
+
|
|
304
|
+
async function dispatchTool(name, args) {
|
|
305
|
+
switch (name) {
|
|
306
|
+
case 'escalate_to_human': return handleEscalation(args);
|
|
307
|
+
case 'send_notification': return handleSendNotification(args);
|
|
308
|
+
case 'list_tasks': return handleListTasks(args);
|
|
309
|
+
case 'assign_task': return handleAssignTask(args);
|
|
310
|
+
case 'check_workers': return handleCheckWorkers();
|
|
311
|
+
case 'wait_for_completion': return handleWaitForCompletion(args);
|
|
312
|
+
case 'send_message': return handleSendMessage(args);
|
|
313
|
+
case 'report_work_item': return handleReportWorkItem(args);
|
|
314
|
+
case 'update_work_item': return handleUpdateWorkItem(args);
|
|
315
|
+
default:
|
|
316
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// ─── Tool Implementations ───
|
|
321
|
+
|
|
322
|
+
async function handleEscalation(args) {
|
|
323
|
+
const { question, options, blocking, timeout_seconds } = args;
|
|
324
|
+
const isBlocking = blocking !== false;
|
|
325
|
+
|
|
326
|
+
const createRes = await post('/api/escalation/create', {
|
|
327
|
+
source: 'ralph', taskId: '', taskTitle: '',
|
|
328
|
+
question, options: options || [], timeoutSeconds: timeout_seconds || 1800,
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
if (!createRes.ok) throw new Error('Failed to create escalation');
|
|
332
|
+
|
|
333
|
+
const escalationId = createRes.data.escalationId;
|
|
334
|
+
|
|
335
|
+
if (!isBlocking) {
|
|
336
|
+
return { escalationId, status: 'sent', message: 'Escalation sent (non-blocking)' };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Poll for response
|
|
340
|
+
const deadline = Date.now() + (timeout_seconds || 1800) * 1000;
|
|
341
|
+
|
|
342
|
+
while (Date.now() < deadline) {
|
|
343
|
+
await sleep(POLL_INTERVAL);
|
|
344
|
+
|
|
345
|
+
const status = await get('/api/escalation/status');
|
|
346
|
+
if (status.ok && status.data?.responded && status.data.escalation?.response) {
|
|
347
|
+
const response = status.data.escalation.response;
|
|
348
|
+
await post('/api/escalation/clear', {});
|
|
349
|
+
return { escalationId, status: 'responded', response, question };
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (status.ok && status.data?.escalation?.status === 'timed_out') {
|
|
353
|
+
return { escalationId, status: 'timed_out', message: 'No response received', question };
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return { escalationId, status: 'timed_out', message: 'Timeout', question };
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
async function handleSendNotification(args) {
|
|
361
|
+
await post('/api/escalation/create', {
|
|
362
|
+
source: 'ralph', question: args.message, options: [],
|
|
363
|
+
taskId: '', taskTitle: 'Notification', timeoutSeconds: 5,
|
|
364
|
+
});
|
|
365
|
+
return 'Notification sent';
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async function handleListTasks(args) {
|
|
369
|
+
let path = '/api/teams/tasks';
|
|
370
|
+
const params = [];
|
|
371
|
+
if (args.projectSlug) params.push(`projectSlug=${encodeURIComponent(args.projectSlug)}`);
|
|
372
|
+
if (args.workItemSlug) params.push(`workItemSlug=${encodeURIComponent(args.workItemSlug)}`);
|
|
373
|
+
if (params.length) path += '?' + params.join('&');
|
|
374
|
+
|
|
375
|
+
const res = await get(path);
|
|
376
|
+
if (!res.ok) throw new Error('Failed to fetch tasks');
|
|
377
|
+
return res.data || res;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
async function handleAssignTask(args) {
|
|
381
|
+
const { taskId, agent, model, additionalContext } = args;
|
|
382
|
+
|
|
383
|
+
const body = { taskId };
|
|
384
|
+
if (agent !== undefined) body.agent = agent;
|
|
385
|
+
if (model !== undefined) body.model = model;
|
|
386
|
+
if (additionalContext !== undefined) body.additionalContext = additionalContext;
|
|
387
|
+
|
|
388
|
+
const res = await post('/api/teams/assign', body);
|
|
389
|
+
if (!res.ok) throw new Error(res.error || 'Failed to assign task');
|
|
390
|
+
return res.data || res;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
async function handleCheckWorkers() {
|
|
394
|
+
const res = await get('/api/teams/workers');
|
|
395
|
+
if (!res.ok) throw new Error('Failed to fetch workers');
|
|
396
|
+
return res.data || res;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async function handleWaitForCompletion(args) {
|
|
400
|
+
const { taskIds, timeout_seconds } = args;
|
|
401
|
+
const timeoutMs = (timeout_seconds || 900) * 1000;
|
|
402
|
+
const deadline = Date.now() + timeoutMs;
|
|
403
|
+
const targetIds = taskIds && taskIds.length > 0 ? new Set(taskIds) : null;
|
|
404
|
+
|
|
405
|
+
// Snapshot initial completed count for "any new completion" mode
|
|
406
|
+
let initialCompletedCount = null;
|
|
407
|
+
if (!targetIds) {
|
|
408
|
+
try {
|
|
409
|
+
const snapshot = await get('/api/teams/workers');
|
|
410
|
+
if (snapshot.ok) {
|
|
411
|
+
const data = snapshot.data || snapshot;
|
|
412
|
+
const completed = data.completedResults || data.completed || [];
|
|
413
|
+
initialCompletedCount = completed.length;
|
|
414
|
+
}
|
|
415
|
+
} catch {
|
|
416
|
+
initialCompletedCount = 0;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
while (Date.now() < deadline) {
|
|
421
|
+
await sleep(POLL_INTERVAL);
|
|
422
|
+
|
|
423
|
+
const res = await get('/api/teams/workers');
|
|
424
|
+
if (!res.ok) continue;
|
|
425
|
+
|
|
426
|
+
const data = res.data || res;
|
|
427
|
+
const completed = data.completedResults || data.completed || [];
|
|
428
|
+
|
|
429
|
+
if (targetIds) {
|
|
430
|
+
// Wait for all specified taskIds to appear in completedResults
|
|
431
|
+
const completedIds = new Set(completed.map(r => r.taskId || r.id).filter(Boolean));
|
|
432
|
+
const allDone = [...targetIds].every(id => completedIds.has(id));
|
|
433
|
+
if (allDone) {
|
|
434
|
+
const matching = completed.filter(r => targetIds.has(r.taskId || r.id));
|
|
435
|
+
return { status: 'completed', results: matching, allWorkers: data };
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
// Wait for any new completion
|
|
439
|
+
if (completed.length > initialCompletedCount) {
|
|
440
|
+
const newResults = completed.slice(initialCompletedCount);
|
|
441
|
+
return { status: 'completed', results: newResults, allWorkers: data };
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Timeout — return current state
|
|
447
|
+
const finalRes = await get('/api/teams/workers');
|
|
448
|
+
const finalData = finalRes.ok ? (finalRes.data || finalRes) : {};
|
|
449
|
+
return {
|
|
450
|
+
status: 'timed_out',
|
|
451
|
+
message: `No completion after ${timeout_seconds || 900}s`,
|
|
452
|
+
allWorkers: finalData,
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
async function handleSendMessage(args) {
|
|
457
|
+
await post('/api/escalation/create', {
|
|
458
|
+
source: 'teams', question: args.message, options: [],
|
|
459
|
+
taskId: '', taskTitle: 'Message', timeoutSeconds: 5,
|
|
460
|
+
});
|
|
461
|
+
return 'Message sent';
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
async function handleReportWorkItem(args) {
|
|
465
|
+
const { id, title, category } = args;
|
|
466
|
+
if (!id || !title) throw new Error('id and title are required');
|
|
467
|
+
const res = await post('/api/planner/report-item', { id, title, category: category || 'feature' });
|
|
468
|
+
if (!res.ok) throw new Error(res.error || 'Failed to report item');
|
|
469
|
+
return res.data || { message: `Item "${title}" registered on the planner dashboard.` };
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
async function handleUpdateWorkItem(args) {
|
|
473
|
+
const { id, status, plan, tasks } = args;
|
|
474
|
+
if (!id || !status) throw new Error('id and status are required');
|
|
475
|
+
const body = { id, status };
|
|
476
|
+
if (plan) body.plan = plan;
|
|
477
|
+
if (tasks) body.tasks = tasks.map(t => ({
|
|
478
|
+
title: t.title,
|
|
479
|
+
description: t.description || '',
|
|
480
|
+
model: t.model || 'sonnet',
|
|
481
|
+
priority: t.priority || 'medium',
|
|
482
|
+
tags: t.tags || [],
|
|
483
|
+
}));
|
|
484
|
+
const res = await post('/api/planner/update-item', body);
|
|
485
|
+
if (!res.ok) throw new Error(res.error || 'Failed to update item');
|
|
486
|
+
return res.data || { message: `Item updated to "${status}".` };
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// ─── Utilities ───
|
|
490
|
+
|
|
491
|
+
function sleep(ms) {
|
|
492
|
+
return new Promise(r => setTimeout(r, ms));
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// Keep process alive
|
|
496
|
+
process.stdin.resume();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kanbaii",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "The organization layer that Claude Code doesn't have. Plan visually, track progress, let AI execute.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kanban",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"dev:server": "tsx watch src/server/index.ts",
|
|
53
53
|
"dev:frontend": "cd frontend && npm run dev",
|
|
54
54
|
"dev": "concurrently \"npm run dev:server\" \"npm run dev:frontend\"",
|
|
55
|
-
"build:server": "tsc -p tsconfig.server.json",
|
|
56
|
-
"build:cli": "tsc -p tsconfig.cli.json",
|
|
55
|
+
"build:server": "tsc -p tsconfig.server.json && node -e \"const fs=require('fs'),p=require('path');const s='src/server/mcp',d='dist/server/mcp';fs.mkdirSync(d,{recursive:true});fs.readdirSync(s).filter(f=>f.endsWith('.js')).forEach(f=>fs.copyFileSync(p.join(s,f),p.join(d,f)));\"",
|
|
56
|
+
"build:cli": "tsc -p tsconfig.cli.json && node -e \"const fs=require('fs'),p=require('path');const s='src/server/mcp',d='dist/server/mcp';fs.mkdirSync(d,{recursive:true});fs.readdirSync(s).filter(f=>f.endsWith('.js')).forEach(f=>fs.copyFileSync(p.join(s,f),p.join(d,f)));\"",
|
|
57
57
|
"build:frontend": "cd frontend && npm ci && npm run build && node -e \"const fs=require('fs');fs.rmSync('../dashboard',{recursive:true,force:true});fs.cpSync('out','../dashboard',{recursive:true});\"",
|
|
58
|
-
"build": "
|
|
58
|
+
"build": "npm run build:cli && npm run build:frontend",
|
|
59
59
|
"postbuild": "node -e \"require('fs').chmodSync('dist/cli/index.js', '755')\"",
|
|
60
60
|
"prepublishOnly": "echo 'Build handled by CI'",
|
|
61
61
|
"start": "node dist/server/index.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{4732:function(e,t,s){Promise.resolve().then(s.t.bind(s,7960,23)),Promise.resolve().then(s.bind(s,792))},792:function(e,t,s){"use strict";s.d(t,{AppShell:function(){return ek}});var a=s(7437),n=s(2265);let r=(0,n.createContext)(void 0);function o(e){let{children:t}=e,[s,o]=(0,n.useState)("dark"),[l,i]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{let e=localStorage.getItem("kanbaii-theme");"light"===e||"dark"===e?o(e):o("dark"),i(!0)},[]),(0,n.useEffect)(()=>{l&&(document.documentElement.setAttribute("data-theme",s),localStorage.setItem("kanbaii-theme",s))},[s,l]),l)?(0,a.jsx)(r.Provider,{value:{theme:s,toggleTheme:()=>{o(e=>"dark"===e?"light":"dark")}},children:t}):null}function l(){let e=(0,n.useContext)(r);if(!e)throw Error("useTheme must be used within ThemeProvider");return e}var i=s(2829);let c=(0,i.Z)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var d=s(9397);let x=(0,i.Z)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),u=(0,i.Z)("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);var p=s(8930),m=s(407),h=s(9076);let f=(0,i.Z)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);var b=s(8728),g=s(9747),v=s(9449),j=s(2569),y=s(9405),k=s(1347);function N(){let{theme:e,toggleTheme:t}=l();return(0,a.jsxs)("button",{className:"relative w-12 h-[26px] rounded-[13px] border border-border bg-surface cursor-pointer p-0 transition-all duration-250 ease-out-expo overflow-hidden shrink-0 hover:border-accent hover:bg-surface-hover hover:shadow-[0_0_8px_var(--accent-glow)]",onClick:t,title:"Switch to ".concat("dark"===e?"light":"dark"," theme"),children:[(0,a.jsx)(k.E.div,{className:"absolute top-0.5 left-0.5 w-5 h-5 rounded-[10px] bg-accent shadow-[0_2px_6px_rgba(0,0,0,0.3)] flex items-center justify-center",initial:!1,animate:{x:"dark"===e?0:22},transition:{type:"spring",stiffness:300,damping:30},children:"dark"===e?(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,a.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,a.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),(0,a.jsx)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),(0,a.jsx)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),(0,a.jsx)("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),(0,a.jsx)("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),(0,a.jsx)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),(0,a.jsx)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}),(0,a.jsxs)("div",{className:"absolute inset-0 flex items-center justify-between px-1.5 pointer-events-none",children:[(0,a.jsx)("div",{className:"ml-0.5 transition-opacity duration-250 ease-out-expo ".concat("dark"===e?"opacity-30":"opacity-0"),children:(0,a.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}),(0,a.jsx)("div",{className:"mr-0.5 transition-opacity duration-250 ease-out-expo ".concat("light"===e?"opacity-30":"opacity-0"),children:(0,a.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,a.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,a.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"})]})})]})]})}var w=s(2489),C=s(1171),S=s(9116);let T=["#6366f1","#ef4444","#f59e0b","#22c55e","#3b82f6","#8b5cf6","#ec4899","#14b8a6"];function E(e){let{onClose:t}=e,s=(0,v.U)(e=>e.goToProject),r=(0,g.i)(e=>e.createProject),[o,l]=(0,n.useState)(""),[i,c]=(0,n.useState)(""),[d,x]=(0,n.useState)(""),[u,p]=(0,n.useState)(T[0]),[m,h]=(0,n.useState)(!1),{overlayProps:f}=(0,C.N)(t,{disabled:m});(0,n.useEffect)(()=>{S.h.getHealth().then(e=>{e.cwd&&!d&&x(e.cwd)}).catch(()=>{})},[]);let b=async e=>{if(e.preventDefault(),o.trim()){h(!0);try{let e=await r({title:o.trim(),description:i.trim()||void 0,color:u,workingDir:d.trim()||void 0});t(),s(e.slug)}catch(e){h(!1)}}};return(0,a.jsx)("div",{className:"glass-overlay",...f,children:(0,a.jsxs)("div",{className:"modal-box w-[440px] max-w-[92%] p-7",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-7",children:[(0,a.jsx)("span",{className:"text-h2 font-semibold tracking-tight",children:"New Project"}),(0,a.jsx)("button",{className:"btn-icon",onClick:t,children:(0,a.jsx)(w.Z,{size:16})})]}),(0,a.jsxs)("form",{className:"flex flex-col gap-5",onSubmit:b,children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Title"}),(0,a.jsx)("input",{value:o,onChange:e=>l(e.target.value),placeholder:"Project name...",autoFocus:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Description (optional)"}),(0,a.jsx)("input",{value:i,onChange:e=>c(e.target.value),placeholder:"Brief description..."})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Working Directory"}),(0,a.jsx)("input",{value:d,onChange:e=>x(e.target.value),placeholder:"C:\\Users\\...\\my-project"}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted mt-1 opacity-60",children:"Where Claude runs commands. Defaults to where kanbaii was started."})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-widest mb-2 font-mono",children:"Color"}),(0,a.jsx)("div",{className:"flex gap-2",children:T.map(e=>(0,a.jsx)("button",{type:"button",className:"w-6 h-6 rounded-full border-2 cursor-pointer transition-all duration-150 ease-out-expo\n ".concat(u===e?"border-text shadow-[0_0_8px_currentColor]":"border-transparent shadow-[0_0_0_0_transparent]","\n hover:scale-[1.2] hover:shadow-[0_0_12px_currentColor]"),style:{background:e},onClick:()=>p(e)},e))})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,a.jsx)("button",{type:"button",className:"btn-ghost",onClick:t,children:"Cancel"}),(0,a.jsx)("button",{type:"submit",className:"btn-primary",disabled:!o.trim()||m,children:m?"Creating...":"Create"})]})]})]})})}let z=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555",P=[{key:"general",label:"General"},{key:"ralph",label:"Ralph"},{key:"scheduler",label:"Scheduler"},{key:"terminal",label:"Terminal"},{key:"auth",label:"Auth"},{key:"integrations",label:"Integrations"}];function M(e){let{onClose:t}=e,s=(0,y.E)(e=>e.addToast),[r,o]=(0,n.useState)("general"),[l,i]=(0,n.useState)(null),[c,d]=(0,n.useState)(!1),{overlayProps:x}=(0,C.N)(t),u=(0,n.useCallback)(async()=>{try{let e=await fetch("".concat(z,"/api/settings")),t=await e.json();t.ok&&i(t.data)}catch(e){}},[]);(0,n.useEffect)(()=>{u()},[u]);let p=async(e,t)=>{d(!0);try{await fetch("".concat(z,"/api/settings/").concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s("Settings saved","success"),u()}catch(e){s("Failed to save","error")}d(!1)};return l?(0,a.jsx)("div",{className:"glass-overlay",...x,children:(0,a.jsxs)("div",{className:"modal-box max-w-[680px] w-[95%] max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 pt-5 pb-4 shrink-0",children:[(0,a.jsxs)("div",{className:"text-h2 font-semibold tracking-tight flex items-center gap-2",children:[(0,a.jsx)(b.Z,{size:16})," Settings"]}),(0,a.jsx)("button",{className:"btn-icon",onClick:t,children:(0,a.jsx)(w.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,a.jsx)("div",{className:"w-40 shrink-0 border-r border-border p-2 flex flex-col gap-0.5 bg-bg-subtle",children:P.map(e=>(0,a.jsx)("button",{className:"px-3 py-2 text-xs font-medium text-text-muted rounded-sm text-left transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat(r===e.key?"text-text bg-accent-muted":""),onClick:()=>o(e.key),children:e.label},e.key))}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:["general"===r&&(0,a.jsxs)(_,{title:"General",onSave:e=>p("general",e),saving:c,children:[(0,a.jsx)(I,{label:"Default Model",type:"select",value:l.general.defaultModel,options:["haiku","sonnet","opus"],field:"defaultModel"}),(0,a.jsx)(I,{label:"Timezone",value:l.general.timezone,field:"timezone"}),(0,a.jsx)(I,{label:"Port",type:"number",value:l.general.port,field:"port"})]}),"ralph"===r&&(0,a.jsxs)(_,{title:"Ralph",onSave:e=>p("ralph",e),saving:c,children:[(0,a.jsx)(I,{label:"Max Iterations",type:"number",value:l.ralph.maxIterations,field:"maxIterations"}),(0,a.jsx)(I,{label:"Circuit Breaker (max errors)",type:"number",value:l.ralph.circuitBreaker,field:"circuitBreaker"}),(0,a.jsx)(I,{label:"Task Filter",type:"select",value:l.ralph.taskFilter,options:["todo-only","all"],field:"taskFilter"})]}),"scheduler"===r&&(0,a.jsxs)(_,{title:"Scheduler",onSave:e=>p("scheduler",e),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.scheduler.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"Max Concurrent",type:"number",value:l.scheduler.maxConcurrent,field:"maxConcurrent"}),(0,a.jsx)(I,{label:"Timeout (ms)",type:"number",value:l.scheduler.timeout,field:"timeout"}),(0,a.jsx)(I,{label:"Stale Threshold (min)",type:"number",value:l.scheduler.staleThreshold,field:"staleThreshold"})]}),"terminal"===r&&(0,a.jsxs)(_,{title:"Terminal",onSave:e=>p("terminal",e),saving:c,children:[(0,a.jsx)(I,{label:"Inactivity Warn (min)",type:"number",value:l.terminal.inactivityWarn,field:"inactivityWarn"}),(0,a.jsx)(I,{label:"Inactivity Kill (min)",type:"number",value:l.terminal.inactivityKill,field:"inactivityKill"}),(0,a.jsx)(I,{label:"Max Timeout (min)",type:"number",value:l.terminal.maxTimeout,field:"maxTimeout"})]}),"auth"===r&&(0,a.jsxs)(_,{title:"Authentication",onSave:e=>p("auth",e),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.auth.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"Secret Key",value:l.auth.secret,field:"secret",placeholder:"auto-generated if empty"}),(0,a.jsx)(I,{label:"Token Expiry",value:l.auth.tokenExpiry,field:"tokenExpiry",placeholder:"24h"})]}),"integrations"===r&&(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(_,{title:"Telegram",onSave:e=>p("integrations",{telegram:e}),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.integrations.telegram.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"Bot Token",value:l.integrations.telegram.botToken,field:"botToken",placeholder:"123456:ABC-DEF..."}),(0,a.jsx)(I,{label:"Chat ID",value:l.integrations.telegram.chatId,field:"chatId",placeholder:"-100123456789"})]}),(0,a.jsxs)(_,{title:"Voice Input",onSave:e=>p("integrations",{voice:e}),saving:c,children:[(0,a.jsx)(I,{label:"Enabled",type:"toggle",value:l.integrations.voice.enabled,field:"enabled"}),(0,a.jsx)(I,{label:"OpenAI API Key",value:l.integrations.voice.openaiApiKey||"",field:"openaiApiKey",placeholder:"sk-... (for Whisper fallback)"})]})]})]})]})]})}):null}function _(e){let{title:t,children:s,onSave:r,saving:o}=e,[l,i]=(0,n.useState)({});(0,n.useEffect)(()=>{let e={};n.Children.forEach(s,t=>{var s;(null==t?void 0:null===(s=t.props)||void 0===s?void 0:s.field)&&(e[t.props.field]=t.props.value)}),i(e)},[s]);let c=(e,t)=>{i(s=>({...s,[e]:t}))};return(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-body font-semibold text-text tracking-tight",children:t}),(0,a.jsx)("button",{className:"btn-primary",onClick:()=>r(l),disabled:o,children:o?"Saving...":"Save"})]}),(0,a.jsx)("div",{className:"flex flex-col gap-3",children:n.Children.map(s,e=>{var t,s;return(null==e?void 0:null===(t=e.props)||void 0===t?void 0:t.field)?n.cloneElement(e,{value:null!==(s=l[e.props.field])&&void 0!==s?s:e.props.value,onChange:t=>c(e.props.field,t)}):e})})]})}function I(e){let{label:t,value:s,field:n,type:r,options:o,placeholder:l,onChange:i}=e;return"toggle"===r?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-secondary min-w-[140px] shrink-0",children:t}),(0,a.jsx)("button",{className:"px-3 py-1 text-data font-semibold rounded-xs font-mono border transition-all duration-150 ease-out-expo tracking-wide ".concat(s?"text-success border-success-dim bg-success-dim":"text-text-muted border-border"),onClick:()=>null==i?void 0:i(!s),children:s?"ON":"OFF"})]}):"select"===r&&o?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-secondary min-w-[140px] shrink-0",children:t}),(0,a.jsx)("div",{className:"flex gap-1",children:o.map(e=>(0,a.jsx)("button",{className:"px-2.5 py-1 text-data font-medium rounded-full border font-mono transition-all duration-150 ease-out-expo ".concat(s===e?"border-accent-dim text-accent bg-accent-muted":"border-border text-text-muted hover:border-border-light hover:text-text-secondary"),onClick:()=>null==i?void 0:i(e),children:e},e))})]}):(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-secondary min-w-[140px] shrink-0",children:t}),(0,a.jsx)("input",{type:r||"text",value:null!=s?s:"",onChange:e=>null==i?void 0:i("number"===r?Number(e.target.value):e.target.value),placeholder:l,className:"flex-1 max-w-[200px] text-right font-mono text-xs"})]})}let A=(0,i.Z)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var Z=s(1239),R=s(1723);let D=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555";function F(e){return e<.01?"$".concat(e.toFixed(4)):"$".concat(e.toFixed(2))}function L(e){var t;let{projectSlug:s}=e,r=(0,y.E)(e=>e.addToast),[o,l]=(0,n.useState)(null),[i,c]=(0,n.useState)([]),[d,x]=(0,n.useState)("30d"),[u,m]=(0,n.useState)(s?"project":"global"),h=(0,n.useCallback)(async()=>{let e="project"===u&&s?s:void 0,t="7d"===d?7:"30d"===d?30:void 0,[a,n]=await Promise.all([fetch("".concat(D,"/api/costs/summary").concat(e?"?projectSlug=".concat(e):"")).then(e=>e.json()).catch(()=>({data:null})),fetch("".concat(D,"/api/costs/executions?limit=50").concat(e?"&projectSlug=".concat(e):"").concat(t?"&days=".concat(t):"")).then(e=>e.json()).catch(()=>({data:[]}))]);l(a.data||null),c(n.data||[])},[s,u,d]);(0,n.useEffect)(()=>{h()},[h]);let b=async()=>{let e="project"===u&&s?"?projectSlug=".concat(s):"";await fetch("".concat(D,"/api/costs/clear").concat(e),{method:"DELETE"}),r("Execution history cleared","info"),h()},g={opus:"#a855f7",sonnet:"#6366f1",haiku:"#22c55e"};return(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-y-auto gap-5 p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("div",{className:"text-h2 font-semibold tracking-tight flex items-center gap-2",children:[(0,a.jsx)(f,{size:18})," Costs & Analytics"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[s&&(0,a.jsxs)("div",{className:"flex border border-border rounded-sm overflow-hidden",children:[(0,a.jsx)("button",{className:"px-2.5 py-1 text-xxs font-semibold font-mono tracking-wide uppercase text-text-muted transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat("project"===u?"text-accent bg-accent-muted":""),onClick:()=>m("project"),children:"Project"}),(0,a.jsx)("button",{className:"px-2.5 py-1 text-xxs font-semibold font-mono tracking-wide uppercase text-text-muted transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat("global"===u?"text-accent bg-accent-muted":""),onClick:()=>m("global"),children:"Global"})]}),(0,a.jsx)("div",{className:"flex border border-border rounded-sm overflow-hidden",children:["7d","30d","all"].map(e=>(0,a.jsx)("button",{className:"px-2.5 py-1 text-xxs font-semibold font-mono tracking-wide uppercase text-text-muted transition-all duration-150 ease-out-expo hover:text-text-secondary hover:bg-surface-hover ".concat(d===e?"text-accent bg-accent-muted":""),onClick:()=>x(e),children:e},e))})]})]}),o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-4 gap-2 max-md:grid-cols-2",children:[(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(A,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:F(o.todayCost)}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"Today"})]}),(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(A,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:F(o.monthlyCost)}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"This Month"})]}),(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(Z.Z,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:(t=o.monthlyTokens)>=1e6?"".concat((t/1e6).toFixed(1),"M"):t>=1e3?"".concat((t/1e3).toFixed(0),"K"):"".concat(t)}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"Tokens (Month)"})]}),(0,a.jsxs)("div",{className:"p-4 border border-border rounded-md bg-card text-center relative overflow-hidden",children:[(0,a.jsx)("div",{className:"text-accent mb-1.5 flex justify-center",children:(0,a.jsx)(R.Z,{size:14})}),(0,a.jsx)("div",{className:"text-h1 font-bold text-text font-mono tracking-tight",children:o.monthlyExecutions}),(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mt-1",children:"Executions (Month)"})]})]}),Object.keys(o.byModel).length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("div",{className:"text-data font-semibold text-text-muted uppercase tracking-widest font-mono",children:"Model Breakdown"}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:Object.entries(o.byModel).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2.5 border border-border rounded-sm bg-card",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:g[t]||"#6366f1"}}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text",children:t}),(0,a.jsxs)("span",{className:"text-data text-text-muted font-mono ml-2",children:[s.count," runs — ",F(s.cost)]})]}),(0,a.jsx)("div",{className:"w-20 h-1 rounded-full overflow-hidden",style:{background:"rgba(148, 163, 242, 0.06)"},children:(0,a.jsx)("div",{className:"h-full rounded-full transition-[width] duration-500 ease-out-expo",style:{width:"".concat(o.totalExecutions>0?s.count/o.totalExecutions*100:0,"%"),background:g[t]||"#6366f1"}})})]},t)})})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"text-data font-semibold text-text-muted uppercase tracking-widest font-mono",children:"Recent Executions"}),(0,a.jsxs)("button",{className:"inline-flex items-center gap-[3px] text-xxs text-text-muted px-2 py-[3px] rounded-xs font-mono border border-border transition-all duration-120 ease-out-expo hover:text-danger hover:border-danger-dim",onClick:b,children:[(0,a.jsx)(p.Z,{size:10})," Clear"]})]}),0===i.length?(0,a.jsx)("div",{className:"text-text-muted text-label text-center py-8 font-mono opacity-50",children:"No executions recorded yet"}):(0,a.jsxs)("div",{className:"border border-border rounded-md overflow-hidden bg-card",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_70px_70px_60px_40px] px-3.5 py-2 text-xxs font-semibold text-text-muted uppercase tracking-wide font-mono border-b border-border bg-bg-subtle",children:[(0,a.jsx)("span",{children:"Task"}),(0,a.jsx)("span",{children:"Model"}),(0,a.jsx)("span",{children:"Duration"}),(0,a.jsx)("span",{children:"Cost"}),(0,a.jsx)("span",{children:"Status"})]}),i.map(e=>{var t;return(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_70px_70px_60px_40px] px-3.5 py-2 text-label border-b border-b-[rgba(148,163,242,0.03)] last:border-b-0 transition-colors duration-120 ease-out-expo hover:bg-surface-hover",children:[(0,a.jsx)("span",{className:"text-text overflow-hidden text-ellipsis whitespace-nowrap",children:e.taskTitle||e.projectSlug}),(0,a.jsx)("span",{className:"font-mono text-data font-semibold",style:{color:g[e.model]||"#6366f1"},children:e.model}),(0,a.jsx)("span",{className:"text-text-muted font-mono text-data",children:(t=e.duration)<1e3?"".concat(t,"ms"):"".concat((t/1e3).toFixed(1),"s")}),(0,a.jsx)("span",{className:"text-text-secondary font-mono text-data font-medium",children:F(e.costUsd)}),(0,a.jsx)("span",{className:"text-center ".concat("success"===e.status?"text-success":"text-danger"),children:"success"===e.status?"✓":"✗"})]},e.id)})]})]})]})}var q=s(7168),U=s(4401),B=s(6766);let O=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555",K="kanbaii-claude-usage";function W(e){return e>=80?"#ef4444":e>=60?"#f59e0b":"#6366f1"}function G(){try{var e;let t=sessionStorage.getItem(K);if(!t)return null;let s=JSON.parse(t);if((null==s?void 0:null===(e=s.entries)||void 0===e?void 0:e.length)>0&&Date.now()-new Date(s.timestamp).getTime()<3e5)return s}catch(e){}return null}function H(e){let{isExpanded:t}=e,[s,r]=(0,n.useState)(G),[o,l]=(0,n.useState)(!1),i=(0,n.useRef)(!0),c=(0,n.useCallback)(e=>{if(i.current){r(e),l(!1);try{sessionStorage.setItem(K,JSON.stringify(e))}catch(e){}}},[]),d=(0,n.useCallback)(async()=>{try{var e;let t=await fetch("".concat(O,"/api/costs/claude-usage")),s=await t.json(),a=(null==s?void 0:s.data)||s;if((null==a?void 0:null===(e=a.entries)||void 0===e?void 0:e.length)>0)return c(a),!0}catch(e){}return!1},[c]);(0,n.useEffect)(()=>{i.current=!0;let e=null,t=null,a=null,n=()=>{t=setInterval(async()=>{await d()&&t&&(clearInterval(t),t=null)},3e3),a=setTimeout(()=>{t&&(clearInterval(t),t=null),i.current&&!s&&l(!0)},3e4)};return e=setInterval(d,6e4),d().then(e=>{e||n()}),()=>{i.current=!1,e&&clearInterval(e),t&&clearInterval(t),a&&clearTimeout(a)}},[]),(0,n.useEffect)(()=>{let e=(0,B.h)(),t=e=>{var t;(null==e?void 0:null===(t=e.entries)||void 0===t?void 0:t.length)>0&&c(e)};return e.on("claude-usage",t),e.on("connect",()=>{d()}),()=>{e.off("claude-usage",t)}},[c,d]);let x=s?Math.max(...s.entries.map(e=>e.percent),0):0;return t?s?(0,a.jsxs)("div",{className:"px-3 py-2 flex flex-col gap-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-0.5",children:[(0,a.jsx)(U.Z,{size:10,className:"text-text-muted opacity-50"}),(0,a.jsx)("span",{className:"text-[8px] font-semibold text-text-muted uppercase tracking-[0.1em] font-mono opacity-60",children:"Rate Limits"})]}),s.entries.map((e,t)=>{var s;let n=W(e.percent),r=(s=e.percent)>=80?"rgba(239,68,68,0.3)":s>=60?"rgba(245,158,11,0.2)":"rgba(99,102,241,0.15)";return(0,a.jsxs)("div",{className:"flex flex-col gap-[3px]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-baseline",children:[(0,a.jsx)("span",{className:"text-[9px] text-text-muted truncate max-w-[110px] font-mono",children:e.label}),(0,a.jsxs)("span",{className:"text-[10px] font-bold font-mono tabular-nums ".concat(e.percent>=80?"animate-breathe":""),style:{color:n},children:[e.percent,"%"]})]}),(0,a.jsx)("div",{className:"w-full h-[3px] rounded-full overflow-hidden",style:{background:"rgba(148,163,242,0.06)"},children:(0,a.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:"".concat(Math.min(e.percent,100),"%"),background:n,boxShadow:e.percent>40?"0 0 6px ".concat(r):"none"}})}),e.resetsAt&&(0,a.jsxs)("span",{className:"text-[7px] text-text-muted font-mono opacity-40",children:["Resets ",e.resetsAt]})]},t)})]}):o?(0,a.jsxs)("div",{className:"px-3 py-2 flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"text-[8px] text-text-muted font-mono opacity-40",children:"Unavailable"}),(0,a.jsxs)("button",{className:"text-[8px] text-accent font-mono opacity-60 hover:opacity-100 transition-opacity flex items-center gap-1",onClick:()=>{l(!1),d()},children:[(0,a.jsx)(q.Z,{size:8})," Retry"]})]}):(0,a.jsxs)("div",{className:"px-3 py-2 flex items-center justify-center gap-2",children:[(0,a.jsx)("div",{className:"w-2.5 h-2.5 border border-text-muted/20 border-t-accent/50 rounded-full animate-spin"}),(0,a.jsx)("span",{className:"text-[8px] text-text-muted font-mono opacity-40",children:"Loading usage..."})]}):s?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1 py-1",title:s.entries.map(e=>"".concat(e.label,": ").concat(e.percent,"%")).join("\n"),children:[(0,a.jsx)("div",{className:"w-[5px] h-5 rounded-full overflow-hidden flex flex-col-reverse",style:{background:"rgba(148, 163, 242, 0.06)"},children:(0,a.jsx)("div",{className:"w-full rounded-full transition-[height] duration-500",style:{height:"".concat(Math.min(x,100),"%"),background:W(x)}})}),(0,a.jsxs)("span",{className:"text-[7px] text-text-muted font-mono opacity-50",children:[x,"%"]})]}):null}let V=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555";function J(){let{projects:e,fetchProjects:t,setActiveSlug:s,deleteProject:r,permanentDeleteProject:o,updateProject:l}=(0,g.i)(),{projectSlug:i,goToProject:k,goHome:w}=(0,v.U)(),C=(0,j.q)(e=>e.ralph),S=(0,j.q)(e=>e.teams),T=(0,y.E)(e=>e.addToast),[z,P]=(0,n.useState)(!1),[_,I]=(0,n.useState)(!1),[A,Z]=(0,n.useState)(!1),[R,D]=(0,n.useState)(null),[F,q]=(0,n.useState)(null),[U,B]=(0,n.useState)(null),[O,K]=(0,n.useState)(!1),[W,G]=(0,n.useState)(!1),[J,$]=(0,n.useState)(!0),[Q,Y]=(0,n.useState)(!1),ee=(0,n.useRef)(null),et=J||Q,es=(0,j.q)(e=>e.terminal.status),ea=(0,j.q)(e=>e.planner.active),en="running"===C.status||"paused"===C.status||S.active||"running"===es||ea;(0,n.useEffect)(()=>{t()},[t]),(0,n.useEffect)(()=>{if(!U)return;let e=()=>B(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[U]);let er=e=>{s(e.slug),k(e.slug)},eo=async(e,t)=>{e.stopPropagation(),B(null);try{await l(t.slug,{status:"archived"}),i===t.slug&&w(),T("".concat(t.title," archived"),"success")}catch(e){T("Failed to archive","error")}},el=async(e,t)=>{e.stopPropagation(),B(null);try{await r(t.slug),i===t.slug&&w(),T("".concat(t.title," moved to trash"),"success")}catch(e){T("Failed to move to trash","error")}},ei=async(e,t)=>{if(e.stopPropagation(),F!==t.slug){q(t.slug),setTimeout(()=>q(null),3e3);return}B(null);try{await o(t.slug),T("".concat(t.title," permanently deleted"),"success"),q(null)}catch(e){T("Failed to delete","error")}},ec=async(e,t)=>{e.stopPropagation(),B(null);try{await l(t.slug,{status:"active"}),T("".concat(t.title," restored"),"success")}catch(e){T("Failed to restore","error")}},ed=(e,t)=>{e.stopPropagation(),fetch("".concat(V,"/api/system/open-folder"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.workingDir})}).catch(()=>T("Failed to open folder","error"))},ex=e.filter(e=>"active"===e.status),eu=e.filter(e=>"archived"===e.status),ep=e.filter(e=>"deleted"===e.status);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("aside",{className:"flex-shrink-0 border-r border-border bg-bg-subtle flex flex-col overflow-hidden relative z-10\n transition-all duration-300 ease-out-expo ".concat(et?"w-sidebar":"w-sidebar-collapsed"),onMouseEnter:()=>{ee.current&&clearTimeout(ee.current),Y(!0)},onMouseLeave:()=>{ee.current=setTimeout(()=>Y(!1),200)},children:[(0,a.jsxs)("div",{className:"flex items-center flex-shrink-0 min-h-[48px]\n ".concat(et?"px-3 pt-3.5 pb-2.5 justify-between":"px-0 pt-3.5 pb-[18px] justify-center"),children:[(0,a.jsxs)("div",{className:"flex items-center ".concat(et?"gap-2.5":"gap-0"),children:[(0,a.jsx)("div",{className:"rounded-sm flex items-center justify-center flex-shrink-0 overflow-hidden relative\n transition-all duration-400\n ".concat(et?"w-[26px] h-[26px]":"w-7 h-7","\n ").concat(en?"bg-gradient-to-br from-emerald-800 to-emerald-500 shadow-[0_0_10px_rgba(16,185,129,0.3),0_0_20px_rgba(16,185,129,0.1)] border border-emerald-500/35 animate-breathe":"bg-gradient-to-br from-indigo-800 to-indigo-400 shadow-[0_0_8px_rgba(99,102,241,0.15),inset_0_0_6px_rgba(99,102,241,0.06)] border border-indigo-500/12"),children:(0,a.jsxs)("svg",{width:et?26:28,height:et?26:28,viewBox:"0 0 32 32",className:"block",children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"kc1",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:en?"#d1fae5":"#e0e7ff"}),(0,a.jsx)("stop",{offset:"100%",stopColor:en?"#a7f3d0":"#c7d2fe"})]}),(0,a.jsxs)("linearGradient",{id:"kc2",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:en?"#f0fdf4":"#f5f3ff"}),(0,a.jsx)("stop",{offset:"100%",stopColor:en?"#d1fae5":"#e0e7ff"})]}),(0,a.jsxs)("filter",{id:"kglow",children:[(0,a.jsx)("feGaussianBlur",{stdDeviation:"1.5",result:"b"}),(0,a.jsxs)("feMerge",{children:[(0,a.jsx)("feMergeNode",{in:"b"}),(0,a.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})]}),(0,a.jsxs)("g",{filter:"url(#kglow)",children:[(0,a.jsx)("rect",{x:"7",y:"10",width:"4.5",height:"12",fill:"url(#kc1)",rx:"1.5"}),(0,a.jsx)("rect",{x:"13.75",y:"7.5",width:"4.5",height:"17",fill:"url(#kc2)",rx:"1.5"}),(0,a.jsx)("rect",{x:"20.5",y:"11",width:"4.5",height:"10",fill:"url(#kc1)",rx:"1.5"})]})]})}),et&&(0,a.jsx)("span",{className:"text-[17px] font-light tracking-[0.15em] uppercase text-gradient opacity-90",children:"KANBAII"})]}),et&&(0,a.jsx)("button",{className:"w-[26px] h-[26px] flex items-center justify-center rounded-md transition-all duration-200\n ".concat(J?"text-accent bg-accent-muted":"text-text-muted bg-transparent opacity-50 hover:opacity-100 hover:bg-surface hover:text-text"),onClick:()=>$(!J),title:J?"Unpin sidebar":"Pin sidebar",children:(0,a.jsx)(c,{size:13,fill:J?"currentColor":"none",className:"transition-transform duration-300 ".concat(J?"rotate-0":"-rotate-45")})})]}),(0,a.jsx)("div",{className:"h-px flex-shrink-0 opacity-50 ".concat(et?"mx-3 my-[2px_12px_6px]":"mx-2.5 my-[2px_10px_6px]"),style:{background:"linear-gradient(90deg, transparent 10%, var(--border-glow) 50%, transparent 90%)",margin:et?"2px 12px 6px":"2px 10px 6px"}}),(0,a.jsx)("div",{className:"flex-shrink-0 px-2 py-1",children:(0,a.jsxs)("button",{className:"w-full rounded-sm border border-dashed border-border-light bg-transparent text-text-muted text-xs font-medium\n flex items-center gap-2 cursor-pointer transition-all duration-200 ease-out-expo\n hover:bg-accent-muted hover:border-accent/25 hover:text-accent\n ".concat(et?"py-2 px-2.5 justify-start":"py-2 px-0 justify-center"),onClick:()=>P(!0),children:[(0,a.jsx)(d.Z,{size:14}),et&&"New Project"]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden px-2 py-1 pb-4",children:0===ex.length&&0===eu.length&&0===ep.length?(0,a.jsx)("div",{className:"text-center text-text-muted text-body py-8 px-3 transition-opacity duration-150 ".concat(et?"opacity-100":"opacity-0"),children:"No projects yet"}):(0,a.jsxs)(a.Fragment,{children:[ex.map(e=>{let t=i===e.slug,s=C.projectSlug===e.slug&&("running"===C.status||"paused"===C.status),n=S.active&&S.projectSlug===e.slug,r=ea&&j.q.getState().planner.projectSlug===e.slug,o=s||n||r,l=function(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:99,g:102,b:241}}(e.color);return(0,a.jsxs)("div",{className:"relative mb-0.5 group",children:[(0,a.jsxs)("button",{className:"w-full rounded-sm text-left flex items-center transition-all duration-200 cursor-pointer\n ".concat(et?"py-3 px-3.5 justify-start gap-3":"py-2.5 px-0 justify-center gap-0","\n ").concat(t?"bg-surface border border-border":"bg-transparent border border-transparent hover:bg-surface"),onClick:()=>er(e),children:[(0,a.jsx)("div",{className:"rounded-full flex-shrink-0 transition-all duration-400\n ".concat(et?"w-2.5 h-2.5":"w-3 h-3","\n ").concat(o?"!bg-emerald-500 animate-dot-pulse":""),style:{"--dot-r":l.r,"--dot-g":l.g,"--dot-b":l.b,...o?{}:{background:e.color,boxShadow:t?"0 0 8px ".concat(e.color,"50"):"none"}}}),et&&(0,a.jsxs)("div",{className:"flex-1 min-w-0 pr-6",children:[(0,a.jsx)("div",{className:"text-sm font-medium whitespace-nowrap overflow-hidden text-ellipsis tracking-tight\n ".concat(t?"text-text":"text-text-secondary"),children:e.title}),e.workingDir?(0,a.jsxs)("button",{className:"text-label flex items-center gap-1 mt-0.5 whitespace-nowrap overflow-hidden text-ellipsis text-text-muted hover:text-accent transition-colors duration-150",onClick:t=>ed(t,e),title:"Open folder in explorer",children:[(0,a.jsx)(x,{size:10}),e.workingDir.split(/[/\\]/).slice(-2).join("/")]}):(0,a.jsxs)("button",{className:"text-label flex items-center gap-1 mt-0.5 text-warning hover:text-accent transition-colors duration-150",onClick:t=>{t.stopPropagation(),D({slug:e.slug,current:""})},title:"Click to set project folder",children:[(0,a.jsx)(x,{size:10})," Set folder"]})]})]}),et&&(0,a.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[e.workingDir&&(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-accent",onClick:t=>ed(t,e),title:"Open folder",children:(0,a.jsx)(x,{size:11})}),(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-text-secondary",onClick:t=>{t.stopPropagation(),B(U===e.slug?null:e.slug),q(null)},children:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,a.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"19",r:"2"})]})})]}),U===e.slug&&et&&(0,a.jsxs)("div",{className:"absolute right-1 top-full mt-0.5 min-w-[160px] bg-glass backdrop-blur-[12px] backdrop-saturate-[160%] border border-glass-border rounded-md shadow-elevated z-[100] py-1 overflow-hidden animate-filter-in",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>{t.stopPropagation(),B(null),D({slug:e.slug,current:e.workingDir||""})},children:[(0,a.jsx)(x,{size:14})," ",e.workingDir?"Change Folder":"Set Folder"]}),e.workingDir&&(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>{t.stopPropagation(),B(null),ed(t,e)},children:[(0,a.jsx)(x,{size:14})," Open Folder"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>eo(t,e),children:[(0,a.jsx)(u,{size:14})," Archive"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 text-danger text-xs text-left transition-colors duration-100 bg-transparent hover:bg-danger-dim",onClick:t=>el(t,e),children:[(0,a.jsx)(p.Z,{size:14})," Move to Trash"]})]})]},e.id)}),eu.length>0&&et&&(0,a.jsxs)("div",{className:"mt-3 pt-2 border-t border-border/20",children:[(0,a.jsxs)("button",{className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-[10px] font-medium uppercase tracking-wider text-text-muted/50 hover:text-text-muted transition-colors",onClick:()=>K(!O),children:[(0,a.jsx)(m.Z,{size:10,className:"transition-transform duration-200 ".concat(O?"rotate-90":"")}),(0,a.jsx)(u,{size:10}),"Archived (",eu.length,")"]}),O&&eu.map(e=>(0,a.jsxs)("div",{className:"relative mb-0.5 group opacity-50 hover:opacity-70 transition-opacity",children:[(0,a.jsxs)("button",{className:"w-full rounded-sm text-left flex items-center transition-all duration-200 cursor-pointer py-2 px-3.5 justify-start gap-3 bg-transparent border border-transparent hover:bg-surface",onClick:()=>er(e),children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:e.color}}),(0,a.jsx)("span",{className:"text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis tracking-tight text-text-secondary flex-1 min-w-0",children:e.title})]}),(0,a.jsx)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-text-secondary",onClick:t=>{t.stopPropagation(),B(U===e.slug?null:e.slug),q(null)},children:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,a.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"19",r:"2"})]})})}),U===e.slug&&(0,a.jsxs)("div",{className:"absolute right-1 top-full mt-0.5 min-w-[160px] bg-glass backdrop-blur-[12px] backdrop-saturate-[160%] border border-glass-border rounded-md shadow-elevated z-[100] py-1 overflow-hidden animate-filter-in",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>ec(t,e),children:[(0,a.jsx)(h.Z,{size:14})," Unarchive"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 text-danger text-xs text-left transition-colors duration-100 bg-transparent hover:bg-danger-dim",onClick:t=>el(t,e),children:[(0,a.jsx)(p.Z,{size:14})," Move to Trash"]})]})]},e.id))]}),ep.length>0&&et&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-border/20",children:[(0,a.jsxs)("button",{className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-[10px] font-medium uppercase tracking-wider text-text-muted/50 hover:text-text-muted transition-colors",onClick:()=>G(!W),children:[(0,a.jsx)(m.Z,{size:10,className:"transition-transform duration-200 ".concat(W?"rotate-90":"")}),(0,a.jsx)(p.Z,{size:10}),"Trash (",ep.length,")"]}),W&&ep.map(e=>(0,a.jsxs)("div",{className:"relative mb-0.5 group opacity-40 hover:opacity-60 transition-opacity",children:[(0,a.jsxs)("div",{className:"w-full rounded-sm text-left flex items-center py-2 px-3.5 justify-start gap-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full flex-shrink-0 opacity-50",style:{background:e.color}}),(0,a.jsx)("span",{className:"text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis tracking-tight text-text-muted line-through flex-1 min-w-0",children:e.title})]}),(0,a.jsx)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:(0,a.jsx)("button",{className:"w-[22px] h-[22px] flex items-center justify-center rounded-sm text-text-muted bg-transparent transition-all duration-150 opacity-0 group-hover:opacity-100 hover:bg-surface hover:text-text-secondary",onClick:t=>{t.stopPropagation(),B(U===e.slug?null:e.slug),q(null)},children:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,a.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"19",r:"2"})]})})}),U===e.slug&&(0,a.jsxs)("div",{className:"absolute right-1 top-full mt-0.5 min-w-[160px] bg-glass backdrop-blur-[12px] backdrop-saturate-[160%] border border-glass-border rounded-md shadow-elevated z-[100] py-1 overflow-hidden animate-filter-in",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 bg-transparent text-text-secondary text-xs text-left transition-colors duration-100 hover:bg-surface-hover",onClick:t=>ec(t,e),children:[(0,a.jsx)(h.Z,{size:14})," Restore"]}),(0,a.jsxs)("button",{className:"w-full py-2 px-3 flex items-center gap-2 text-xs text-left transition-colors duration-100\n ".concat(F===e.slug?"text-danger bg-danger-dim":"text-danger bg-transparent hover:bg-danger-dim"),onClick:t=>ei(t,e),children:[(0,a.jsx)(p.Z,{size:14})," ",F===e.slug?"Confirm Delete?":"Delete Permanently"]})]})]},e.id))]})]})}),(0,a.jsx)("div",{className:"border-t border-[rgba(148,163,242,0.03)] flex-shrink-0",children:(0,a.jsx)(H,{isExpanded:et})}),(0,a.jsxs)("div",{className:"border-t border-[rgba(148,163,242,0.03)] flex-shrink-0 flex items-center\n ".concat(et?"px-3 py-2.5 flex-row gap-1 justify-center":"px-0 py-3 flex-col gap-3 justify-center"),children:[(0,a.jsx)("button",{className:"inline-flex items-center justify-center w-7 h-7 rounded-sm text-text-muted transition-all duration-150 hover:text-accent hover:bg-accent-muted",onClick:()=>Z(!0),title:"Costs & Analytics",children:(0,a.jsx)(f,{size:14})}),(0,a.jsx)("button",{className:"inline-flex items-center justify-center w-7 h-7 rounded-sm text-text-muted transition-all duration-150 hover:text-text-secondary hover:bg-surface-hover",onClick:()=>I(!0),title:"Settings",children:(0,a.jsx)(b.Z,{size:14})}),(0,a.jsx)(N,{}),et&&(0,a.jsx)("span",{className:"text-data text-text-muted opacity-30 font-mono ml-auto",children:"H"})]})]}),z&&(0,a.jsx)(E,{onClose:()=>P(!1)}),R&&(0,a.jsx)(X,{currentPath:R.current,onSave:async e=>{try{await l(R.slug,{workingDir:e}),T("Folder linked","success")}catch(e){T("Failed to set folder","error")}D(null)},onClose:()=>D(null)}),_&&(0,a.jsx)(M,{onClose:()=>I(!1)}),A&&(0,a.jsx)("div",{className:"fixed inset-0 z-[200] bg-overlay backdrop-blur-[16px] backdrop-saturate-[180%] flex items-center justify-center animate-overlay-in",onClick:()=>Z(!1),children:(0,a.jsxs)("div",{className:"bg-modal border border-glass-border rounded-lg shadow-modal max-w-[800px] w-[95%] max-h-[85vh] overflow-hidden animate-spring-pop",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[(0,a.jsxs)("span",{className:"text-h2 font-semibold flex items-center gap-2",children:[(0,a.jsx)(f,{size:16})," Costs & Analytics"]}),(0,a.jsx)("button",{className:"btn-icon",onClick:()=>Z(!1),children:(0,a.jsx)("span",{className:"text-text-muted",children:"\xd7"})})]}),(0,a.jsx)("div",{className:"overflow-y-auto max-h-[calc(85vh-52px)]",children:(0,a.jsx)(L,{projectSlug:i||void 0})})]})})]})}function X(e){let{currentPath:t,onSave:s,onClose:r}=e,[o,l]=(0,n.useState)(t),i=(0,n.useRef)(null);return(0,n.useEffect)(()=>{var e,t;null===(e=i.current)||void 0===e||e.focus(),null===(t=i.current)||void 0===t||t.select()},[]),(0,a.jsx)("div",{className:"fixed inset-0 z-[200] bg-overlay backdrop-blur-[16px] backdrop-saturate-[180%] flex items-center justify-center animate-overlay-in",onClick:r,children:(0,a.jsxs)("div",{className:"bg-modal border border-glass-border rounded-lg shadow-modal max-w-[440px] w-[92%] animate-spring-pop relative overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("div",{className:"absolute top-0 left-[15%] right-[15%] h-px pointer-events-none",style:{background:"linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.2), transparent)"}}),(0,a.jsxs)("div",{className:"px-6 pt-5 pb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)(x,{size:16,className:"text-accent"}),(0,a.jsx)("span",{className:"text-h2 font-semibold tracking-tight",children:t?"Change Folder":"Link Project Folder"})]}),(0,a.jsx)("p",{className:"text-label text-text-muted leading-relaxed",children:"Set the local directory where this project's code lives. Ralph and the terminal will use this path."})]}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.trim()&&s(o.trim())},className:"px-6 pb-5 flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-data font-semibold text-text-muted uppercase tracking-widest font-mono",children:"Folder Path"}),(0,a.jsx)("input",{ref:i,value:o,onChange:e=>l(e.target.value),placeholder:"C:\\Users\\marti\\projects\\my-app",className:"w-full font-mono text-xs",spellCheck:!1})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",className:"btn-ghost",onClick:r,children:"Cancel"}),(0,a.jsxs)("button",{type:"submit",className:"btn-primary",disabled:!o.trim(),children:[(0,a.jsx)(x,{size:12})," ",t?"Update":"Link Folder"]})]})]})]})})}var $=s(401);let Q=(0,i.Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Y=(0,i.Z)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),ee={success:{accent:"border-l-success",iconColor:"text-success",icon:(0,a.jsx)($.Z,{size:14})},error:{accent:"border-l-danger",iconColor:"text-danger",icon:(0,a.jsx)(Q,{size:14})},info:{accent:"border-l-accent",iconColor:"text-accent",icon:(0,a.jsx)(Y,{size:14})}};function et(){let{toasts:e,removeToast:t}=(0,y.E)();return 0===e.length?null:(0,a.jsx)("div",{className:"fixed bottom-4 right-4 flex flex-col gap-1.5 z-[400] pointer-events-none",children:e.map((s,n)=>{let r=ee[s.type]||ee.info,o=n<e.length-1;return(0,a.jsxs)("div",{className:"bg-glass backdrop-blur-[16px] backdrop-saturate-[160%] border border-glass-border rounded-md\n px-3.5 py-2.5 text-xs font-medium text-text shadow-elevated\n flex items-center gap-2.5 animate-toast-in pointer-events-auto min-w-[220px]\n relative overflow-hidden border-l-2 ".concat(r.accent,"\n transition-all duration-200 ease-out-expo\n ").concat(o?"scale-[0.97] opacity-80":""),children:[(0,a.jsx)("div",{className:"absolute top-0 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-white/[0.04] to-transparent pointer-events-none"}),(0,a.jsx)("span",{className:"flex flex-shrink-0 ".concat(r.iconColor),children:r.icon}),(0,a.jsx)("span",{className:"flex-1",children:s.message}),(0,a.jsx)("button",{className:"text-text-muted p-0.5 flex rounded-xs transition-all duration-120 ease-out-expo hover:text-text hover:bg-surface-hover",onClick:()=>t(s.id),children:(0,a.jsx)(w.Z,{size:12})})]},s.id)})})}let es=[{title:"Navigation",shortcuts:[{keys:["↑","↓"],desc:"Previous / next project"},{keys:["B"],desc:"Board view"},{keys:["C"],desc:"Console / Terminal"},{keys:["R"],desc:"Ralph / Agents"},{keys:["S"],desc:"Soul"}]},{title:"Actions",shortcuts:[{keys:["N"],desc:"New task"},{keys:["Ctrl","F"],desc:"Toggle filter bar"}]},{title:"General",shortcuts:[{keys:["H"],desc:"Show this help"},{keys:["Esc"],desc:"Close modal / go back"}]}];function ea(e){let{onClose:t}=e,{overlayProps:s}=(0,C.N)(t);return(0,a.jsx)("div",{className:"glass-overlay",...s,children:(0,a.jsxs)("div",{className:"modal-box w-[400px] max-w-[90%] p-7",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("span",{className:"text-h2 font-semibold tracking-tight",children:"Keyboard Shortcuts"}),(0,a.jsx)("button",{className:"btn-icon",onClick:t,children:(0,a.jsx)(w.Z,{size:16})})]}),(0,a.jsx)("div",{className:"flex flex-col gap-[22px]",children:es.map(e=>(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("div",{className:"text-xxs font-semibold text-text-muted uppercase tracking-widest font-mono mb-1",children:e.title}),e.shortcuts.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,a.jsx)("div",{className:"flex items-center gap-[3px]",children:e.keys.map((t,s)=>(0,a.jsxs)("span",{children:[(0,a.jsx)("kbd",{className:"inline-flex items-center justify-center min-w-[24px] h-6 px-[7px] bg-[rgba(148,163,242,0.04)] border border-[rgba(148,163,242,0.08)] border-b-2 border-b-[rgba(148,163,242,0.1)] rounded-[5px] text-[10px] font-semibold text-text font-mono",children:t}),s<e.keys.length-1&&(0,a.jsx)("span",{className:"text-xxs text-text-muted opacity-50",children:"+"})]},s))}),(0,a.jsx)("span",{className:"text-xs text-text-secondary",children:e.desc})]},e.desc))]},e.title))})]})})}let en=(0,i.Z)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),er=(0,i.Z)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),eo=(0,i.Z)("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);var el=s(3468),ei=s(2222),ec=s(221),ed=s(5805),ex=s(2208),eu=s(3247),ep=s(15);function em(e){let{onClose:t,onShowCreateProject:s,onShowCreateWorkItem:r,onShowHelp:o}=e,[i,c]=(0,n.useState)(""),[u,p]=(0,n.useState)(0),m=(0,n.useRef)(null),h=(0,n.useRef)(null),f=(0,g.i)(e=>e.projects),b=(0,ep.o)(e=>e.workItems),{goToProject:j,goToWorkItem:y,setView:k,projectSlug:N,workItemSlug:w}=(0,v.U)(),{theme:C,toggleTheme:S}=l(),T=(0,n.useMemo)(()=>{let e=[];return e.push({id:"create-project",label:"Create Project",section:"Actions",icon:(0,a.jsx)(d.Z,{size:14}),action:()=>{t(),null==s||s()}}),N&&e.push({id:"create-wi",label:"Create Work Item",section:"Actions",icon:(0,a.jsx)(d.Z,{size:14}),action:()=>{t(),null==r||r()}}),e.push({id:"toggle-theme",label:"Switch to ".concat("dark"===C?"Light":"Dark"," mode"),section:"Actions",icon:"dark"===C?(0,a.jsx)(en,{size:14}):(0,a.jsx)(er,{size:14}),action:()=>{S(),t()}}),e.push({id:"keyboard-shortcuts",label:"Keyboard Shortcuts",section:"Actions",icon:(0,a.jsx)(eo,{size:14}),shortcut:"H",action:()=>{t(),null==o||o()}}),N&&(w?[{key:"board",label:"Go to Board",icon:(0,a.jsx)(el.Z,{size:14}),shortcut:"B"},{key:"ralph",label:"Go to Ralph",icon:(0,a.jsx)(ei.Z,{size:14}),shortcut:"R"}]:[{key:"work-items",label:"Go to Work Items",icon:(0,a.jsx)(el.Z,{size:14}),shortcut:"W"},{key:"console",label:"Go to Console",icon:(0,a.jsx)(ec.Z,{size:14}),shortcut:"C"},{key:"teams",label:"Go to Teams",icon:(0,a.jsx)(ed.Z,{size:14}),shortcut:"T"},{key:"soul",label:"Go to Soul",icon:(0,a.jsx)(ex.Z,{size:14}),shortcut:"S"}]).forEach(s=>{e.push({id:"nav-".concat(s.key),label:s.label,section:"Navigation",icon:s.icon,shortcut:s.shortcut,action:()=>{k(s.key),t()}})}),f.forEach(s=>{e.push({id:"project-".concat(s.slug),label:s.title,section:"Projects",icon:(0,a.jsx)(x,{size:14}),action:()=>{j(s.slug),t()}})}),N&&b.forEach(s=>{e.push({id:"wi-".concat(s.slug),label:s.title,section:"Work Items",icon:(0,a.jsx)(Z.Z,{size:14}),action:()=>{y(N,s.slug),t()}})}),e},[f,b,N,C,t,s,r,o,j,y,k,S]),E=(0,n.useMemo)(()=>{if(!i.trim())return T;let e=i.toLowerCase();return T.filter(t=>t.label.toLowerCase().includes(e)||t.section.toLowerCase().includes(e))},[T,i]);(0,n.useEffect)(()=>{p(0)},[E.length]),(0,n.useEffect)(()=>{var e;null===(e=m.current)||void 0===e||e.focus()},[]);let z=(0,n.useCallback)(e=>{"ArrowDown"===e.key?(e.preventDefault(),p(e=>Math.min(e+1,E.length-1))):"ArrowUp"===e.key?(e.preventDefault(),p(e=>Math.max(e-1,0))):"Enter"===e.key&&E[u]?(e.preventDefault(),E[u].action()):"Escape"===e.key&&t()},[E,u,t]);(0,n.useEffect)(()=>{var e;let t=null===(e=h.current)||void 0===e?void 0:e.querySelector('[data-selected="true"]');null==t||t.scrollIntoView({block:"nearest"})},[u]);let P=(0,n.useMemo)(()=>{let e=new Map;return E.forEach(t=>{let s=e.get(t.section)||[];s.push(t),e.set(t.section,s)}),e},[E]),M=-1;return(0,a.jsx)("div",{className:"fixed inset-0 z-[500] flex items-start justify-center pt-[20vh] animate-overlay-in",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(8px)"},onClick:t,children:(0,a.jsxs)("div",{className:"w-full max-w-[520px] bg-modal rounded-xl overflow-hidden shadow-modal animate-spring-pop border border-glass-border relative",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("div",{className:"absolute top-0 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-[rgba(129,140,248,0.2)] to-transparent pointer-events-none z-10"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[(0,a.jsx)(eu.Z,{size:16,className:"text-text-muted flex-shrink-0"}),(0,a.jsx)("input",{ref:m,type:"text",value:i,onChange:e=>c(e.target.value),onKeyDown:z,placeholder:"Type a command or search...",className:"flex-1 bg-transparent border-none outline-none text-body text-text placeholder:text-text-muted p-0 shadow-none"}),(0,a.jsx)("kbd",{className:"text-data font-mono text-text-muted bg-surface px-1.5 py-0.5 rounded border border-border",children:"ESC"})]}),(0,a.jsx)("div",{ref:h,className:"max-h-[320px] overflow-y-auto py-1",children:0===E.length?(0,a.jsx)("div",{className:"px-4 py-8 text-center text-text-muted text-xs",children:"No results found"}):Array.from(P.entries()).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"px-4 pt-2 pb-1 text-xxs font-semibold text-text-muted uppercase tracking-[0.08em]",children:t}),s.map(e=>{let t=++M===u,s=M;return(0,a.jsxs)("button",{"data-selected":t,className:"w-full flex items-center gap-3 px-4 py-2 text-xs text-left transition-colors duration-75\n ".concat(t?"bg-accent-muted text-text":"text-text-secondary hover:bg-surface-hover hover:text-text"),onClick:e.action,onMouseEnter:()=>p(s),children:[(0,a.jsx)("span",{className:"flex-shrink-0 ".concat(t?"text-accent":"text-text-muted"),children:e.icon}),(0,a.jsx)("span",{className:"flex-1 truncate",children:e.label}),e.shortcut&&(0,a.jsx)("kbd",{className:"text-data font-mono text-text-muted bg-surface px-1.5 py-0.5 rounded border border-border",children:e.shortcut})]},e.id)})]},t)})})]})})}var eh=s(4822);let ef=(0,i.Z)("skip-forward",[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]);var eb=s(1094),eg=s(4743);let ev=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:5555";function ej(){let e=(0,j.q)(e=>e.escalation),t=(0,y.E)(e=>e.addToast),[s,r]=(0,n.useState)(""),[o,l]=(0,n.useState)(!1),i=(0,n.useRef)(null);if((0,n.useEffect)(()=>{e&&(r(""),setTimeout(()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.focus()},100),"undefined"!=typeof Notification&&("granted"===Notification.permission?new Notification("KANBAII — ".concat("ralph"===e.source?"Ralph":"Teams"," needs input"),{body:e.question.slice(0,120),icon:"/favicon.svg"}):"denied"!==Notification.permission&&Notification.requestPermission()))},[e]),!e||"planner"===e.source)return null;let c=async a=>{let n=a||s.trim();if(n&&!o){l(!0);try{await fetch("".concat(ev,"/api/escalation/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id,response:n})}),t("Response sent to Claude","success")}catch(e){t("Failed to send response","error")}l(!1)}},d="ralph"===e.source,x=d?eh.Z:ed.Z,u=d?"Ralph":"Teams",p=function(e){try{let t=JSON.parse(e);if(t.questions&&Array.isArray(t.questions)&&t.questions.length>0){let s=t.questions[0];return{question:s.question||s.header||e,options:(s.options||[]).map(e=>({label:"string"==typeof e?e:e.label||e.text||"",description:e.description}))}}if(t.question)return{question:t.question,options:(t.options||[]).map(e=>({label:"string"==typeof e?e:e.label||""}))}}catch(e){}return{question:e,options:[]}}(e.question),m=p.question,h=p.options.length>0?p.options:e.options;return(0,a.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center animate-overlay-in",style:{background:"rgba(3, 3, 8, 0.85)",backdropFilter:"blur(20px) saturate(180%)"},children:(0,a.jsxs)("div",{className:"max-w-[520px] w-[94%] animate-spring-pop relative",children:[(0,a.jsx)("div",{className:"absolute -inset-px rounded-lg animate-breathe",style:{background:d?"linear-gradient(135deg, rgba(99,102,241,0.3), rgba(129,140,248,0.1), rgba(99,102,241,0.3))":"linear-gradient(135deg, rgba(16,185,129,0.3), rgba(52,211,153,0.1), rgba(16,185,129,0.3))"}}),(0,a.jsxs)("div",{className:"relative bg-modal border border-glass-border rounded-lg shadow-modal overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute top-0 left-[10%] right-[10%] h-px pointer-events-none",style:{background:d?"linear-gradient(90deg, transparent, rgba(99,102,241,0.4), transparent)":"linear-gradient(90deg, transparent, rgba(52,211,153,0.4), transparent)"}}),(0,a.jsxs)("div",{className:"flex items-center gap-3 px-6 pt-5 pb-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center animate-breathe\n ".concat(d?"bg-accent-muted border border-accent/20":"bg-success-dim border border-success/20"),children:(0,a.jsx)(x,{size:16,className:d?"text-accent":"text-success"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-sm font-semibold text-text tracking-tight",children:[u," needs your input"]}),e.taskTitle&&(0,a.jsxs)("div",{className:"text-xxs text-text-muted font-mono mt-0.5",children:["Task: ",e.taskTitle]})]})]}),(0,a.jsx)("div",{className:"mx-6 mb-4 p-3 bg-bg border border-border rounded-md shadow-inset",children:(0,a.jsx)("div",{className:"text-sm text-text leading-relaxed",children:m})}),h.length>0&&(0,a.jsx)("div",{className:"mx-6 mb-3 flex flex-col gap-1.5",children:h.map((e,t)=>(0,a.jsxs)("button",{className:"flex flex-col gap-0.5 px-3 py-2.5 text-left rounded-sm border border-border transition-all duration-150 hover:border-accent hover:bg-accent-muted group",onClick:()=>c("string"==typeof e?e:e.label),disabled:o,children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text group-hover:text-accent transition-colors",children:"string"==typeof e?e:e.label}),"string"!=typeof e&&e.description&&(0,a.jsx)("span",{className:"text-xxs text-text-muted leading-snug",children:e.description})]},t))}),(0,a.jsxs)("div",{className:"px-6 pb-5",children:[(0,a.jsx)("textarea",{ref:i,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),c())},placeholder:"Type your response... (Enter to send)",rows:2,className:"w-full resize-none text-xs",disabled:o}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-3",children:[(0,a.jsxs)("button",{className:"inline-flex items-center gap-1.5 text-xxs text-text-muted font-mono px-3 py-1.5 rounded-sm border border-border transition-all duration-150 hover:text-text-secondary hover:bg-surface-hover",onClick:()=>c("yes"),disabled:o,children:[(0,a.jsx)(ef,{size:11})," Skip (yes)"]}),(0,a.jsxs)("button",{className:"inline-flex items-center gap-1.5 text-xxs text-danger font-mono px-3 py-1.5 rounded-sm border border-danger/20 transition-all duration-150 hover:bg-danger-dim",onClick:async()=>{await fetch(d?"".concat(ev,"/api/ralph/stop"):"".concat(ev,"/api/teams/stop"),{method:"POST"}),c("STOP"),t("".concat(u," stopped"),"info")},disabled:o,children:[(0,a.jsx)(eb.Z,{size:11})," Stop ",u]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)("button",{className:"inline-flex items-center gap-1.5 px-4 py-1.5 text-white text-xs font-semibold rounded-sm\n bg-gradient-to-br ".concat(d?"from-indigo-600 to-indigo-400":"from-emerald-600 to-emerald-400","\n relative overflow-hidden\n before:absolute before:inset-0 before:bg-gradient-to-b before:from-white/15 before:to-transparent before:pointer-events-none\n transition-all duration-150 hover:shadow-glow-accent hover:-translate-y-px disabled:opacity-40"),onClick:()=>c(),disabled:!s.trim()||o,children:[o?(0,a.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-white/20 border-t-white rounded-full animate-spin"}):(0,a.jsx)(eg.Z,{size:12}),"Send"]})]})]})]})]})})}function ey(e){let{children:t}=e;!function(){let e=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(e.current)return;e.current=!0;let t=(0,B.h)(),s=j.q.getState,a=g.i.getState,n=ep.o.getState;return t.on("project:updated",e=>{let{project:t}=e;return a().onProjectUpdated(t)}),t.on("project:deleted",e=>{let{slug:t}=e;return a().onProjectDeleted(t)}),t.on("workItem:updated",e=>{let{projectSlug:t,workItem:s}=e;return n().onWorkItemUpdated(t,s)}),t.on("workItem:deleted",e=>{let{projectSlug:t,workItemId:s}=e;return n().onWorkItemDeleted(t,s)}),t.on("ralph:started",e=>s().onRalphStarted(e)),t.on("ralph:progress",e=>s().onRalphProgress(e)),t.on("ralph:output",e=>s().onRalphOutput(e)),t.on("ralph:completed",e=>s().onRalphCompleted(e)),t.on("ralph:error",e=>s().onRalphError(e)),t.on("ralph:input-needed",e=>s().onRalphInputNeeded(e)),t.on("live:started",e=>s().onTeamsStarted(e)),t.on("live:worker-assigned",e=>s().onTeamsWorkerAssigned(e)),t.on("live:worker-completed",e=>s().onTeamsWorkerCompleted(e)),t.on("live:metrics",e=>s().onTeamsMetrics(e)),t.on("live:output",e=>s().onTeamsOutput(e)),t.on("live:stopped",e=>s().onTeamsStopped(e)),t.on("teams:input-needed",e=>s().onTeamsInputNeeded(e)),t.on("coordinator:thinking",e=>s().onCoordinatorThinking(e)),t.on("coordinator:tool_call",e=>s().onCoordinatorToolCall(e)),t.on("coordinator:completed",e=>s().onCoordinatorCompleted(e)),t.on("escalation:created",e=>{if("planner"===e.source){s().onPlannerEscalation({id:e.id,source:"planner",taskId:e.taskId||"planner",taskTitle:e.taskTitle||"AI Planner",question:e.question,options:e.options||[],timeoutMs:e.timeoutMs||18e5});return}s().onEscalationCreated(e)}),t.on("escalation:responded",e=>{s().planner.escalation?s().onPlannerEscalationResponded((null==e?void 0:e.response)||"responded"):s().onEscalationResponded()}),t.on("escalation:timeout",()=>{s().planner.escalation?s().onPlannerEscalationResponded("(timed out)"):s().onEscalationTimeout()}),t.on("planner:started",e=>s().onPlannerStarted(e)),t.on("planner:message",e=>s().onPlannerMessage(e)),t.on("planner:item-discovered",e=>s().onPlannerItemDiscovered(e)),t.on("planner:item-updated",e=>s().onPlannerItemUpdated(e)),t.on("planner:escalation",e=>s().onPlannerEscalation(e)),t.on("planner:item-approved",e=>s().onPlannerItemApproved(e)),t.on("planner:stopped",()=>s().onPlannerStopped()),t.on("terminal:output",e=>{let t=v.U.getState().projectSlug;e.projectSlug&&e.projectSlug!==t||(s().appendTerminalOutput(e.text),s().setTerminalStatus("running"))}),t.on("terminal:closed",e=>{let t=v.U.getState().projectSlug;null!=e&&e.projectSlug&&e.projectSlug!==t||s().setTerminalStatus("idle")}),t.on("terminal:error",e=>{let t=v.U.getState().projectSlug;null!=e&&e.projectSlug&&e.projectSlug!==t||(s().appendTerminalOutput("ERROR: ".concat(e.message)),s().setTerminalStatus("error"))}),s().rehydrate(),t.on("connect",()=>s().rehydrate()),()=>{(0,B.l)(),e.current=!1}},[])}();let[s,r]=(0,n.useState)(!1),[o,l]=(0,n.useState)(!1),i=(0,n.useCallback)(()=>r(e=>!e),[]),c=(0,n.useCallback)(()=>r(!1),[]),d=(0,n.useCallback)(()=>l(e=>!e),[]),x=(0,n.useCallback)(()=>l(!1),[]);return!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{projectSlug:t,workItemSlug:s,setView:a,goToProject:r}=(0,v.U)(),o=(0,g.i)(e=>e.projects);(0,n.useEffect)(()=>{let n=n=>{var l,i,c,d,x;let u=n.target.tagName;if("INPUT"!==u&&"TEXTAREA"!==u&&"SELECT"!==u&&!n.target.isContentEditable){if((n.ctrlKey||n.metaKey)&&"k"===n.key){n.preventDefault(),null===(l=e.onToggleCommandPalette)||void 0===l||l.call(e);return}if((n.ctrlKey||n.metaKey)&&"f"===n.key){n.preventDefault(),null===(i=e.onToggleFilter)||void 0===i||i.call(e);return}if(!n.ctrlKey&&!n.metaKey&&!n.altKey)switch(n.key.toLowerCase()){case"w":t&&!s&&a("work-items");break;case"c":t&&!s&&a("console");break;case"t":t&&!s&&a("teams");break;case"s":t&&!s&&a("soul");break;case"b":s&&a("board");break;case"r":s&&a("ralph");break;case"n":null===(c=e.onNewTask)||void 0===c||c.call(e);break;case"h":null===(d=e.onToggleHelp)||void 0===d||d.call(e);break;case"escape":null===(x=e.onEscape)||void 0===x||x.call(e);break;case"arrowup":{n.preventDefault();let e=o.findIndex(e=>e.slug===t);e>0&&r(o[e-1].slug);break}case"arrowdown":{n.preventDefault();let e=o.findIndex(e=>e.slug===t);e<o.length-1&&r(o[e+1].slug)}}}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,s,o,a,r,e])}({onToggleHelp:i,onToggleCommandPalette:d,onEscape:()=>{o?x():c()}}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden",children:[(0,a.jsx)(J,{}),(0,a.jsx)("div",{className:"w-px flex-shrink-0 bg-gradient-to-b from-transparent via-border-glow to-transparent"}),(0,a.jsx)("main",{className:"flex-1 overflow-hidden flex flex-col surface-gradient",children:t})]}),(0,a.jsx)(et,{}),(0,a.jsx)(ej,{}),s&&(0,a.jsx)(ea,{onClose:c}),o&&(0,a.jsx)(em,{onClose:x,onShowHelp:()=>{x(),i()}})]})}function ek(e){let{children:t}=e;return(0,a.jsx)(o,{children:(0,a.jsx)(ey,{children:t})})}},7960:function(){}},function(e){e.O(0,[587,184,23,971,117,744],function(){return e(e.s=4732)}),_N_E=e.O()}]);
|
/package/dashboard/_next/static/{Tp6HPn---FNpuYm3B24fA → hTyF4xO8N7w2cEHRx7q75}/_buildManifest.js
RENAMED
|
File without changes
|
/package/dashboard/_next/static/{Tp6HPn---FNpuYm3B24fA → hTyF4xO8N7w2cEHRx7q75}/_ssgManifest.js
RENAMED
|
File without changes
|