@sma1lboy/kobe 0.7.27 → 0.7.29
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/dist/cli/index.js +1248 -773
- package/dist/web-ui/assets/AppShell-D7vN32jP.js +8 -0
- package/dist/web-ui/assets/{ChatTerminal-CcdiyDLi.js → ChatTerminal-Dzrtw3pW.js} +3 -3
- package/dist/web-ui/assets/IssuePeek-B4sEOPyN.css +1 -0
- package/dist/web-ui/assets/IssuePeek-C209KHal.js +184 -0
- package/dist/web-ui/assets/ViewToggle-eyNy-OIE.js +1 -0
- package/dist/web-ui/assets/board-Bf9WC1dC.js +1 -0
- package/dist/web-ui/assets/engines-Dg-YdbV1.js +1 -0
- package/dist/web-ui/assets/index-DfvJr9CT.js +10 -0
- package/dist/web-ui/assets/index-gdVt3uX3.css +2 -0
- package/dist/web-ui/assets/issues-CsoGRcf8.js +1 -0
- package/dist/web-ui/assets/routes-BdRb63td.js +1 -0
- package/dist/web-ui/assets/{tabs-7WK4MwGF.js → tabs-may5sub7.js} +1 -1
- package/dist/web-ui/assets/task._taskId-9HaGMHxf.js +1 -0
- package/dist/web-ui/assets/useNavigate-1MDuT9d4.js +1 -0
- package/dist/web-ui/index.html +4 -3
- package/package.json +1 -1
- package/dist/web-ui/assets/AppShell-CseeU4ld.js +0 -7
- package/dist/web-ui/assets/ChatTranscript-DBk96m82.js +0 -11
- package/dist/web-ui/assets/arrow-left-DbEl9vGA.js +0 -1
- package/dist/web-ui/assets/board-4GZVbT7l.js +0 -6
- package/dist/web-ui/assets/chips-4L0VTRjY.js +0 -2
- package/dist/web-ui/assets/index-DwX3YPSK.css +0 -2
- package/dist/web-ui/assets/index-Dy89TZk1.js +0 -10
- package/dist/web-ui/assets/overview-DlOA2rw0.js +0 -1
- package/dist/web-ui/assets/routes-BU7iBSg2.js +0 -1
- package/dist/web-ui/assets/task._taskId-9jugSRjg.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTerminal-Dzrtw3pW.js","assets/tabs-may5sub7.js","assets/terminal-CapzGZr6.js","assets/index-DfvJr9CT.js","assets/useNavigate-1MDuT9d4.js","assets/index-gdVt3uX3.css","assets/engines-Dg-YdbV1.js","assets/ChatTerminal-kHJ-D0s7.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as e,a as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,t as f,v as p,x as m}from"./tabs-may5sub7.js";import{t as h}from"./useNavigate-1MDuT9d4.js";import{a as g,i as _,n as v,r as y,t as b}from"./ViewToggle-eyNy-OIE.js";import{t as x}from"./terminal-CapzGZr6.js";import{a as S,c as C,d as w,f as T,h as E,i as D,l as O,n as k,o as A,r as j,u as M}from"./index-DfvJr9CT.js";import{_ as ee,a as te,c as N,d as P,f as F,g as I,h as ne,i as L,l as re,m as ie,n as ae,p as oe,r as se,s as ce,t as le,u as R,v as ue,y as z}from"./engines-Dg-YdbV1.js";var de=z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),fe=z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),pe=z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),me=z(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),he=z(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ge=z(`layout-panel-left`,[[`rect`,{width:`7`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`2obqm`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}]]),_e=z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ve=z(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),ye=z(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),B=z(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),be=z(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),xe=z(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),V=m(p(),1);function Se(e){switch(e){case`running`:return`bg-kobe-orange`;case`waiting_permission`:return`bg-kobe-blue`;case`rate_limited`:return`bg-kobe-yellow`;case`error`:return`bg-kobe-red`;case`idle`:return`bg-kobe-green/60`;default:return`bg-subtle`}}function Ce(e){switch(e){case`running`:return`running`;case`waiting_permission`:return`needs input`;case`rate_limited`:return`rate limited`;case`error`:return`error`;case`idle`:return`idle`;default:return``}}function we(e,t=36){return e.length<=t?e:`…${e.slice(e.length-t+1)}`}var Te={query:``,statusFilter:`all`,sortMode:`default`,showArchived:!1},Ee=null,De=new Set;function H(e){Te={...Te,...e};for(let e of De)e()}function U(e){H({query:e})}function Oe(e){H({statusFilter:e})}function ke(e){H({sortMode:e})}function Ae(e){H({showArchived:e})}function je(e){!e||e===Ee||(Ee=e,H({sortMode:e}))}function Me(){return Te}function Ne(){return(0,V.useSyncExternalStore)(e=>(De.add(e),()=>De.delete(e)),Me,Me)}function Pe(e){let t=Date.parse(e.updatedAt||e.createdAt);return Number.isFinite(t)?t:0}function Fe(e,t){let n=Pe(t)-Pe(e);return n===0?t.id.localeCompare(e.id):n}function Ie(e,t){let n=e.filter(e=>e.kind===`main`),r=e.filter(e=>e.kind!==`main`&&e.pinned),i=e.filter(e=>e.kind!==`main`&&!e.pinned);return t===`recent`&&(r.sort(Fe),i.sort(Fe)),[...n,...r,...i]}function Le(e){let t=new Set;for(let n of e)n.archived||n.kind===`main`||t.add(n.vendor??`claude`);return[...t]}function Re(e){return Le(e).length>1}function ze(e,t){return t?[e.title,e.branch,e.repo,e.worktreePath,e.vendor,e.status].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase()):!0}function Be(e,t=Date.now()){if(!e)return``;let n=Math.max(0,Math.round((t-e)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function Ve(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<45)return`now`;let i=Math.round(r/60);if(i<60)return`${i}m`;let a=Math.round(i/60);if(a<24)return`${a}h`;let o=Math.round(a/24);if(o<7)return`${o}d`;let s=Math.round(o/7);if(s<5)return`${s}w`;let c=Math.round(o/30);return c<12?`${c}mo`:`${Math.round(o/365)}y`}var W=E();function G({children:e}){return(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e})}var K=`w-full border border-line bg-bg px-2 py-1.5 text-[12px] text-fg placeholder:text-subtle focus:border-line-active focus:outline-none`;function He({onClose:e}){let{tasks:t}=j(),n=ae(),i=h(),a=(0,V.useRef)(null);N(a);let o=(0,V.useMemo)(()=>{let e=new Set,n=[];for(let r of t){let t=r.repo;t&&!e.has(t)&&(e.add(t),n.push(t))}return n.sort()},[t]),[l,u]=(0,V.useState)(o[0]??``),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(``),[b,x]=(0,V.useState)(n[0]?.id??`claude`),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)(``),[E,D]=(0,V.useState)(!1),O=l.trim().length>0&&!E;(0,V.useEffect)(()=>{let e=!1;return oe().then(t=>{e||!t||S||x(t)}),()=>{e=!0}},[S]);let A=async()=>{if(O){D(!0);try{let t={repo:l.trim()};p.trim()&&(t.title=p.trim()),g.trim()&&(t.branch=g.trim()),v.trim()&&(t.baseRef=v.trim()),b&&(t.vendor=b);let{taskId:n,task:a}=await k(`task.create`,t);r(n);let o=w.trim();o&&(s(n,o),c(n)),i({to:`/task/$taskId`,params:{taskId:n}}),await k(`task.setActive`,{taskId:n}).catch(()=>{}),R(`success`,`Task created: ${a?.title||a?.branch||n}`),e()}catch(e){P(`create task`,e)}finally{D(!1)}}};return(0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:a,role:`dialog`,"aria-modal":`true`,"aria-label":`New task`,className:`w-[28rem] max-w-[calc(100vw-2rem)] border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`New Task`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`worktree + engine session`})]}),(0,W.jsxs)(`form`,{className:`space-y-3 px-3 py-3`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(G,{children:`Repo`}),o.length>0&&!d?(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),className:`${K} min-w-0 flex-1`,children:o.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{f(!0),u(``)},className:`shrink-0 border border-line bg-bg px-2 text-[11px] text-muted hover:border-primary hover:text-fg`,title:`Type a repo path instead`,children:`path…`})]}):(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`/absolute/path/to/repo`,className:`${K} min-w-0 flex-1 font-mono`}),o.length>0&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(o[0]??``)},className:`shrink-0 border border-line bg-bg px-2 text-[11px] text-muted hover:border-primary hover:text-fg`,title:`Pick a known repo`,children:`list`})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(G,{children:`Title`}),(0,W.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`optional — auto-titled from the first message`,className:K})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(G,{children:`Branch`}),(0,W.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),placeholder:`auto`,className:`${K} font-mono`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(G,{children:`Base ref`}),(0,W.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`default branch`,className:`${K} font-mono`})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(G,{children:`Engine`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>{C(!0),x(e.id)},className:`border px-2 py-1 text-[11px] transition-colors ${b===e.id?`border-primary bg-inset text-fg`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,children:le(n,e.id)},e.id))})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(G,{children:`First prompt`}),(0,W.jsx)(`textarea`,{value:w,onChange:e=>T(e.target.value),placeholder:`optional — waits in the engine composer, ready to send`,rows:2,className:`${K} resize-none`})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-line pt-3`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-3 py-1.5 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,disabled:!O,className:`border border-primary bg-inset px-3 py-1.5 text-[11px] text-fg transition-colors hover:bg-primary/10 disabled:opacity-40`,children:E?`Creating…`:`Create task`})]})]})]})})}function Ue({onClose:e}){let{tasks:t}=j(),n=h(),i=(0,V.useRef)(null);N(i);let a=(0,V.useMemo)(()=>{let e=new Set,n=[];for(let r of t)r.repo&&!e.has(r.repo)&&(e.add(r.repo),n.push(r.repo));return n.sort()},[t]),o=(0,V.useMemo)(()=>new Set(t.map(e=>e.worktreePath).filter(Boolean)),[t]),[s,c]=(0,V.useState)(a[0]??``),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(null),[g,_]=(0,V.useState)(!1),v=async e=>{if(e){f(!0),u(null);try{let{worktrees:t}=await k(`worktree.discoverAdoptable`,{repo:e});u(t)}catch(e){P(`scan worktrees`,e),u([])}finally{f(!1)}}},y=async t=>{m(t.path);try{let{task:i}=await k(`worktree.adopt`,{repo:s,worktreePath:t.path,branch:t.branch,ifExists:`return`});r(i.id),k(`task.setActive`,{taskId:i.id}).catch(()=>{}),n({to:`/task/$taskId`,params:{taskId:i.id}}),R(`success`,`Adopted ${t.branch||t.path}`),e()}catch(e){P(`adopt worktree`,e)}finally{m(null)}};return g?(0,W.jsx)(He,{onClose:e}):a.length===0?(0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-label":`Adopt worktree`,className:`flex w-[32rem] max-w-[calc(100vw-2rem)] flex-col border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center`,children:[(0,W.jsx)(`p`,{className:`text-[12px] leading-relaxed text-subtle`,children:`No repos known to kobe yet. Create a task in a repo first, then come back to adopt its worktrees.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>_(!0),className:`mt-4 border border-primary bg-inset px-3 py-1.5 text-[11px] text-fg transition-colors hover:bg-primary/10`,children:`Create a task`})]}),(0,W.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-3 py-1.5 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Close`})})]})}):(0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-label":`Adopt worktree`,className:`flex max-h-[80vh] w-[32rem] max-w-[calc(100vw-2rem)] flex-col border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,W.jsxs)(`div`,{className:`space-y-2 px-3 py-3`,children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Repo`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`min-w-0 flex-1 border border-line bg-bg px-2 py-1.5 text-[12px] text-fg focus:border-line-active focus:outline-none`,children:a.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void v(s),disabled:!s||d,className:`shrink-0 border border-primary bg-inset px-3 py-1.5 text-[11px] text-fg transition-colors hover:bg-primary/10 disabled:opacity-40`,children:d?`Scanning…`:`Scan`})]})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-line`,children:l===null?(0,W.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`Pick a repo and Scan to find adoptable worktrees.`}):l.length===0?(0,W.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`No adoptable worktrees found for this repo.`}):l.map(e=>{let t=o.has(e.path);return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-subtle px-3 py-2 last:border-b-0`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-mono text-[12px] text-fg`,children:e.branch||`(detached)`}),e.dirty&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-kobe-yellow`,children:`dirty`}),e.kobeManaged&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`kobe`})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-subtle`,children:[(0,W.jsx)(`span`,{className:`truncate font-mono`,children:e.path}),e.lastActivityMs>0&&(0,W.jsx)(`span`,{className:`ml-auto shrink-0`,children:Be(e.lastActivityMs)})]})]}),t?(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`tracked`}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>void y(e),disabled:p!==null,className:`shrink-0 border border-line bg-bg px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg disabled:opacity-40`,children:p===e.path?`Adopting…`:`Adopt`})]},e.path)})}),(0,W.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-3 py-1.5 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Close`})})]})})}function We(e,t){if(!e)return 0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0,a=0,o=-1;for(let e=0;e<r.length&&i<n.length;e++)r[e]===n[i]&&(a+=e-o,o=e,i++);return i===n.length?a:null}function Ge(e){return e.filter(e=>!e.archived).sort((e,t)=>{let n=Date.parse(e.updatedAt||e.createdAt)||0,r=Date.parse(t.updatedAt||t.createdAt)||0;return r===n?t.id.localeCompare(e.id):r-n})}function Ke({kind:e}){return e===`new`?(0,W.jsx)(ue,{size:14,strokeWidth:2}):e===`settings`?(0,W.jsx)(be,{size:14,strokeWidth:1.8}):e===`board`?(0,W.jsx)(y,{size:14,strokeWidth:1.8}):e===`workspace`?(0,W.jsx)(ge,{size:14,strokeWidth:1.8}):(0,W.jsx)(de,{size:14,strokeWidth:1.8})}function qe({open:t,onClose:n,onNewTask:i,onOpenSettings:a}){let{tasks:o,engineStates:s}=j(),{selectedTaskId:c}=e(),l=h(),[u,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(0),m=(0,V.useRef)(null),g=(0,V.useRef)(null),_=(0,V.useRef)(null);N(g,t),(0,V.useEffect)(()=>{_.current?.querySelector(`[data-index="${f}"]`)?.scrollIntoView({block:`nearest`})},[f]),(0,V.useEffect)(()=>{t&&(d(``),p(0),requestAnimationFrame(()=>m.current?.focus()))},[t]);let v=(0,V.useMemo)(()=>[{id:`action:new`,label:`New task`,hint:`create`,icon:`new`,run:()=>{i(),n()}},{id:`action:board`,label:`Open board`,hint:`kanban`,icon:`board`,run:()=>{l({to:`/board`}),n()}},{id:`action:workspace`,label:`Open workspace`,hint:`workspace`,icon:`workspace`,run:()=>{l(c?{to:`/task/$taskId`,params:{taskId:c}}:{to:`/`}),n()}},{id:`action:settings`,label:`Open settings`,hint:`settings`,icon:`settings`,run:()=>{a(),n()}},...Ge(o).map(e=>({id:`task:${e.id}`,label:e.title||e.branch||e.id,hint:e.kind===`main`?`project`:e.branch,icon:`task`,taskId:e.id,run:()=>{r(e.id),k(`task.setActive`,{taskId:e.id}).catch(e=>P(`switch task`,e)),l({to:`/task/$taskId`,params:{taskId:e.id}}),n()}}))],[o,c,l,n,i,a]),y=(0,V.useMemo)(()=>u.trim()?v.map(e=>{let t=`${e.label} ${e.hint??``}`,n=We(u.trim(),t);return n===null?null:{cmd:e,score:n}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score).map(e=>e.cmd):v,[v,u]);return(0,V.useEffect)(()=>{p(e=>Math.min(e,Math.max(0,y.length-1)))},[y.length]),t?(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center bg-black/50 pt-[12vh]`,onClick:n,onKeyDown:()=>{},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:g,role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`w-[34rem] max-w-[calc(100vw-2rem)] overflow-hidden border border-line bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line px-3 py-2.5`,children:[(0,W.jsx)(ee,{size:15,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,W.jsx)(`input`,{ref:m,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),p(e=>Math.min(e+1,y.length-1))):e.key===`ArrowUp`?(e.preventDefault(),p(e=>Math.max(e-1,0))):e.key===`Enter`?(e.preventDefault(),y[f]?.run()):e.key===`Escape`&&(e.preventDefault(),n())},placeholder:`Jump to a task or run a command…`,className:`min-w-0 flex-1 bg-transparent text-[13px] text-fg placeholder:text-subtle focus:outline-none`}),(0,W.jsx)(`kbd`,{className:`shrink-0 border border-line px-1.5 py-0.5 font-mono text-[10px] text-subtle`,children:`esc`})]}),(0,W.jsx)(`div`,{ref:_,className:`max-h-[50vh] overflow-y-auto py-1`,children:y.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:[`No matches for “`,u,`”.`]}):y.map((e,t)=>(0,W.jsxs)(`button`,{type:`button`,"data-index":t,onClick:e.run,onMouseMove:()=>p(t),className:`flex w-full items-center gap-3 px-3 py-2 text-left ${t===f?`bg-inset`:`hover:bg-inset/50`}`,children:[e.taskId?(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Se(s[e.taskId]?.state)}`}):(0,W.jsx)(`span`,{className:`shrink-0 ${t===f?`text-primary`:`text-subtle`}`,children:(0,W.jsx)(Ke,{kind:e.icon})}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-fg`,children:e.label}),e.hint&&(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:e.hint})]},e.id))}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-3 py-1.5 font-mono text-[10px] text-subtle`,children:[(0,W.jsx)(`span`,{children:`↑↓ move`}),(0,W.jsx)(`span`,{children:`↵ run`}),(0,W.jsx)(`span`,{children:`esc close`})]})]})}):null}var Je=[{keys:[`⌘`,`K`],label:`Command palette — jump to a task or run an action`},{keys:[`j`,`k`],label:`Move between tasks in the rail (also ↑ / ↓)`},{keys:[`/`],label:`Focus the task filter — then ↵ jumps to the top match, esc clears`},{keys:[`?`],label:`This help`},{keys:[`esc`],label:`Close a dialog / palette / help`}],Ye=[{keys:[`↑`,`↓`],label:`Move selection`},{keys:[`↵`],label:`Run the selected command`}],Xe=[{keys:[`↑`,`↓`],label:`Recall previously-sent prompts (newest first)`},{keys:[`↵`],label:`Send · Shift+↵ for a newline`}],Ze=[{label:`New task`,detail:`the + in the task rail (or palette → New task)`},{label:`Adopt worktree`,detail:`the folder-in icon next to + — pull an existing worktree in`},{label:`Chat / Vendor / Terminal`,detail:`tab kinds inside a task workspace; Chat has search and a hide-tools toggle`},{label:`Triage`,detail:`task rail status chips (All/Needs) + the Board — filter by what needs you`},{label:`Changes / diff`,detail:`filter files by path, toggle line wrap on a file preview`},{label:`Notifications`,detail:`Settings → Notifications — get pinged when a task needs you`}];function Qe({k:e}){return(0,W.jsx)(`kbd`,{className:`inline-flex min-w-[1.4rem] items-center justify-center border border-line bg-inset px-1.5 py-0.5 font-mono text-[11px] text-fg`,children:e})}function $e({keys:e,label:t}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,W.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.map(e=>(0,W.jsx)(Qe,{k:e},e))}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 text-[12px] text-muted`,children:t})]})}function et({onClose:e}){let t=(0,V.useRef)(null);return N(t),(0,V.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:()=>{},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Keyboard shortcuts`,className:`w-[30rem] max-w-[calc(100vw-2rem)] border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Keyboard & shortcuts`}),(0,W.jsx)(`kbd`,{className:`border border-line px-1.5 py-0.5 font-mono text-[10px] text-subtle`,children:`esc`})]}),(0,W.jsxs)(`div`,{className:`space-y-4 px-4 py-3`,children:[(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Global`}),Je.map(e=>(0,W.jsx)($e,{...e},e.label))]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`In the command palette`}),Ye.map(e=>(0,W.jsx)($e,{...e},e.label))]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`In the engine composer`}),Xe.map(e=>(0,W.jsx)($e,{...e},e.label))]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Where things are`}),Ze.map(e=>(0,W.jsxs)(`div`,{className:`flex items-baseline gap-2 py-0.5 text-[12px]`,children:[(0,W.jsx)(`span`,{className:`shrink-0 font-semibold text-fg`,children:e.label}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 text-subtle`,children:e.detail})]},e.label))]})]})]})})}async function tt(){try{let e=await fetch(`/api/quick-prompts`);if(!e.ok)return{review:null,pr:null};let t=await e.json();return{review:typeof t.review==`string`?t.review:null,pr:typeof t.pr==`string`?t.pr:null}}catch{return{review:null,pr:null}}}async function nt(e){let t=await fetch(`/api/quick-prompts`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`save failed (${t.status})`)}function rt(e){return(e??`claude`)===`claude`?`/review`:`Review the current changes in this worktree critically.`}var it=[`Open a pull request for this task's branch:`,`1. Make sure the work is committed, then push the branch to origin.`,"2. Create the PR with `gh pr create` — write a clear title and a body that summarizes what changed and why, following this repo's conventions."].join(`
|
|
3
|
+
`);function at({palette:e}){return(0,W.jsx)(`span`,{className:`flex shrink-0 overflow-hidden rounded border border-line`,children:[e.bg,e.primary,e[`kobe-blue`],e[`kobe-green`]].filter(Boolean).map((e,t)=>(0,W.jsx)(`span`,{className:`h-5 w-3`,style:{backgroundColor:e}},t))})}function ot(){let{names:e,palettes:t,active:n,overridden:r}=A();return(0,W.jsxs)(`div`,{className:`border border-line bg-surface p-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Appearance`}),r?(0,W.jsx)(`button`,{type:`button`,onClick:D,className:`border border-line bg-bg px-2 py-0.5 text-[10px] text-muted transition-colors hover:border-primary hover:text-fg`,title:`Clear the web-local theme and follow the TUI again`,children:`Follow TUI`}):(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`following TUI`})]}),e.length===0?(0,W.jsx)(`p`,{className:`mt-4 text-[12px] text-subtle`,children:`Loading themes…`}):(0,W.jsx)(`div`,{className:`mt-4 grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:e.map(e=>{let r=e===n;return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>S(e),className:`flex items-center gap-2 border px-2 py-1.5 text-left transition-colors ${r?`border-primary bg-inset`:`border-line bg-bg hover:border-primary`}`,children:[(0,W.jsx)(at,{palette:t[e]??{}}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] ${r?`text-fg`:`text-muted`}`,children:e}),r&&(0,W.jsx)(pe,{size:13,strokeWidth:2.5,className:`shrink-0 text-primary`})]},e)})})]})}var st=[[`general`,`General`],[`engines`,`Engines`],[`board`,`Board`],[`dev`,`Dev`],[`notifications`,`Notifications`]];function q({title:e,children:t}){return(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),(0,W.jsx)(`div`,{className:`mt-3 space-y-3 text-[12px]`,children:t})]})}function J({label:e,detail:t,enabled:n,onToggle:r,disabled:i}){return(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border border-line bg-bg p-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-[12px] font-bold text-fg`,children:e}),t?(0,W.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed text-subtle`,children:t}):null]}),(0,W.jsx)(`button`,{type:`button`,onClick:r,disabled:i,className:`shrink-0 border px-2 py-0.5 text-[10px] transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${n?`border-primary bg-inset text-fg`:`border-line bg-surface text-muted hover:border-primary hover:text-fg`}`,children:n?`On`:`Off`})]})}function ct(){let[e,t]=(0,V.useState)(null),[n,r]=(0,V.useState)(!0),[i,a]=(0,V.useState)(!1),o=(0,V.useRef)(0),s=(0,V.useCallback)(async()=>{let e=++o.current;r(!0),a(!1);try{let n=await ie();e===o.current&&t(n)}catch(t){e===o.current&&a(!0),P(`load settings`,t)}finally{e===o.current&&r(!1)}},[]);return(0,V.useEffect)(()=>{s()},[s]),{settings:e,loading:n,error:i,reload:s,patch:async e=>{let n=await ne(e);return t(n),n}}}function lt(){return(0,W.jsx)(`div`,{className:`space-y-6`,children:(0,W.jsxs)(q,{title:`Dashboard theme`,children:[(0,W.jsx)(`p`,{className:`text-[11px] leading-relaxed text-subtle`,children:`Pick a theme for this browser, or follow the TUI's theme. This is a browser-local override — it never changes the TUI.`}),(0,W.jsx)(ot,{})]})})}function ut({engine:e,onSave:t,onDefault:n,onRemove:r}){let[i,a]=(0,V.useState)(e.command),[o,s]=(0,V.useState)(e.label),c=/\s--[A-Za-z0-9][\w-]*/.test(o)&&!/\s--[A-Za-z0-9][\w-]*/.test(i);return(0,V.useEffect)(()=>{a(e.command),s(e.label)},[e.command,e.label]),(0,W.jsxs)(`div`,{className:`border border-line bg-bg p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`font-bold text-fg`,children:e.label}),e.isDefault?(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-primary`,children:`default`}):null,e.isCustom?(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`custom`}):null]}),(0,W.jsx)(`div`,{className:`font-mono text-[10px] text-subtle`,children:e.id})]}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),className:`shrink-0 border border-line bg-surface px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Make default`})]}),(0,W.jsxs)(`label`,{className:`mt-3 block`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted`,children:`Display name (label only)`}),(0,W.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),className:`mt-1 w-full border border-line bg-surface px-2 py-1 text-fg focus:border-line-active focus:outline-none`})]}),(0,W.jsxs)(`label`,{className:`mt-2 block`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted`,children:`Launch command (argv that kobe runs)`}),(0,W.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),className:`mt-1 w-full border border-line bg-surface px-2 py-1 font-mono text-fg focus:border-line-active focus:outline-none`})]}),c?(0,W.jsx)(`div`,{className:`mt-2 border border-kobe-yellow/40 bg-kobe-yellow/10 px-2 py-1 text-[11px] leading-relaxed text-kobe-yellow`,children:`This looks like a flag in the display name. Put permission/model flags in Launch command; the label is never executed.`}):null,(0,W.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,i,o),className:`border border-primary bg-inset px-2 py-1 text-[11px] text-fg`,children:`Save`}),e.isCustom?(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`border border-kobe-red/40 bg-kobe-red/10 px-2 py-1 text-[11px] text-kobe-red`,children:`Remove`}):null]})]})}function dt({settings:e,patch:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),c=(e,n,r)=>void t({engineUpdates:[{id:e,command:n,label:r}]}).then(()=>R(`success`,`engine saved`));return(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsxs)(q,{title:`Launch commands`,children:[(0,W.jsx)(`p`,{className:`text-[11px] leading-relaxed text-subtle`,children:`Same shared engine settings as the TUI. Built-ins can be renamed or pointed at a different command. Permission/model flags must live in Launch command, not Display name. Custom engines are available in new task and tab pickers.`}),(0,W.jsx)(`div`,{className:`space-y-2`,children:e.engines.map(e=>(0,W.jsx)(ut,{engine:e,onSave:c,onDefault:e=>void t({defaultEngine:e}).then(()=>R(`success`,`default engine saved`)),onRemove:e=>void t({removeEngine:e}).then(()=>R(`success`,`engine removed`))},e.id))})]}),(0,W.jsxs)(q,{title:`Add engine`,children:[(0,W.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,W.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`id, e.g. aider`,className:`border border-line bg-bg px-2 py-1 text-fg placeholder:text-subtle focus:border-line-active focus:outline-none`}),(0,W.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`command`,className:`border border-line bg-bg px-2 py-1 font-mono text-fg placeholder:text-subtle focus:border-line-active focus:outline-none`}),(0,W.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`display name`,className:`border border-line bg-bg px-2 py-1 text-fg placeholder:text-subtle focus:border-line-active focus:outline-none`})]}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void t({addEngine:{id:n,command:i,label:o}}).then(()=>{r(``),a(``),s(``),R(`success`,`engine added`)}).catch(e=>P(`add engine`,e)),className:`border border-primary bg-inset px-2 py-1 text-[11px] text-fg`,children:`Add engine`})]})]})}function ft(){let[e,t]=(0,V.useState)(``),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let e=!1;return tt().then(n=>{e||(t(n.review??``),r(n.pr??``),a(!0))}),()=>{e=!0}},[]),(0,W.jsxs)(q,{title:`Board quick actions`,children:[(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`text-muted`,children:`Review template`}),(0,W.jsx)(`textarea`,{value:e,onChange:e=>t(e.target.value),placeholder:`default: ${rt(`claude`)}`,rows:3,disabled:!i,className:`mt-1 w-full resize-y border border-line bg-bg p-2 font-mono text-[12px] text-fg placeholder:text-subtle focus:border-line-active focus:outline-none`})]}),(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`text-muted`,children:`Open-PR template`}),(0,W.jsx)(`textarea`,{value:n,onChange:e=>r(e.target.value),placeholder:`default:\n${it}`,rows:5,disabled:!i,className:`mt-1 w-full resize-y border border-line bg-bg p-2 font-mono text-[12px] text-fg placeholder:text-subtle focus:border-line-active focus:outline-none`})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-subtle`,children:`Empty = built-in default. kobe appends its status/URL guardrails at send time.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void nt({review:e,pr:n}).then(()=>R(`success`,`quick-action templates saved`)).catch(e=>P(`save templates`,e)),disabled:!i,className:`shrink-0 border border-line bg-bg px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Save`})]})]})}function pt({settings:e,patch:t}){let[r,i]=(0,V.useState)(!1),a=h();return(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsxs)(q,{title:`Experimental gates`,children:[(0,W.jsx)(J,{label:`Remote projects`,detail:`Enables SSH-backed remote project setup in the CLI.`,enabled:e.remoteProjects,onToggle:()=>void t({remoteProjects:!e.remoteProjects})}),(0,W.jsx)(J,{label:`Auto status flow`,detail:`Moves backlog tasks to in progress on turn start and injects the self-report protocol.`,enabled:e.autoStatus,onToggle:()=>void t({autoStatus:!e.autoStatus})}),(0,W.jsx)(J,{label:`Dispatcher`,detail:`Enables the field-notes dispatcher protocol for repo main sessions.`,enabled:e.dispatcher,onToggle:()=>void t({dispatcher:!e.dispatcher})})]}),(0,W.jsxs)(q,{title:`Browser workspace`,children:[(0,W.jsx)(`p`,{className:`text-[11px] leading-relaxed text-subtle`,children:`Reset the per-task tab layout (open tabs, splits, selection). Pure browser state: tasks, worktrees, notes, and engines are untouched.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{if(!r){i(!0);return}n(),a({to:`/`}),i(!1)},onBlur:()=>i(!1),className:`border px-3 py-1.5 text-[11px] transition-colors ${r?`border-kobe-red/50 bg-kobe-red/10 text-kobe-red`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,children:r?`Click again to reset layout`:`Reset layout`})]})]})}function mt(){let{supported:e,permission:t,enabled:n}=M();return(0,W.jsx)(`div`,{className:`space-y-6`,children:(0,W.jsxs)(q,{title:`Notifications`,children:[e?(0,W.jsx)(J,{label:`Desktop notifications`,detail:`Get pinged when a task needs input or errors while this browser tab is in the background.`,enabled:n,onToggle:()=>void C(!n),disabled:t===`denied`&&!n}):(0,W.jsx)(`p`,{className:`text-[11px] leading-relaxed text-subtle`,children:`This browser does not support desktop notifications.`}),t===`denied`&&!n?(0,W.jsx)(`p`,{className:`text-[11px] leading-relaxed text-kobe-yellow`,children:`Notifications are blocked for this site. Allow them in your browser's site settings to turn this on.`}):null]})})}function ht({onClose:e}){let[t,n]=(0,V.useState)(`general`),{settings:r,loading:i,error:a,reload:o,patch:s}=ct(),c=(0,V.useMemo)(()=>st.find(([e])=>e===t)?.[1]??`Settings`,[t]);return(0,W.jsxs)(`section`,{"data-settings-open":!0,className:`flex min-w-0 flex-1 flex-col bg-bg`,children:[(0,W.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center justify-between border-b border-line bg-surface px-3`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Settings`}),(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Close`})]}),(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[180px_minmax(0,1fr)] overflow-hidden`,children:[(0,W.jsx)(`nav`,{className:`min-h-0 overflow-auto border-r border-line bg-surface/60 p-2`,children:st.map(([e,r])=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`mb-1 block w-full border px-2 py-2 text-left text-[12px] transition-colors ${t===e?`border-primary bg-inset text-fg`:`border-transparent text-muted hover:border-line hover:bg-bg hover:text-fg`}`,children:r},e))}),(0,W.jsx)(`main`,{className:`min-h-0 overflow-auto p-4`,children:(0,W.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[(0,W.jsx)(`h1`,{className:`mb-3 text-[13px] font-bold uppercase tracking-[0.12em] text-fg`,children:c}),a?(0,W.jsxs)(`div`,{className:`border border-line bg-surface p-4 text-[12px]`,children:[(0,W.jsx)(`p`,{className:`text-subtle`,children:`Couldn't load settings (daemon/bridge offline?)`}),(0,W.jsx)(`button`,{type:`button`,onClick:o,className:`mt-3 border border-line bg-bg px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Retry`})]}):i||!r?(0,W.jsx)(`div`,{className:`border border-line bg-surface p-4 text-[12px] text-subtle`,children:`Loading settings...`}):t===`general`?(0,W.jsx)(lt,{}):t===`engines`?(0,W.jsx)(dt,{settings:r,patch:s}):t===`board`?(0,W.jsx)(ft,{}):t===`dev`?(0,W.jsx)(pt,{settings:r,patch:s}):(0,W.jsx)(mt,{})]})})]})]})}function gt(e){switch(e){case`error`:return`border-kobe-red/50 text-kobe-red`;case`success`:return`border-kobe-green/50 text-kobe-green`;default:return`border-line text-fg`}}function _t(){let e=F();return e.length===0?null:(0,W.jsx)(`div`,{className:`pointer-events-none fixed bottom-10 right-3 z-50 flex w-80 flex-col gap-2`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`pointer-events-auto flex items-start gap-2 border bg-surface px-3 py-2 shadow-lg ${gt(e.kind)}`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-[12px] leading-relaxed`,children:e.message}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>re(e.id),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`dismiss notification`,children:(0,W.jsx)(I,{size:13,strokeWidth:2})})]},e.id))})}async function vt(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function yt(e,t={}){let n=new URLSearchParams({worktreePath:e});t.path&&n.set(`path`,t.path),t.namesOnly&&n.set(`namesOnly`,`1`);let r=await fetch(`/api/diff?${n.toString()}`),i=await r.json();if(!r.ok||i.error)throw Error(i.error??`diff fetch failed (${r.status})`);return{files:i.files??[],raw:i.raw??``}}function bt(e){switch(e){case`added`:return{label:`A`,cls:`text-kobe-green`};case`untracked`:return{label:`U`,cls:`text-kobe-green`};case`modified`:return{label:`M`,cls:`text-kobe-yellow`};case`deleted`:return{label:`D`,cls:`text-kobe-red`};case`renamed`:return{label:`R`,cls:`text-kobe-blue`};case`copied`:return{label:`C`,cls:`text-kobe-blue`};default:return{label:e.slice(0,1).toUpperCase()||`?`,cls:`text-muted`}}}function xt(e){switch(e){case`hunk`:return`kobe-diff-hunk`;case`meta`:return`kobe-diff-meta`;case`add`:return`kobe-diff-add`;case`del`:return`kobe-diff-del`;default:return`kobe-diff-ctx`}}function St(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ct(e){let t=e.replace(/\*+/g,`*`).split(`*`).map(St).join(`.*`);return RegExp(`^${t}$`)}function wt(e,t){let n=t.trim(),r=n.startsWith(`!`),i=(r?n.slice(1):n).trim().toLowerCase();if(!i)return!0;let a=e.toLowerCase(),o=i.includes(`*`)?Ct(i).test(a):a.includes(i);return r?!o:o}function Tt(e,t){let n=t.trim();return n?e.filter(e=>wt(e.path,n)):e}var Et=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,Dt=[`diff --git`,`index `,`--- `,`+++ `,`new file`,`deleted file`,`rename `,`similarity `,`copy `,`\\ No newline`,`Binary files`];function Ot(e){return Dt.some(t=>e.startsWith(t))}function kt(e){let t=0,n=0;for(let r of At(e))r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,deleted:n}}function At(e){let t=e.replace(/\n$/,``).split(`
|
|
4
|
+
`),n=[],r=0,i=0,a=!1;for(let e of t){let t=Et.exec(e);if(t){r=Number.parseInt(t[1],10),i=Number.parseInt(t[2],10),a=!0,n.push({kind:`hunk`,oldLn:null,newLn:null,text:e});continue}if(e.startsWith(`diff --git`)&&(a=!1),!a&&(Ot(e)||e===``)){n.push({kind:`meta`,oldLn:null,newLn:null,text:e});continue}let o=e[0];o===`+`?(n.push({kind:`add`,oldLn:null,newLn:i,text:e}),i++):o===`-`?(n.push({kind:`del`,oldLn:r,newLn:null,text:e}),r++):Ot(e)?n.push({kind:`meta`,oldLn:null,newLn:null,text:e}):(n.push({kind:`ctx`,oldLn:r,newLn:i,text:e}),r++,i++)}return n}function jt({added:e,deleted:t}){return e===0&&t===0?null:(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px]`,children:[(0,W.jsxs)(`span`,{className:`text-kobe-green`,children:[`+`,e]}),` `,(0,W.jsxs)(`span`,{className:`text-kobe-red`,children:[`−`,t]})]})}function Mt(e){let{worktreeChanges:t}=j(),n=e?t[e]:void 0;return n?`${n.added}:${n.deleted}`:`none`}function Nt({onRetry:e}){let{daemonConnected:t,streamConnected:n}=j();return!t||!n?(0,W.jsx)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:`The kobe daemon is offline — changes will reappear once it reconnects.`}):(0,W.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-3 py-4`,children:[(0,W.jsx)(`span`,{className:`text-[12px] text-kobe-red`,children:`Couldn't load changes.`}),(0,W.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 border border-line bg-bg px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:[(0,W.jsx)(B,{size:11,strokeWidth:2}),`Retry`]})]})}function Pt({patch:e,wrap:t}){let n=(0,V.useMemo)(()=>At(e),[e]);return e.trim()?(0,W.jsx)(`div`,{className:`kobe-diff min-h-0 flex-1 overflow-auto py-2 font-mono text-[12px] leading-[1.15rem] ${t?`kobe-diff-wrap`:``}`,children:n.map((e,t)=>(0,W.jsxs)(`div`,{className:`kobe-diff-row ${xt(e.kind)}`,children:[(0,W.jsx)(`span`,{className:`kobe-diff-gutter`,children:e.oldLn??``}),(0,W.jsx)(`span`,{className:`kobe-diff-gutter`,children:e.newLn??``}),(0,W.jsx)(`span`,{className:`kobe-diff-text`,children:e.text===``?` `:e.text})]},t))}):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`No textual diff for this file.`})}function Ft({worktreePath:e,onOpenFile:t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(null),c=Mt(e),{worktreeChanges:l}=j(),u=e?l[e]:void 0,d=(0,V.useRef)(0),f=(0,V.useCallback)(async()=>{if(!e){r(null),s(null);return}let t=++d.current;a(!0),s(null);try{let n=await yt(e,{namesOnly:!0});t===d.current&&r(n)}catch(e){t===d.current&&(s(e instanceof Error?e.message:String(e)),r(null))}finally{t===d.current&&a(!1)}},[e]);(0,V.useEffect)(()=>{f()},[f,c]);let[p,m]=(0,V.useState)(``);(0,V.useEffect)(()=>{m(``)},[e]);let h=n?.files??[],g=(0,V.useMemo)(()=>Tt(h,p),[h,p]);return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,W.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:[`Changes`,h.length>0?` · ${h.length}`:``]}),u&&(0,W.jsx)(jt,{added:u.added,deleted:u.deleted}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void f(),disabled:!e||i,className:`ml-auto rounded border border-line px-1.5 py-0.5 text-[10px] text-muted transition-colors hover:bg-surface disabled:opacity-40`,children:i?`…`:`↻`})]}),e?o?(0,W.jsx)(Nt,{onRetry:()=>void f()}):h.length===0?(0,W.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,W.jsx)(`div`,{className:`text-[12px] text-subtle`,children:i?`Loading changes…`:`Worktree clean.`})}):(0,W.jsxs)(W.Fragment,{children:[h.length>1&&(0,W.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`&&p&&(e.preventDefault(),m(``))},placeholder:`Filter ${h.length} files… (*.ts, !*.json)`,title:`Match a substring, a *.glob, or !exclude`,spellCheck:!1,className:`mx-3 mb-1 shrink-0 border border-line bg-bg px-2 py-1 font-mono text-[11px] text-fg placeholder:text-subtle focus:border-line-active focus:outline-none`}),g.length===0?(0,W.jsx)(`div`,{className:`px-3 py-3 text-center text-[11px] text-subtle`,children:`No files match.`}):(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:g.map(e=>{let n=bt(e.status);return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),title:e.path,className:`flex w-full items-center gap-2 border-l-2 border-transparent px-3 py-2 text-left transition-colors hover:border-primary hover:bg-inset`,children:[(0,W.jsx)(`span`,{className:`w-3 shrink-0 text-center font-mono text-[11px] font-bold ${n.cls}`,children:n.label}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] text-fg/90`,children:we(e.path,34)}),e.staged&&(0,W.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase text-subtle`,children:`staged`})]},e.path)})})]}):(0,W.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,W.jsx)(`div`,{className:`mt-1 max-w-48 text-[12px] leading-relaxed text-subtle`,children:`Select a task to watch its worktree changes.`})]})})]})}function It({worktreePath:e,path:t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(null),u=Mt(e),d=(0,V.useRef)(0),f=(0,V.useCallback)(async()=>{if(!e){r(null),l(null);return}let n=++d.current;s(!0),l(null);try{let i=await yt(e,{path:t});if(n!==d.current)return;r(i.files.find(e=>e.path===t)??null)}catch(e){n===d.current&&l(e instanceof Error?e.message:String(e))}finally{n===d.current&&s(!1)}},[e,t]);(0,V.useEffect)(()=>{f()},[f,u]);let p=n?kt(n.patch):null;return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,W.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line px-3`,children:[(0,W.jsx)(`span`,{className:`truncate font-mono text-[12px] text-fg`,title:t,children:t}),p&&(0,W.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,W.jsx)(jt,{added:p.added,deleted:p.deleted})}),n&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-subtle ${p&&(p.added||p.deleted)?``:`ml-auto`}`,children:n.status}),n&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),title:i?`Disable line wrap`:`Wrap long lines`,className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${i?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,children:`wrap`})]}),c?(0,W.jsx)(Nt,{onRetry:()=>void f()}):n?(0,W.jsx)(Pt,{patch:n.patch,wrap:i}):o?(0,W.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-[12px] text-subtle`,children:`Loading preview…`}):(0,W.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-[12px] text-subtle`,children:`No diff for this file.`})]})}function Y(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var Lt=/^\/api\/issue-assets\/[a-f0-9]{16}\/[A-Za-z0-9_-]+\.[a-z0-9]+$/;function Rt(e){let t=e.trim();return Lt.test(t)?t:null}function zt(e){let t=e.trim();return/^https?:\/\//i.test(t)?t:t.startsWith(`//`)?null:t.startsWith(`/`)||t.startsWith(`#`)||t.startsWith(`./`)||t.startsWith(`../`)?t:null}function Bt(e){let t=e;return t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(e,t,n)=>{let r=Rt(n.replace(/&/g,`&`));return r?`<img src="${Y(r)}" alt="${Y(t)}" loading="lazy" class="kobe-md-img">`:``})),t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=zt(n.replace(/&/g,`&`));return r?`<a href="${Y(r)}" target="_blank" rel="noopener noreferrer" class="kobe-md-link">${t}</a>`:`${t}(${n})`})),t=t.replace(/\*\*(.+?)\*\*/g,`<strong>$1</strong>`),t=t.replace(/(^|[^*])\*([^*]+)\*/g,`$1<em>$2</em>`),t}function X(e){return e.split(/(`[^`]+`)/g).map((e,t)=>t%2==1?`<code class="kobe-md-code">${e.slice(1,-1)}</code>`:Bt(e)).join(``)}function Vt(e){let t=e.replace(/\r\n/g,`
|
|
5
|
+
`).split(`
|
|
6
|
+
`),n=[],r=0,i=null,a=()=>{i&&=(n.push(`</${i}>`),null)};for(;r<t.length;){let e=t[r];if(/^```/.test(e)){a();let e=[];for(r++;r<t.length&&!/^```/.test(t[r]);)e.push(Y(t[r])),r++;r++,n.push(`<pre class="kobe-md-pre"><code>${e.join(`
|
|
7
|
+
`)}</code></pre>`);continue}if(/^\s*(-{3,}|\*{3,}|_{3,})\s*$/.test(e)){a(),n.push(`<hr class="kobe-md-hr" />`),r++;continue}let o=/^(#{1,6})\s+(.*)$/.exec(e);if(o){a();let e=o[1].length;n.push(`<h${e} class="kobe-md-h">${X(Y(o[2]))}</h${e}>`),r++;continue}if(/^>\s?/.test(e)){a(),n.push(`<blockquote class="kobe-md-quote">${X(Y(e.replace(/^>\s?/,``)))}</blockquote>`),r++;continue}let s=/^\s*[-*]\s+(.*)$/.exec(e);if(s){i!==`ul`&&(a(),n.push(`<ul class="kobe-md-ul">`),i=`ul`),n.push(`<li>${X(Y(s[1]))}</li>`),r++;continue}let c=/^\s*\d+\.\s+(.*)$/.exec(e);if(c){i!==`ol`&&(a(),n.push(`<ol class="kobe-md-ol">`),i=`ol`),n.push(`<li>${X(Y(c[1]))}</li>`),r++;continue}if(e.trim()===``){a(),r++;continue}a();let l=[e];for(r++;r<t.length&&t[r].trim()!==``&&!/^(#{1,6}\s|>\s?|```|\s*[-*]\s|\s*\d+\.\s|\s*(-{3,}|\*{3,}|_{3,})\s*$)/.test(t[r]);)l.push(t[r]),r++;n.push(`<p class="kobe-md-p">${X(Y(l.join(` `)))}</p>`)}return a(),n.join(`
|
|
8
|
+
`)}async function Ht(e){let t=await fetch(`/api/notes?taskId=${encodeURIComponent(e)}`);if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`failed to load notes (${t.status})${e?`: ${e}`:``}`)}return(await t.json()).markdown??``}async function Ut(e,t){let n=await fetch(`/api/notes`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({taskId:e,markdown:t})});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`failed to save notes (${n.status})${e?`: ${e}`:``}`)}}function Wt(e){switch(e){case`saving`:return`saving…`;case`saved`:return`saved`;case`error`:return`save failed`;default:return``}}var Gt=600;function Kt({children:e,right:t}){return(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t]})}function qt({taskId:e,full:t=!1}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(`idle`),u=(0,V.useMemo)(()=>Vt(n),[n]),d=(0,V.useRef)(null),f=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(d.current&&clearTimeout(d.current),f.current=e,l(`idle`),r(``),a(!1),!e)return;let t=!1;return s(!0),Ht(e).then(n=>{!t&&f.current===e&&r(n)}).catch(()=>{!t&&f.current===e&&r(``)}).finally(()=>{t||s(!1)}),()=>{t=!0}},[e]),(0,V.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let p=(0,V.useCallback)(t=>{if(r(t),!e)return;let n=e;l(`saving`),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{Ut(n,t).then(()=>{f.current===n&&l(`saved`)}).catch(()=>{f.current===n&&l(`error`)})},Gt)},[e]);return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-bg`,children:[(0,W.jsx)(Kt,{right:e?(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c!==`idle`&&(0,W.jsx)(`span`,{className:`text-[10px] ${c===`error`?`text-kobe-red`:`text-subtle`}`,children:Wt(c)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`border px-1.5 py-0.5 text-[10px] transition-colors ${i?`border-primary bg-inset text-fg`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,title:`Toggle markdown preview`,children:i?`Edit`:`Preview`})]}):null,children:`Notes`}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 ${t?`px-0 pb-0`:`px-3 pb-3`}`,children:e?i?(0,W.jsx)(`div`,{className:`h-full w-full overflow-auto bg-surface px-4 py-3 ${t?`border-t border-line`:`rounded border border-line`}`,children:n.trim()?(0,W.jsx)(`div`,{className:`kobe-md text-[12px] leading-relaxed text-fg`,dangerouslySetInnerHTML:{__html:u}}):(0,W.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Nothing to preview yet.`})}):(0,W.jsx)(`textarea`,{value:n,onChange:e=>p(e.target.value),spellCheck:!1,placeholder:o?`loading notes…`:`Notes for this task — markdown, autosaved.`,disabled:o,className:`h-full w-full resize-none border-line bg-surface px-4 py-3 font-mono text-[12px] leading-relaxed text-fg placeholder:text-subtle focus:border-line-active focus:outline-none disabled:opacity-60 ${t?`border-x-0 border-b-0 border-t`:`rounded border`}`}):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,W.jsx)(`div`,{className:`mt-1 max-w-48 text-[12px] leading-relaxed text-subtle`,children:`Pick a task to open its web-only scratchpad.`})]})})})]})}var Jt=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],Yt=`DIRTY_WORKTREE`;function Xt(e){return e.replace(/_/g,` `)}function Z({name:e,value:t,mono:n=!1}){return(0,W.jsxs)(`div`,{className:`min-w-0 border-b border-line-subtle py-2 last:border-b-0`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),(0,W.jsx)(`div`,{className:`mt-1 min-w-0 truncate text-[12px] text-fg ${n?`font-mono`:``}`,title:t,children:t||`—`})]})}function Q({children:e,onClick:t,disabled:n,danger:r=!1}){return(0,W.jsx)(`button`,{type:`button`,onClick:t,disabled:n,className:`border px-2 py-1 text-[11px] transition-colors disabled:opacity-40 ${r?`border-kobe-red/40 text-kobe-red hover:bg-kobe-red/10`:`border-line bg-surface text-muted hover:border-primary hover:text-fg`}`,children:e})}function Zt({task:e}){let[t,n]=(0,V.useState)(e?.title??``),[r,i]=(0,V.useState)(e?.branch??``),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),l=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]);let[u,f]=(0,V.useState)(null),p=ae(),m=h();if((0,V.useEffect)(()=>{n(e?.title??``)},[e?.title]),(0,V.useEffect)(()=>{i(e?.branch??``)},[e?.branch]),!e)return(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,W.jsx)(`div`,{className:`mt-1 max-w-48 text-[12px] leading-relaxed text-subtle`,children:`Pick a task to edit its metadata and worktree state.`})]})});let g=async(e,t)=>{o(e);try{await t()}catch(t){P(e.split(`:`)[0],t)}finally{o(null)}},_=()=>{let n=t.trim();!n||n===e.title||g(`rename`,()=>k(`task.rename`,{taskId:e.id,title:n}))},v=()=>{let t=r.trim();!t||t===e.branch||g(`branch`,()=>k(`task.setBranch`,{taskId:e.id,branch:t}))},y=()=>{vt(e.worktreePath).then(e=>{e&&(c(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>c(!1),1200))})},b=()=>{f(null),g(`archive`,async()=>{await k(`task.archive`,{taskId:e.id,archived:!0}),d(),m({to:`/`}),await k(`task.setActive`,{taskId:null})})},x=()=>{g(`restore`,()=>k(`task.archive`,{taskId:e.id,archived:!1}))},S=t=>{f(null),o(`delete`),(async()=>{try{await k(`task.delete`,{taskId:e.id,force:t}),d(),m({to:`/`}),await k(`task.setActive`,{taskId:null}).catch(()=>{}),R(`success`,`Deleted "${e.title||e.branch}"`)}catch(e){let n=e instanceof Error?e.message:String(e);!t&&n.includes(Yt)?f({kind:`delete`,force:!0}):P(`delete`,e)}finally{o(null)}})()};return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,W.jsxs)(`div`,{className:`border-b border-line px-3 py-3`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Task`}),(0,W.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,W.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),onBlur:_,onKeyDown:e=>{e.key===`Enter`&&_()},className:`min-w-0 flex-1 border border-line bg-bg px-2 py-1.5 text-[12px] text-fg focus:border-line-active focus:outline-none`}),(0,W.jsx)(Q,{onClick:_,disabled:a===`rename`,children:`Save`})]}),e.archived&&(0,W.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 border border-kobe-yellow/40 bg-kobe-yellow/10 px-2 py-1.5`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-kobe-yellow`,children:`archived`}),(0,W.jsx)(Q,{onClick:x,disabled:a!==null,children:`Restore`})]})]}),(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:[e.kind===`main`?(0,W.jsx)(Z,{name:`Branch`,value:e.branch,mono:!0}):(0,W.jsxs)(`div`,{className:`min-w-0 border-b border-line-subtle py-2`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Branch`}),(0,W.jsx)(`div`,{className:`mt-1 flex gap-2`,children:(0,W.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onBlur:v,onKeyDown:e=>{e.key===`Enter`&&v()},className:`min-w-0 flex-1 border border-line bg-bg px-2 py-1 font-mono text-[12px] text-fg focus:border-line-active focus:outline-none`})})]}),(0,W.jsx)(Z,{name:`Vendor`,value:e.vendor??`claude`}),(0,W.jsx)(Z,{name:`Worktree`,value:e.worktreePath,mono:!0}),(0,W.jsx)(Z,{name:`Repo`,value:e.repo,mono:!0}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Status`}),(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:Jt.map(t=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>void g(`status:${t}`,()=>k(`task.status`,{taskId:e.id,status:t})),disabled:a!==null,className:`border px-2 py-1.5 text-left text-[11px] capitalize transition-colors disabled:opacity-40 ${e.status===t?`border-primary bg-inset text-fg`:`border-line bg-surface text-muted hover:border-primary hover:text-fg`}`,children:Xt(t)},t))})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Vendor`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:p.map(t=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>void g(`vendor:${t.id}`,()=>k(`task.setVendor`,{taskId:e.id,vendor:t.id})),disabled:a!==null,className:`border px-2 py-1 text-[11px] transition-colors disabled:opacity-40 ${(e.vendor??`claude`)===t.id?`border-primary bg-inset text-fg`:`border-line bg-surface text-muted hover:border-primary hover:text-fg`}`,children:t.label},t.id))})]}),(0,W.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,W.jsx)(Q,{onClick:()=>void g(`pin`,()=>k(`task.pin`,{taskId:e.id,pinned:!e.pinned})),disabled:a!==null,children:e.pinned?`Unpin`:`Pin`}),(0,W.jsx)(Q,{onClick:()=>void g(`worktree`,()=>k(`task.ensureWorktree`,{taskId:e.id})),disabled:a!==null,children:`Ensure worktree`}),(0,W.jsx)(Q,{onClick:y,children:s?`Copied`:`Copy path`}),!e.archived&&(0,W.jsx)(Q,{onClick:()=>f({kind:`archive`}),disabled:a!==null,danger:!0,children:`Archive`})]}),e.kind!==`main`&&(0,W.jsxs)(`div`,{className:`mt-4 border-t border-line-subtle pt-3`,children:[(0,W.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Danger zone`}),(0,W.jsx)(Q,{onClick:()=>f({kind:`delete`,force:!1}),disabled:a!==null,danger:!0,children:`Delete task + worktree`})]})]}),u?.kind===`archive`&&(0,W.jsx)(ce,{title:`Archive task`,body:`Archive "${e.title||e.branch}"? Its tmux session and engine will be stopped; the worktree stays on disk and the task can be restored from the Archived section.`,confirmLabel:`Archive`,danger:!0,busy:a===`archive`,onConfirm:b,onCancel:()=>f(null)}),u?.kind===`delete`&&(0,W.jsx)(ce,{title:u.force?`Worktree has uncommitted changes`:`Delete task`,body:u.force?`"${e.title||e.branch}" has uncommitted or untracked changes in its worktree. Force-delete discards them permanently.`:`Delete "${e.title||e.branch}"? This removes the task, kills its engine session, and removes its worktree (branch history stays in git).`,confirmLabel:u.force?`Force delete`:`Delete`,danger:!0,busy:a===`delete`,onConfirm:()=>S(u.force),onCancel:()=>f(null)})]})}function Qt({drawer:t=!1,onClose:n}={}){let[r,i]=(0,V.useState)(`overview`),{selectedTaskId:a}=e(),{tasks:s}=j(),c=a?s.find(e=>e.id===a)??null:null;return(0,W.jsxs)(`aside`,{className:t?`flex h-full w-full flex-col bg-bg`:`flex w-80 shrink-0 flex-col border-l border-line bg-bg`,children:[(0,W.jsxs)(`div`,{className:`flex h-9 shrink-0 items-stretch border-b border-line bg-surface`,children:[[`overview`,`notes`,`changes`].map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`px-3 text-[10px] font-bold uppercase tracking-[0.12em] ${r===e?`border-b-2 border-primary text-fg`:`text-subtle hover:text-muted`}`,children:e===`overview`?`Task`:e===`notes`?`Notes`:`Changes`},e)),t&&n&&(0,W.jsx)(`button`,{type:`button`,onClick:n,className:`ml-auto px-3 text-subtle hover:text-fg`,"aria-label":`Close tools`,children:(0,W.jsx)(I,{size:14,strokeWidth:2})})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1`,children:r===`overview`?(0,W.jsx)(Zt,{task:c}):r===`notes`?(0,W.jsx)(qt,{taskId:a,full:!0}):(0,W.jsx)(Ft,{worktreePath:c?.worktreePath??null,onOpenFile:e=>{a&&o(a,e)}})})]})}async function $t(e,t){let n=new URLSearchParams(t),r=await fetch(`${e}?${n.toString()}`),i=await r.json();if(!r.ok||i.error)throw Error(i.error??`${e} failed (${r.status})`);return i}function en(e,t){return $t(`/api/history/sessions`,{worktreePath:e,vendor:t})}async function tn(e,t){let{messages:n}=await $t(`/api/history/messages`,{vendor:e,sessionId:t});return n}function nn(e){let t=0,n=0,r=0;for(let i of e){let e=i.usage;e&&(t+=e.input_tokens,n+=e.output_tokens,r=e.input_tokens+(e.cache_read_input_tokens??0)+(e.cache_creation_input_tokens??0))}return{inputTokens:t,outputTokens:n,contextTokens:r}}function rn(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function an(e,t,n,r=80){return t-e-n<r}var $=90;function on(e){let t=e.input;if(t&&typeof t==`object`){let e=e=>typeof t[e]==`string`?t[e]:null,n=e(`command`)??e(`file_path`)??e(`pattern`)??e(`url`)??e(`description`)??e(`prompt`)??e(`query`);if(n)return n.length>$?`${n.slice(0,$-1)}…`:n}try{let t=JSON.stringify(e.input);return!t||t===`{}`||t===`null`?``:t.length>$?`${t.slice(0,$-1)}…`:t}catch{return``}}function sn(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function cn(e){switch(e.type){case`text`:case`thinking`:return e.text;case`tool_call`:return`${e.name} ${on(e)}`;case`tool_result`:return sn(e.output)}}function ln(e){return e.blocks.map(cn).join(` `)}function un(e,t){return!(t&&e.type===`tool_call`)}function dn(e,t){return e.blocks.some(e=>e.type===`text`||e.type===`thinking`?e.text.trim()!==``:e.type===`tool_call`?!t:!1)}var fn=2500,pn=600;function mn({call:e,result:t}){let[n,r]=(0,V.useState)(!1),i=on(e),a=t?sn(t.output):``,o=!n&&a.length>pn,s=o?`${a.slice(0,pn)}…`:a,c=a.length>0;return(0,W.jsxs)(`div`,{className:`my-1`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>c&&r(e=>!e),className:`flex w-full items-baseline gap-2 text-left ${c?`cursor-pointer`:`cursor-default`}`,children:[(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?.isError?`text-kobe-red`:`text-kobe-green`}`,children:`⏺`}),(0,W.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-fg`,children:e.name}),i&&(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-subtle`,children:i}),c&&(0,W.jsx)(`span`,{className:`shrink-0 text-subtle`,children:n?(0,W.jsx)(g,{size:12}):(0,W.jsx)(_,{size:12})})]}),(n||!n&&a&&a.length<=pn)&&a&&(0,W.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto whitespace-pre-wrap break-words border-l-2 pl-3 font-mono text-[11px] leading-relaxed ${t?.isError?`border-kobe-red/40 text-kobe-red/90`:`border-line text-muted`}`,children:s}),o&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`ml-5 mt-0.5 text-[10px] text-subtle hover:text-fg`,children:`show full output`})]})}function hn({text:e}){let[t,n]=(0,V.useState)(!1);return(0,W.jsxs)(`div`,{className:`my-1`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-baseline gap-2 text-[11px] italic text-subtle hover:text-muted`,children:[(0,W.jsx)(`span`,{children:`✱`}),(0,W.jsx)(`span`,{children:t?`thinking`:`thinking…`}),t?(0,W.jsx)(g,{size:11}):(0,W.jsx)(_,{size:11})]}),t&&(0,W.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words border-l-2 border-line-subtle pl-3 text-[11px] italic leading-relaxed text-subtle`,children:e})]})}function gn({message:e,results:t,hideTools:n}){let r=[],i=Ve(e.timestamp),a=!1;return e.blocks.forEach((o,s)=>{if(!un(o,n))return;let c=`${e.timestamp}-${s}`;if(o.type===`text`){if(!o.text.trim())return;e.role===`user`?(r.push((0,W.jsxs)(`div`,{className:`my-2 flex items-baseline gap-2 border-l-2 border-primary/60 bg-inset/40 px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] font-bold text-primary`,children:`❯`}),(0,W.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg`,children:o.text}),i&&!a&&(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,title:e.timestamp,children:i})]},c)),a=!0):r.push((0,W.jsx)(`p`,{className:`my-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed ${e.role===`system`?`text-subtle`:`text-fg/90`}`,children:o.text},c));return}if(o.type===`tool_call`){r.push((0,W.jsx)(mn,{call:o,result:t.get(o.callId)},c));return}if(o.type===`thinking`){o.text.trim()&&r.push((0,W.jsx)(hn,{text:o.text},c));return}}),r.length===0?null:(0,W.jsx)(W.Fragment,{children:r})}function _n({worktreePath:e,vendor:t}){let{daemonConnected:n,streamConnected:r}=j(),i=!n||!r,[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!0),[d,f]=(0,V.useState)([]),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!0),C=(0,V.useRef)(-1),w=(0,V.useRef)(null),T=(0,V.useRef)(!0),E=(0,V.useRef)(0),D=(0,V.useRef)(!0),O=(0,V.useRef)(null);(0,V.useEffect)(()=>{D.current=l,O.current=s},[l,s]);let k=(0,V.useCallback)(async(n=!1)=>{if(!e)return;let r=E.current;try{let i=await en(e,t);if(i.latestMtime===C.current&&!n)return;C.current=i.latestMtime;let a=i.sessions.at(-1)??null,s=D.current?a:O.current??a;r=++E.current;let l=s?await tn(t,s):[];if(r!==E.current)return;o(i.sessions),f(l),c(s),v(null)}catch(e){r===E.current&&v(e instanceof Error?e.message:String(e))}finally{r===E.current&&b(!0)}},[e,t]),A=(0,V.useRef)(k);(0,V.useEffect)(()=>{A.current=k},[k]),(0,V.useEffect)(()=>{C.current=-1,b(!1),D.current=!0,O.current=null,T.current=!0,u(!0),c(null),m(``),g(!1),S(!0),A.current(!0);let e=window.setInterval(()=>{document.hidden||A.current()},fn);return()=>window.clearInterval(e)},[e,t]);let M=e=>{let n=e===a.at(-1);D.current=n,O.current=e,u(n),c(e);let r=++E.current;tn(t,e).then(e=>{r===E.current&&f(e)}).catch(e=>{r===E.current&&v(e instanceof Error?e.message:String(e))})};(0,V.useEffect)(()=>{let e=w.current;e&&T.current&&(e.scrollTop=e.scrollHeight)},[d]);let te=()=>{let e=w.current;if(!e)return;let t=an(e.scrollTop,e.scrollHeight,e.clientHeight);T.current=t,S(t)},N=()=>{let e=w.current;e&&(e.scrollTop=e.scrollHeight,T.current=!0,S(!0))},P=(0,V.useMemo)(()=>{let e=new Map;for(let t of d)for(let n of t.blocks)n.type===`tool_result`&&e.set(n.callId,n);return e},[d]),F=(0,V.useMemo)(()=>nn(d),[d]),ne=(0,V.useMemo)(()=>d.map(e=>ln(e).toLowerCase()),[d]),L=(0,V.useMemo)(()=>{let e=p.trim().toLowerCase();return d.filter((t,n)=>(!e||ne[n].includes(e))&&dn(t,h))},[d,ne,p,h]);return e?(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,W.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-surface px-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Chat`}),a.length>0&&(0,W.jsx)(`select`,{value:s??``,onChange:e=>M(e.target.value),className:`max-w-44 border border-line bg-bg px-1 py-0.5 font-mono text-[10px] text-muted focus:outline-none`,title:`Engine session`,children:a.map((e,t)=>(0,W.jsxs)(`option`,{value:e,children:[`#`,t+1,` `,e.slice(0,8),t===a.length-1?` (latest)`:``]},e))}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[10px] text-subtle`,children:[F.contextTokens>0&&(0,W.jsxs)(`span`,{title:`Live context estimate (last turn's full prompt)`,children:[`ctx `,rn(F.contextTokens)]}),F.outputTokens>0&&(0,W.jsxs)(`span`,{title:`Session tokens in / out`,children:[`⇡`,rn(F.inputTokens),` ⇣`,rn(F.outputTokens)]}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void k(!0),className:`text-subtle transition-colors hover:text-fg`,title:`Refresh transcript`,"aria-label":`Refresh transcript`,children:(0,W.jsx)(B,{size:11,strokeWidth:2})})]})]}),d.length>0&&(0,W.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,W.jsx)(ee,{size:11,strokeWidth:2,className:`shrink-0 text-subtle`}),(0,W.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`&&p&&(e.preventDefault(),m(``))},placeholder:`Search transcript…`,spellCheck:!1,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg placeholder:text-subtle focus:outline-none`}),p.trim()&&(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:[L.length,`/`,d.length]}),p.trim()&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>m(``),className:`shrink-0 text-subtle transition-colors hover:text-fg`,"aria-label":`clear transcript search`,title:`Clear search`,children:(0,W.jsx)(I,{size:12,strokeWidth:2})}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${h?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,title:h?`Show tool calls`:`Hide tool calls — read just the conversation`,children:h?`tools off`:`tools`})]}),(0,W.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,W.jsx)(`div`,{ref:w,onScroll:te,className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:_?i?(0,W.jsx)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:`The kobe daemon is offline — the transcript will reappear once it reconnects.`}):(0,W.jsxs)(`div`,{className:`flex flex-col items-start gap-2 py-4`,children:[(0,W.jsx)(`span`,{className:`text-[12px] text-kobe-red`,children:`Couldn't load the transcript.`}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>void k(!0),className:`flex items-center gap-1.5 border border-line bg-bg px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:[(0,W.jsx)(B,{size:11,strokeWidth:2}),`Retry`]})]}):y?d.length===0?(0,W.jsx)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:`No engine session recorded for this worktree yet. Open a Vendor tab and start a conversation — the transcript appears here.`}):L.length===0?(0,W.jsxs)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:[`No messages match “`,p.trim(),`”.`]}):L.map((e,t)=>(0,W.jsx)(gn,{message:e,results:P,hideTools:h},`${e.sessionId}-${t}`)):(0,W.jsx)(`div`,{className:`py-4 text-[12px] text-subtle`,children:`Loading transcript…`})}),!x&&L.length>0&&(0,W.jsx)(`button`,{type:`button`,onClick:N,className:`absolute bottom-3 right-4 flex items-center gap-1 border border-line bg-surface px-2 py-1 font-mono text-[10px] text-muted shadow-md transition-colors hover:border-primary hover:text-fg`,children:`↓ latest`})]})]}):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`This task has no worktree yet.`})}var vn=(0,V.lazy)(()=>w(()=>import(`./ChatTerminal-Dzrtw3pW.js`).then(e=>({default:e.ChatTerminal})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function yn(){return(0,W.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-[12px] text-subtle`,children:`Loading terminal…`})}function bn(e){return e??`claude`}function xn({taskId:e,tabId:t,vendor:n}){return(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center px-6`,children:(0,W.jsx)(`div`,{className:`grid w-full max-w-2xl grid-cols-1 gap-3 md:grid-cols-3`,children:[{title:`Vendor`,detail:n,body:`Start an engine session for this task.`,icon:fe,action:()=>l(e,t,`vendor`)},{title:`Chat`,detail:`transcript`,body:`Read the session as structured messages and tool calls.`,icon:ve,action:()=>l(e,t,`transcript`)},{title:`Terminal`,detail:`shell / worktree`,body:`Open a command shell in this task worktree.`,icon:xe,action:()=>l(e,t,`terminal`)}].map(e=>{let t=e.icon;return(0,W.jsxs)(`button`,{type:`button`,onClick:e.action,className:`group flex min-h-36 flex-col border border-line bg-surface p-4 text-left transition-colors hover:border-primary hover:bg-inset`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center border border-line bg-bg text-muted group-hover:border-primary group-hover:text-primary`,children:(0,W.jsx)(t,{size:17,strokeWidth:1.8})}),(0,W.jsx)(`span`,{className:`truncate text-[10px] uppercase text-subtle`,children:e.detail})]}),(0,W.jsx)(`div`,{className:`mt-5 text-[12px] font-bold uppercase tracking-[0.12em] text-fg`,children:e.title}),(0,W.jsx)(`div`,{className:`mt-2 text-[12px] leading-relaxed text-subtle`,children:e.body})]},e.title)})})})}function Sn({tab:e,taskId:t,taskWorktreePath:n,taskTitle:r,vendor:i}){return e?.kind===`empty`?(0,W.jsx)(xn,{taskId:t,tabId:e.id,vendor:i}):e?.kind===`vendor`?(0,W.jsx)(V.Suspense,{fallback:(0,W.jsx)(yn,{}),children:(0,W.jsx)(vn,{tabId:e.id,taskId:t,mode:`engine`},e.id)}):e?.kind===`terminal`?(0,W.jsx)(V.Suspense,{fallback:(0,W.jsx)(yn,{}),children:(0,W.jsx)(vn,{tabId:e.id,taskId:t,mode:`shell`},e.id)}):e?.kind===`transcript`?(0,W.jsx)(_n,{worktreePath:n,vendor:i,title:r},e.id):e?.kind===`file`?(0,W.jsx)(It,{worktreePath:n,path:e.path},e.id):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`Opening a tab…`})}function Cn({tab:e,side:t,children:n,onCloseSplit:r}){return(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[t===`right`&&(0,W.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center justify-between border-b border-line bg-surface px-3`,children:[(0,W.jsx)(`span`,{className:`truncate text-[11px] text-muted`,children:e?.title??`Split`}),(0,W.jsx)(`button`,{type:`button`,onClick:r,className:`text-[11px] text-subtle hover:text-fg`,"aria-label":`close split`,title:`Close split`,children:`×`})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 p-2`,children:n})]})}function wn(){let[n,r]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),{selectedTaskId:c,tabsByTask:l,activeByTask:d,splitByTask:p}=e(),{tasks:m,jobs:h}=j(),g=c?m.find(e=>e.id===c):null,_=c?l[c]??[]:[],v=c?d[c]:void 0,y=c?p[c]:void 0,b=e=>{if(!c)return;let n=_.find(t=>t.id===e);t(c,e),(n?.kind===`vendor`||n?.kind===`terminal`)&&x(e)},S=_.find(e=>e.id===v)??_[0],C=y&&y!==S?.id?_.find(e=>e.id===y):void 0,w=bn(g?.vendor),T=g?.title||g?.branch||`Session`,E=!!g&&((c?h[c]?.phase===`running`:!1)||g.worktreePath===null);return(0,W.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col bg-bg`,children:[(0,W.jsx)(`div`,{className:`flex h-9 shrink-0 items-stretch border-b border-line bg-surface`,children:c?(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-stretch overflow-x-auto`,role:`tablist`,children:[_.map(e=>{let t=e.id===S?.id,n=e.id===C?.id;return(0,W.jsxs)(`div`,{role:`tab`,"aria-selected":t,tabIndex:0,draggable:!0,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id),r(e.id)},onDragEnd:()=>{r(null),s(!1)},className:`group flex h-9 select-none items-center gap-2 border-r border-b-2 border-r-line px-3 text-[12px] transition-colors ${t?`border-b-primary bg-bg text-fg`:n?`border-b-kobe-blue bg-inset text-fg`:`border-b-transparent text-muted hover:bg-inset/50`}`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>u(c,e.id),className:`max-w-40 cursor-grab truncate active:cursor-grabbing`,title:n?`${e.title} (split)`:e.title,children:e.title}),n&&(0,W.jsx)(`span`,{className:`text-[9px] font-bold uppercase text-kobe-blue`,children:`Split`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>b(e.id),className:`text-subtle opacity-0 transition-opacity hover:text-fg group-hover:opacity-100`,"aria-label":`close tab`,title:`Close tab`,children:`×`})]},e.id)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>f(c),className:`px-3 text-[13px] text-subtle hover:text-fg`,"aria-label":`new tab`,title:`New tab`,children:`+`})]}):(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-[11px] text-subtle`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-subtle`}),`No task selected`]})}),(0,W.jsxs)(`section`,{className:`relative min-h-0 flex-1`,"aria-label":`Workspace`,onDragOver:e=>{if(!c||!n)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect();s(e.clientX>t.left+t.width/2)},onDragLeave:()=>s(!1),onDrop:e=>{if(!c||!n)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect();e.clientX>t.left+t.width/2?i(c,n):u(c,n),r(null),s(!1)},children:[c&&S?(0,W.jsxs)(`div`,{className:`flex h-full min-w-0`,children:[(0,W.jsx)(Cn,{tab:S,side:`left`,children:(0,W.jsx)(Sn,{tab:S,taskId:c,taskWorktreePath:g?.worktreePath??null,taskTitle:T,vendor:w})}),C&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`w-px shrink-0 bg-line`}),(0,W.jsx)(Cn,{tab:C,side:`right`,onCloseSplit:()=>{c&&a(c)},children:(0,W.jsx)(Sn,{tab:C,taskId:c,taskWorktreePath:g?.worktreePath??null,taskTitle:T,vendor:w})})]})]}):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,W.jsxs)(`div`,{className:`max-w-md`,children:[(0,W.jsx)(`div`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe web]`}),(0,W.jsx)(`h1`,{className:`mt-4 text-[18px] font-semibold text-fg`,children:g?E?`Setting up this task's worktree…`:`Opening workspace…`:`Select a task to open its workspace.`}),(0,W.jsx)(`p`,{className:`mt-2 text-[12px] leading-relaxed text-subtle`,children:`Web workspaces keep their own browser tabs, split panes, notes, and file previews for each task.`})]})}),n&&(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-y-2 right-2 flex w-[calc(50%-0.5rem)] items-center justify-center border border-dashed ${o?`border-primary bg-primary/10`:`border-line bg-inset/40`}`,children:(0,W.jsx)(`span`,{className:`border border-line bg-bg px-2 py-1 text-[10px] font-bold uppercase tracking-[0.12em] text-muted`,children:`Drop to split right`})})]})]})}function Tn({children:e,suffix:t}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`h-px flex-1 bg-line`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] font-bold uppercase text-primary`,children:t})]}):null]})}function En({task:e,engine:t,job:n,changes:r,engineName:i,active:a,onClick:o}){let s=n?.phase===`running`,c=s?`materializing…`:Ce(t?.state),l=Ve(e.updatedAt||e.createdAt);return(0,W.jsxs)(`button`,{type:`button`,"data-task-id":e.id,onClick:o,className:`group w-full border-l-2 px-3 py-2 text-left transition-colors ${a?`border-primary bg-inset`:`border-transparent hover:bg-surface`}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s?(0,W.jsx)(_e,{size:10,strokeWidth:2.5,className:`shrink-0 animate-spin text-primary`}):(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Se(t?.state)}`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${a?`text-fg`:`text-fg/90`}`,children:e.title||e.branch}),(0,W.jsx)(te,{pr:e.prStatus}),e.pinned&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`PIN`}),(0,W.jsx)(se,{counts:r})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 pl-3.5 text-[11px] text-subtle`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.branch||`—`}),(0,W.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,W.jsx)(L,{label:i}),c&&(0,W.jsx)(`span`,{className:`text-muted`,children:c}),l&&(0,W.jsx)(`span`,{className:`text-subtle`,children:l})]})]})]})}function Dn({task:e,onRestore:t}){return(0,W.jsxs)(`div`,{className:`group flex items-center gap-2 border-l-2 border-transparent px-3 py-1.5`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] text-subtle`,children:e.title||e.branch}),(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 border border-line bg-surface px-1.5 py-0.5 text-[10px] text-muted opacity-0 transition-opacity hover:border-primary hover:text-fg group-hover:opacity-100`,children:`Restore`})]})}function On({onOpenSettings:t,onNewTask:n,onAdopt:i}){let{tasks:a,engineStates:o,jobs:s,worktreeChanges:c,uiPrefs:l,hydrated:u,streamConnected:d}=j(),{selectedTaskId:f}=e(),p=ae(),m=(0,V.useMemo)(()=>Re(a),[a]),g=e=>m&&e.kind!==`main`?le(p,e.vendor):null,{query:_,statusFilter:v,sortMode:y,showArchived:b}=Ne(),x=(0,V.useRef)(null),S=(0,V.useRef)(null);(0,V.useEffect)(()=>{f&&x.current?.querySelector(`[data-task-id="${CSS.escape(f)}"]`)?.scrollIntoView({block:`nearest`})},[f]);let C=l?.sortMode;(0,V.useEffect)(()=>{je(C)},[C]);let w=(0,V.useMemo)(()=>a.filter(e=>!e.archived),[a]),E=(0,V.useMemo)(()=>a.filter(e=>e.archived&&e.kind!==`main`),[a]),D=(0,V.useMemo)(()=>Ie(w.filter(e=>ze(e,_)&&T(o[e.id],c[e.worktreePath],v)),y),[w,_,v,y,o,c]),O=D.filter(e=>e.kind===`main`),A=D.filter(e=>e.kind!==`main`),M=!u||!d&&a.length===0,te=h(),N=e=>{r(e),k(`task.setActive`,{taskId:e}).catch(()=>{}),te({to:`/task/$taskId`,params:{taskId:e}})};(0,V.useEffect)(()=>{let e=e=>{if(e.metaKey||e.ctrlKey||e.altKey)return;let t=e.key,n=t===`ArrowDown`||t===`ArrowUp`,r=t===`j`||t===`ArrowDown`,i=t===`k`||t===`ArrowUp`,a=t===`/`;if(!r&&!i&&!a)return;let o=e.target;if(o&&(o.tagName===`INPUT`||o.tagName===`TEXTAREA`||o.tagName===`SELECT`||o.isContentEditable)||document.querySelector(`[role=dialog],[role=alertdialog]`)||document.querySelector(`[data-settings-open]`))return;if(a){e.preventDefault(),S.current?.focus();return}if(n&&o&&o!==document.body&&!x.current?.contains(o)||D.length===0)return;e.preventDefault();let s=D.findIndex(e=>e.id===f);N(D[s===-1?0:Math.min(Math.max(s+(r?1:-1),0),D.length-1)].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[D,f]);let F=e=>{k(`task.archive`,{taskId:e.id,archived:!1}).catch(t=>P(`restore "${e.title||e.branch}"`,t))};return(0,W.jsxs)(`aside`,{className:`flex w-64 shrink-0 flex-col border-r border-line bg-bg`,children:[(0,W.jsxs)(`div`,{className:`border-b border-line bg-surface/50 px-3 py-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Tasks`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>ke(y==="default"?`recent`:`default`),className:`font-mono text-[10px] uppercase ${y===`recent`?`text-primary`:`text-muted hover:text-fg`}`,title:`Toggle task sort`,children:`sort`}),(0,W.jsxs)(`span`,{className:`font-mono text-[10px] text-muted`,children:[D.length,`/`,w.length]}),(0,W.jsx)(`button`,{type:`button`,onClick:i,className:`text-muted transition-colors hover:text-primary`,title:`Adopt an existing worktree`,"aria-label":`Adopt worktree`,children:(0,W.jsx)(he,{size:14,strokeWidth:1.9})}),(0,W.jsx)(`button`,{type:`button`,onClick:n,className:`text-muted transition-colors hover:text-primary`,title:`New task`,"aria-label":`New task`,children:(0,W.jsx)(ue,{size:14,strokeWidth:2.2})})]})]}),(0,W.jsxs)(`label`,{className:`mt-2 flex h-8 items-center gap-2 border border-line bg-bg px-2 text-[12px] text-muted focus-within:border-line-active`,children:[(0,W.jsx)(ee,{size:14,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,W.jsx)(`input`,{ref:S,value:_,onChange:e=>U(e.target.value),onKeyDown:e=>{e.key===`Enter`&&D.length>0?(e.preventDefault(),N(D[0].id),e.currentTarget.blur()):e.key===`Escape`&&_&&(e.preventDefault(),U(``))},placeholder:`Filter tasks`,className:`min-w-0 flex-1 bg-transparent text-fg placeholder:text-subtle focus:outline-none`}),_&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>U(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear task filter`,title:`Clear filter`,children:(0,W.jsx)(I,{size:13,strokeWidth:2})})]}),(0,W.jsx)(`div`,{className:`mt-2 flex items-center gap-1`,children:[{key:`all`,label:`All`,title:`All tasks`},{key:`attention`,label:`Needs`,title:`Needs input / errored / rate-limited`}].map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>Oe(e.key),title:e.title,className:`border px-1.5 py-0.5 text-[10px] transition-colors ${v===e.key?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,children:e.label},e.key))})]}),(0,W.jsxs)(`div`,{ref:x,className:`flex-1 overflow-y-auto`,children:[M?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-[12px] text-subtle`,children:[(0,W.jsx)(_e,{size:13,strokeWidth:2,className:`animate-spin`}),(0,W.jsx)(`span`,{children:`connecting…`})]}):w.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,W.jsx)(`p`,{children:`No tasks yet.`}),(0,W.jsx)(`button`,{type:`button`,onClick:n,className:`mt-3 border border-line bg-surface px-2 py-1 text-[11px] text-muted hover:border-primary hover:text-fg`,children:`+ New task`})]}):D.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,W.jsx)(`div`,{children:_?`No matches for “${_}”.`:`No tasks in this status.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{U(``),Oe(`all`)},className:`mt-3 border border-line bg-surface px-2 py-1 text-[11px] text-muted hover:border-primary hover:text-fg`,children:`Clear filter`})]}):(0,W.jsxs)(W.Fragment,{children:[O.length>0&&(0,W.jsx)(Tn,{children:`Projects`}),O.map(e=>(0,W.jsx)(En,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],engineName:g(e),active:e.id===f,onClick:()=>N(e.id)},e.id)),A.length>0&&(0,W.jsx)(Tn,{suffix:y==="default"?void 0:y,children:`Worktrees`}),A.map(e=>(0,W.jsx)(En,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],engineName:g(e),active:e.id===f,onClick:()=>N(e.id)},e.id))]}),!M&&E.length>0&&(0,W.jsxs)(`div`,{className:`mt-2 border-t border-line-subtle pb-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>Ae(!b),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Archived`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:E.length}),(0,W.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-subtle`,children:b?`−`:`+`})]}),b&&E.map(e=>(0,W.jsx)(Dn,{task:e,onRestore:()=>F(e)},e.id))]})]}),(0,W.jsx)(`div`,{className:`border-t border-line p-2`,children:(0,W.jsxs)(`button`,{type:`button`,onClick:t,className:`flex w-full items-center gap-2 border border-line bg-surface px-2 py-2 text-left text-[12px] text-muted transition-colors hover:border-primary hover:bg-inset hover:text-fg`,children:[(0,W.jsx)(be,{size:15,strokeWidth:1.8}),(0,W.jsx)(`span`,{children:`Settings`})]})})]})}function kn({onToggleTools:t,onShowHelp:n}){let{daemonConnected:r,streamConnected:i,tasks:a}=j(),{selectedTaskId:o}=e(),s=o?a.find(e=>e.id===o):null,c=r&&i;return(0,W.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-3 border-b border-line bg-surface px-3`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe]`}),(0,W.jsx)(b,{}),s?(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`max-w-56 truncate rounded bg-inset px-2 py-0.5 text-[11px] text-fg`,children:s.title||s.branch}),(0,W.jsx)(`span`,{className:`hidden max-w-40 truncate font-mono text-[11px] text-subtle md:inline`,children:s.branch})]}):(0,W.jsx)(`span`,{className:`rounded bg-inset px-2 py-0.5 text-[11px] text-muted`,children:`Workspace`}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[11px] text-subtle`,children:[(0,W.jsxs)(`span`,{className:`hidden items-center gap-1.5 sm:flex`,title:!c&&i?"Daemon offline — if it doesn't recover, run `kobe doctor` or `kobe reset` in a terminal.":void 0,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${c?`bg-kobe-green`:`bg-kobe-yellow`}`}),(0,W.jsx)(`span`,{children:c?`daemon connected`:i?`no daemon`:`connecting…`})]}),(0,W.jsx)(`button`,{type:`button`,onClick:n,className:`hidden items-center text-muted transition-colors hover:text-fg sm:flex`,"aria-label":`Keyboard shortcuts`,title:`Keyboard shortcuts (?)`,children:(0,W.jsx)(me,{size:15,strokeWidth:1.8})}),(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`flex items-center text-muted transition-colors hover:text-fg lg:hidden`,"aria-label":`Toggle task tools`,title:`Task tools`,children:(0,W.jsx)(ye,{size:15,strokeWidth:1.8})})]})]})}function An(){let{tasks:t,update:n}=j(),{selectedTaskId:r}=e(),i=r?t.find(e=>e.id===r):null,a=t.filter(e=>!e.archived).length;return(0,W.jsxs)(`footer`,{className:`flex h-7 shrink-0 items-center gap-4 border-t border-line bg-surface px-3 text-[11px] text-subtle`,children:[(0,W.jsxs)(`span`,{children:[a,` task`,a===1?``:`s`]}),i&&(0,W.jsxs)(`span`,{className:`min-w-0 truncate text-muted`,children:[i.kind===`main`?`project`:`worktree`,` ·`,` `,we(i.worktreePath,54)]}),(0,W.jsx)(`span`,{className:`ml-auto`,children:n?.latest?`update ${n.latest} available`:`kobe web`})]})}function jn(){let e=h(),[t,n]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){e.preventDefault(),l(e=>!e);return}if(e.key===`?`&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)||(e.preventDefault(),d(!0));return}e.key===`Escape`&&p(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,V.useEffect)(()=>(O(t=>{r(t),k(`task.setActive`,{taskId:t}).catch(()=>{}),e({to:`/task/$taskId`,params:{taskId:t}})}),()=>O(null)),[e]),(0,W.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,W.jsx)(kn,{onToggleTools:()=>p(e=>!e),onShowHelp:()=>d(!0)}),(0,W.jsx)(v,{}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,W.jsx)(On,{onOpenSettings:()=>n(!0),onNewTask:()=>a(!0),onAdopt:()=>s(!0)}),t?(0,W.jsx)(ht,{onClose:()=>n(!1)}):(0,W.jsx)(wn,{}),(0,W.jsx)(`div`,{className:`hidden lg:flex`,children:(0,W.jsx)(Qt,{})}),f&&(0,W.jsx)(`div`,{className:`fixed inset-0 z-30 flex justify-end bg-black/50 lg:hidden`,onClick:()=>p(!1),onKeyDown:e=>{e.key===`Escape`&&p(!1)},role:`presentation`,children:(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Task tools`,className:`h-full w-80 max-w-[85vw] border-l border-line bg-bg shadow-2xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:(0,W.jsx)(Qt,{drawer:!0,onClose:()=>p(!1)})})})]}),(0,W.jsx)(An,{}),i&&(0,W.jsx)(He,{onClose:()=>a(!1)}),o&&(0,W.jsx)(Ue,{onClose:()=>s(!1)}),u&&(0,W.jsx)(et,{onClose:()=>d(!1)}),(0,W.jsx)(qe,{open:c,onClose:()=>l(!1),onNewTask:()=>a(!0),onOpenSettings:()=>n(!0)}),(0,W.jsx)(_t,{})]})}export{B as n,jn as t};
|