@sma1lboy/kobe 0.7.25 → 0.7.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/cli/index.js +2 -1
- package/dist/web-ui/assets/AppShell-CQxa6abu.js +7 -0
- package/dist/web-ui/assets/{ChatTerminal-DL9kz6iJ.js → ChatTerminal-BMSvAiAB.js} +2 -2
- package/dist/web-ui/assets/{ChatTranscript-DL4KGcCP.js → ChatTranscript-BJhX29XX.js} +2 -2
- package/dist/web-ui/assets/arrow-left-Cbh2rcaq.js +1 -0
- package/dist/web-ui/assets/board-l1dAjN3Y.js +6 -0
- package/dist/web-ui/assets/chips-D1mC9nB4.js +2 -0
- package/dist/web-ui/assets/index-i463t0Rc.js +10 -0
- package/dist/web-ui/assets/overview-DZo39fTv.js +1 -0
- package/dist/web-ui/assets/routes-DOqWXZU_.js +1 -0
- package/dist/web-ui/assets/tabs-7WK4MwGF.js +1 -0
- package/dist/web-ui/assets/task._taskId-DmEKhgY3.js +1 -0
- package/dist/web-ui/assets/terminal-BUdn99hL.js +1 -0
- package/dist/web-ui/assets/terminal-CapzGZr6.js +1 -0
- package/dist/web-ui/index.html +3 -2
- package/package.json +1 -1
- package/dist/web-ui/assets/AppShell-BUxSw0xG.js +0 -7
- package/dist/web-ui/assets/arrow-left-CPDGLwQs.js +0 -1
- package/dist/web-ui/assets/board-CbwyUj3Z.js +0 -7
- package/dist/web-ui/assets/chips-BYg-ofbe.js +0 -2
- package/dist/web-ui/assets/index-DdSnT7Rv.js +0 -10
- package/dist/web-ui/assets/overview-BFm-fRcJ.js +0 -1
- package/dist/web-ui/assets/react-B8IZ02wI.js +0 -1
- package/dist/web-ui/assets/routes-B6JWLjSF.js +0 -1
- package/dist/web-ui/assets/task._taskId-CnOx0dEd.js +0 -1
- package/dist/web-ui/assets/terminal-D7PGfbSa.js +0 -1
- package/dist/web-ui/assets/triage-89UXpkZl.js +0 -1
package/README.md
CHANGED
|
@@ -118,6 +118,21 @@ export KOBE_OPEN_EDITOR=/Applications/Cursor.app/Contents/Resources/app/bin/curs
|
|
|
118
118
|
|
|
119
119
|
For the full feature manifest, see [`CHANGELOG.md`](./CHANGELOG.md).
|
|
120
120
|
|
|
121
|
+
## Browser dashboard
|
|
122
|
+
|
|
123
|
+
kobe also ships a local web UI over the same tasks and sessions, for when you'd
|
|
124
|
+
rather drive things from a browser than the TUI:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
kobe web # serves http://localhost:5173
|
|
128
|
+
kobe web --port 5180 # pick a different port
|
|
129
|
+
kobe web --help # all options (--bridge-only, --no-takeover, …)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
It connects to the same daemon as the TUI, so tasks created in either surface
|
|
133
|
+
appear in both. The process model, routes, and security posture are documented
|
|
134
|
+
in [`docs/design/web-dashboard.md`](../../docs/design/web-dashboard.md).
|
|
135
|
+
|
|
121
136
|
## Custom themes
|
|
122
137
|
|
|
123
138
|
kobe ships a handful of bundled themes (`claude` is the default), and any JSON
|
package/dist/cli/index.js
CHANGED
|
@@ -90,7 +90,7 @@ var init_package = __esm(() => {
|
|
|
90
90
|
package_default = {
|
|
91
91
|
$schema: "https://json.schemastore.org/package.json",
|
|
92
92
|
name: "@sma1lboy/kobe",
|
|
93
|
-
version: "0.7.
|
|
93
|
+
version: "0.7.26",
|
|
94
94
|
description: "TUI orchestrator for Claude Code (codename)",
|
|
95
95
|
type: "module",
|
|
96
96
|
packageManager: "bun@1.3.13",
|
|
@@ -28199,6 +28199,7 @@ function topLevelUsage() {
|
|
|
28199
28199
|
"Run with no command to launch the TUI.",
|
|
28200
28200
|
"",
|
|
28201
28201
|
"Commands:",
|
|
28202
|
+
" web [options] Launch the browser dashboard (default http://localhost:5173)",
|
|
28202
28203
|
" add [path] Save a repo path for the new-task picker",
|
|
28203
28204
|
" adopt [glob] Import existing git worktrees as tasks",
|
|
28204
28205
|
" repo <verb> Per-repo init script + first prompt (show|set|unset)",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTerminal-BMSvAiAB.js","assets/tabs-7WK4MwGF.js","assets/terminal-CapzGZr6.js","assets/index-i463t0Rc.js","assets/index-CtJIPdVH.css","assets/chips-D1mC9nB4.js","assets/ChatTranscript-BJhX29XX.js","assets/ChatTerminal-kHJ-D0s7.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as e,a as t,b as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,t as p,v as m}from"./tabs-7WK4MwGF.js";import{t as h}from"./terminal-CapzGZr6.js";import{S as g,_,a as v,g as y,h as b,i as x,m as S,n as C,o as w,r as T,v as E,x as D,y as O}from"./index-i463t0Rc.js";import{C as k,E as A,S as j,T as ee,a as M,i as N,m as te,n as ne,o as re,p as ie,r as ae,s as oe,t as se,w as P}from"./chips-D1mC9nB4.js";import{a as F,c as ce,f as le,i as ue,n as de,o as I,p as fe,r as L,s as pe,t as me,u as he}from"./ChatTranscript-BJhX29XX.js";var ge=A(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),_e=A(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),ve=A(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),ye=A(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),be=A(`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`}]]),xe=A(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Se=A(`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`}]]),Ce=A(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`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`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),we=A(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Te=A(`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`}]]),Ee=A(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),De=A(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Oe=A(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ke=A(`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`}]]),Ae=A(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),R=n(m(),1),z=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}],je=!1,B=new Set;function Me(){je||(je=!0,fetch(`/api/engines`).then(async e=>{if(!e.ok)return;let t=await e.json();if(!(!Array.isArray(t.engines)||t.engines.length===0)){z=t.engines.filter(e=>typeof e?.id==`string`&&typeof e?.label==`string`);for(let e of B)e()}}).catch(()=>{}))}function V(){return Me(),(0,R.useSyncExternalStore)(e=>(B.add(e),()=>B.delete(e)),()=>z,()=>z)}function Ne(e,t){return t?e.find(e=>e.id===t)?.label??t:`claude`}function Pe(e,t=36){return e.length<=t?e:`…${e.slice(e.length-t+1)}`}var H={query:``,statusFilter:`all`,sortMode:`default`,showArchived:!1},Fe=null,U=new Set;function W(e){H={...H,...e};for(let e of U)e()}function G(e){W({query:e})}function Ie(e){W({statusFilter:e})}function Le(e){W({sortMode:e})}function Re(e){W({showArchived:e})}function ze(e){!e||e===Fe||(Fe=e,W({sortMode:e}))}function Be(){return H}function Ve(){return(0,R.useSyncExternalStore)(e=>(U.add(e),()=>U.delete(e)),Be,Be)}var K=g();function He({onClose:e}){let{tasks:t}=T(),n=D(),r=(0,R.useRef)(null);L(r);let a=(0,R.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,R.useMemo)(()=>new Set(t.map(e=>e.worktreePath).filter(Boolean)),[t]),[s,c]=(0,R.useState)(a[0]??``),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(null),h=async e=>{if(e){f(!0),u(null);try{let{worktrees:t}=await C(`worktree.discoverAdoptable`,{repo:e});u(t)}catch(e){I(`scan worktrees`,e),u([])}finally{f(!1)}}},g=async t=>{m(t.path);try{let{task:r}=await C(`worktree.adopt`,{repo:s,worktreePath:t.path,branch:t.branch,ifExists:`return`});i(r.id),C(`task.setActive`,{taskId:r.id}).catch(()=>{}),n({to:`/task/$taskId`,params:{taskId:r.id}}),F(`success`,`Adopted ${t.branch||t.path}`),e()}catch(e){I(`adopt worktree`,e)}finally{m(null)}};return(0,K.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,K.jsxs)(`div`,{ref:r,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,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 px-3 py-3`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Repo`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`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.length===0&&(0,K.jsx)(`option`,{value:``,children:`No known repos`}),a.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void h(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,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-line`,children:l===null?(0,K.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,K.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,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-subtle px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate font-mono text-[12px] text-fg`,children:e.branch||`(detached)`}),e.dirty&&(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-kobe-yellow`,children:`dirty`}),e.kobeManaged&&(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`kobe`})]}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-subtle`,children:[(0,K.jsx)(`span`,{className:`truncate font-mono`,children:e.path}),e.lastActivityMs>0&&(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,children:M(e.lastActivityMs)})]})]}),t?(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`tracked`}):(0,K.jsx)(`button`,{type:`button`,onClick:()=>void g(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,K.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,K.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 Ue(e,t){return e.filter(e=>!e.archived&&e.kind!==`main`&&O(t[e.id],void 0)===`attention`).map(e=>e.id)}function We(e,t){if(e.length===0)return null;let n=t?e.indexOf(t):-1;return n===-1?e[0]??null:e[(n+1)%e.length]??null}function Ge(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 Ke(e,t){return e.map(e=>({id:`theme:${e}`,label:`Theme: ${e}`,hint:e===t?`active`:`theme`,name:e}))}function qe({kind:e}){return e===`new`?(0,K.jsx)(Oe,{size:14,strokeWidth:2}):e===`settings`?(0,K.jsx)(ke,{size:14,strokeWidth:1.8}):e===`overview`?(0,K.jsx)(Ce,{size:14,strokeWidth:1.8}):e===`board`?(0,K.jsx)(xe,{size:14,strokeWidth:1.8}):e===`theme`?(0,K.jsx)(Ee,{size:14,strokeWidth:1.8}):e===`attention`?(0,K.jsx)(_e,{size:14,strokeWidth:1.8}):(0,K.jsx)(ge,{size:14,strokeWidth:1.8})}function Je({open:e,onClose:t,onNewTask:n,onOpenSettings:r}){let{tasks:a,engineStates:o,activeTaskId:s}=T(),{names:c,active:l,overridden:u}=w(),d=D(),[f,p]=(0,R.useState)(``),[m,h]=(0,R.useState)(0),g=(0,R.useRef)(null),_=(0,R.useRef)(null),y=(0,R.useRef)(null);L(_,e),(0,R.useEffect)(()=>{y.current?.querySelector(`[data-index="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let[b,S]=(0,R.useState)([]);(0,R.useEffect)(()=>{e&&(p(``),h(0),S(Ue(a,o)),requestAnimationFrame(()=>g.current?.focus()))},[e]);let E=(0,R.useMemo)(()=>{if(!e)return[];let o=a.filter(e=>!e.archived).map(e=>({id:`task:${e.id}`,label:e.title||e.branch||e.id,hint:e.kind===`main`?`project`:e.branch,icon:`task`,run:()=>{i(e.id),C(`task.setActive`,{taskId:e.id}).catch(e=>I(`switch task`,e)),d({to:`/task/$taskId`,params:{taskId:e.id}}),t()}})),f=b,p=[];f.length>0&&p.push({id:`action:next-attention`,label:`Go to next task needing you`,hint:f.length>1?`${f.length} waiting`:`1 waiting`,icon:`attention`,run:()=>{let e=We(f,s);e&&(i(e),C(`task.setActive`,{taskId:e}).catch(e=>I(`switch task`,e)),d({to:`/task/$taskId`,params:{taskId:e}})),t()}}),p.push({id:`action:new`,label:`New task`,hint:`create`,icon:`new`,run:()=>{n(),t()}},{id:`action:overview`,label:`Open overview`,hint:`triage`,icon:`overview`,run:()=>{d({to:`/overview`}),t()}},{id:`action:board`,label:`Open board`,hint:`kanban`,icon:`board`,run:()=>{d({to:`/board`}),t()}},{id:`action:settings`,label:`Open settings`,hint:`settings`,icon:`settings`,run:()=>{r(),t()}});let m=Ke(c,l).map(e=>({id:e.id,label:e.label,hint:e.hint,icon:`theme`,run:()=>{v(e.name),t()}}));return u&&m.unshift({id:`theme:follow-tui`,label:`Theme: Follow TUI`,hint:`clear override`,icon:`theme`,run:()=>{x(),t()}}),[...p,...m,...o]},[e,a,b,s,c,l,u,d,t,n,r]),O=(0,R.useMemo)(()=>f.trim()?E.map(e=>{let t=`${e.label} ${e.hint??``}`,n=Ge(f.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):E,[E,f]);return(0,R.useEffect)(()=>{h(e=>Math.min(e,Math.max(0,O.length-1)))},[O.length]),e?(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center bg-black/50 pt-[12vh]`,onClick:t,onKeyDown:()=>{},role:`presentation`,children:(0,K.jsxs)(`div`,{ref:_,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,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line px-3 py-2.5`,children:[(0,K.jsx)(ee,{size:15,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,K.jsx)(`input`,{ref:g,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),h(e=>Math.min(e+1,O.length-1))):e.key===`ArrowUp`?(e.preventDefault(),h(e=>Math.max(e-1,0))):e.key===`Enter`?(e.preventDefault(),O[m]?.run()):e.key===`Escape`&&(e.preventDefault(),t())},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,K.jsx)(`kbd`,{className:`shrink-0 border border-line px-1.5 py-0.5 font-mono text-[10px] text-subtle`,children:`esc`})]}),(0,K.jsx)(`div`,{ref:y,className:`max-h-[50vh] overflow-y-auto py-1`,children:O.length===0?(0,K.jsxs)(`div`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:[`No matches for “`,f,`”.`]}):O.map((e,t)=>(0,K.jsxs)(`button`,{type:`button`,"data-index":t,onClick:e.run,onMouseMove:()=>h(t),className:`flex w-full items-center gap-3 px-3 py-2 text-left ${t===m?`bg-inset`:`hover:bg-inset/50`}`,children:[(0,K.jsx)(`span`,{className:`shrink-0 ${t===m?`text-primary`:`text-subtle`}`,children:(0,K.jsx)(qe,{kind:e.icon})}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-fg`,children:e.label}),e.hint&&(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:e.hint})]},e.id))}),(0,K.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,K.jsx)(`span`,{children:`↑↓ move`}),(0,K.jsx)(`span`,{children:`↵ run`}),(0,K.jsx)(`span`,{children:`esc close`})]})]})}):null}var Ye=[{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`}],Xe=[{keys:[`↑`,`↓`],label:`Move selection`},{keys:[`↵`],label:`Run the selected command`},{keys:[`theme`],label:`Type "theme" to switch theme (or Follow TUI)`}],Ze=[{keys:[`↑`,`↓`],label:`Recall previously-sent prompts (newest first)`},{keys:[`↵`],label:`Send · Shift+↵ for a newline`}],Qe=[{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:`Overview`,detail:`the grid icon in the top bar — triage every task at once; j/k highlight, Enter opens`},{label:`Chat / Vendor / Terminal`,detail:`tab kinds inside a task workspace; Chat has search, a hide-tools toggle, and copy-as-Markdown`},{label:`Triage`,detail:`rail status chips (All/Needs/Run/Dirty) + the Overview grid — filter by what needs you`},{label:`Changes / diff`,detail:`filter files by path, toggle line wrap on a file preview`},{label:`Conflicts`,detail:`a ⚠ on a task (rail / Overview / board) means its branch collides with another in-flight task — red = real merge conflict, yellow = file overlap; hover for who + which files`},{label:`Copy link`,detail:`Task panel → Copy link — share a deep link to a task`},{label:`Needs you`,detail:`the tab title shows "(N) kobe" when N tasks are waiting; Cmd+K → "Go to next task needing you" jumps straight to them`},{label:`Notifications`,detail:`Settings → Notifications — get pinged when a task needs you`}];function $e({k:e}){return(0,K.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 q({keys:e,label:t}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,K.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.map(e=>(0,K.jsx)($e,{k:e},e))}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 text-[12px] text-muted`,children:t})]})}function et({onClose:e}){let t=(0,R.useRef)(null);return L(t),(0,R.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:()=>{},role:`presentation`,children:(0,K.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,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Keyboard & shortcuts`}),(0,K.jsx)(`kbd`,{className:`border border-line px-1.5 py-0.5 font-mono text-[10px] text-subtle`,children:`esc`})]}),(0,K.jsxs)(`div`,{className:`space-y-4 px-4 py-3`,children:[(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Global`}),Ye.map(e=>(0,K.jsx)(q,{...e},e.label))]}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`In the command palette`}),Xe.map(e=>(0,K.jsx)(q,{...e},e.label))]}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`In the engine composer`}),Ze.map(e=>(0,K.jsx)(q,{...e},e.label))]}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Where things are`}),Qe.map(e=>(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 py-0.5 text-[12px]`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-semibold text-fg`,children:e.label}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 text-subtle`,children:e.detail})]},e.label))]})]})]})})}function J({children:e}){return(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e})}var Y=`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 tt({onClose:e}){let{tasks:t}=T(),n=V(),r=D(),a=(0,R.useRef)(null);L(a);let o=(0,R.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]),[s,u]=(0,R.useState)(o[0]??``),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(``),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(n[0]?.id??`claude`),[x,S]=(0,R.useState)(``),[w,E]=(0,R.useState)(!1),O=s.trim().length>0&&!w,k=async()=>{if(O){E(!0);try{let t={repo:s.trim()};p.trim()&&(t.title=p.trim()),h.trim()&&(t.branch=h.trim()),_.trim()&&(t.baseRef=_.trim()),y&&(t.vendor=y);let{taskId:n,task:a}=await C(`task.create`,t);i(n);let o=x.trim();o&&(c(n,o),l(n)),r({to:`/task/$taskId`,params:{taskId:n}}),await C(`task.setActive`,{taskId:n}).catch(()=>{}),F(`success`,`Task created: ${a?.title||a?.branch||n}`),e()}catch(e){I(`create task`,e)}finally{E(!1)}}};return(0,K.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,K.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,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`New Task`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`worktree + engine session`})]}),(0,K.jsxs)(`form`,{className:`space-y-3 px-3 py-3`,onSubmit:e=>{e.preventDefault(),k()},children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(J,{children:`Repo`}),o.length>0&&!d?(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`select`,{value:s,onChange:e=>u(e.target.value),className:`${Y} min-w-0 flex-1`,children:o.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))}),(0,K.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,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{value:s,onChange:e=>u(e.target.value),placeholder:`/absolute/path/to/repo`,className:`${Y} min-w-0 flex-1 font-mono`}),o.length>0&&(0,K.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,K.jsxs)(`div`,{children:[(0,K.jsx)(J,{children:`Title`}),(0,K.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`optional — auto-titled from the first message`,className:Y})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(J,{children:`Branch`}),(0,K.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto`,className:`${Y} font-mono`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(J,{children:`Base ref`}),(0,K.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:`default branch`,className:`${Y} font-mono`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(J,{children:`Engine`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>b(e.id),className:`border px-2 py-1 text-[11px] transition-colors ${y===e.id?`border-primary bg-inset text-fg`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,children:Ne(n,e.id)},e.id))})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(J,{children:`First prompt`}),(0,K.jsx)(`textarea`,{value:x,onChange:e=>S(e.target.value),placeholder:`optional — waits in the engine composer, ready to send`,rows:2,className:`${Y} resize-none`})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-line pt-3`,children:[(0,K.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,K.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:w?`Creating…`:`Create task`})]})]})]})})}function nt({palette:e}){return(0,K.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,K.jsx)(`span`,{className:`h-5 w-3`,style:{backgroundColor:e}},t))})}function rt(){let{names:e,palettes:t,active:n,overridden:r}=w();return(0,K.jsxs)(`div`,{className:`border border-line bg-surface p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Appearance`}),r?(0,K.jsx)(`button`,{type:`button`,onClick:x,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,K.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`following TUI`})]}),e.length===0?(0,K.jsx)(`p`,{className:`mt-4 text-[12px] text-subtle`,children:`Loading themes…`}):(0,K.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,K.jsxs)(`button`,{type:`button`,onClick:()=>v(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,K.jsx)(nt,{palette:t[e]??{}}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] ${r?`text-fg`:`text-muted`}`,children:e}),r&&(0,K.jsx)(ye,{size:13,strokeWidth:2.5,className:`shrink-0 text-primary`})]},e)})})]})}function it(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 at(){let e=pe();return e.length===0?null:(0,K.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,K.jsxs)(`div`,{className:`pointer-events-auto flex items-start gap-2 border bg-surface px-3 py-2 shadow-lg ${it(e.kind)}`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-[12px] leading-relaxed`,children:e.message}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>ue(e.id),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`dismiss notification`,children:(0,K.jsx)(P,{size:13,strokeWidth:2})})]},e.id))})}function ot(e,t){return`${e.replace(/\/+$/,``)}/task/${encodeURIComponent(t)}`}function st({title:e,body:t,confirmLabel:n,danger:r=!1,busy:i=!1,onConfirm:a,onCancel:o}){let s=(0,R.useRef)(null),c=(0,R.useRef)(null);return L(c),(0,R.useEffect)(()=>{s.current?.focus();let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]),(0,K.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:o,onKeyDown:()=>{},role:`presentation`,children:(0,K.jsxs)(`div`,{ref:c,role:`alertdialog`,"aria-modal":`true`,"aria-label":e,className:`w-96 border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,K.jsx)(`div`,{className:`border-b border-line px-3 py-2 text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:e}),(0,K.jsx)(`p`,{className:`px-3 py-3 text-[12px] leading-relaxed text-muted`,children:t}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-line px-3 py-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:o,className:`border border-line bg-bg px-3 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Cancel`}),(0,K.jsx)(`button`,{ref:s,type:`button`,onClick:a,disabled:i,className:`border px-3 py-1 text-[11px] transition-colors disabled:opacity-40 ${r?`border-kobe-red/50 bg-kobe-red/10 text-kobe-red hover:bg-kobe-red/20`:`border-primary bg-inset text-fg hover:bg-primary/10`}`,children:i?`Working…`:n})]})]})})}async function ct(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 lt(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 ut(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 dt(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.path.toLowerCase().includes(n)):e}var ft=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,pt=[`diff --git`,`index `,`--- `,`+++ `,`new file`,`deleted file`,`rename `,`similarity `,`copy `,`\\ No newline`,`Binary files`];function mt(e){return pt.some(t=>e.startsWith(t))}function ht(e){let t=0,n=0;for(let r of gt(e))r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,deleted:n}}function gt(e){let t=e.replace(/\n$/,``).split(`
|
|
3
|
+
`),n=[],r=0,i=0,a=!1;for(let e of t){let t=ft.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&&(mt(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++):mt(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 _t({added:e,deleted:t}){return e===0&&t===0?null:(0,K.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px]`,children:[(0,K.jsxs)(`span`,{className:`text-kobe-green`,children:[`+`,e]}),` `,(0,K.jsxs)(`span`,{className:`text-kobe-red`,children:[`−`,t]})]})}function vt(e){let{worktreeChanges:t}=T(),n=e?t[e]:void 0;return n?`${n.added}:${n.deleted}`:`none`}function yt({patch:e,wrap:t}){let n=(0,R.useMemo)(()=>gt(e),[e]);return e.trim()?(0,K.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,K.jsxs)(`div`,{className:`kobe-diff-row ${ut(e.kind)}`,children:[(0,K.jsx)(`span`,{className:`kobe-diff-gutter`,children:e.oldLn??``}),(0,K.jsx)(`span`,{className:`kobe-diff-gutter`,children:e.newLn??``}),(0,K.jsx)(`span`,{className:`kobe-diff-text`,children:e.text===``?` `:e.text})]},t))}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`No textual diff for this file.`})}function bt({worktreePath:e,onOpenFile:t}){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(null),c=vt(e),{worktreeChanges:l}=T(),u=e?l[e]:void 0,d=(0,R.useRef)(0),f=(0,R.useCallback)(async()=>{if(!e){r(null),s(null);return}let t=++d.current;a(!0),s(null);try{let n=await ct(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,R.useEffect)(()=>{f()},[f,c]);let[p,m]=(0,R.useState)(``);(0,R.useEffect)(()=>{m(``)},[e]);let h=n?.files??[],g=(0,R.useMemo)(()=>dt(h,p),[h,p]);return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,K.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:[`Changes`,h.length>0?` · ${h.length}`:``]}),u&&(0,K.jsx)(_t,{added:u.added,deleted:u.deleted}),(0,K.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,K.jsx)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-kobe-red`,children:o}):h.length===0?(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,K.jsx)(`div`,{className:`text-[12px] text-subtle`,children:i?`Loading changes…`:`Worktree clean.`})}):(0,K.jsxs)(K.Fragment,{children:[h.length>1&&(0,K.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`&&p&&(e.preventDefault(),m(``))},placeholder:`Filter ${h.length} files…`,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,K.jsx)(`div`,{className:`px-3 py-3 text-center text-[11px] text-subtle`,children:`No files match.`}):(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:g.map(e=>{let n=lt(e.status);return(0,K.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,K.jsx)(`span`,{className:`w-3 shrink-0 text-center font-mono text-[11px] font-bold ${n.cls}`,children:n.label}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] text-fg/90`,children:Pe(e.path,34)}),e.staged&&(0,K.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase text-subtle`,children:`staged`})]},e.path)})})]}):(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,K.jsx)(`div`,{className:`mt-1 max-w-48 text-[12px] leading-relaxed text-subtle`,children:`Select a task to watch its worktree changes.`})]})})]})}function xt({worktreePath:e,path:t}){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e){r(null);return}let n=!1;return s(!0),l(null),ct(e,{path:t}).then(e=>{n||r(e.files.find(e=>e.path===t)??null)}).catch(e=>{n||l(e instanceof Error?e.message:String(e))}).finally(()=>{n||s(!1)}),()=>{n=!0}},[e,t,vt(e)]);let u=n?ht(n.patch):null;return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line px-3`,children:[(0,K.jsx)(`span`,{className:`truncate font-mono text-[12px] text-fg`,title:t,children:t}),u&&(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,K.jsx)(_t,{added:u.added,deleted:u.deleted})}),n&&(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-subtle ${u&&(u.added||u.deleted)?``:`ml-auto`}`,children:n.status}),n&&(0,K.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,K.jsx)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-kobe-red`,children:c}):n?(0,K.jsx)(yt,{patch:n.patch,wrap:i}):o?(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-[12px] text-subtle`,children:`Loading preview…`}):(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-[12px] text-subtle`,children:`No diff for this file.`})]})}function X(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function St(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 Ct(e){let t=e;return t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=St(n.replace(/&/g,`&`));return r?`<a href="${X(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 Z(e){return e.split(/(`[^`]+`)/g).map((e,t)=>t%2==1?`<code class="kobe-md-code">${e.slice(1,-1)}</code>`:Ct(e)).join(``)}function wt(e){let t=e.replace(/\r\n/g,`
|
|
4
|
+
`).split(`
|
|
5
|
+
`),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(X(t[r])),r++;r++,n.push(`<pre class="kobe-md-pre"><code>${e.join(`
|
|
6
|
+
`)}</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">${Z(X(o[2]))}</h${e}>`),r++;continue}if(/^>\s?/.test(e)){a(),n.push(`<blockquote class="kobe-md-quote">${Z(X(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>${Z(X(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>${Z(X(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">${Z(X(l.join(` `)))}</p>`)}return a(),n.join(`
|
|
7
|
+
`)}async function Tt(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 Et(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 Dt(e){switch(e){case`saving`:return`saving…`;case`saved`:return`saved`;case`error`:return`save failed`;default:return``}}var Ot=600;function kt({children:e,right:t}){return(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t]})}function At({taskId:e,full:t=!1}){let[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(`idle`),u=(0,R.useMemo)(()=>wt(n),[n]),d=(0,R.useRef)(null),f=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(d.current&&clearTimeout(d.current),f.current=e,l(`idle`),r(``),a(!1),!e)return;let t=!1;return s(!0),Tt(e).then(n=>{!t&&f.current===e&&r(n)}).catch(()=>{!t&&f.current===e&&r(``)}).finally(()=>{t||s(!1)}),()=>{t=!0}},[e]),(0,R.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let p=(0,R.useCallback)(t=>{if(r(t),!e)return;let n=e;l(`saving`),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{Et(n,t).then(()=>{f.current===n&&l(`saved`)}).catch(()=>{f.current===n&&l(`error`)})},Ot)},[e]);return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-bg`,children:[(0,K.jsx)(kt,{right:e?(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c!==`idle`&&(0,K.jsx)(`span`,{className:`text-[10px] ${c===`error`?`text-kobe-red`:`text-subtle`}`,children:Dt(c)}),(0,K.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,K.jsx)(`div`,{className:`min-h-0 flex-1 ${t?`px-0 pb-0`:`px-3 pb-3`}`,children:e?i?(0,K.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,K.jsx)(`div`,{className:`kobe-md text-[12px] leading-relaxed text-fg`,dangerouslySetInnerHTML:{__html:u}}):(0,K.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Nothing to preview yet.`})}):(0,K.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,K.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,K.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`],Mt=`DIRTY_WORKTREE`;function Nt(e){return e.replace(/_/g,` `)}function Q({name:e,value:t,mono:n=!1}){return(0,K.jsxs)(`div`,{className:`min-w-0 border-b border-line-subtle py-2 last:border-b-0`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),(0,K.jsx)(`div`,{className:`mt-1 min-w-0 truncate text-[12px] text-fg ${n?`font-mono`:``}`,title:t,children:t||`—`})]})}function $({children:e,onClick:t,disabled:n,danger:r=!1}){return(0,K.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 Pt({task:e}){let[t,n]=(0,R.useState)(e?.title??``),[r,i]=(0,R.useState)(e?.branch??``),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]);let[u,d]=(0,R.useState)(null),p=V(),m=D();if((0,R.useEffect)(()=>{n(e?.title??``)},[e?.title]),(0,R.useEffect)(()=>{i(e?.branch??``)},[e?.branch]),!e)return(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,K.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 h=async(e,t)=>{o(e);try{await t()}catch(t){I(e.split(`:`)[0],t)}finally{o(null)}},g=()=>{let n=t.trim();!n||n===e.title||h(`rename`,()=>C(`task.rename`,{taskId:e.id,title:n}))},_=()=>{let t=r.trim();!t||t===e.branch||h(`branch`,()=>C(`task.setBranch`,{taskId:e.id,branch:t}))},v=e=>t=>{t&&(c(e),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>c(null),1200))},y=()=>{de(e.worktreePath).then(v(`path`))},b=()=>{de(ot(window.location.origin,e.id)).then(v(`link`))},x=()=>{d(null),h(`archive`,async()=>{await C(`task.archive`,{taskId:e.id,archived:!0}),f(),m({to:`/`}),await C(`task.setActive`,{taskId:null})})},S=()=>{h(`restore`,()=>C(`task.archive`,{taskId:e.id,archived:!1}))},w=t=>{d(null),o(`delete`),(async()=>{try{await C(`task.delete`,{taskId:e.id,force:t}),f(),m({to:`/`}),await C(`task.setActive`,{taskId:null}).catch(()=>{}),F(`success`,`Deleted "${e.title||e.branch}"`)}catch(e){let n=e instanceof Error?e.message:String(e);!t&&n.includes(Mt)?d({kind:`delete`,force:!0}):I(`delete`,e)}finally{o(null)}})()};return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,K.jsxs)(`div`,{className:`border-b border-line px-3 py-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Task`}),(0,K.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,K.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),onBlur:g,onKeyDown:e=>{e.key===`Enter`&&g()},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,K.jsx)($,{onClick:g,disabled:a===`rename`,children:`Save`})]}),e.archived&&(0,K.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,K.jsx)(`span`,{className:`text-[11px] text-kobe-yellow`,children:`archived`}),(0,K.jsx)($,{onClick:S,disabled:a!==null,children:`Restore`})]})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:[e.kind===`main`?(0,K.jsx)(Q,{name:`Branch`,value:e.branch,mono:!0}):(0,K.jsxs)(`div`,{className:`min-w-0 border-b border-line-subtle py-2`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Branch`}),(0,K.jsx)(`div`,{className:`mt-1 flex gap-2`,children:(0,K.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onBlur:_,onKeyDown:e=>{e.key===`Enter`&&_()},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,K.jsx)(Q,{name:`Vendor`,value:e.vendor??`claude`}),(0,K.jsx)(Q,{name:`Worktree`,value:e.worktreePath,mono:!0}),(0,K.jsx)(Q,{name:`Repo`,value:e.repo,mono:!0}),(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Status`}),(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:jt.map(t=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>void h(`status:${t}`,()=>C(`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:Nt(t)},t))})]}),(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Vendor`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:p.map(t=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>void h(`vendor:${t.id}`,()=>C(`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,K.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,K.jsx)($,{onClick:()=>void h(`pin`,()=>C(`task.pin`,{taskId:e.id,pinned:!e.pinned})),disabled:a!==null,children:e.pinned?`Unpin`:`Pin`}),(0,K.jsx)($,{onClick:()=>void h(`worktree`,()=>C(`task.ensureWorktree`,{taskId:e.id})),disabled:a!==null,children:`Ensure worktree`}),(0,K.jsx)($,{onClick:y,children:s===`path`?`Copied`:`Copy path`}),(0,K.jsx)($,{onClick:b,children:s===`link`?`Copied`:`Copy link`}),!e.archived&&(0,K.jsx)($,{onClick:()=>d({kind:`archive`}),disabled:a!==null,danger:!0,children:`Archive`})]}),e.kind!==`main`&&(0,K.jsxs)(`div`,{className:`mt-4 border-t border-line-subtle pt-3`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Danger zone`}),(0,K.jsx)($,{onClick:()=>d({kind:`delete`,force:!1}),disabled:a!==null,danger:!0,children:`Delete task + worktree`})]})]}),u?.kind===`archive`&&(0,K.jsx)(st,{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:x,onCancel:()=>d(null)}),u?.kind===`delete`&&(0,K.jsx)(st,{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:()=>w(u.force),onCancel:()=>d(null)})]})}function Ft({drawer:t=!1,onClose:n}={}){let[r,i]=(0,R.useState)(`overview`),{selectedTaskId:a}=e(),{tasks:o}=T(),c=a?o.find(e=>e.id===a)??null:null;return(0,K.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,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-stretch border-b border-line bg-surface`,children:[[`overview`,`notes`,`changes`].map(e=>(0,K.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,K.jsx)(`button`,{type:`button`,onClick:n,className:`ml-auto px-3 text-subtle hover:text-fg`,"aria-label":`Close tools`,children:(0,K.jsx)(P,{size:14,strokeWidth:2})})]}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:r===`overview`?(0,K.jsx)(Pt,{task:c}):r===`notes`?(0,K.jsx)(At,{taskId:a,full:!0}):(0,K.jsx)(bt,{worktreePath:c?.worktreePath??null,onOpenFile:e=>{a&&s(a,e)}})})]})}var It=(0,R.lazy)(()=>_(()=>import(`./ChatTerminal-BMSvAiAB.js`).then(e=>({default:e.ChatTerminal})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function Lt(){return(0,K.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-[12px] text-subtle`,children:`Loading terminal…`})}function Rt(e){return e??`claude`}function zt({taskId:e,tabId:t,vendor:n}){return(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center px-6`,children:(0,K.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:ve,action:()=>u(e,t,`vendor`)},{title:`Chat`,detail:`transcript`,body:`Read the session as structured messages and tool calls.`,icon:Te,action:()=>u(e,t,`transcript`)},{title:`Terminal`,detail:`shell / worktree`,body:`Open a command shell in this task worktree.`,icon:Ae,action:()=>u(e,t,`terminal`)}].map(e=>{let t=e.icon;return(0,K.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,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.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,K.jsx)(t,{size:17,strokeWidth:1.8})}),(0,K.jsx)(`span`,{className:`truncate text-[10px] uppercase text-subtle`,children:e.detail})]}),(0,K.jsx)(`div`,{className:`mt-5 text-[12px] font-bold uppercase tracking-[0.12em] text-fg`,children:e.title}),(0,K.jsx)(`div`,{className:`mt-2 text-[12px] leading-relaxed text-subtle`,children:e.body})]},e.title)})})})}function Bt({tab:e,taskId:t,taskWorktreePath:n,taskTitle:r,vendor:i}){return e?.kind===`empty`?(0,K.jsx)(zt,{taskId:t,tabId:e.id,vendor:i}):e?.kind===`vendor`?(0,K.jsx)(R.Suspense,{fallback:(0,K.jsx)(Lt,{}),children:(0,K.jsx)(It,{tabId:e.id,taskId:t,mode:`engine`},e.id)}):e?.kind===`terminal`?(0,K.jsx)(R.Suspense,{fallback:(0,K.jsx)(Lt,{}),children:(0,K.jsx)(It,{tabId:e.id,taskId:t,mode:`shell`},e.id)}):e?.kind===`transcript`?(0,K.jsx)(me,{worktreePath:n,vendor:i,title:r},e.id):e?.kind===`file`?(0,K.jsx)(xt,{worktreePath:n,path:e.path},e.id):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`Opening a tab…`})}function Vt({tab:e,side:t,children:n,onCloseSplit:r}){return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[t===`right`&&(0,K.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center justify-between border-b border-line bg-surface px-3`,children:[(0,K.jsx)(`span`,{className:`truncate text-[11px] text-muted`,children:e?.title??`Split`}),(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`text-[11px] text-subtle hover:text-fg`,"aria-label":`close split`,title:`Close split`,children:`×`})]}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1 p-2`,children:n})]})}function Ht(){let[n,r]=(0,R.useState)(!1),[i,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(!1),{selectedTaskId:u,tabsByTask:f,activeByTask:m,splitByTask:g}=e(),_=V(),{tasks:v}=T(),y=u?v.find(e=>e.id===u):null,b=u?f[u]??[]:[],x=u?m[u]:void 0,S=u?g[u]:void 0,w=e=>{if(!u)return;let n=b.find(t=>t.id===e);t(u,e),(n?.kind===`vendor`||n?.kind===`terminal`)&&h(e)},E=b.find(e=>e.id===x)??b[0],D=S&&S!==E?.id?b.find(e=>e.id===S):void 0,O=Rt(y?.vendor),k=y?.title||y?.branch||`Session`,A=e=>{u&&(r(!1),C(`task.setVendor`,{taskId:u,vendor:e}).catch(e=>I(`switch engine`,e)))};return(0,K.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col bg-bg`,children:[(0,K.jsx)(`div`,{className:`flex h-9 shrink-0 items-stretch border-b border-line bg-surface`,children:u?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-stretch overflow-x-auto`,role:`tablist`,children:[b.map(e=>{let t=e.id===E?.id,n=e.id===D?.id;return(0,K.jsxs)(`div`,{role:`tab`,"aria-selected":t,tabIndex:0,draggable:!0,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id),s(e.id)},onDragEnd:()=>{s(null),l(!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,K.jsx)(`button`,{type:`button`,onClick:()=>d(u,e.id),className:`max-w-40 cursor-grab truncate active:cursor-grabbing`,title:n?`${e.title} (split)`:e.title,children:e.title}),n&&(0,K.jsx)(`span`,{className:`text-[9px] font-bold uppercase text-kobe-blue`,children:`Split`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>w(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,K.jsx)(`button`,{type:`button`,onClick:()=>p(u),className:`px-3 text-[13px] text-subtle hover:text-fg`,"aria-label":`new tab`,title:`New tab`,children:`+`})]}),(0,K.jsxs)(`div`,{className:`relative flex shrink-0 items-center border-l border-line px-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`rounded border border-line bg-bg px-2 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,title:`Select vendor / model`,children:O}),n&&(0,K.jsx)(`div`,{className:`absolute right-2 top-8 z-10 w-40 border border-line bg-menu shadow-xl`,children:_.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(e.id),className:`block w-full px-3 py-2 text-left text-[12px] hover:bg-inset ${e.id===O?`text-primary`:`text-muted`}`,children:e.label},e.id))})]})]}):(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-[11px] text-subtle`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-subtle`}),`No task selected`]})}),(0,K.jsxs)(`section`,{className:`relative min-h-0 flex-1`,"aria-label":`Workspace`,onDragOver:e=>{if(!u||!i)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect();l(e.clientX>t.left+t.width/2)},onDragLeave:()=>l(!1),onDrop:e=>{if(!u||!i)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect();e.clientX>t.left+t.width/2?a(u,i):d(u,i),s(null),l(!1)},children:[u&&E?(0,K.jsxs)(`div`,{className:`flex h-full min-w-0`,children:[(0,K.jsx)(Vt,{tab:E,side:`left`,children:(0,K.jsx)(Bt,{tab:E,taskId:u,taskWorktreePath:y?.worktreePath??null,taskTitle:k,vendor:O})}),D&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`w-px shrink-0 bg-line`}),(0,K.jsx)(Vt,{tab:D,side:`right`,onCloseSplit:()=>{u&&o(u)},children:(0,K.jsx)(Bt,{tab:D,taskId:u,taskWorktreePath:y?.worktreePath??null,taskTitle:k,vendor:O})})]})]}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-md`,children:[(0,K.jsx)(`div`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe web]`}),(0,K.jsx)(`h1`,{className:`mt-4 text-[18px] font-semibold text-fg`,children:y?`Opening workspace…`:`Select a task to open its workspace.`}),(0,K.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.`})]})}),i&&(0,K.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 ${c?`border-primary bg-primary/10`:`border-line bg-inset/40`}`,children:(0,K.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 Ut({children:e,suffix:t}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`h-px flex-1 bg-line`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] font-bold uppercase text-primary`,children:t})]}):null]})}function Wt({task:e,engine:t,job:n,changes:r,conflict:i,active:a,onClick:o}){let s=n?.phase===`running`,c=s?`materializing…`:k(t?.state),l=N(e.updatedAt||e.createdAt);return(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s?(0,K.jsx)(we,{size:10,strokeWidth:2.5,className:`shrink-0 animate-spin text-primary`}):(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${j(t?.state)}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${a?`text-fg`:`text-fg/90`}`,children:e.title||e.branch}),(0,K.jsx)(ne,{badge:i}),(0,K.jsx)(ae,{pr:e.prStatus}),e.pinned&&(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`PIN`}),(0,K.jsx)(se,{counts:r})]}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 pl-3.5 text-[11px] text-subtle`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.branch||`—`}),(0,K.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[c&&(0,K.jsx)(`span`,{className:`text-muted`,children:c}),l&&(0,K.jsx)(`span`,{className:`text-subtle`,children:l})]})]})]})}function Gt({task:e,onRestore:t}){return(0,K.jsxs)(`div`,{className:`group flex items-center gap-2 border-l-2 border-transparent px-3 py-1.5`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] text-subtle`,children:e.title||e.branch}),(0,K.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 Kt({onOpenSettings:t,onNewTask:n,onAdopt:r}){let{tasks:a,engineStates:o,jobs:s,worktreeChanges:c,conflicts:l,uiPrefs:u,hydrated:d,streamConnected:f}=T(),{selectedTaskId:p}=e(),m=(0,R.useMemo)(()=>{let e=e=>{let t=a.find(t=>t.id===e);return t?.title||t?.branch||e},t=new Map;for(let n of new Set(l.flatMap(e=>[e.a,e.b]))){let r=ie(l,n);r&&t.set(n,{...r,tip:te(l,n,e)})}return t},[l,a]),{query:h,statusFilter:g,sortMode:_,showArchived:v}=Ve(),y=(0,R.useRef)(null),b=(0,R.useRef)(null);(0,R.useEffect)(()=>{p&&y.current?.querySelector(`[data-task-id="${CSS.escape(p)}"]`)?.scrollIntoView({block:`nearest`})},[p]);let x=u?.sortMode;(0,R.useEffect)(()=>{ze(x)},[x]);let S=(0,R.useMemo)(()=>a.filter(e=>!e.archived),[a]),w=(0,R.useMemo)(()=>a.filter(e=>e.archived&&e.kind!==`main`),[a]),O=(0,R.useMemo)(()=>oe(S.filter(e=>re(e,h)&&E(o[e.id],c[e.worktreePath],g)),_),[S,h,g,_,o,c]),k=O.filter(e=>e.kind===`main`),A=O.filter(e=>e.kind!==`main`),j=!d||!f&&a.length===0,M=D(),N=e=>{i(e),C(`task.setActive`,{taskId:e}).catch(()=>{}),M({to:`/task/$taskId`,params:{taskId:e}})};(0,R.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(),b.current?.focus();return}if(n&&o&&o!==document.body&&!y.current?.contains(o)||O.length===0)return;e.preventDefault();let s=O.findIndex(e=>e.id===p);N(O[s===-1?0:Math.min(Math.max(s+(r?1:-1),0),O.length-1)].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O,p]);let ne=e=>{C(`task.archive`,{taskId:e.id,archived:!1}).catch(t=>I(`restore "${e.title||e.branch}"`,t))};return(0,K.jsxs)(`aside`,{className:`flex w-64 shrink-0 flex-col border-r border-line bg-bg`,children:[(0,K.jsxs)(`div`,{className:`border-b border-line bg-surface/50 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Tasks`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>Le(_==="default"?`recent`:`default`),className:`font-mono text-[10px] uppercase ${_===`recent`?`text-primary`:`text-muted hover:text-fg`}`,title:`Toggle task sort`,children:`sort`}),(0,K.jsxs)(`span`,{className:`font-mono text-[10px] text-muted`,children:[O.length,`/`,S.length]}),(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted transition-colors hover:text-primary`,title:`Adopt an existing worktree`,"aria-label":`Adopt worktree`,children:(0,K.jsx)(Se,{size:14,strokeWidth:1.9})}),(0,K.jsx)(`button`,{type:`button`,onClick:n,className:`text-muted transition-colors hover:text-primary`,title:`New task`,"aria-label":`New task`,children:(0,K.jsx)(Oe,{size:14,strokeWidth:2.2})})]})]}),(0,K.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,K.jsx)(ee,{size:14,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,K.jsx)(`input`,{ref:b,value:h,onChange:e=>G(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O.length>0?(e.preventDefault(),N(O[0].id),e.currentTarget.blur()):e.key===`Escape`&&h&&(e.preventDefault(),G(``))},placeholder:`Filter tasks`,className:`min-w-0 flex-1 bg-transparent text-fg placeholder:text-subtle focus:outline-none`}),h&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>G(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear task filter`,title:`Clear filter`,children:(0,K.jsx)(P,{size:13,strokeWidth:2})})]}),(0,K.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`},{key:`working`,label:`Run`,title:`Engine running`},{key:`changes`,label:`Dirty`,title:`Uncommitted changes`}].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>Ie(e.key),title:e.title,className:`border px-1.5 py-0.5 text-[10px] transition-colors ${g===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,K.jsxs)(`div`,{ref:y,className:`flex-1 overflow-y-auto`,children:[j?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-[12px] text-subtle`,children:[(0,K.jsx)(we,{size:13,strokeWidth:2,className:`animate-spin`}),(0,K.jsx)(`span`,{children:`connecting…`})]}):S.length===0?(0,K.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,K.jsx)(`p`,{children:`No tasks yet.`}),(0,K.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`})]}):O.length===0?(0,K.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,K.jsx)(`div`,{children:h?`No matches for “${h}”.`:`No tasks in this status.`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{G(``),Ie(`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,K.jsxs)(K.Fragment,{children:[k.length>0&&(0,K.jsx)(Ut,{children:`Projects`}),k.map(e=>(0,K.jsx)(Wt,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],conflict:m.get(e.id)??null,active:e.id===p,onClick:()=>N(e.id)},e.id)),A.length>0&&(0,K.jsx)(Ut,{suffix:_==="default"?void 0:_,children:`Worktrees`}),A.map(e=>(0,K.jsx)(Wt,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],conflict:m.get(e.id)??null,active:e.id===p,onClick:()=>N(e.id)},e.id))]}),!j&&w.length>0&&(0,K.jsxs)(`div`,{className:`mt-2 border-t border-line-subtle pb-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Re(!v),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Archived`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:w.length}),(0,K.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-subtle`,children:v?`−`:`+`})]}),v&&w.map(e=>(0,K.jsx)(Gt,{task:e,onRestore:()=>ne(e)},e.id))]})]}),(0,K.jsx)(`div`,{className:`border-t border-line p-2`,children:(0,K.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,K.jsx)(ke,{size:15,strokeWidth:1.8}),(0,K.jsx)(`span`,{children:`Settings`})]})})]})}function qt({onToggleTools:t,onShowHelp:n}){let{daemonConnected:r,streamConnected:i,tasks:a}=T(),{selectedTaskId:o}=e(),s=D(),c=o?a.find(e=>e.id===o):null,l=r&&i;return(0,K.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-3 border-b border-line bg-surface px-3`,children:[(0,K.jsx)(`span`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe]`}),c?(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`max-w-56 truncate rounded bg-inset px-2 py-0.5 text-[11px] text-fg`,children:c.title||c.branch}),(0,K.jsx)(`span`,{className:`hidden max-w-40 truncate font-mono text-[11px] text-subtle md:inline`,children:c.branch})]}):(0,K.jsx)(`span`,{className:`rounded bg-inset px-2 py-0.5 text-[11px] text-muted`,children:`Workspace`}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[11px] text-subtle`,children:[(0,K.jsxs)(`span`,{className:`hidden items-center gap-1.5 sm:flex`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${l?`bg-kobe-green`:`bg-kobe-yellow`}`}),(0,K.jsx)(`span`,{children:l?`daemon connected`:i?`no daemon`:`connecting…`})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>s({to:`/overview`}),className:`flex items-center text-muted transition-colors hover:text-fg`,"aria-label":`Overview`,title:`Overview — triage all tasks`,children:(0,K.jsx)(Ce,{size:15,strokeWidth:1.8})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>s({to:`/board`}),className:`flex items-center text-muted transition-colors hover:text-fg`,"aria-label":`Board`,title:`Board — tasks by status`,children:(0,K.jsx)(xe,{size:15,strokeWidth:1.8})}),(0,K.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,K.jsx)(be,{size:15,strokeWidth:1.8})}),(0,K.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,K.jsx)(De,{size:15,strokeWidth:1.8})})]})]})}function Jt(){let{daemonConnected:e,streamConnected:t,hydrated:n}=T(),[r,i]=(0,R.useState)(!1);return!(n&&t&&!e)||r?null:(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-kobe-yellow/40 bg-kobe-yellow/10 px-3 py-1.5 text-[11px] text-kobe-yellow`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-kobe-yellow`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:`The kobe daemon is offline — task data is frozen and mutations will fail until it reconnects (it auto-reconnects; the dashboard recovers on its own).`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(!0),className:`shrink-0 text-kobe-yellow/70 hover:text-kobe-yellow`,"aria-label":`dismiss`,children:(0,K.jsx)(P,{size:13,strokeWidth:2})})]})}function Yt(){let{tasks:t,update:n}=T(),{selectedTaskId:r}=e(),i=r?t.find(e=>e.id===r):null,a=t.filter(e=>!e.archived).length;return(0,K.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,K.jsxs)(`span`,{children:[a,` task`,a===1?``:`s`]}),i&&(0,K.jsxs)(`span`,{className:`min-w-0 truncate text-muted`,children:[i.kind===`main`?`project`:`worktree`,` ·`,` `,Pe(i.worktreePath,54)]}),(0,K.jsx)(`span`,{className:`ml-auto`,children:n?.latest?`update ${n.latest} available`:`kobe web`})]})}function Xt(){let e=V();return(0,K.jsxs)(`div`,{className:`border border-line bg-surface p-4`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Engines`}),(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:e.map(e=>(0,K.jsx)(`span`,{className:`border border-line bg-bg px-2 py-1 font-mono text-[11px] text-muted`,title:e.id,children:e.label},e.id))}),(0,K.jsx)(`p`,{className:`mt-3 text-[11px] leading-relaxed text-subtle`,children:`Detected engine CLIs plus any custom engines you've registered. Switch a task's engine from its Task panel or the workspace tab dropdown.`})]})}function Zt(){let{supported:e,permission:t,enabled:n}=y();return(0,K.jsxs)(`div`,{className:`border border-line bg-surface p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Notifications`}),e?(0,K.jsx)(`button`,{type:`button`,onClick:()=>void S(!n),disabled:t===`denied`&&!n,className:`border px-2 py-0.5 text-[10px] transition-colors disabled:opacity-40 ${n?`border-primary bg-inset text-fg`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,children:n?`On`:`Off`}):(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`unsupported`})]}),(0,K.jsx)(`p`,{className:`mt-3 text-[11px] leading-relaxed text-subtle`,children:t===`denied`&&!n?`Browser notifications are blocked — allow them in your browser's site settings to enable.`:`Get a desktop notification when a task needs your input or errors while this tab is in the background. Click it to jump to the task.`})]})}function Qt(){let[e,t]=(0,R.useState)(!1),n=D();return(0,K.jsxs)(`div`,{className:`border border-line bg-surface p-4`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Workspace`}),(0,K.jsx)(`p`,{className:`mt-3 text-[11px] leading-relaxed text-subtle`,children:`Reset the per-task tab layout (open tabs, splits, selection) if it ever gets wedged or cluttered. Pure browser state — your tasks, worktrees, and notes are untouched.`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{if(!e){t(!0);return}r(),n({to:`/`}),t(!1)},onBlur:()=>t(!1),className:`mt-3 border px-3 py-1.5 text-[11px] transition-colors ${e?`border-kobe-red/50 bg-kobe-red/10 text-kobe-red`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,children:e?`Click again to reset layout`:`Reset layout`})]})}function $t(){let[e,t]=(0,R.useState)(``),[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{let e=!1;return le().then(n=>{e||(t(n.review??``),r(n.pr??``),a(!0))}),()=>{e=!0}},[]),(0,K.jsxs)(`div`,{className:`border border-line bg-surface p-4 md:col-span-2`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Board quick actions`}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-3 text-[12px]`,children:[(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:`Review template`}),(0,K.jsx)(`textarea`,{value:e,onChange:e=>t(e.target.value),placeholder:`default: ${he(`claude`)}`,rows:2,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,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:`Open-PR template`}),(0,K.jsx)(`textarea`,{value:n,onChange:e=>r(e.target.value),placeholder:`default:\n${ce}`,rows:4,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,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`text-[11px] text-subtle`,children:`Empty = built-in default. kobe appends its status/URL clause after your template — the guardrails stay regardless.`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{fe({review:e,pr:n}).then(()=>F(`success`,`quick-action templates saved`)).catch(e=>I(`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 en({onClose:e}){let{daemonConnected:t,streamConnected:n,update:r}=T();return(0,K.jsxs)(`section`,{"data-settings-open":!0,className:`flex min-w-0 flex-1 flex-col bg-bg`,children:[(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center justify-between border-b border-line bg-surface px-3`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Settings`}),(0,K.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,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,K.jsxs)(`div`,{className:`grid max-w-3xl grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,K.jsx)($t,{}),(0,K.jsxs)(`div`,{className:`border border-line bg-surface p-4`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Connection`}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-3 text-[12px]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:`Daemon`}),(0,K.jsx)(`span`,{className:t?`text-kobe-green`:`text-kobe-yellow`,children:t?`connected`:`offline`})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:`Event stream`}),(0,K.jsx)(`span`,{className:n?`text-kobe-green`:`text-kobe-yellow`,children:n?`connected`:`connecting`})]})]})]}),(0,K.jsxs)(`div`,{className:`border border-line bg-surface p-4`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Version`}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-3 text-[12px]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:`Current`}),(0,K.jsx)(`span`,{className:`text-fg`,children:typeof r?.current==`string`?r.current:`unknown`})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-muted`,children:`Latest`}),(0,K.jsx)(`span`,{className:`text-fg`,children:typeof r?.latest==`string`?r.latest:`unknown`})]})]})]}),(0,K.jsx)(`div`,{className:`md:col-span-2`,children:(0,K.jsx)(rt,{})}),(0,K.jsx)(Zt,{}),(0,K.jsx)(Qt,{}),(0,K.jsx)(`div`,{className:`md:col-span-2`,children:(0,K.jsx)(Xt,{})})]})})]})}function tn(){let e=D(),[t,n]=(0,R.useState)(!1),[r,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1);return(0,R.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,R.useEffect)(()=>(b(t=>{i(t),C(`task.setActive`,{taskId:t}).catch(()=>{}),e({to:`/task/$taskId`,params:{taskId:t}})}),()=>b(null)),[e]),(0,K.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,K.jsx)(qt,{onToggleTools:()=>p(e=>!e),onShowHelp:()=>d(!0)}),(0,K.jsx)(Jt,{}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,K.jsx)(Kt,{onOpenSettings:()=>n(!0),onNewTask:()=>a(!0),onAdopt:()=>s(!0)}),t?(0,K.jsx)(en,{onClose:()=>n(!1)}):(0,K.jsx)(Ht,{}),(0,K.jsx)(`div`,{className:`hidden lg:flex`,children:(0,K.jsx)(Ft,{})}),f&&(0,K.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,K.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,K.jsx)(Ft,{drawer:!0,onClose:()=>p(!1)})})})]}),(0,K.jsx)(Yt,{}),r&&(0,K.jsx)(tt,{onClose:()=>a(!1)}),o&&(0,K.jsx)(He,{onClose:()=>s(!1)}),u&&(0,K.jsx)(et,{onClose:()=>d(!1)}),(0,K.jsx)(Je,{open:c,onClose:()=>l(!1),onNewTask:()=>a(!0),onOpenSettings:()=>n(!0)}),(0,K.jsx)(at,{})]})}export{tn as t};
|