@sma1lboy/kobe 0.7.53 → 0.7.55
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 +207 -205
- package/dist/web-ui/assets/AppShell-DatLbUH8.js +5 -0
- package/dist/web-ui/assets/{Board-Cb_qgK8p.js → Board-eEGLQBF4.js} +1 -1
- package/dist/web-ui/assets/{BoardPeek-BhMuWjKj.js → BoardPeek-BN0d-Zie.js} +1 -1
- package/dist/web-ui/assets/{ChatTranscript-DdXMAQZR.js → ChatTranscript-CzQspNKE.js} +1 -1
- package/dist/web-ui/assets/{ConfirmDialog-NPI1j7RW.js → ConfirmDialog-BPIwmIjt.js} +1 -1
- package/dist/web-ui/assets/IssueIntakePanel-BF7ifkKK.js +1 -0
- package/dist/web-ui/assets/IssuePeek-DTInqza8.js +1 -0
- package/dist/web-ui/assets/{IssuesPage-zQbthJwx.js → IssuesPage-Bx7iHFBo.js} +1 -1
- package/dist/web-ui/assets/{SlideOver-CLaRtSQE.js → RichEditor-DvjbbcLw.js} +52 -52
- package/dist/web-ui/assets/{SettingsPage-BT-LGgyI.js → SettingsPage-DZ25Tk5v.js} +2 -2
- package/dist/web-ui/assets/SlideOver-D9BDfm6L.js +1 -0
- package/dist/web-ui/assets/{ViewToggle-Cok6O_mP.js → ViewToggle-DsJBr4VT.js} +1 -1
- package/dist/web-ui/assets/{WorkspaceTabs-DmfAn-hk.js → WorkspaceTabs-C2pSVT1A.js} +1 -1
- package/dist/web-ui/assets/board-rpuYw0Ze.js +1 -0
- package/dist/web-ui/assets/{index-CZ8GNIM9.js → index-BC9H3mAq.js} +2 -2
- package/dist/web-ui/assets/issues-CvEDCZIa.js +1 -0
- package/dist/web-ui/assets/{issues-Dq7AkivK.js → issues-YCoQHBtW.js} +1 -1
- package/dist/web-ui/assets/{lazy-issue-panels-CAA0flSv.js → lazy-issue-panels-C8OnZML2.js} +3 -3
- package/dist/web-ui/assets/routes-BvOMdZDM.js +1 -0
- package/dist/web-ui/assets/{task._taskId-DBT8vG_M.js → task._taskId-DweEr9w7.js} +1 -1
- package/dist/web-ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/web-ui/assets/AppShell-CYm01lx0.js +0 -5
- package/dist/web-ui/assets/IssueIntakePanel-60iwjJTZ.js +0 -1
- package/dist/web-ui/assets/IssuePeek-BbXifAKp.js +0 -1
- package/dist/web-ui/assets/board-BEUe7jtL.js +0 -1
- package/dist/web-ui/assets/issues-DkAiF0x1.js +0 -1
- package/dist/web-ui/assets/routes-DBeL-4xe.js +0 -1
- /package/dist/web-ui/assets/{SlideOver-B4sEOPyN.css → RichEditor-B4sEOPyN.css} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{S as e,_ as t,f as n,l as r,r as i,y as a}from"./tabs-Db1r1FTh.js";import{a as o,n as s,r as c}from"./toast-CfAxitbT.js";import{d as l,t as u}from"./createLucideIcon-BoVlWivB.js";import{n as d,t as f}from"./ViewToggle-DsJBr4VT.js";import{n as p,t as m}from"./store-BXWXnGds.js";import{i as h}from"./terminal-Ckm9XXat.js";import{i as g,n as _}from"./settings-B_VT_pPR.js";import{i as v,r as y,t as b}from"./WorkspaceTabs-C2pSVT1A.js";import{t as x}from"./SettingsPage-DZ25Tk5v.js";import{n as S,r as C,t as w}from"./ChatTranscript-CzQspNKE.js";import{C as T,S as E,b as D,d as O,f as k,g as ee,h as te,l as ne,m as re,n as ie,o as ae,p as oe,r as A,s as se,u as j,v as M,w as N,x as P,y as F}from"./index-BC9H3mAq.js";import{t as I}from"./text-match-C3BRtNXy.js";import{r as L}from"./web-transport-BS7imUMS.js";import{t as R}from"./SlideOver-D9BDfm6L.js";import{a as z,i as B,n as V,r as ce,t as H}from"./ConfirmDialog-BPIwmIjt.js";var le=u(`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`}]]),ue=u(`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`}]]),U=u(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),de=u(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),W=e(a(),1),G=g({query:``,statusFilter:`all`,sortMode:`default`,showArchived:!1}),K=null;function q(e){G.update(t=>({...t,...e}))}function J(e){q({query:e})}function fe(e){q({statusFilter:e})}function pe(e){q({sortMode:e})}function me(e){q({showArchived:e})}function he(e){!e||e===K||(K=e,q({sortMode:e}))}function ge(){return G.useSnapshot()}function _e(e){let t=Date.parse(e.updatedAt||e.createdAt);return Number.isFinite(t)?t:0}function ve(e,t){let n=_e(t)-_e(e);return n===0?t.id.localeCompare(e.id):n}function ye(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(ve),i.sort(ve)),[...n,...r,...i]}function be(e,t){return I([e.title,e.branch,e.repo,e.worktreePath,e.vendor,e.status].filter(Boolean).join(` `),t)}var Y=l();function xe({onClose:e}){let{tasks:t}=p(),r=o(),i=(0,W.useRef)(null);j(i);let a=(0,W.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]),l=(0,W.useMemo)(()=>new Set(t.map(e=>e.worktreePath).filter(Boolean)),[t]),[u,d]=(0,W.useState)(a[0]??``),[f,h]=(0,W.useState)(null),[g,_]=(0,W.useState)(!1),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)(!1),S=async e=>{if(e){_(!0),h(null);try{let{worktrees:t}=await m(`worktree.discoverAdoptable`,{repo:e});h(t)}catch(e){c(`scan worktrees`,e),h([])}finally{_(!1)}}},w=async t=>{y(t.path);try{let{task:i}=await m(`worktree.adopt`,{repo:u,worktreePath:t.path,branch:t.branch,ifExists:`return`});n(i.id),N(i.id),r({to:`/task/$taskId`,params:{taskId:i.id}}),s(`success`,`Adopted ${t.branch||t.path}`),e()}catch(e){c(`adopt worktree`,e)}finally{y(null)}};return b?(0,Y.jsx)(A,{onClose:e}):a.length===0?(0,Y.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,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,Y.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,Y.jsxs)(`div`,{className:`px-3 py-6 text-center`,children:[(0,Y.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,Y.jsx)(`button`,{type:`button`,onClick:()=>x(!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,Y.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,Y.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,Y.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,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,Y.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-3`,children:[(0,Y.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Repo`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`select`,{value:u,onChange:e=>d(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,Y.jsx)(`option`,{value:e,children:e},e))}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void S(u),disabled:!u||g,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:g?`Scanning…`:`Scan`})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-line`,children:f===null?(0,Y.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`Pick a repo and Scan to find adoptable worktrees.`}):f.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`No adoptable worktrees found for this repo.`}):f.map(e=>{let t=l.has(e.path);return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-subtle px-3 py-2 last:border-b-0`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`truncate font-mono text-[12px] text-fg`,children:e.branch||`(detached)`}),e.dirty&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[10px] text-kobe-yellow`,children:`dirty`}),e.kobeManaged&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`kobe`})]}),(0,Y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-subtle`,children:[(0,Y.jsx)(`span`,{className:`truncate font-mono`,children:e.path}),e.lastActivityMs>0&&(0,Y.jsx)(`span`,{className:`ml-auto shrink-0`,children:C(e.lastActivityMs)})]})]}),t?(0,Y.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`tracked`}):(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void w(e),disabled:v!==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:v===e.path?`Adopting…`:`Adopt`})]},e.path)})}),(0,Y.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,Y.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 Se({task:e,onClose:t}){return(0,Y.jsx)(R,{open:e!==null,onClose:t,title:e?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 border border-line px-1 py-0.5 font-mono text-[9px] uppercase tracking-wide text-subtle`,children:`Archived`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title||e.branch})]}):void 0,children:e&&(0,Y.jsx)(w,{worktreePath:e.worktreePath??null,vendor:e.vendor??`claude`,title:e.title||e.branch})})}async function Ce(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}}function X(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var we=/^\/api\/issue-assets\/[a-f0-9]{16}\/[A-Za-z0-9_-]+\.[a-z0-9]+$/;function Te(e){let t=e.trim();return we.test(t)?t:null}function Ee(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 De(e){let t=e;return t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(e,t,n)=>{let r=Te(n.replace(/&/g,`&`));return r?`<img src="${X(r)}" alt="${X(t)}" loading="lazy" class="kobe-md-img">`:``})),t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=Ee(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>`:De(e)).join(``)}function Oe(e){let t=e.replace(/\r\n/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`),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(`
|
|
4
|
+
`)}</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(`
|
|
5
|
+
`)}async function ke(e){return(await h.get(`/api/notes`,{query:{taskId:e},label:`load notes`})).markdown??``}async function Ae(e,t){await h.put(`/api/notes`,{taskId:e,markdown:t},{label:`save notes`})}function je(e){switch(e){case`saving`:return`saving…`;case`saved`:return`saved`;case`error`:return`save failed`;default:return``}}var Me=600;function Ne({children:e,right:t}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t]})}function Pe({taskId:e,full:t=!1}){let[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(`idle`),u=(0,W.useMemo)(()=>Oe(n),[n]),d=(0,W.useRef)(null),f=(0,W.useRef)(null);(0,W.useEffect)(()=>{if(d.current&&clearTimeout(d.current),f.current=e,l(`idle`),r(``),a(!1),!e)return;let t=!1;return s(!0),ke(e).then(n=>{!t&&f.current===e&&r(n)}).catch(()=>{!t&&f.current===e&&r(``)}).finally(()=>{t||s(!1)}),()=>{t=!0}},[e]),(0,W.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let p=(0,W.useCallback)(t=>{if(r(t),!e)return;let n=e;l(`saving`),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{Ae(n,t).then(()=>{f.current===n&&l(`saved`)}).catch(()=>{f.current===n&&l(`error`)})},Me)},[e]);return(0,Y.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-bg`,children:[(0,Y.jsx)(Ne,{right:e?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c!==`idle`&&(0,Y.jsx)(`span`,{className:`text-[10px] ${c===`error`?`text-kobe-red`:`text-subtle`}`,children:je(c)}),(0,Y.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,Y.jsx)(`div`,{className:`min-h-0 flex-1 ${t?`px-0 pb-0`:`px-3 pb-3`}`,children:e?i?(0,Y.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,Y.jsx)(`div`,{className:`kobe-md text-[12px] leading-relaxed text-fg`,dangerouslySetInnerHTML:{__html:u}}):(0,Y.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Nothing to preview yet.`})}):(0,Y.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,Y.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,Y.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 Fe=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],Ie=`DIRTY_WORKTREE`;function Le(e){return e.replace(/_/g,` `)}function Q({name:e,value:t,mono:n=!1}){return(0,Y.jsxs)(`div`,{className:`min-w-0 border-b border-line-subtle py-2 last:border-b-0`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),(0,Y.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,Y.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 Re({task:e}){let[t,n]=(0,W.useState)(e?.title??``),[r,a]=(0,W.useState)(e?.branch??``),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),p=(0,W.useRef)(null);(0,W.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let[h,g]=(0,W.useState)(null),_=ne(),v=o();if((0,W.useEffect)(()=>{n(e?.title??``)},[e?.title]),(0,W.useEffect)(()=>{a(e?.branch??``)},[e?.branch]),!e)return(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-[12px] font-semibold text-fg`,children:`No task selected`}),(0,Y.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 y=async(e,t)=>{u(e);try{await t()}catch(t){c(e.split(`:`)[0],t)}finally{u(null)}},b=()=>{let n=t.trim();!n||n===e.title||y(`rename`,()=>m(`task.rename`,{taskId:e.id,title:n}))},x=()=>{let t=r.trim();!t||t===e.branch||y(`branch`,()=>m(`task.setBranch`,{taskId:e.id,branch:t}))},S=()=>{Ce(e.worktreePath).then(e=>{e&&(f(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(!1),1200))})},C=()=>{g(null),y(`archive`,async()=>{await m(`task.archive`,{taskId:e.id,archived:!0}),i(),v({to:`/`}),await T(null)})},w=()=>{y(`restore`,()=>m(`task.archive`,{taskId:e.id,archived:!1}))},E=t=>{g(null),u(`delete`),(async()=>{try{await m(`task.delete`,{taskId:e.id,force:t}),i(),v({to:`/`}),N(null),s(`success`,`Deleted "${e.title||e.branch}"`)}catch(e){let n=e instanceof Error?e.message:String(e);!t&&n.includes(Ie)?g({kind:`delete`,force:!0}):c(`delete`,e)}finally{u(null)}})()};return(0,Y.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-line px-3 py-3`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Task`}),(0,Y.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,Y.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),onBlur:b,onKeyDown:e=>{e.key===`Enter`&&b()},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,Y.jsx)($,{onClick:b,disabled:l===`rename`,children:`Save`})]}),e.archived&&(0,Y.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,Y.jsx)(`span`,{className:`text-[11px] text-kobe-yellow`,children:`archived`}),(0,Y.jsx)($,{onClick:w,disabled:l!==null,children:`Restore`})]})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:[e.kind===`main`?(0,Y.jsx)(Q,{name:`Branch`,value:e.branch,mono:!0}):(0,Y.jsxs)(`div`,{className:`min-w-0 border-b border-line-subtle py-2`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Branch`}),(0,Y.jsx)(`div`,{className:`mt-1 flex gap-2`,children:(0,Y.jsx)(`input`,{value:r,onChange:e=>a(e.target.value),onBlur:x,onKeyDown:e=>{e.key===`Enter`&&x()},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,Y.jsx)(Q,{name:`Vendor`,value:e.vendor??`claude`}),(0,Y.jsx)(Q,{name:`Worktree`,value:e.worktreePath,mono:!0}),(0,Y.jsx)(Q,{name:`Repo`,value:e.repo,mono:!0}),(0,Y.jsxs)(`div`,{className:`mt-4`,children:[(0,Y.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Status`}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:Fe.map(t=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void y(`status:${t}`,()=>m(`task.status`,{taskId:e.id,status:t})),disabled:l!==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:Le(t)},t))})]}),(0,Y.jsxs)(`div`,{className:`mt-4`,children:[(0,Y.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Vendor`}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(t=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void y(`vendor:${t.id}`,()=>m(`task.setVendor`,{taskId:e.id,vendor:t.id})),disabled:l!==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,Y.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,Y.jsx)($,{onClick:()=>void y(`pin`,()=>m(`task.pin`,{taskId:e.id,pinned:!e.pinned})),disabled:l!==null,children:e.pinned?`Unpin`:`Pin`}),(0,Y.jsx)($,{onClick:()=>void y(`worktree`,()=>m(`task.ensureWorktree`,{taskId:e.id})),disabled:l!==null,children:`Ensure worktree`}),(0,Y.jsx)($,{onClick:S,children:d?`Copied`:`Copy path`}),!e.archived&&(0,Y.jsx)($,{onClick:()=>g({kind:`archive`}),disabled:l!==null,danger:!0,children:`Archive`})]}),e.kind!==`main`&&(0,Y.jsxs)(`div`,{className:`mt-4 border-t border-line-subtle pt-3`,children:[(0,Y.jsx)(`div`,{className:`mb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Danger zone`}),(0,Y.jsx)($,{onClick:()=>g({kind:`delete`,force:!1}),disabled:l!==null,danger:!0,children:`Delete task + worktree`})]})]}),h?.kind===`archive`&&(0,Y.jsx)(H,{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:l===`archive`,onConfirm:C,onCancel:()=>g(null)}),h?.kind===`delete`&&(0,Y.jsx)(H,{title:h.force?`Worktree has uncommitted changes`:`Delete task`,body:h.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:h.force?`Force delete`:`Delete`,danger:!0,busy:l===`delete`,onConfirm:()=>E(h.force),onCancel:()=>g(null)})]})}function ze({drawer:e=!1,onClose:n}={}){let[i,a]=(0,W.useState)(`overview`),{selectedTaskId:o}=t(),{tasks:s}=p(),c=o?s.find(e=>e.id===o)??null:null;return(0,Y.jsxs)(`aside`,{className:e?`flex h-full w-full flex-col bg-bg`:`flex w-80 shrink-0 flex-col border-l border-line bg-bg`,children:[(0,Y.jsxs)(`div`,{className:`flex h-9 shrink-0 items-stretch border-b border-line bg-surface`,children:[[`overview`,`notes`,`changes`].map(e=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`px-3 text-[10px] font-bold uppercase tracking-[0.12em] ${i===e?`border-b-2 border-primary text-fg`:`text-subtle hover:text-muted`}`,children:e===`overview`?`Task`:e===`notes`?`Notes`:`Changes`},e)),e&&n&&(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`ml-auto px-3 text-subtle hover:text-fg`,"aria-label":`Close tools`,children:(0,Y.jsx)(oe,{size:14,strokeWidth:2})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1`,children:i===`overview`?(0,Y.jsx)(Re,{task:c}):i===`notes`?(0,Y.jsx)(Pe,{taskId:o,full:!0}):(0,Y.jsx)(y,{worktreePath:c?.worktreePath??null,onOpenFile:e=>{o&&r(o,e)}})})]})}function Be({children:e,suffix:t}){return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`h-px flex-1 bg-line`}),(0,Y.jsx)(`span`,{className:`font-mono text-[10px] font-bold uppercase text-primary`,children:t})]}):null]})}function Ve({task:e,engine:t,job:n,changes:r,engineName:i,active:a,onClick:o}){let s=n?.phase===`running`,c=s?`materializing…`:k(t?.state),l=S(e.updatedAt||e.createdAt);return(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s?(0,Y.jsx)(U,{size:10,strokeWidth:2.5,className:`shrink-0 animate-spin text-primary`}):(0,Y.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${O(t?.state)}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${a?`text-fg`:`text-fg/90`}`,children:e.title||e.branch}),(0,Y.jsx)(z,{pr:e.prStatus}),e.pinned&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`PIN`}),(0,Y.jsx)(ce,{counts:r})]}),(0,Y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 pl-3.5 text-[11px] text-subtle`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.branch||`—`}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(B,{label:i}),c&&(0,Y.jsx)(`span`,{className:`text-muted`,children:c}),l&&(0,Y.jsx)(`span`,{className:`text-subtle`,children:l})]})]})]})}function He({task:e,onRestore:t,onPreview:n}){let r=e.title||e.branch;return(0,Y.jsxs)(`div`,{className:`group flex items-center gap-2 border-l-2 border-transparent px-3 py-1.5`,children:[n?(0,Y.jsx)(`button`,{type:`button`,onClick:n,title:`Preview history`,className:`min-w-0 flex-1 truncate text-left text-[12px] text-subtle transition-colors hover:text-fg`,children:r}):(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] text-subtle`,children:r}),(0,Y.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 Ue({onOpenSettings:e,onNewTask:r,onAdopt:i}){let{tasks:a,engineStates:s,jobs:l,worktreeChanges:u,uiPrefs:d,hydrated:f,streamConnected:h}=p(),{selectedTaskId:g}=t(),v=ne(),y=(0,W.useMemo)(()=>ae(a),[a]),b=e=>se(v,e,y),{query:x,statusFilter:S,sortMode:C,showArchived:w}=ge(),T=(0,W.useRef)(null),E=(0,W.useRef)(null);(0,W.useEffect)(()=>{g&&T.current?.querySelector(`[data-task-id="${CSS.escape(g)}"]`)?.scrollIntoView({block:`nearest`})},[g]);let D=d?.sortMode;(0,W.useEffect)(()=>{he(D)},[D]);let O=(0,W.useMemo)(()=>a.filter(e=>!e.archived),[a]),k=(0,W.useMemo)(()=>a.filter(e=>e.archived&&e.kind!==`main`),[a]),A=(0,W.useMemo)(()=>ye(O.filter(e=>be(e,x)&&ie(s[e.id],u[e.worktreePath],S)),C),[O,x,S,C,s,u]),j=A.filter(e=>e.kind===`main`),M=A.filter(e=>e.kind!==`main`),P=!f||!h&&a.length===0,F=o(),I=e=>{n(e),N(e),F({to:`/task/$taskId`,params:{taskId:e}})};(0,W.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(),E.current?.focus();return}if(n&&o&&o!==document.body&&!T.current?.contains(o)||A.length===0)return;e.preventDefault();let s=A.findIndex(e=>e.id===g);I(A[s===-1?0:Math.min(Math.max(s+(r?1:-1),0),A.length-1)].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A,g]);let L=e=>{m(`task.archive`,{taskId:e.id,archived:!1}).catch(t=>c(`restore "${e.title||e.branch}"`,t))},[R,z]=(0,W.useState)(!1),[B,V]=(0,W.useState)(null);return(0,W.useEffect)(()=>{let e=!0;return _().then(t=>{e&&z(t.archivedHistoryPreview===!0)}).catch(()=>{}),()=>{e=!1}},[]),(0,Y.jsxs)(`aside`,{className:`flex w-64 shrink-0 flex-col border-r border-line bg-bg`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-line bg-surface/50 px-3 py-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Tasks`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>pe(C==="default"?`recent`:`default`),className:`font-mono text-[10px] uppercase ${C===`recent`?`text-primary`:`text-muted hover:text-fg`}`,title:`Toggle task sort`,children:`sort`}),(0,Y.jsxs)(`span`,{className:`font-mono text-[10px] text-muted`,children:[A.length,`/`,O.length]}),(0,Y.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,Y.jsx)(ue,{size:14,strokeWidth:1.9})}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted transition-colors hover:text-primary`,title:`New task`,"aria-label":`New task`,children:(0,Y.jsx)(ee,{size:14,strokeWidth:2.2})})]})]}),(0,Y.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,Y.jsx)(te,{size:14,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,Y.jsx)(`input`,{ref:E,value:x,onChange:e=>J(e.target.value),onKeyDown:e=>{e.key===`Enter`&&A.length>0?(e.preventDefault(),I(A[0].id),e.currentTarget.blur()):e.key===`Escape`&&x&&(e.preventDefault(),J(``))},placeholder:`Filter tasks`,className:`min-w-0 flex-1 bg-transparent text-fg placeholder:text-subtle focus:outline-none`}),x&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>J(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear task filter`,title:`Clear filter`,children:(0,Y.jsx)(oe,{size:13,strokeWidth:2})})]}),(0,Y.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,Y.jsx)(`button`,{type:`button`,onClick:()=>fe(e.key),title:e.title,className:`border px-1.5 py-0.5 text-[10px] transition-colors ${S===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,Y.jsxs)(`div`,{ref:T,className:`flex-1 overflow-y-auto`,children:[P?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-[12px] text-subtle`,children:[(0,Y.jsx)(U,{size:13,strokeWidth:2,className:`animate-spin`}),(0,Y.jsx)(`span`,{children:`connecting…`})]}):O.length===0?(0,Y.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,Y.jsx)(`p`,{children:`No tasks yet.`}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,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`})]}):A.length===0?(0,Y.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,Y.jsx)(`div`,{children:x?`No matches for “${x}”.`:`No tasks in this status.`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{J(``),fe(`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,Y.jsxs)(Y.Fragment,{children:[j.length>0&&(0,Y.jsx)(Be,{children:`Projects`}),j.map(e=>(0,Y.jsx)(Ve,{task:e,engine:s[e.id],job:l[e.id],changes:u[e.worktreePath],engineName:b(e),active:e.id===g,onClick:()=>I(e.id)},e.id)),M.length>0&&(0,Y.jsx)(Be,{suffix:C==="default"?void 0:C,children:`Worktrees`}),M.map(e=>(0,Y.jsx)(Ve,{task:e,engine:s[e.id],job:l[e.id],changes:u[e.worktreePath],engineName:b(e),active:e.id===g,onClick:()=>I(e.id)},e.id))]}),!P&&k.length>0&&(0,Y.jsxs)(`div`,{className:`mt-2 border-t border-line-subtle pb-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>me(!w),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Archived`}),(0,Y.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:k.length}),(0,Y.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-subtle`,children:w?`−`:`+`})]}),w&&k.map(e=>(0,Y.jsx)(He,{task:e,onRestore:()=>L(e),onPreview:R?()=>V(e):void 0},e.id))]})]}),(0,Y.jsx)(Se,{task:B,onClose:()=>V(null)}),(0,Y.jsx)(`div`,{className:`border-t border-line p-2`,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:e,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,Y.jsx)(re,{size:15,strokeWidth:1.8}),(0,Y.jsx)(`span`,{children:`Settings`})]})})]})}function We({onToggleTools:e,onShowHelp:n}){let{daemonConnected:r,streamConnected:i,tasks:a}=p(),{selectedTaskId:o}=t(),s=o?a.find(e=>e.id===o):null,c=L({daemonConnected:r,streamConnected:i});return(0,Y.jsxs)(`header`,{"data-kobe-topbar":!0,className:`flex h-10 shrink-0 items-center gap-3 border-b border-line bg-surface px-3`,children:[(0,Y.jsx)(V,{}),(0,Y.jsx)(`span`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe]`}),(0,Y.jsx)(f,{}),s?(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.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,Y.jsx)(`span`,{className:`hidden max-w-40 truncate font-mono text-[11px] text-subtle md:inline`,children:s.branch})]}):(0,Y.jsx)(`span`,{className:`rounded bg-inset px-2 py-0.5 text-[11px] text-muted`,children:`Workspace`}),(0,Y.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[11px] text-subtle`,children:[(0,Y.jsxs)(`span`,{className:`hidden items-center gap-1.5 sm:flex`,title:c.title,children:[(0,Y.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${c.ok?`bg-kobe-green`:`bg-kobe-yellow`}`}),(0,Y.jsx)(`span`,{children:c.label})]}),(0,Y.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,Y.jsx)(le,{size:15,strokeWidth:1.8})}),(0,Y.jsx)(`button`,{type:`button`,onClick:e,className:`flex items-center text-muted transition-colors hover:text-fg lg:hidden`,"aria-label":`Toggle task tools`,title:`Task tools`,children:(0,Y.jsx)(de,{size:15,strokeWidth:1.8})})]})]})}function Ge(){let{tasks:e,update:n}=p(),{selectedTaskId:r}=t(),i=r?e.find(e=>e.id===r):null,a=e.filter(e=>!e.archived).length;return(0,Y.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,Y.jsxs)(`span`,{children:[a,` task`,a===1?``:`s`]}),i&&(0,Y.jsxs)(`span`,{className:`min-w-0 truncate text-muted`,children:[i.kind===`main`?`project`:`worktree`,` ·`,` `,v(i.worktreePath,54)]}),(0,Y.jsx)(`span`,{className:`ml-auto`,children:n?.latest?`update ${n.latest} available`:`kobe web`})]})}function Ke(){let{settingsOpen:e}=E(),[t,n]=(0,W.useState)(!1),[r,i]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,Y.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,Y.jsx)(We,{onToggleTools:()=>i(e=>!e),onShowHelp:F}),(0,Y.jsx)(d,{}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,Y.jsx)(Ue,{onOpenSettings:P,onNewTask:D,onAdopt:()=>n(!0)}),e?(0,Y.jsx)(x,{onClose:M}):(0,Y.jsx)(b,{}),(0,Y.jsx)(`div`,{className:`hidden lg:flex`,children:(0,Y.jsx)(ze,{})}),r&&(0,Y.jsx)(`div`,{className:`fixed inset-0 z-30 flex justify-end bg-black/50 lg:hidden`,onClick:()=>i(!1),onKeyDown:e=>{e.key===`Escape`&&i(!1)},role:`presentation`,children:(0,Y.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,Y.jsx)(ze,{drawer:!0,onClose:()=>i(!1)})})})]}),(0,Y.jsx)(Ge,{}),t&&(0,Y.jsx)(xe,{onClose:()=>n(!1)})]})}export{Ke as AppShell};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,f as t,y as n}from"./tabs-Db1r1FTh.js";import{a as r,n as i,r as a}from"./toast-CfAxitbT.js";import{d as o}from"./createLucideIcon-BoVlWivB.js";import{n as ee,t as s}from"./ViewToggle-
|
|
1
|
+
import{S as e,f as t,y as n}from"./tabs-Db1r1FTh.js";import{a as r,n as i,r as a}from"./toast-CfAxitbT.js";import{d as o}from"./createLucideIcon-BoVlWivB.js";import{n as ee,t as s}from"./ViewToggle-DsJBr4VT.js";import{n as te}from"./store-BXWXnGds.js";import{i as c}from"./settings-B_VT_pPR.js";import{t as l}from"./external-link-C51-09OW.js";import{a as u,i as d,n as f,r as p,t as m}from"./lazy-issue-panels-C8OnZML2.js";import{g as h,h as ne,p as re,w as ie}from"./index-BC9H3mAq.js";import{n as ae,t as oe}from"./ConfirmDialog-BPIwmIjt.js";import{a as g,d as _,f as v,g as y,h as b,m as x,p as S,s as C,u as w}from"./issues-YCoQHBtW.js";var T=e(n(),1),E={query:``,repo:null};function D(e){O.update(t=>({...t,...e}))}var O=c(E);function se(){return O.useSnapshot()}function k(e){e!==O.getSnapshot().query&&D({query:e})}function A(e){e!==O.getSnapshot().repo&&D({repo:e})}var j=o();function M({repo:e,column:t,onNewIssue:n,onPeekIssue:r,onOpenTask:i,onDeleteIssue:a}){return(0,j.jsxs)(`section`,{"data-column":`${e}:${t.key}`,className:`flex h-full shrink-0 flex-col border border-transparent ${t.key===`backlog`?`w-96`:`w-72`}`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-baseline gap-2`,children:[(0,j.jsx)(`h2`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] ${t.accent}`,children:t.title}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:t.cards.length+t.hiddenCount}),n&&(0,j.jsxs)(`button`,{type:`button`,onClick:n,className:`ml-auto flex items-center gap-0.5 text-[10px] text-subtle transition-colors hover:text-fg`,title:`New story in this project`,children:[(0,j.jsx)(h,{size:11,strokeWidth:2}),(0,j.jsx)(`span`,{children:`New story`})]})]}),(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pb-2`,children:[t.cards.length===0?(0,j.jsx)(`div`,{className:`border border-dashed border-line-subtle p-3 text-center text-[11px] text-subtle`,children:`none`}):t.cards.map(e=>{let{issue:t}=e,n=y(t)?t.taskId:void 0;return(0,j.jsxs)(`div`,{className:`group/wrap relative`,children:[(0,j.jsx)(d,{issue:t,onOpen:()=>r(t),onDelete:()=>a(t)}),n&&(0,j.jsxs)(`button`,{type:`button`,onClick:()=>i(n),"aria-label":`Open task for issue #${t.id}`,title:`Started — open task`,className:`absolute bottom-2 right-2 flex items-center gap-1 border border-line bg-surface px-1.5 py-0.5 text-[10px] text-subtle opacity-0 transition-opacity hover:border-primary hover:text-fg focus-visible:opacity-100 group-hover/wrap:opacity-100`,children:[(0,j.jsx)(l,{size:10,strokeWidth:1.8}),(0,j.jsx)(`span`,{children:`open task`})]})]},`issue:${t.id}`)}),t.hiddenCount>0&&(0,j.jsxs)(`div`,{className:`p-2 text-center text-[10px] text-subtle`,children:[`+`,t.hiddenCount,` more — finish stories to thin this column`]})]})]})}function ce({board:e,onNewIssue:t,onPeekIssue:n,onOpenTask:r,onDeleteIssue:i}){return(0,j.jsx)(`div`,{className:`flex h-full min-w-max gap-4`,children:e.columns.map(a=>(0,j.jsx)(M,{repo:e.repo,column:a,onNewIssue:a.key===`backlog`?()=>t(e.repo):void 0,onPeekIssue:n,onOpenTask:r,onDeleteIssue:t=>i(e.repo,t)},a.key))})}function N(){let{tasks:e,hydrated:n,daemonConnected:o}=te(),{query:c,repo:l}=se(),d=r(),y=(0,T.useRef)(null),[E,D]=(0,T.useState)(null),[O,M]=(0,T.useState)(null),[N,P]=(0,T.useState)(!1),[F,I]=(0,T.useState)(null),[L,R]=(0,T.useState)(new Map),[z,B]=(0,T.useState)(null),[V,H]=(0,T.useState)([]);(0,T.useEffect)(()=>{let e=!1;return C().then(t=>{e||H(t)}).catch(e=>a(`load projects`,e)),()=>{e=!0}},[]);let U=(0,T.useMemo)(()=>w(e,V),[e,V]),W=(0,T.useMemo)(()=>U.map(e=>e.repo),[U]),G=(0,T.useMemo)(()=>S(U,l),[U,l]),{data:K,pending:q,refresh:J}=u(W),{allIssues:Y,repoChips:le,projectBoards:X,shownCount:Z,hasAnyCard:Q}=(0,T.useMemo)(()=>b({issueData:K,issueRepos:W,pendingLinks:L,query:c,repoFilter:G}),[K,W,L,c,G]);(0,T.useEffect)(()=>{R(e=>{if(e.size===0)return e;let t=new Map(e),n=!1;for(let e of W){let r=K[e];if(!(!r||!r.exists))for(let i of r.issues)i.taskId&&t.delete(`${e}:${i.id}`)&&(n=!0)}return n?t:e})},[W,K]),(0,T.useEffect)(()=>{E&&(Y.some(e=>e.repo===E.repo&&e.issue.id===E.id)||D(null))},[Y,E]),(0,T.useEffect)(()=>{let e=e=>{if(E||O||z||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target,n=!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable);e.key===`/`&&!n?(e.preventDefault(),y.current?.focus()):e.key===`Escape`&&t===y.current&&c&&(e.preventDefault(),k(``))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c,E,O,z]),(0,T.useEffect)(()=>{l!==G&&A(G)},[G,l]);let ue=!!c,$=e=>{t(e),ie(e),d({to:`/task/$taskId`,params:{taskId:e}})},de=async(e,t,n)=>{P(!0);try{return await x(e,t,n),J([e]),!0}catch(e){return a(`update issue`,e),!1}finally{P(!1)}},fe=async(e,t)=>{P(!0);try{await g(e,t.id),J([e]),B(null),E?.repo===e&&E.id===t.id&&D(null)}catch(e){a(`delete issue`,e)}finally{P(!1)}},pe=async(e,t,n,r)=>{if(F===null){I(t.id);try{let{taskId:i}=await v(e,t,n,r);return R(n=>{let r=new Map(n);return r.set(`${e}:${t.id}`,{repo:e,issueId:t.id,taskId:i}),r}),i}catch(e){a(`quick start issue`,e);return}finally{I(null)}}};return(0,j.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,j.jsxs)(`header`,{"data-kobe-topbar":!0,className:`flex h-10 shrink-0 items-center gap-3 border-b border-line bg-surface px-3`,children:[(0,j.jsx)(ae,{}),(0,j.jsx)(`span`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe]`}),(0,j.jsx)(s,{}),(0,j.jsxs)(`label`,{className:`flex h-7 items-center gap-1.5 border border-line bg-bg px-2 text-muted focus-within:border-line-active`,children:[(0,j.jsx)(ne,{size:13,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,j.jsx)(`input`,{ref:y,value:c,onChange:e=>k(e.target.value),placeholder:`Filter stories ( / )`,className:`w-44 bg-transparent text-[12px] text-fg placeholder:text-subtle focus:outline-none`}),c&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>k(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear filter`,title:`Clear filter`,children:(0,j.jsx)(re,{size:13,strokeWidth:2})})]}),U.length>0&&(0,j.jsxs)(`label`,{className:`flex h-7 min-w-0 max-w-[24rem] items-center gap-1.5 border border-line bg-bg px-2 text-muted focus-within:border-line-active`,children:[(0,j.jsx)(`span`,{className:`shrink-0 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Project`}),(0,j.jsx)(`select`,{value:G??``,onChange:e=>A(e.target.value),title:G??`Select project`,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg focus:outline-none`,children:U.map(e=>{let t=le.find(t=>t.repo===e.repo)?.count??0;return(0,j.jsxs)(`option`,{value:e.repo,title:e.repo,className:`bg-surface text-fg`,children:[e.label,` · `,t,` · `,e.repo]},e.repo)})})]}),(0,j.jsx)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[11px] text-subtle`,children:(0,j.jsxs)(`span`,{children:[Z,` stor`,Z===1?`y`:`ies`]})})]}),(0,j.jsx)(ee,{}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden p-4`,children:!n||q&&!Q?(0,j.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Loading…`}):Z===0&&ue&&Q?(0,j.jsxs)(`div`,{className:`text-[12px] leading-relaxed text-subtle`,children:[(0,j.jsx)(`p`,{children:`No stories match.`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>{k(``)},className:`mt-3 border border-line bg-surface px-2 py-1 text-[11px] text-muted hover:border-primary hover:text-fg`,children:`Clear filters`})]}):Z===0&&!o?(0,j.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Can't reach the daemon — issue list may be incomplete.`}):X[0]?(0,j.jsx)(ce,{board:X[0],onNewIssue:M,onPeekIssue:e=>D({repo:X[0].repo,id:e.id}),onOpenTask:$,onDeleteIssue:(e,t)=>B({repo:e,issue:t})}):(0,j.jsxs)(`div`,{className:`text-[12px] leading-relaxed text-subtle`,children:[(0,j.jsx)(`p`,{children:`No projects yet. Create a task from the workspace to track stories against its repo.`}),(0,j.jsx)(`div`,{className:`mt-3 flex items-center gap-2`,children:(0,j.jsx)(`button`,{type:`button`,onClick:()=>d({to:`/`}),className:`border border-line bg-surface px-2 py-1 text-[11px] text-muted hover:border-primary hover:text-fg`,children:`Back to workspace`})})]})}),(()=>{let e=G??X[0]?.repo??W[0];return e?(0,j.jsx)(`button`,{type:`button`,onClick:()=>M(e),title:`New story`,"aria-label":`New story`,className:`fixed bottom-6 right-6 z-20 flex h-12 w-12 items-center justify-center rounded-full border border-primary bg-primary text-bg shadow-lg transition-transform hover:scale-105`,children:(0,j.jsx)(h,{size:22,strokeWidth:2.2})}):null})(),O&&(0,j.jsx)(m,{children:(0,j.jsx)(f,{repoRoot:O,open:!0,onClose:()=>M(null),onCreated:(e,t)=>{O&&J([O]),i(`success`,t?`Story #${e.id} created — starting its session`:`Story #${e.id} created`)}})}),(()=>{if(!E)return null;let e=Y.find(e=>e.repo===E.repo&&e.issue.id===E.id);return e?(0,j.jsx)(m,{children:(0,j.jsx)(p,{issue:e.issue,repoRoot:e.repo,busy:N,starting:F===e.issue.id,onClose:()=>D(null),onSave:t=>de(e.repo,e.issue.id,t),onStart:async({vendor:t,effort:n,watch:r})=>{let i=await pe(e.repo,e.issue,t,n);r&&i?(D(null),$(i)):D(null)},onOpenSession:e.issue.taskId?()=>{let t=e.issue.taskId;D(null),t&&$(t)}:void 0,onPromptMerge:e.issue.taskId?()=>{let t=e.issue.taskId;t&&_(t,e.issue).then(()=>i(`success`,`Prompt inserted for story #${e.issue.id}`)).catch(e=>a(`prompt issue merge`,e))}:void 0},`${e.repo}:${e.issue.id}`)}):null})(),z&&(0,j.jsx)(oe,{title:`Delete issue`,body:`Delete issue #${z.issue.id}: "${z.issue.title}"? This removes it from the daemon issue tracker only; it does not delete any task, branch, worktree, or engine session.`,confirmLabel:`Delete`,danger:!0,busy:N,onConfirm:()=>void fe(z.repo,z.issue),onCancel:()=>B(null)})]})}export{N as Board};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTerminal-DtqC7Mxi.js","assets/tabs-Db1r1FTh.js","assets/terminal-Ckm9XXat.js","assets/store-BXWXnGds.js","assets/createLucideIcon-BoVlWivB.js","assets/rotate-cw-pZvvI6Ao.js","assets/web-transport-BS7imUMS.js","assets/ChatTerminal-kHJ-D0s7.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{S as e,c as t,y as n}from"./tabs-Db1r1FTh.js";import{d as r,t as i}from"./createLucideIcon-BoVlWivB.js";import{i as a}from"./store-BXWXnGds.js";import{t as o}from"./ChatTranscript-
|
|
2
|
+
import{S as e,c as t,y as n}from"./tabs-Db1r1FTh.js";import{d as r,t as i}from"./createLucideIcon-BoVlWivB.js";import{i as a}from"./store-BXWXnGds.js";import{t as o}from"./ChatTranscript-CzQspNKE.js";import{t as s}from"./external-link-C51-09OW.js";import{d as c,f as l,p as u,u as d}from"./index-BC9H3mAq.js";var f=i(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),p=i(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),m=e(n(),1),h=r(),g=(0,m.lazy)(()=>a(()=>import(`./ChatTerminal-DtqC7Mxi.js`).then(e=>({default:e.ChatTerminal})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function _({task:e,engine:n,onClose:r,onOpenWorkspace:i,onReview:a,onCreatePr:_}){let[v,y]=(0,m.useState)(`engine`),[b]=(0,m.useState)(()=>t(e.id)),x=(0,m.useRef)(null);d(x,!0),(0,m.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=e.target;t?.closest(`.xterm`)||t&&(t.tagName===`TEXTAREA`||t.tagName===`INPUT`)||(e.preventDefault(),r())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let S=l(n?.state),C=e=>`border-b-2 px-2 py-1.5 text-[11px] transition-colors ${e?`border-primary text-fg`:`border-transparent text-muted hover:text-fg`}`;return(0,h.jsxs)(`div`,{className:`fixed inset-0 z-40 flex justify-end`,children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":`Close peek`,onClick:r,className:`absolute inset-0 cursor-default bg-black/40`}),(0,h.jsxs)(`div`,{ref:x,role:`dialog`,"aria-modal":`true`,"aria-label":`Session peek: ${e.title||e.branch||e.id}`,className:`relative flex h-full w-[640px] max-w-[92vw] flex-col border-l border-line bg-bg shadow-2xl`,children:[(0,h.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-2 border-b border-line bg-surface px-3`,children:[(0,h.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${c(n?.state)}`}),(0,h.jsx)(`span`,{className:`min-w-0 truncate text-[13px] text-fg`,children:e.title||e.branch||e.id}),(0,h.jsx)(`span`,{className:`hidden min-w-0 truncate font-mono text-[11px] text-subtle sm:inline`,children:e.branch}),S&&(0,h.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted`,children:S}),(0,h.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[a&&(0,h.jsxs)(`button`,{type:`button`,onClick:a,className:`flex items-center gap-1 text-muted transition-colors hover:text-fg`,title:`Review → done if it passes`,children:[(0,h.jsx)(f,{size:13,strokeWidth:1.8}),(0,h.jsx)(`span`,{className:`text-[11px]`,children:`Review`})]}),_&&(0,h.jsxs)(`button`,{type:`button`,onClick:_,className:`flex items-center gap-1 text-muted transition-colors hover:text-fg`,title:`Open a PR for this branch`,children:[(0,h.jsx)(p,{size:13,strokeWidth:1.8}),(0,h.jsx)(`span`,{className:`text-[11px]`,children:`PR`})]}),(0,h.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1 text-muted transition-colors hover:text-fg`,title:`Open in workspace`,children:[(0,h.jsx)(s,{size:13,strokeWidth:1.8}),(0,h.jsx)(`span`,{className:`text-[11px]`,children:`Workspace`})]}),(0,h.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center text-muted transition-colors hover:text-fg`,"aria-label":`Close peek`,title:`Close (Esc)`,children:(0,h.jsx)(u,{size:15,strokeWidth:1.8})})]})]}),(0,h.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-1 border-b border-line bg-surface px-2`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>y(`engine`),className:C(v===`engine`),children:`Engine`}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>y(`transcript`),className:C(v===`transcript`),children:`Transcript`})]}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1`,children:v===`engine`?(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`Loading terminal…`}),children:(0,h.jsx)(g,{tabId:b,taskId:e.id,mode:`engine`},b)}):(0,h.jsx)(o,{worktreePath:e.worktreePath,vendor:e.vendor??`claude`,title:e.title||e.branch})})]})]})}export{_ as BoardPeek};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,y as t}from"./tabs-Db1r1FTh.js";import{d as n,t as r}from"./createLucideIcon-BoVlWivB.js";import{n as i}from"./store-BXWXnGds.js";import{i as a}from"./terminal-Ckm9XXat.js";import{t as o}from"./rotate-cw-pZvvI6Ao.js";import{h as s,p as c}from"./index-CZ8GNIM9.js";import{t as l}from"./web-transport-BS7imUMS.js";var u=r(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),d=r(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),f=e(t(),1);function p(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 m(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`}function h(e,t){return a.get(`/api/history/sessions`,{query:{worktreePath:e,vendor:t},label:`/api/history/sessions`})}async function g(e,t){let{messages:n}=await a.get(`/api/history/messages`,{query:{vendor:e,sessionId:t},label:`/api/history/messages`});return n}function _(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 v(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function y(e,t,n,r=80){return t-e-n<r}var b=90;function x(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>b?`${n.slice(0,b-1)}…`:n}try{let t=JSON.stringify(e.input);return!t||t===`{}`||t===`null`?``:t.length>b?`${t.slice(0,b-1)}…`:t}catch{return``}}function S(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function C(e){switch(e.type){case`text`:case`thinking`:return e.text;case`tool_call`:return`${e.name} ${x(e)}`;case`tool_result`:return S(e.output)}}function w(e){return e.blocks.map(C).join(` `)}function T(e,t){return!(t&&e.type===`tool_call`)}function E(e,t){return e.blocks.some(e=>e.type===`text`||e.type===`thinking`?e.text.trim()!==``:e.type===`tool_call`?!t:!1)}var D=n(),O=2500,k=600;function A({call:e,result:t}){let[n,r]=(0,f.useState)(!1),i=x(e),a=t?S(t.output):``,o=!n&&a.length>k,s=o?`${a.slice(0,k)}…`:a,c=a.length>0;return(0,D.jsxs)(`div`,{className:`my-1`,children:[(0,D.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,D.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?.isError?`text-kobe-red`:`text-kobe-green`}`,children:`⏺`}),(0,D.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-fg`,children:e.name}),i&&(0,D.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-subtle`,children:i}),c&&(0,D.jsx)(`span`,{className:`shrink-0 text-subtle`,children:n?(0,D.jsx)(u,{size:12}):(0,D.jsx)(d,{size:12})})]}),(n||!n&&a&&a.length<=k)&&a&&(0,D.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,D.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 j({text:e}){let[t,n]=(0,f.useState)(!1);return(0,D.jsxs)(`div`,{className:`my-1`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-baseline gap-2 text-[11px] italic text-subtle hover:text-muted`,children:[(0,D.jsx)(`span`,{children:`✱`}),(0,D.jsx)(`span`,{children:t?`thinking`:`thinking…`}),t?(0,D.jsx)(u,{size:11}):(0,D.jsx)(d,{size:11})]}),t&&(0,D.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 M({message:e,results:t,hideTools:n}){let r=[],i=m(e.timestamp),a=!1;return e.blocks.forEach((o,s)=>{if(!T(o,n))return;let c=`${e.timestamp}-${s}`;if(o.type===`text`){if(!o.text.trim())return;e.role===`user`?(r.push((0,D.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,D.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] font-bold text-primary`,children:`❯`}),(0,D.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,D.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,title:e.timestamp,children:i})]},c)),a=!0):r.push((0,D.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,D.jsx)(A,{call:o,result:t.get(o.callId)},c));return}if(o.type===`thinking`){o.text.trim()&&r.push((0,D.jsx)(j,{text:o.text},c));return}}),r.length===0?null:(0,D.jsx)(D.Fragment,{children:r})}function N({worktreePath:e,vendor:t}){let{daemonConnected:n,streamConnected:r}=i(),a=l({daemonConnected:n,streamConnected:r}),[u,d]=(0,f.useState)([]),[p,m]=(0,f.useState)(null),[b,x]=(0,f.useState)(!0),[S,C]=(0,f.useState)([]),[T,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(!1),[N,P]=(0,f.useState)(null),[F,I]=(0,f.useState)(!1),[L,R]=(0,f.useState)(!0),z=(0,f.useRef)(-1),B=(0,f.useRef)(null),V=(0,f.useRef)(!0),H=(0,f.useRef)(0),U=(0,f.useRef)(!0),W=(0,f.useRef)(null);(0,f.useEffect)(()=>{U.current=b,W.current=p},[b,p]);let G=(0,f.useCallback)(async(n=!1)=>{if(!e)return;let r=H.current;try{let i=await h(e,t);if(i.latestMtime===z.current&&!n)return;z.current=i.latestMtime;let a=i.sessions.at(-1)??null,o=U.current?a:W.current??a;r=++H.current;let s=o?await g(t,o):[];if(r!==H.current)return;d(i.sessions),C(s),m(o),P(null)}catch(e){r===H.current&&P(e instanceof Error?e.message:String(e))}finally{r===H.current&&I(!0)}},[e,t]),K=(0,f.useRef)(G);(0,f.useEffect)(()=>{K.current=G},[G]),(0,f.useEffect)(()=>{z.current=-1,I(!1),U.current=!0,W.current=null,V.current=!0,x(!0),m(null),k(``),j(!1),R(!0),K.current(!0);let e=window.setInterval(()=>{document.hidden||K.current()},O);return()=>window.clearInterval(e)},[e,t]);let q=e=>{let n=e===u.at(-1);U.current=n,W.current=e,x(n),m(e);let r=++H.current;g(t,e).then(e=>{r===H.current&&C(e)}).catch(e=>{r===H.current&&P(e instanceof Error?e.message:String(e))})};(0,f.useEffect)(()=>{let e=B.current;e&&V.current&&(e.scrollTop=e.scrollHeight)},[S]);let J=()=>{let e=B.current;if(!e)return;let t=y(e.scrollTop,e.scrollHeight,e.clientHeight);V.current=t,R(t)},Y=()=>{let e=B.current;e&&(e.scrollTop=e.scrollHeight,V.current=!0,R(!0))},X=(0,f.useMemo)(()=>{let e=new Map;for(let t of S)for(let n of t.blocks)n.type===`tool_result`&&e.set(n.callId,n);return e},[S]),Z=(0,f.useMemo)(()=>_(S),[S]),Q=(0,f.useMemo)(()=>S.map(e=>w(e).toLowerCase()),[S]),$=(0,f.useMemo)(()=>{let e=T.trim().toLowerCase();return S.filter((t,n)=>(!e||Q[n].includes(e))&&E(t,A))},[S,Q,T,A]);return e?(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,D.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-surface px-2`,children:[(0,D.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Chat`}),u.length>0&&(0,D.jsx)(`select`,{value:p??``,onChange:e=>q(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:u.map((e,t)=>(0,D.jsxs)(`option`,{value:e,children:[`#`,t+1,` `,e.slice(0,8),t===u.length-1?` (latest)`:``]},e))}),(0,D.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[10px] text-subtle`,children:[Z.contextTokens>0&&(0,D.jsxs)(`span`,{title:`Live context estimate (last turn's full prompt)`,children:[`ctx `,v(Z.contextTokens)]}),Z.outputTokens>0&&(0,D.jsxs)(`span`,{title:`Session tokens in / out`,children:[`⇡`,v(Z.inputTokens),` ⇣`,v(Z.outputTokens)]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>void G(!0),className:`text-subtle transition-colors hover:text-fg`,title:`Refresh transcript`,"aria-label":`Refresh transcript`,children:(0,D.jsx)(o,{size:11,strokeWidth:2})})]})]}),S.length>0&&(0,D.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,D.jsx)(s,{size:11,strokeWidth:2,className:`shrink-0 text-subtle`}),(0,D.jsx)(`input`,{value:T,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T&&(e.preventDefault(),k(``))},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`}),T.trim()&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:[$.length,`/`,S.length]}),T.trim()&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>k(``),className:`shrink-0 text-subtle transition-colors hover:text-fg`,"aria-label":`clear transcript search`,title:`Clear search`,children:(0,D.jsx)(c,{size:12,strokeWidth:2})}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>j(e=>!e),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${A?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,title:A?`Show tool calls`:`Hide tool calls — read just the conversation`,children:A?`tools off`:`tools`})]}),(0,D.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,D.jsx)(`div`,{ref:B,onScroll:J,className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:N?a?(0,D.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,D.jsxs)(`div`,{className:`flex flex-col items-start gap-2 py-4`,children:[(0,D.jsx)(`span`,{className:`text-[12px] text-kobe-red`,children:`Couldn't load the transcript.`}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void G(!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,D.jsx)(o,{size:11,strokeWidth:2}),`Retry`]})]}):F?S.length===0?(0,D.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.`}):$.length===0?(0,D.jsxs)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:[`No messages match “`,T.trim(),`”.`]}):$.map((e,t)=>(0,D.jsx)(M,{message:e,results:X,hideTools:A},`${e.sessionId}-${t}`)):(0,D.jsx)(`div`,{className:`py-4 text-[12px] text-subtle`,children:`Loading transcript…`})}),!L&&$.length>0&&(0,D.jsx)(`button`,{type:`button`,onClick:Y,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,D.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`This task has no worktree yet.`})}export{m as n,p as r,N as t};
|
|
1
|
+
import{S as e,y as t}from"./tabs-Db1r1FTh.js";import{d as n,t as r}from"./createLucideIcon-BoVlWivB.js";import{n as i}from"./store-BXWXnGds.js";import{i as a}from"./terminal-Ckm9XXat.js";import{t as o}from"./rotate-cw-pZvvI6Ao.js";import{h as s,p as c}from"./index-BC9H3mAq.js";import{t as l}from"./web-transport-BS7imUMS.js";var u=r(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),d=r(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),f=e(t(),1);function p(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 m(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`}function h(e,t){return a.get(`/api/history/sessions`,{query:{worktreePath:e,vendor:t},label:`/api/history/sessions`})}async function g(e,t){let{messages:n}=await a.get(`/api/history/messages`,{query:{vendor:e,sessionId:t},label:`/api/history/messages`});return n}function _(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 v(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function y(e,t,n,r=80){return t-e-n<r}var b=90;function x(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>b?`${n.slice(0,b-1)}…`:n}try{let t=JSON.stringify(e.input);return!t||t===`{}`||t===`null`?``:t.length>b?`${t.slice(0,b-1)}…`:t}catch{return``}}function S(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function C(e){switch(e.type){case`text`:case`thinking`:return e.text;case`tool_call`:return`${e.name} ${x(e)}`;case`tool_result`:return S(e.output)}}function w(e){return e.blocks.map(C).join(` `)}function T(e,t){return!(t&&e.type===`tool_call`)}function E(e,t){return e.blocks.some(e=>e.type===`text`||e.type===`thinking`?e.text.trim()!==``:e.type===`tool_call`?!t:!1)}var D=n(),O=2500,k=600;function A({call:e,result:t}){let[n,r]=(0,f.useState)(!1),i=x(e),a=t?S(t.output):``,o=!n&&a.length>k,s=o?`${a.slice(0,k)}…`:a,c=a.length>0;return(0,D.jsxs)(`div`,{className:`my-1`,children:[(0,D.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,D.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?.isError?`text-kobe-red`:`text-kobe-green`}`,children:`⏺`}),(0,D.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-fg`,children:e.name}),i&&(0,D.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-subtle`,children:i}),c&&(0,D.jsx)(`span`,{className:`shrink-0 text-subtle`,children:n?(0,D.jsx)(u,{size:12}):(0,D.jsx)(d,{size:12})})]}),(n||!n&&a&&a.length<=k)&&a&&(0,D.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,D.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 j({text:e}){let[t,n]=(0,f.useState)(!1);return(0,D.jsxs)(`div`,{className:`my-1`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-baseline gap-2 text-[11px] italic text-subtle hover:text-muted`,children:[(0,D.jsx)(`span`,{children:`✱`}),(0,D.jsx)(`span`,{children:t?`thinking`:`thinking…`}),t?(0,D.jsx)(u,{size:11}):(0,D.jsx)(d,{size:11})]}),t&&(0,D.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 M({message:e,results:t,hideTools:n}){let r=[],i=m(e.timestamp),a=!1;return e.blocks.forEach((o,s)=>{if(!T(o,n))return;let c=`${e.timestamp}-${s}`;if(o.type===`text`){if(!o.text.trim())return;e.role===`user`?(r.push((0,D.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,D.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] font-bold text-primary`,children:`❯`}),(0,D.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,D.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,title:e.timestamp,children:i})]},c)),a=!0):r.push((0,D.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,D.jsx)(A,{call:o,result:t.get(o.callId)},c));return}if(o.type===`thinking`){o.text.trim()&&r.push((0,D.jsx)(j,{text:o.text},c));return}}),r.length===0?null:(0,D.jsx)(D.Fragment,{children:r})}function N({worktreePath:e,vendor:t}){let{daemonConnected:n,streamConnected:r}=i(),a=l({daemonConnected:n,streamConnected:r}),[u,d]=(0,f.useState)([]),[p,m]=(0,f.useState)(null),[b,x]=(0,f.useState)(!0),[S,C]=(0,f.useState)([]),[T,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(!1),[N,P]=(0,f.useState)(null),[F,I]=(0,f.useState)(!1),[L,R]=(0,f.useState)(!0),z=(0,f.useRef)(-1),B=(0,f.useRef)(null),V=(0,f.useRef)(!0),H=(0,f.useRef)(0),U=(0,f.useRef)(!0),W=(0,f.useRef)(null);(0,f.useEffect)(()=>{U.current=b,W.current=p},[b,p]);let G=(0,f.useCallback)(async(n=!1)=>{if(!e)return;let r=H.current;try{let i=await h(e,t);if(i.latestMtime===z.current&&!n)return;z.current=i.latestMtime;let a=i.sessions.at(-1)??null,o=U.current?a:W.current??a;r=++H.current;let s=o?await g(t,o):[];if(r!==H.current)return;d(i.sessions),C(s),m(o),P(null)}catch(e){r===H.current&&P(e instanceof Error?e.message:String(e))}finally{r===H.current&&I(!0)}},[e,t]),K=(0,f.useRef)(G);(0,f.useEffect)(()=>{K.current=G},[G]),(0,f.useEffect)(()=>{z.current=-1,I(!1),U.current=!0,W.current=null,V.current=!0,x(!0),m(null),k(``),j(!1),R(!0),K.current(!0);let e=window.setInterval(()=>{document.hidden||K.current()},O);return()=>window.clearInterval(e)},[e,t]);let q=e=>{let n=e===u.at(-1);U.current=n,W.current=e,x(n),m(e);let r=++H.current;g(t,e).then(e=>{r===H.current&&C(e)}).catch(e=>{r===H.current&&P(e instanceof Error?e.message:String(e))})};(0,f.useEffect)(()=>{let e=B.current;e&&V.current&&(e.scrollTop=e.scrollHeight)},[S]);let J=()=>{let e=B.current;if(!e)return;let t=y(e.scrollTop,e.scrollHeight,e.clientHeight);V.current=t,R(t)},Y=()=>{let e=B.current;e&&(e.scrollTop=e.scrollHeight,V.current=!0,R(!0))},X=(0,f.useMemo)(()=>{let e=new Map;for(let t of S)for(let n of t.blocks)n.type===`tool_result`&&e.set(n.callId,n);return e},[S]),Z=(0,f.useMemo)(()=>_(S),[S]),Q=(0,f.useMemo)(()=>S.map(e=>w(e).toLowerCase()),[S]),$=(0,f.useMemo)(()=>{let e=T.trim().toLowerCase();return S.filter((t,n)=>(!e||Q[n].includes(e))&&E(t,A))},[S,Q,T,A]);return e?(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,D.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-surface px-2`,children:[(0,D.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Chat`}),u.length>0&&(0,D.jsx)(`select`,{value:p??``,onChange:e=>q(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:u.map((e,t)=>(0,D.jsxs)(`option`,{value:e,children:[`#`,t+1,` `,e.slice(0,8),t===u.length-1?` (latest)`:``]},e))}),(0,D.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[10px] text-subtle`,children:[Z.contextTokens>0&&(0,D.jsxs)(`span`,{title:`Live context estimate (last turn's full prompt)`,children:[`ctx `,v(Z.contextTokens)]}),Z.outputTokens>0&&(0,D.jsxs)(`span`,{title:`Session tokens in / out`,children:[`⇡`,v(Z.inputTokens),` ⇣`,v(Z.outputTokens)]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>void G(!0),className:`text-subtle transition-colors hover:text-fg`,title:`Refresh transcript`,"aria-label":`Refresh transcript`,children:(0,D.jsx)(o,{size:11,strokeWidth:2})})]})]}),S.length>0&&(0,D.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,D.jsx)(s,{size:11,strokeWidth:2,className:`shrink-0 text-subtle`}),(0,D.jsx)(`input`,{value:T,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T&&(e.preventDefault(),k(``))},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`}),T.trim()&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:[$.length,`/`,S.length]}),T.trim()&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>k(``),className:`shrink-0 text-subtle transition-colors hover:text-fg`,"aria-label":`clear transcript search`,title:`Clear search`,children:(0,D.jsx)(c,{size:12,strokeWidth:2})}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>j(e=>!e),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${A?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,title:A?`Show tool calls`:`Hide tool calls — read just the conversation`,children:A?`tools off`:`tools`})]}),(0,D.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,D.jsx)(`div`,{ref:B,onScroll:J,className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:N?a?(0,D.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,D.jsxs)(`div`,{className:`flex flex-col items-start gap-2 py-4`,children:[(0,D.jsx)(`span`,{className:`text-[12px] text-kobe-red`,children:`Couldn't load the transcript.`}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void G(!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,D.jsx)(o,{size:11,strokeWidth:2}),`Retry`]})]}):F?S.length===0?(0,D.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.`}):$.length===0?(0,D.jsxs)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:[`No messages match “`,T.trim(),`”.`]}):$.map((e,t)=>(0,D.jsx)(M,{message:e,results:X,hideTools:A},`${e.sessionId}-${t}`)):(0,D.jsx)(`div`,{className:`py-4 text-[12px] text-subtle`,children:`Loading transcript…`})}),!L&&$.length>0&&(0,D.jsx)(`button`,{type:`button`,onClick:Y,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,D.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`This task has no worktree yet.`})}export{m as n,p as r,N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,y as t}from"./tabs-Db1r1FTh.js";import{d as n}from"./createLucideIcon-BoVlWivB.js";import{E as r,T as i,u as a}from"./index-
|
|
1
|
+
import{S as e,y as t}from"./tabs-Db1r1FTh.js";import{d as n}from"./createLucideIcon-BoVlWivB.js";import{E as r,T as i,u as a}from"./index-BC9H3mAq.js";function o(e){let t=e?.lifecycle;if(!e||!t||t===`unknown`)return null;let n=e.checkState,r=t===`merged`?`text-kobe-violet`:t===`closed`||n===`failing`?`text-kobe-red`:n===`passing`?`text-kobe-green`:n===`pending`?`text-kobe-yellow`:`text-kobe-blue`;return{label:e.number?`PR #${e.number}`:`PR`,cls:r,title:`${t}${n&&n!==`none`?` · ${n}`:``}`}}var s=n(),c=`after:pointer-events-none after:absolute after:right-0 after:bottom-full after:z-10 after:mb-1 after:hidden after:whitespace-nowrap after:border after:border-line after:bg-menu after:px-1.5 after:py-0.5 after:text-[10px] after:text-fg after:content-[attr(data-tip)] hover:after:block`;function l({counts:e}){return!e||e.added===0&&e.deleted===0?null:(0,s.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px]`,children:[(0,s.jsxs)(`span`,{className:`text-kobe-green`,children:[`+`,e.added]}),` `,(0,s.jsxs)(`span`,{className:`text-kobe-red`,children:[`−`,e.deleted]})]})}function u({pr:e}){let t=o(e);return t?(0,s.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] ${t.cls}`,title:t.title,children:t.label}):null}function d({label:e}){return e?(0,s.jsx)(`span`,{className:`shrink-0 rounded-sm border border-line px-1 font-mono text-[9px] uppercase tracking-wide text-subtle`,title:`engine: ${e}`,children:e}):null}function f({label:e,tone:t,onClick:n}){return(0,s.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:n,className:`h-3 w-3 rounded-full border border-black/20 ${t===`close`?`bg-[#ff5f57]`:t===`minimize`?`bg-[#febc2e]`:`bg-[#28c840]`}`})}function p(){if(!r())return null;let e=i();return(0,s.jsxs)(`fieldset`,{"data-kobe-window-controls":!0,className:`m-0 flex min-w-0 shrink-0 items-center gap-2 border-0 p-0`,children:[(0,s.jsx)(`legend`,{className:`sr-only`,children:`Window controls`}),(0,s.jsx)(f,{label:`Close window`,tone:`close`,onClick:()=>e?.close()}),(0,s.jsx)(f,{label:`Minimize window`,tone:`minimize`,onClick:()=>e?.minimize()}),(0,s.jsx)(f,{label:`Zoom window`,tone:`zoom`,onClick:()=>e?.toggleMaximize()})]})}var m=e(t(),1);function h({title:e,body:t,confirmLabel:n,danger:r=!1,busy:i=!1,onConfirm:o,onCancel:c}){let l=(0,m.useRef)(null),u=(0,m.useRef)(null);return a(u),(0,m.useEffect)(()=>{l.current?.focus();let e=e=>{e.key===`Escape`&&c()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]),(0,s.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:c,onKeyDown:()=>{},role:`presentation`,children:(0,s.jsxs)(`div`,{ref:u,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,s.jsx)(`div`,{className:`border-b border-line px-3 py-2 text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:e}),(0,s.jsx)(`p`,{className:`px-3 py-3 text-[12px] leading-relaxed text-muted`,children:t}),(0,s.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-line px-3 py-2`,children:[(0,s.jsx)(`button`,{type:`button`,onClick:c,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,s.jsx)(`button`,{ref:l,type:`button`,onClick:o,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})]})]})})}export{u as a,d as i,p as n,c as o,l as r,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,y as t}from"./tabs-Db1r1FTh.js";import{d as n}from"./createLucideIcon-BoVlWivB.js";import{t as r}from"./SlideOver-D9BDfm6L.js";import{f as i,i as a}from"./issues-YCoQHBtW.js";import{n as o,t as s}from"./RichEditor-DvjbbcLw.js";var c=e(t(),1),l=n();function u({repoRoot:e,open:t,onClose:n,onCreated:u}){let[d,f]=(0,c.useState)(``),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(void 0),[_,v]=(0,c.useState)(void 0),[y,b]=(0,c.useState)(!1),[x,S]=(0,c.useState)(null),C=d.trim().length>0&&!y,w=t=>{if(!C)return;let r=d.trim();b(!0),S(null),a(e,p.trim()?{title:r,body:p}:{title:r}).then(async a=>{let o=a.issues.find(e=>e.title===r)??a.issues[0];t&&o&&await i(e,o,h,_),o&&u(o,t),f(``),m(``),n()}).catch(e=>{S(e instanceof Error?e.message:`failed to create issue`)}).finally(()=>b(!1))};return(0,l.jsx)(r,{open:t,onClose:n,title:`New story`,footer:(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-3 py-2.5`,children:[(0,l.jsx)(`button`,{type:`button`,disabled:!C,onClick:()=>w(!1),className:`border border-line bg-bg px-3 py-1 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,children:y?`Saving…`:`Save`}),(0,l.jsx)(`button`,{type:`button`,disabled:!C,onClick:()=>w(!0),className:`border border-primary bg-inset px-3 py-1 text-[11px] text-fg transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-40`,children:y?`Starting…`:`Start session`})]}),children:(0,l.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Title`}),(0,l.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`What should the session deliver?`,autoFocus:!0,className:`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`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Acceptance`}),(0,l.jsx)(`span`,{className:`text-[10px] text-subtle`,children:`paste or drop images`})]}),(0,l.jsx)(s,{value:p,onChange:m,repoRoot:e,placeholder:`context, constraints, acceptance criteria — paste a screenshot to attach it`})]}),(0,l.jsx)(o,{vendor:h,effort:_,disabled:y,onChange:e=>{g(e.vendor),v(e.effort)}}),x&&(0,l.jsx)(`p`,{className:`text-[11px] text-kobe-red`,role:`alert`,children:x})]})})}export{u as IssueIntakePanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,y as t}from"./tabs-Db1r1FTh.js";import{d as n,t as r}from"./createLucideIcon-BoVlWivB.js";import{t as i}from"./external-link-C51-09OW.js";import{t as a}from"./SlideOver-D9BDfm6L.js";import{n as o,r as s}from"./issues-YCoQHBtW.js";import{n as c,t as l}from"./RichEditor-DvjbbcLw.js";var u=r(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),d=r(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),f=e(t(),1),p=n();function m({issue:e,repoRoot:t,busy:n,starting:r,onClose:m,onSave:h,onStart:g,onOpenSession:_,onPromptMerge:v}){let[y,b]=(0,f.useState)(e.title),[x,S]=(0,f.useState)(e.body),[C,w]=(0,f.useState)(void 0),[T,E]=(0,f.useState)(void 0),[D,O]=(0,f.useState)(null),k=!!e.taskId,A=s(e.status)&&!k,j=y!==e.title||x!==e.body,M=j&&y.trim().length>0&&!n,N=o[e.status];return(0,p.jsx)(a,{open:!0,wide:!0,onClose:m,title:(0,p.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,p.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-subtle`,children:[`#`,e.id]}),(0,p.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),children:(0,p.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,p.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 border-r border-line p-3`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Title`}),(0,p.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Issue title`,className:`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`})]}),(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,p.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Acceptance`}),(0,p.jsx)(`span`,{className:`text-[10px] text-subtle`,children:`paste or drop images`})]}),(0,p.jsx)(l,{value:x,onChange:S,repoRoot:t,placeholder:`context, constraints, acceptance criteria — paste a screenshot to attach it`},e.id)]}),D&&(0,p.jsx)(`p`,{className:`text-[11px] text-kobe-red`,role:`alert`,children:D}),(0,p.jsx)(`div`,{className:`flex justify-end`,children:(0,p.jsx)(`button`,{type:`button`,disabled:!M,onClick:()=>{M&&(O(null),h({title:y,body:x}).catch(e=>{O(e instanceof Error?e.message:`failed to save issue`)}))},title:j?`Save title and body`:`No unsaved changes`,className:`border border-primary bg-inset px-3 py-1 text-[11px] text-fg transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-40`,children:n?`Saving…`:`Save`})})]}),(0,p.jsxs)(`div`,{className:`flex w-72 shrink-0 flex-col gap-4 p-3`,children:[(0,p.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,p.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Detail`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] ${N.accent}`,children:N.title}),(0,p.jsxs)(`span`,{className:`font-mono text-[10px] text-subtle`,children:[`created `,e.created]})]}),k&&e.taskId&&(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[10px] text-kobe-orange`,title:`Linked to task ${e.taskId}`,children:[(0,p.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-kobe-orange`}),`running`]})]}),(0,p.jsxs)(`section`,{className:`flex flex-col gap-1.5 border-t border-line pt-3`,children:[(0,p.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Engine`}),(0,p.jsx)(c,{vendor:C,effort:T,disabled:!A,onChange:e=>{w(e.vendor),E(e.effort)}})]}),(0,p.jsx)(`div`,{className:`mt-auto flex flex-col gap-2 border-t border-line pt-3`,children:k?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>_?.(),disabled:!_,title:`Open this story's running session in the workspace`,className:`flex h-8 items-center justify-center gap-1.5 border border-primary bg-inset px-3 text-[11px] text-fg transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,p.jsx)(i,{size:12,strokeWidth:1.8}),`Open session`]}),(0,p.jsxs)(`button`,{type:`button`,onClick:()=>v?.(),disabled:!v||r,title:`Insert the finish and merge prompt into this story's task`,className:`flex h-8 items-center justify-center gap-1.5 border border-line bg-bg px-3 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,p.jsx)(u,{size:12,strokeWidth:1.8}),`Prompt merge`]}),(0,p.jsx)(`span`,{className:`text-center text-[10px] text-subtle`,children:`Started`})]}):A?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>g({vendor:C,effort:T,watch:!1}),title:`Spawn a kobe task session for this story and stay on the board`,className:`flex h-8 items-center justify-center gap-1.5 border border-line bg-bg px-3 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,p.jsx)(d,{size:12,strokeWidth:1.8}),r?`Starting…`:`Start in background`]}),(0,p.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>g({vendor:C,effort:T,watch:!0}),title:`Spawn a kobe task session and open it`,className:`flex h-8 items-center justify-center gap-1.5 border border-primary bg-inset px-3 text-[11px] text-fg transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,p.jsx)(d,{size:12,strokeWidth:1.8}),r?`Starting…`:`Start & watch`]})]}):(0,p.jsx)(`p`,{className:`text-center text-[10px] text-subtle`,children:`Done stories have nothing left to start.`})})]})]})})}export{m as IssuePeek};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,c as t,y as n}from"./tabs-Db1r1FTh.js";import{a as r,r as i}from"./toast-CfAxitbT.js";import{d as a,t as o}from"./createLucideIcon-BoVlWivB.js";import{n as ee}from"./store-BXWXnGds.js";import{a as te,i as ne,n as re,r as s,t as c}from"./lazy-issue-panels-
|
|
1
|
+
import{S as e,c as t,y as n}from"./tabs-Db1r1FTh.js";import{a as r,r as i}from"./toast-CfAxitbT.js";import{d as a,t as o}from"./createLucideIcon-BoVlWivB.js";import{n as ee}from"./store-BXWXnGds.js";import{a as te,i as ne,n as re,r as s,t as c}from"./lazy-issue-panels-C8OnZML2.js";import{g as l,h as u,p as d}from"./index-BC9H3mAq.js";import{n as f,t as p}from"./ConfirmDialog-BPIwmIjt.js";import{a as m,c as h,d as g,f as _,l as v,m as y,n as b,s as x,t as S,u as C}from"./issues-YCoQHBtW.js";var ie=o(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),w=e(n(),1),T=a();function E(){let{tasks:e,hydrated:n}=ee(),a=r(),[o,E]=(0,w.useState)([]);(0,w.useEffect)(()=>{let e=!1;return x().then(t=>{e||E(t)}).catch(e=>i(`load projects`,e)),()=>{e=!0}},[]);let D=(0,w.useMemo)(()=>C(e,o),[e,o]),[O,k]=(0,w.useState)(null);(0,w.useEffect)(()=>{if(D.length===0){O!==null&&k(null);return}(!O||!D.some(e=>e.repo===O))&&k(D[0]?.repo??null)},[D,O]);let{data:A,failed:j,pending:M}=te((0,w.useMemo)(()=>O?[O]:[],[O])),N=O?A[O]:void 0,[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(!1),[W,G]=(0,w.useState)(!1),[K,q]=(0,w.useState)(!1),J=N?.issues??[],Y=(0,w.useMemo)(()=>h(J,{query:P}),[J,P]),ae=(0,w.useMemo)(()=>v(Y),[Y]),X=Y.length,Z=R==null?null:J.find(e=>e.id===R),Q=B==null?null:J.find(e=>e.id===B);(0,w.useEffect)(()=>{R!=null&&!J.some(e=>e.id===R)&&z(null),B!=null&&!J.some(e=>e.id===B)&&V(null)},[J,R,B]);let $=e=>{a({to:`/task/$taskId`,params:{taskId:e}})};return(0,T.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,T.jsxs)(`header`,{"data-kobe-topbar":!0,className:`flex h-10 shrink-0 items-center gap-3 border-b border-line bg-surface px-3`,children:[(0,T.jsx)(f,{}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>a({to:`/`}),className:`flex items-center gap-1.5 text-muted transition-colors hover:text-fg`,title:`Back to workspace`,children:[(0,T.jsx)(ie,{size:15,strokeWidth:1.8}),(0,T.jsx)(`span`,{className:`text-[12px]`,children:`Workspace`})]}),(0,T.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Issues`}),(0,T.jsxs)(`label`,{className:`flex h-7 items-center gap-1.5 border border-line bg-bg px-2 text-muted focus-within:border-line-active`,children:[(0,T.jsx)(u,{size:13,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,T.jsx)(`input`,{value:P,onChange:e=>F(e.target.value),placeholder:`Filter stories ( #id, title, body )`,className:`w-52 bg-transparent text-[12px] text-fg placeholder:text-subtle focus:outline-none`}),P&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear filter`,title:`Clear filter`,children:(0,T.jsx)(d,{size:13,strokeWidth:2})})]}),D.length>0&&(0,T.jsxs)(`label`,{className:`flex h-7 min-w-0 max-w-[24rem] items-center gap-1.5 border border-line bg-bg px-2 text-muted focus-within:border-line-active`,children:[(0,T.jsx)(`span`,{className:`shrink-0 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Project`}),(0,T.jsx)(`select`,{value:O??``,onChange:e=>k(e.target.value),title:O??`Select project`,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg focus:outline-none`,children:D.map(e=>(0,T.jsxs)(`option`,{value:e.repo,title:e.repo,className:`bg-surface text-fg`,children:[e.label,` · `,e.count,` · `,e.repo]},e.repo))})]}),(0,T.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[11px] text-subtle`,children:[(0,T.jsxs)(`span`,{children:[X,` stor`,X===1?`y`:`ies`]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!O,onClick:()=>L(!0),className:`flex items-center gap-1.5 border border-primary bg-inset px-2 py-0.5 text-[11px] text-fg transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-40`,title:`Capture a new story`,children:[(0,T.jsx)(l,{size:13,strokeWidth:1.8}),`New story`]})]})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden p-4`,children:O?!n||M&&!N?(0,T.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Loading…`}):O&&j[O]?(0,T.jsx)(`p`,{className:`text-[12px] text-kobe-red`,children:j[O]}):X===0?(0,T.jsx)(`p`,{className:`text-[12px] text-subtle`,children:P?`No stories match your filter.`:`No stories yet. Capture one with New story.`}):(0,T.jsx)(`div`,{className:`flex h-full min-h-0 gap-4`,children:S.map(e=>{let t=b[e],n=ae[e];return(0,T.jsxs)(`section`,{className:`flex h-full min-h-0 w-72 shrink-0 flex-col`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[(0,T.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] ${t.accent}`,children:t.title}),(0,T.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:n.length})]}),(0,T.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pr-0.5`,children:n.map(e=>(0,T.jsx)(ne,{issue:e,onOpen:()=>z(e.id),onDelete:()=>V(e.id)},e.id))})]},e)})}):(0,T.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`No projects yet. Create a task from the workspace to track stories against its repo.`})}),O&&I&&(0,T.jsx)(c,{children:(0,T.jsx)(re,{repoRoot:O,open:I,onClose:()=>L(!1),onCreated:(e,t)=>{t&&e.taskId&&$(e.taskId)}})}),O&&Z&&(0,T.jsx)(c,{children:(0,T.jsx)(s,{issue:Z,repoRoot:O,busy:H,starting:W,onClose:()=>z(null),onSave:async e=>{if(!O||R==null)return!1;U(!0);try{return await y(O,R,{title:e.title.trim(),body:e.body}),!0}catch(e){return i(`save issue`,e),!1}finally{U(!1)}},onStart:e=>{!O||!Z||(G(!0),_(O,Z,e.vendor,e.effort).then(({taskId:t})=>{z(null),e.watch&&$(t)}).catch(e=>i(`start issue`,e)).finally(()=>G(!1)))},onOpenSession:Z.taskId?()=>{let e=Z.taskId;e&&(t(e),$(e))}:void 0,onPromptMerge:Z.taskId?()=>{let e=Z.taskId;e&&g(e,Z).catch(e=>i(`prompt issue merge`,e))}:void 0})}),Q&&(0,T.jsx)(p,{title:`Delete issue`,body:`Delete issue #${Q.id} "${Q.title}"? This removes only the issue record — any linked task, branch, or worktree is left untouched.`,confirmLabel:`Delete`,danger:!0,busy:K,onConfirm:()=>{!O||B==null||(q(!0),m(O,B).then(()=>V(null)).catch(e=>i(`delete issue`,e)).finally(()=>q(!1)))},onCancel:()=>V(null)})]})}export{E as IssuesPage};
|