@sma1lboy/kobe 0.8.19 → 0.8.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/cli/index.js +365 -358
  2. package/dist/cli/pty-host-node.mjs +906 -0
  3. package/dist/web-ui/assets/{AppShell-CvbbXJ5F.js → AppShell-Z8dP5tHs.js} +1 -1
  4. package/dist/web-ui/assets/{Board-Bv4goPMT.js → Board-VYFdvD23.js} +1 -1
  5. package/dist/web-ui/assets/{BoardPeek-BkY9UuOO.js → BoardPeek-VjYNGa_e.js} +2 -2
  6. package/dist/web-ui/assets/{ChatTerminal-Ci4mphvC.js → ChatTerminal-Dq5p6wd6.js} +1 -1
  7. package/dist/web-ui/assets/{ChatTranscript-ChbwT5aF.js → ChatTranscript-hdh-Z0CK.js} +1 -1
  8. package/dist/web-ui/assets/{ConfirmDialog-DLIhXq7i.js → ConfirmDialog-CUQLUsl5.js} +1 -1
  9. package/dist/web-ui/assets/{IssueIntakePanel-GVI4EcXz.js → IssueIntakePanel-CLYooVNv.js} +1 -1
  10. package/dist/web-ui/assets/{IssuePeek-GlD8qNa1.js → IssuePeek-DSvnw2pj.js} +1 -1
  11. package/dist/web-ui/assets/{IssuesPage-CCi4SQui.js → IssuesPage--95SRz1C.js} +1 -1
  12. package/dist/web-ui/assets/{RichEditor-zHTUYZU1.js → RichEditor-CTJuSqgK.js} +1 -1
  13. package/dist/web-ui/assets/{SettingsPage-DaEgIDC8.js → SettingsPage-CCAlgkym.js} +1 -1
  14. package/dist/web-ui/assets/{SlideOver-BL608zkP.js → SlideOver-BlmF_2fr.js} +1 -1
  15. package/dist/web-ui/assets/{ViewToggle-CMm5Drjy.js → ViewToggle-Dy8qGxUZ.js} +1 -1
  16. package/dist/web-ui/assets/{WorkspaceTabs-B_KOnpJT.js → WorkspaceTabs-8YMM_mCR.js} +3 -3
  17. package/dist/web-ui/assets/active-task-D3aDSt8x.js +1 -0
  18. package/dist/web-ui/assets/arrow-left-CVsK1Z_1.js +1 -0
  19. package/dist/web-ui/assets/board-BU6SpFlJ.js +1 -0
  20. package/dist/web-ui/assets/{chips-ER3SiHRg.js → chips-fTvSKM6V.js} +1 -1
  21. package/dist/web-ui/assets/{columns-3-B2K2DW2I.js → columns-3-y4l60-at.js} +1 -1
  22. package/dist/web-ui/assets/{createLucideIcon-B3ImGkvG.js → createLucideIcon-BFra8ckc.js} +1 -1
  23. package/dist/web-ui/assets/desktop-DnKVqhdT.js +2 -0
  24. package/dist/web-ui/assets/{engines-BpGfH1Zd.js → engines-VaA1oIxi.js} +1 -1
  25. package/dist/web-ui/assets/{external-link-D0CjtZaF.js → external-link-D72l1S75.js} +1 -1
  26. package/dist/web-ui/assets/{external-store-BMGmoHuF.js → external-store-CcZewmhW.js} +1 -1
  27. package/dist/web-ui/assets/{harness-BLR9sq9b.js → harness-D5256zaS.js} +1 -1
  28. package/dist/web-ui/assets/{index-CxTIVbF1.js → index-kwi5l86q.js} +3 -3
  29. package/dist/web-ui/assets/{issues-D1vtEzDa.js → issues-89uT5swt.js} +1 -1
  30. package/dist/web-ui/assets/issues-CTAEv0gu.js +1 -0
  31. package/dist/web-ui/assets/{lazy-issue-panels-CqdZEwZJ.js → lazy-issue-panels-D77tReDb.js} +3 -3
  32. package/dist/web-ui/assets/plus-BhhrqdEO.js +1 -0
  33. package/dist/web-ui/assets/{react-dom-BzHW8sem.js → react-dom-BQKJ1DoI.js} +1 -1
  34. package/dist/web-ui/assets/{rotate-cw-BxAflhQC.js → rotate-cw-Dg0ivobX.js} +1 -1
  35. package/dist/web-ui/assets/routes-DDtBxDwQ.js +1 -0
  36. package/dist/web-ui/assets/search-DA3nII27.js +1 -0
  37. package/dist/web-ui/assets/{store-DfONeFqN.js → store-LXLUDGEO.js} +2 -2
  38. package/dist/web-ui/assets/{tabs-C6drmk5t.js → tabs-C_UMvAeW.js} +1 -1
  39. package/dist/web-ui/assets/{task._taskId-DnczIHek.js → task._taskId-CTKLplr9.js} +2 -2
  40. package/dist/web-ui/assets/task._taskId-fF9XZnCt.js +1 -0
  41. package/dist/web-ui/assets/{toast-B5B1PUen.js → toast-Da-Q67N5.js} +1 -1
  42. package/dist/web-ui/assets/{triage-B8LSomfv.js → triage-D4d3Ytrq.js} +1 -1
  43. package/dist/web-ui/assets/{use-focus-trap-Bxa2qAjl.js → use-focus-trap-Zurfhrn8.js} +1 -1
  44. package/dist/web-ui/assets/{with-selector-9aQB38X4.js → with-selector-BQWSRu28.js} +1 -1
  45. package/dist/web-ui/assets/{worktrees-CyLbHRDQ.js → worktrees-DBbyo2ew.js} +1 -1
  46. package/dist/web-ui/assets/x-CopxPdj3.js +1 -0
  47. package/dist/web-ui/index.html +18 -18
  48. package/package.json +11 -11
  49. package/dist/web-ui/assets/active-task-bg1gRRr9.js +0 -1
  50. package/dist/web-ui/assets/arrow-left-CTu620DY.js +0 -1
  51. package/dist/web-ui/assets/board-BFy_bR1J.js +0 -1
  52. package/dist/web-ui/assets/desktop-BMy3eltH.js +0 -2
  53. package/dist/web-ui/assets/issues-wKDOEVmV.js +0 -1
  54. package/dist/web-ui/assets/plus-DZE7jB02.js +0 -1
  55. package/dist/web-ui/assets/routes-DoLYSrQS.js +0 -1
  56. package/dist/web-ui/assets/search-cqUzSqUT.js +0 -1
  57. package/dist/web-ui/assets/task._taskId-CCkQTzD1.js +0 -1
  58. package/dist/web-ui/assets/x-BtkkvyxG.js +0 -1
@@ -1,4 +1,4 @@
1
- import{l as e,o as t}from"./terminal-B6OlmT6e.js";import{_ as n,f as r,l as i,r as a,y as o}from"./tabs-C6drmk5t.js";import{d as s,t as c}from"./createLucideIcon-B3ImGkvG.js";import{a as l,n as u,r as d}from"./toast-B5B1PUen.js";import{n as f,t as p}from"./ViewToggle-CMm5Drjy.js";import{n as m,t as h}from"./store-DfONeFqN.js";import{n as g,t as _}from"./active-task-bg1gRRr9.js";import{t as v}from"./external-store-BMGmoHuF.js";import{c as y,d as b,i as x,l as S,p as C,r as w,t as T,u as E}from"./triage-B8LSomfv.js";import{i as D,r as O,t as k}from"./WorkspaceTabs-B_KOnpJT.js";import{t as A}from"./SettingsPage-DaEgIDC8.js";import{t as j}from"./ChatTranscript-ChbwT5aF.js";import{t as ee}from"./plus-DZE7jB02.js";import{t as te}from"./search-cqUzSqUT.js";import{t as ne}from"./x-BtkkvyxG.js";import{n as M,t as N}from"./activity-BjTd1D8q.js";import{t as P}from"./use-focus-trap-Bxa2qAjl.js";import{t as re}from"./engines-BpGfH1Zd.js";import{n as ie}from"./settings-BrzH0i_8.js";import{i as ae,r as oe}from"./vendor-CdtpTJrf.js";import{r as F}from"./web-transport-BS7imUMS.js";import{n as se,t as I}from"./time-kviT26Tm.js";import{n as L,t as R}from"./ConfirmDialog-DLIhXq7i.js";import{t as z}from"./text-match-DW3sD-Rt.js";import{t as B}from"./SlideOver-BL608zkP.js";import{n as V,r as ce,t as le}from"./chips-ER3SiHRg.js";var ue=c(`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`}]]),de=c(`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`}]]),H=c(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),fe=c(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),U=e(o(),1),W=s();function pe({onClose:e}){let{tasks:t}=m(),n=l(),i=(0,U.useRef)(null);P(i);let a=(0,U.useMemo)(()=>{let e=new Set,n=[];for(let r of t)r.repo&&!e.has(r.repo)&&(e.add(r.repo),n.push(r.repo));return n.sort()},[t]),o=(0,U.useMemo)(()=>new Set(t.map(e=>e.worktreePath).filter(Boolean)),[t]),[s,c]=(0,U.useState)(a[0]??``),[f,p]=(0,U.useState)(null),[_,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(!1),C=async e=>{if(e){v(!0),p(null);try{let{worktrees:t}=await h(`worktree.discoverAdoptable`,{repo:e});p(t)}catch(e){d(`scan worktrees`,e),p([])}finally{v(!1)}}},T=async t=>{b(t.path);try{let{task:i}=await h(`worktree.adopt`,{repo:s,worktreePath:t.path,branch:t.branch,ifExists:`return`});r(i.id),g(i.id),n({to:`/task/$taskId`,params:{taskId:i.id}}),u(`success`,`Adopted ${t.branch||t.path}`),e()}catch(e){d(`adopt worktree`,e)}finally{b(null)}};return x?(0,W.jsx)(w,{onClose:e}):a.length===0?(0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-label":`Adopt worktree`,className:`flex w-[32rem] max-w-[calc(100vw-2rem)] flex-col border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center`,children:[(0,W.jsx)(`p`,{className:`text-[12px] leading-relaxed text-subtle`,children:`No repos known to kobe yet. Create a task in a repo first, then come back to adopt its worktrees.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>S(!0),className:`mt-4 border border-primary bg-inset px-3 py-1.5 text-[11px] text-fg transition-colors hover:bg-primary/10`,children:`Create a task`})]}),(0,W.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-3 py-1.5 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Close`})})]})}):(0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-label":`Adopt worktree`,className:`flex max-h-[80vh] w-[32rem] max-w-[calc(100vw-2rem)] flex-col border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,W.jsxs)(`div`,{className:`space-y-2 px-3 py-3`,children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Repo`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`min-w-0 flex-1 border border-line bg-bg px-2 py-1.5 text-[12px] text-fg focus:border-line-active focus:outline-none`,children:a.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void C(s),disabled:!s||_,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:_?`Scanning…`:`Scan`})]})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-line`,children:f===null?(0,W.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`Pick a repo and Scan to find adoptable worktrees.`}):f.length===0?(0,W.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`No adoptable worktrees found for this repo.`}):f.map(e=>{let t=o.has(e.path);return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-subtle px-3 py-2 last:border-b-0`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-mono text-[12px] text-fg`,children:e.branch||`(detached)`}),e.dirty&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-kobe-yellow`,children:`dirty`}),e.kobeManaged&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`kobe`})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-subtle`,children:[(0,W.jsx)(`span`,{className:`truncate font-mono`,children:e.path}),e.lastActivityMs>0&&(0,W.jsx)(`span`,{className:`ml-auto shrink-0`,children:se(e.lastActivityMs)})]})]}),t?(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`tracked`}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>void T(e),disabled:y!==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:y===e.path?`Adopting…`:`Adopt`})]},e.path)})}),(0,W.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-3 py-1.5 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Close`})})]})})}var G=v({query:``,statusFilter:`all`,sortMode:`default`,showArchived:!1}),K=null;function q(e){G.update(t=>({...t,...e}))}function J(e){q({query:e})}function Y(e){q({statusFilter:e})}function me(e){q({sortMode:e})}function he(e){q({showArchived:e})}function ge(e){!e||e===K||(K=e,q({sortMode:e}))}function _e(){return G.useSnapshot()}function ve(e){let t=Date.parse(e.updatedAt||e.createdAt);return Number.isFinite(t)?t:0}function ye(e,t){let n=ve(t)-ve(e);return n===0?t.id.localeCompare(e.id):n}function be(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(ye),i.sort(ye)),[...n,...r,...i]}function xe(e,t){return z([e.title,e.branch,e.repo,e.worktreePath,e.vendor,e.status].filter(Boolean).join(` `),t)}function Se({task:e,onClose:t}){return(0,W.jsx)(B,{open:e!==null,onClose:t,title:e?(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.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,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title||e.branch})]}):void 0,children:e&&(0,W.jsx)(j,{worktreePath:e.worktreePath??null,vendor:e.vendor??`claude`,title:e.title||e.branch})})}function Ce({children:e,suffix:t}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`h-px flex-1 bg-line`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] font-bold uppercase text-primary`,children:t})]}):null]})}function we({task:e,engine:t,job:n,changes:r,engineName:i,active:a,onClick:o}){let s=n?.phase===`running`,c=s?`materializing…`:M(t?.state),l=I(e.updatedAt||e.createdAt);return(0,W.jsxs)(`button`,{type:`button`,"data-task-id":e.id,onClick:o,className:`group w-full border-l-2 px-3 py-2 text-left transition-colors ${a?`border-primary bg-inset`:`border-transparent hover:bg-surface`}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s?(0,W.jsx)(H,{size:10,strokeWidth:2.5,className:`shrink-0 animate-spin text-primary`}):(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${N(t?.state)}`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${a?`text-fg`:`text-fg/90`}`,children:e.title||e.branch}),(0,W.jsx)(ce,{pr:e.prStatus}),e.pinned&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`PIN`}),(0,W.jsx)(le,{counts:r})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 pl-3.5 text-[11px] text-subtle`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.branch||`—`}),(0,W.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,W.jsx)(V,{label:i}),c&&(0,W.jsx)(`span`,{className:`text-muted`,children:c}),l&&(0,W.jsx)(`span`,{className:`text-subtle`,children:l})]})]})]})}function Te({task:e,onRestore:t,onPreview:n}){let r=e.title||e.branch;return(0,W.jsxs)(`div`,{className:`group flex items-center gap-2 border-l-2 border-transparent px-3 py-1.5`,children:[n?(0,W.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,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] text-subtle`,children:r}),(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 border border-line bg-surface px-1.5 py-0.5 text-[10px] text-muted opacity-0 transition-opacity hover:border-primary hover:text-fg group-hover:opacity-100`,children:`Restore`})]})}function Ee({onOpenSettings:e,onNewTask:t,onAdopt:i}){let{tasks:a,engineStates:o,jobs:s,worktreeChanges:c,uiPrefs:u,hydrated:f,streamConnected:p}=m(),{selectedTaskId:_}=n(),v=re(),y=(0,U.useMemo)(()=>oe(a),[a]),b=e=>ae(v,e,y),{query:S,statusFilter:C,sortMode:w,showArchived:E}=_e(),D=(0,U.useRef)(null),O=(0,U.useRef)(null);(0,U.useEffect)(()=>{_&&D.current?.querySelector(`[data-task-id="${CSS.escape(_)}"]`)?.scrollIntoView({block:`nearest`})},[_]);let k=u?.sortMode;(0,U.useEffect)(()=>{ge(k)},[k]);let A=(0,U.useMemo)(()=>a.filter(e=>!e.archived),[a]),j=(0,U.useMemo)(()=>a.filter(e=>e.archived&&e.kind!==`main`),[a]),M=(0,U.useMemo)(()=>be(A.filter(e=>xe(e,S)&&T(o[e.id],c[e.worktreePath],C)),w),[A,S,C,w,o,c]),N=M.filter(e=>e.kind===`main`),P=M.filter(e=>e.kind!==`main`),F=!f||!p&&a.length===0,se=l(),I=e=>{r(e),g(e),se({to:`/task/$taskId`,params:{taskId:e}})};(0,U.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(),O.current?.focus();return}if(n&&o&&o!==document.body&&!D.current?.contains(o)||M.length===0)return;e.preventDefault();let s=M.findIndex(e=>e.id===_),c=s===-1?0:Math.min(Math.max(s+(r?1:-1),0),M.length-1);I(M[c].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M,_]);let L=e=>{h(`task.archive`,{taskId:e.id,archived:!1}).catch(t=>d(`restore "${e.title||e.branch}"`,t))},[R,z]=(0,U.useState)(!1),[B,V]=(0,U.useState)(null);return(0,U.useEffect)(()=>{let e=!0;return ie().then(t=>{e&&z(t.archivedHistoryPreview===!0)}).catch(()=>{}),()=>{e=!1}},[]),(0,W.jsxs)(`aside`,{className:`flex w-64 shrink-0 flex-col border-r border-line bg-bg`,children:[(0,W.jsxs)(`div`,{className:`border-b border-line bg-surface/50 px-3 py-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Tasks`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>me(w==="default"?`recent`:`default`),className:`font-mono text-[10px] uppercase ${w===`recent`?`text-primary`:`text-muted hover:text-fg`}`,title:`Toggle task sort`,children:`sort`}),(0,W.jsxs)(`span`,{className:`font-mono text-[10px] text-muted`,children:[M.length,`/`,A.length]}),(0,W.jsx)(`button`,{type:`button`,onClick:i,className:`text-muted transition-colors hover:text-primary`,title:`Adopt an existing worktree`,"aria-label":`Adopt worktree`,children:(0,W.jsx)(de,{size:14,strokeWidth:1.9})}),(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted transition-colors hover:text-primary`,title:`New task`,"aria-label":`New task`,children:(0,W.jsx)(ee,{size:14,strokeWidth:2.2})})]})]}),(0,W.jsxs)(`label`,{className:`mt-2 flex h-8 items-center gap-2 border border-line bg-bg px-2 text-[12px] text-muted focus-within:border-line-active`,children:[(0,W.jsx)(te,{size:14,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,W.jsx)(`input`,{ref:O,value:S,onChange:e=>J(e.target.value),onKeyDown:e=>{e.key===`Enter`&&M.length>0?(e.preventDefault(),I(M[0].id),e.currentTarget.blur()):e.key===`Escape`&&S&&(e.preventDefault(),J(``))},placeholder:`Filter tasks`,className:`min-w-0 flex-1 bg-transparent text-fg placeholder:text-subtle focus:outline-none`}),S&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>J(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear task filter`,title:`Clear filter`,children:(0,W.jsx)(ne,{size:13,strokeWidth:2})})]}),(0,W.jsx)(`div`,{className:`mt-2 flex items-center gap-1`,children:[{key:`all`,label:`All`,title:`All tasks`},{key:`attention`,label:`Needs`,title:`Needs input / errored / rate-limited`}].map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>Y(e.key),title:e.title,className:`border px-1.5 py-0.5 text-[10px] transition-colors ${C===e.key?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,children:e.label},e.key))})]}),(0,W.jsxs)(`div`,{ref:D,className:`flex-1 overflow-y-auto`,children:[F?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-[12px] text-subtle`,children:[(0,W.jsx)(H,{size:13,strokeWidth:2,className:`animate-spin`}),(0,W.jsx)(`span`,{children:`connecting…`})]}):A.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,W.jsx)(`p`,{children:`No tasks yet.`}),(0,W.jsx)(`button`,{type:`button`,onClick:t,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`})]}):M.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,W.jsx)(`div`,{children:S?`No matches for “${S}”.`:`No tasks in this status.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{J(``),Y(`all`)},className:`mt-3 border border-line bg-surface px-2 py-1 text-[11px] text-muted hover:border-primary hover:text-fg`,children:`Clear filter`})]}):(0,W.jsxs)(W.Fragment,{children:[N.length>0&&(0,W.jsx)(Ce,{children:`Projects`}),N.map(e=>(0,W.jsx)(we,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],engineName:b(e),active:e.id===_,onClick:()=>I(e.id)},e.id)),P.length>0&&(0,W.jsx)(Ce,{suffix:w==="default"?void 0:w,children:`Worktrees`}),P.map(e=>(0,W.jsx)(we,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],engineName:b(e),active:e.id===_,onClick:()=>I(e.id)},e.id))]}),!F&&j.length>0&&(0,W.jsxs)(`div`,{className:`mt-2 border-t border-line-subtle pb-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>he(!E),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Archived`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:j.length}),(0,W.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-subtle`,children:E?`−`:`+`})]}),E&&j.map(e=>(0,W.jsx)(Te,{task:e,onRestore:()=>L(e),onPreview:R?()=>V(e):void 0},e.id))]})]}),(0,W.jsx)(Se,{task:B,onClose:()=>V(null)}),(0,W.jsx)(`div`,{className:`border-t border-line p-2`,children:(0,W.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,W.jsx)(x,{size:15,strokeWidth:1.8}),(0,W.jsx)(`span`,{children:`Settings`})]})})]})}async function De(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,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var Oe=/^\/api\/issue-assets\/[a-f0-9]{16}\/[A-Za-z0-9_-]+\.[a-z0-9]+$/;function ke(e){let t=e.trim();return Oe.test(t)?t:null}function Ae(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 je(e){let t=e;return t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(e,t,n)=>{let r=ke(n.replace(/&amp;/g,`&`));return r?`<img src="${X(r)}" alt="${X(t)}" loading="lazy" class="kobe-md-img">`:`![${t}](${n})`})),t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=Ae(n.replace(/&amp;/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>`:je(e)).join(``)}function Me(e){let t=e.replace(/\r\n/g,`
1
+ import{l as e,o as t}from"./terminal-B6OlmT6e.js";import{_ as n,f as r,l as i,r as a,y as o}from"./tabs-C_UMvAeW.js";import{d as s,t as c}from"./createLucideIcon-BFra8ckc.js";import{a as l,n as u,r as d}from"./toast-Da-Q67N5.js";import{n as f,t as p}from"./ViewToggle-Dy8qGxUZ.js";import{n as m,t as h}from"./store-LXLUDGEO.js";import{n as g,t as _}from"./active-task-D3aDSt8x.js";import{t as v}from"./external-store-CcZewmhW.js";import{c as y,d as b,i as x,l as S,p as C,r as w,t as T,u as E}from"./triage-D4d3Ytrq.js";import{i as D,r as O,t as k}from"./WorkspaceTabs-8YMM_mCR.js";import{t as A}from"./SettingsPage-CCAlgkym.js";import{t as j}from"./ChatTranscript-hdh-Z0CK.js";import{t as ee}from"./plus-BhhrqdEO.js";import{t as te}from"./search-DA3nII27.js";import{t as ne}from"./x-CopxPdj3.js";import{n as M,t as N}from"./activity-BjTd1D8q.js";import{t as P}from"./use-focus-trap-Zurfhrn8.js";import{t as re}from"./engines-VaA1oIxi.js";import{n as ie}from"./settings-BrzH0i_8.js";import{i as ae,r as oe}from"./vendor-CdtpTJrf.js";import{r as F}from"./web-transport-BS7imUMS.js";import{n as se,t as I}from"./time-kviT26Tm.js";import{n as L,t as R}from"./ConfirmDialog-CUQLUsl5.js";import{t as z}from"./text-match-DW3sD-Rt.js";import{t as B}from"./SlideOver-BlmF_2fr.js";import{n as V,r as ce,t as le}from"./chips-fTvSKM6V.js";var ue=c(`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`}]]),de=c(`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`}]]),H=c(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),fe=c(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),U=e(o(),1),W=s();function pe({onClose:e}){let{tasks:t}=m(),n=l(),i=(0,U.useRef)(null);P(i);let a=(0,U.useMemo)(()=>{let e=new Set,n=[];for(let r of t)r.repo&&!e.has(r.repo)&&(e.add(r.repo),n.push(r.repo));return n.sort()},[t]),o=(0,U.useMemo)(()=>new Set(t.map(e=>e.worktreePath).filter(Boolean)),[t]),[s,c]=(0,U.useState)(a[0]??``),[f,p]=(0,U.useState)(null),[_,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(!1),C=async e=>{if(e){v(!0),p(null);try{let{worktrees:t}=await h(`worktree.discoverAdoptable`,{repo:e});p(t)}catch(e){d(`scan worktrees`,e),p([])}finally{v(!1)}}},T=async t=>{b(t.path);try{let{task:i}=await h(`worktree.adopt`,{repo:s,worktreePath:t.path,branch:t.branch,ifExists:`return`});r(i.id),g(i.id),n({to:`/task/$taskId`,params:{taskId:i.id}}),u(`success`,`Adopted ${t.branch||t.path}`),e()}catch(e){d(`adopt worktree`,e)}finally{b(null)}};return x?(0,W.jsx)(w,{onClose:e}):a.length===0?(0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-label":`Adopt worktree`,className:`flex w-[32rem] max-w-[calc(100vw-2rem)] flex-col border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,W.jsxs)(`div`,{className:`px-3 py-6 text-center`,children:[(0,W.jsx)(`p`,{className:`text-[12px] leading-relaxed text-subtle`,children:`No repos known to kobe yet. Create a task in a repo first, then come back to adopt its worktrees.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>S(!0),className:`mt-4 border border-primary bg-inset px-3 py-1.5 text-[11px] text-fg transition-colors hover:bg-primary/10`,children:`Create a task`})]}),(0,W.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-3 py-1.5 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Close`})})]})}):(0,W.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},role:`presentation`,children:(0,W.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-label":`Adopt worktree`,className:`flex max-h-[80vh] w-[32rem] max-w-[calc(100vw-2rem)] flex-col border border-line bg-surface shadow-xl`,onClick:e=>e.stopPropagation(),onKeyDown:()=>{},children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Adopt worktree`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:`pull an existing worktree into kobe`})]}),(0,W.jsxs)(`div`,{className:`space-y-2 px-3 py-3`,children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Repo`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`min-w-0 flex-1 border border-line bg-bg px-2 py-1.5 text-[12px] text-fg focus:border-line-active focus:outline-none`,children:a.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void C(s),disabled:!s||_,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:_?`Scanning…`:`Scan`})]})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-line`,children:f===null?(0,W.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`Pick a repo and Scan to find adoptable worktrees.`}):f.length===0?(0,W.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-subtle`,children:`No adoptable worktrees found for this repo.`}):f.map(e=>{let t=o.has(e.path);return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-subtle px-3 py-2 last:border-b-0`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-mono text-[12px] text-fg`,children:e.branch||`(detached)`}),e.dirty&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-kobe-yellow`,children:`dirty`}),e.kobeManaged&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`kobe`})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-subtle`,children:[(0,W.jsx)(`span`,{className:`truncate font-mono`,children:e.path}),e.lastActivityMs>0&&(0,W.jsx)(`span`,{className:`ml-auto shrink-0`,children:se(e.lastActivityMs)})]})]}),t?(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`tracked`}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>void T(e),disabled:y!==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:y===e.path?`Adopting…`:`Adopt`})]},e.path)})}),(0,W.jsx)(`div`,{className:`flex justify-end border-t border-line px-3 py-2`,children:(0,W.jsx)(`button`,{type:`button`,onClick:e,className:`border border-line bg-bg px-3 py-1.5 text-[11px] text-muted transition-colors hover:border-primary hover:text-fg`,children:`Close`})})]})})}var G=v({query:``,statusFilter:`all`,sortMode:`default`,showArchived:!1}),K=null;function q(e){G.update(t=>({...t,...e}))}function J(e){q({query:e})}function Y(e){q({statusFilter:e})}function me(e){q({sortMode:e})}function he(e){q({showArchived:e})}function ge(e){!e||e===K||(K=e,q({sortMode:e}))}function _e(){return G.useSnapshot()}function ve(e){let t=Date.parse(e.updatedAt||e.createdAt);return Number.isFinite(t)?t:0}function ye(e,t){let n=ve(t)-ve(e);return n===0?t.id.localeCompare(e.id):n}function be(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(ye),i.sort(ye)),[...n,...r,...i]}function xe(e,t){return z([e.title,e.branch,e.repo,e.worktreePath,e.vendor,e.status].filter(Boolean).join(` `),t)}function Se({task:e,onClose:t}){return(0,W.jsx)(B,{open:e!==null,onClose:t,title:e?(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.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,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title||e.branch})]}):void 0,children:e&&(0,W.jsx)(j,{worktreePath:e.worktreePath??null,vendor:e.vendor??`claude`,title:e.title||e.branch})})}function Ce({children:e,suffix:t}){return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:e}),t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`h-px flex-1 bg-line`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] font-bold uppercase text-primary`,children:t})]}):null]})}function we({task:e,engine:t,job:n,changes:r,engineName:i,active:a,onClick:o}){let s=n?.phase===`running`,c=s?`materializing…`:M(t?.state),l=I(e.updatedAt||e.createdAt);return(0,W.jsxs)(`button`,{type:`button`,"data-task-id":e.id,onClick:o,className:`group w-full border-l-2 px-3 py-2 text-left transition-colors ${a?`border-primary bg-inset`:`border-transparent hover:bg-surface`}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s?(0,W.jsx)(H,{size:10,strokeWidth:2.5,className:`shrink-0 animate-spin text-primary`}):(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${N(t?.state)}`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${a?`text-fg`:`text-fg/90`}`,children:e.title||e.branch}),(0,W.jsx)(ce,{pr:e.prStatus}),e.pinned&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`PIN`}),(0,W.jsx)(le,{counts:r})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 pl-3.5 text-[11px] text-subtle`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.branch||`—`}),(0,W.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,W.jsx)(V,{label:i}),c&&(0,W.jsx)(`span`,{className:`text-muted`,children:c}),l&&(0,W.jsx)(`span`,{className:`text-subtle`,children:l})]})]})]})}function Te({task:e,onRestore:t,onPreview:n}){let r=e.title||e.branch;return(0,W.jsxs)(`div`,{className:`group flex items-center gap-2 border-l-2 border-transparent px-3 py-1.5`,children:[n?(0,W.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,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] text-subtle`,children:r}),(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 border border-line bg-surface px-1.5 py-0.5 text-[10px] text-muted opacity-0 transition-opacity hover:border-primary hover:text-fg group-hover:opacity-100`,children:`Restore`})]})}function Ee({onOpenSettings:e,onNewTask:t,onAdopt:i}){let{tasks:a,engineStates:o,jobs:s,worktreeChanges:c,uiPrefs:u,hydrated:f,streamConnected:p}=m(),{selectedTaskId:_}=n(),v=re(),y=(0,U.useMemo)(()=>oe(a),[a]),b=e=>ae(v,e,y),{query:S,statusFilter:C,sortMode:w,showArchived:E}=_e(),D=(0,U.useRef)(null),O=(0,U.useRef)(null);(0,U.useEffect)(()=>{_&&D.current?.querySelector(`[data-task-id="${CSS.escape(_)}"]`)?.scrollIntoView({block:`nearest`})},[_]);let k=u?.sortMode;(0,U.useEffect)(()=>{ge(k)},[k]);let A=(0,U.useMemo)(()=>a.filter(e=>!e.archived),[a]),j=(0,U.useMemo)(()=>a.filter(e=>e.archived&&e.kind!==`main`),[a]),M=(0,U.useMemo)(()=>be(A.filter(e=>xe(e,S)&&T(o[e.id],c[e.worktreePath],C)),w),[A,S,C,w,o,c]),N=M.filter(e=>e.kind===`main`),P=M.filter(e=>e.kind!==`main`),F=!f||!p&&a.length===0,se=l(),I=e=>{r(e),g(e),se({to:`/task/$taskId`,params:{taskId:e}})};(0,U.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(),O.current?.focus();return}if(n&&o&&o!==document.body&&!D.current?.contains(o)||M.length===0)return;e.preventDefault();let s=M.findIndex(e=>e.id===_),c=s===-1?0:Math.min(Math.max(s+(r?1:-1),0),M.length-1);I(M[c].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M,_]);let L=e=>{h(`task.archive`,{taskId:e.id,archived:!1}).catch(t=>d(`restore "${e.title||e.branch}"`,t))},[R,z]=(0,U.useState)(!1),[B,V]=(0,U.useState)(null);return(0,U.useEffect)(()=>{let e=!0;return ie().then(t=>{e&&z(t.archivedHistoryPreview===!0)}).catch(()=>{}),()=>{e=!1}},[]),(0,W.jsxs)(`aside`,{className:`flex w-64 shrink-0 flex-col border-r border-line bg-bg`,children:[(0,W.jsxs)(`div`,{className:`border-b border-line bg-surface/50 px-3 py-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Tasks`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>me(w==="default"?`recent`:`default`),className:`font-mono text-[10px] uppercase ${w===`recent`?`text-primary`:`text-muted hover:text-fg`}`,title:`Toggle task sort`,children:`sort`}),(0,W.jsxs)(`span`,{className:`font-mono text-[10px] text-muted`,children:[M.length,`/`,A.length]}),(0,W.jsx)(`button`,{type:`button`,onClick:i,className:`text-muted transition-colors hover:text-primary`,title:`Adopt an existing worktree`,"aria-label":`Adopt worktree`,children:(0,W.jsx)(de,{size:14,strokeWidth:1.9})}),(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted transition-colors hover:text-primary`,title:`New task`,"aria-label":`New task`,children:(0,W.jsx)(ee,{size:14,strokeWidth:2.2})})]})]}),(0,W.jsxs)(`label`,{className:`mt-2 flex h-8 items-center gap-2 border border-line bg-bg px-2 text-[12px] text-muted focus-within:border-line-active`,children:[(0,W.jsx)(te,{size:14,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,W.jsx)(`input`,{ref:O,value:S,onChange:e=>J(e.target.value),onKeyDown:e=>{e.key===`Enter`&&M.length>0?(e.preventDefault(),I(M[0].id),e.currentTarget.blur()):e.key===`Escape`&&S&&(e.preventDefault(),J(``))},placeholder:`Filter tasks`,className:`min-w-0 flex-1 bg-transparent text-fg placeholder:text-subtle focus:outline-none`}),S&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>J(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear task filter`,title:`Clear filter`,children:(0,W.jsx)(ne,{size:13,strokeWidth:2})})]}),(0,W.jsx)(`div`,{className:`mt-2 flex items-center gap-1`,children:[{key:`all`,label:`All`,title:`All tasks`},{key:`attention`,label:`Needs`,title:`Needs input / errored / rate-limited`}].map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>Y(e.key),title:e.title,className:`border px-1.5 py-0.5 text-[10px] transition-colors ${C===e.key?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,children:e.label},e.key))})]}),(0,W.jsxs)(`div`,{ref:D,className:`flex-1 overflow-y-auto`,children:[F?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-[12px] text-subtle`,children:[(0,W.jsx)(H,{size:13,strokeWidth:2,className:`animate-spin`}),(0,W.jsx)(`span`,{children:`connecting…`})]}):A.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,W.jsx)(`p`,{children:`No tasks yet.`}),(0,W.jsx)(`button`,{type:`button`,onClick:t,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`})]}):M.length===0?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-[12px] leading-relaxed text-subtle`,children:[(0,W.jsx)(`div`,{children:S?`No matches for “${S}”.`:`No tasks in this status.`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{J(``),Y(`all`)},className:`mt-3 border border-line bg-surface px-2 py-1 text-[11px] text-muted hover:border-primary hover:text-fg`,children:`Clear filter`})]}):(0,W.jsxs)(W.Fragment,{children:[N.length>0&&(0,W.jsx)(Ce,{children:`Projects`}),N.map(e=>(0,W.jsx)(we,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],engineName:b(e),active:e.id===_,onClick:()=>I(e.id)},e.id)),P.length>0&&(0,W.jsx)(Ce,{suffix:w==="default"?void 0:w,children:`Worktrees`}),P.map(e=>(0,W.jsx)(we,{task:e,engine:o[e.id],job:s[e.id],changes:c[e.worktreePath],engineName:b(e),active:e.id===_,onClick:()=>I(e.id)},e.id))]}),!F&&j.length>0&&(0,W.jsxs)(`div`,{className:`mt-2 border-t border-line-subtle pb-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>he(!E),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Archived`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:j.length}),(0,W.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-subtle`,children:E?`−`:`+`})]}),E&&j.map(e=>(0,W.jsx)(Te,{task:e,onRestore:()=>L(e),onPreview:R?()=>V(e):void 0},e.id))]})]}),(0,W.jsx)(Se,{task:B,onClose:()=>V(null)}),(0,W.jsx)(`div`,{className:`border-t border-line p-2`,children:(0,W.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,W.jsx)(x,{size:15,strokeWidth:1.8}),(0,W.jsx)(`span`,{children:`Settings`})]})})]})}async function De(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,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var Oe=/^\/api\/issue-assets\/[a-f0-9]{16}\/[A-Za-z0-9_-]+\.[a-z0-9]+$/;function ke(e){let t=e.trim();return Oe.test(t)?t:null}function Ae(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 je(e){let t=e;return t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(e,t,n)=>{let r=ke(n.replace(/&amp;/g,`&`));return r?`<img src="${X(r)}" alt="${X(t)}" loading="lazy" class="kobe-md-img">`:`![${t}](${n})`})),t.includes(`]`)&&t.includes(`)`)&&(t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=Ae(n.replace(/&amp;/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>`:je(e)).join(``)}function Me(e){let t=e.replace(/\r\n/g,`
2
2
  `).split(`
3
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
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(`
@@ -1 +1 @@
1
- import{l as e}from"./terminal-B6OlmT6e.js";import{f as t,y as n}from"./tabs-C6drmk5t.js";import{d as r}from"./createLucideIcon-B3ImGkvG.js";import{a as i,n as a,r as o}from"./toast-B5B1PUen.js";import{n as s,t as c}from"./ViewToggle-CMm5Drjy.js";import{n as l}from"./store-DfONeFqN.js";import{n as u}from"./active-task-bg1gRRr9.js";import{t as d}from"./external-store-BMGmoHuF.js";import{t as f}from"./external-link-D0CjtZaF.js";import{a as p,i as m,n as h,r as g,t as _}from"./lazy-issue-panels-CqdZEwZJ.js";import{t as v}from"./plus-DZE7jB02.js";import{t as y}from"./search-cqUzSqUT.js";import{t as b}from"./x-BtkkvyxG.js";import{n as ee,t as x}from"./ConfirmDialog-DLIhXq7i.js";import{_ as S,a as C,d as te,g as w,h as T,m as E,p as D,s as ne,u as O}from"./issues-D1vtEzDa.js";var k=e(n(),1),A={query:``,repo:null};function j(e){M.update(t=>({...t,...e}))}var M=d(A);function N(){return M.useSnapshot()}function P(e){e!==M.getSnapshot().query&&j({query:e})}function F(e){e!==M.getSnapshot().repo&&j({repo:e})}function re(e){let{issueRepos:t,issueData:n,refreshIssues:r}=e,[i,a]=(0,k.useState)(!1),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(new Map);return(0,k.useEffect)(()=>{u(e=>{if(e.size===0)return e;let r=new Map(e),i=!1;for(let e of t){let t=n[e];if(!(!t||!t.exists))for(let n of t.issues)n.taskId&&r.delete(`${e}:${n.id}`)&&(i=!0)}return i?r:e})},[t,n]),{issueBusy:i,quickStartingId:s,pendingLinks:l,saveIssue:async(e,t,n)=>{a(!0);try{return await T(e,t,n),r([e]),!0}catch(e){return o(`update issue`,e),!1}finally{a(!1)}},deleteIssueConfirmed:async(e,t)=>{a(!0);try{return await C(e,t.id),r([e]),!0}catch(e){return o(`delete issue`,e),!1}finally{a(!1)}},quickStart:async(e,t,n,r,i)=>{if(s===null){c(t.id);try{let{taskId:a,workspaceTaskId:o}=await E(e,t,{vendor:n,effort:r,placement:i});return i!==`project`&&u(n=>{let r=new Map(n);return r.set(`${e}:${t.id}`,{repo:e,issueId:t.id,taskId:a}),r}),o}catch(e){o(`quick start issue`,e);return}finally{c(null)}}}}}var I=r();function L({repo:e,column:t,onNewIssue:n,onPeekIssue:r,onOpenTask:i,onDeleteIssue:a}){return(0,I.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,I.jsxs)(`div`,{className:`mb-2 flex items-baseline gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] ${t.accent}`,children:t.title}),(0,I.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:t.cards.length+t.hiddenCount}),n&&(0,I.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,I.jsx)(v,{size:11,strokeWidth:2}),(0,I.jsx)(`span`,{children:`New story`})]})]}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pb-2`,children:[t.cards.length===0?(0,I.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=S(t)?t.taskId:void 0;return(0,I.jsxs)(`div`,{className:`group/wrap relative`,children:[(0,I.jsx)(m,{issue:t,onOpen:()=>r(t),onDelete:()=>a(t)}),n&&(0,I.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,I.jsx)(f,{size:10,strokeWidth:1.8}),(0,I.jsx)(`span`,{children:`open task`})]})]},`issue:${t.id}`)}),t.hiddenCount>0&&(0,I.jsxs)(`div`,{className:`p-2 text-center text-[10px] text-subtle`,children:[`+`,t.hiddenCount,` more — finish stories to thin this column`]})]})]})}function ie({board:e,onNewIssue:t,onPeekIssue:n,onOpenTask:r,onDeleteIssue:i}){return(0,I.jsx)(`div`,{className:`flex h-full min-w-max gap-4`,children:e.columns.map(a=>(0,I.jsx)(L,{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 R(){let{tasks:e,hydrated:n,daemonConnected:r}=l(),{query:d,repo:f}=N(),m=i(),S=(0,k.useRef)(null),[C,T]=(0,k.useState)(null),[E,A]=(0,k.useState)(null),[j,M]=(0,k.useState)(null),[L,R]=(0,k.useState)([]);(0,k.useEffect)(()=>{let e=!1;return ne().then(t=>{e||R(t)}).catch(e=>o(`load projects`,e)),()=>{e=!0}},[]);let z=(0,k.useMemo)(()=>O(e,L),[e,L]),B=(0,k.useMemo)(()=>z.map(e=>e.repo),[z]),V=(0,k.useMemo)(()=>D(z,f),[z,f]),{data:H,pending:U,refresh:W}=p(B),{issueBusy:G,quickStartingId:K,pendingLinks:q,saveIssue:J,deleteIssueConfirmed:ae,quickStart:oe}=re({issueRepos:B,issueData:H,refreshIssues:W}),{allIssues:Y,repoChips:se,projectBoards:X,shownCount:Z,hasAnyCard:Q}=(0,k.useMemo)(()=>w({issueData:H,issueRepos:B,pendingLinks:q,query:d,repoFilter:V}),[H,B,q,d,V]);(0,k.useEffect)(()=>{C&&(Y.some(e=>e.repo===C.repo&&e.issue.id===C.id)||T(null))},[Y,C]),(0,k.useEffect)(()=>{let e=e=>{if(C||E||j||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(),S.current?.focus()):e.key===`Escape`&&t===S.current&&d&&(e.preventDefault(),P(``))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d,C,E,j]),(0,k.useEffect)(()=>{f!==V&&F(V)},[V,f]);let ce=!!d,$=e=>{t(e),u(e),m({to:`/task/$taskId`,params:{taskId:e}})};return(0,I.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,I.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,I.jsx)(ee,{}),(0,I.jsx)(`span`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe]`}),(0,I.jsx)(c,{}),(0,I.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,I.jsx)(y,{size:13,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,I.jsx)(`input`,{ref:S,value:d,onChange:e=>P(e.target.value),placeholder:`Filter stories ( / )`,className:`w-44 bg-transparent text-[12px] text-fg placeholder:text-subtle focus:outline-none`}),d&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>P(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear filter`,title:`Clear filter`,children:(0,I.jsx)(b,{size:13,strokeWidth:2})})]}),z.length>0&&(0,I.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,I.jsx)(`span`,{className:`shrink-0 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Project`}),(0,I.jsx)(`select`,{value:V??``,onChange:e=>F(e.target.value),title:V??`Select project`,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg focus:outline-none`,children:z.map(e=>{let t=se.find(t=>t.repo===e.repo)?.count??0;return(0,I.jsxs)(`option`,{value:e.repo,title:e.repo,className:`bg-surface text-fg`,children:[e.label,` · `,t,` · `,e.repo]},e.repo)})})]}),(0,I.jsx)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[11px] text-subtle`,children:(0,I.jsxs)(`span`,{children:[Z,` stor`,Z===1?`y`:`ies`]})})]}),(0,I.jsx)(s,{}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden p-4`,children:!n||U&&!Q?(0,I.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Loading…`}):Z===0&&ce&&Q?(0,I.jsxs)(`div`,{className:`text-[12px] leading-relaxed text-subtle`,children:[(0,I.jsx)(`p`,{children:`No stories match.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{P(``)},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&&!r?(0,I.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Can't reach the daemon — issue list may be incomplete.`}):X[0]?(0,I.jsx)(ie,{board:X[0],onNewIssue:A,onPeekIssue:e=>T({repo:X[0].repo,id:e.id}),onOpenTask:$,onDeleteIssue:(e,t)=>M({repo:e,issue:t})}):(0,I.jsxs)(`div`,{className:`text-[12px] leading-relaxed text-subtle`,children:[(0,I.jsx)(`p`,{children:`No projects yet. Create a task from the workspace to track stories against its repo.`}),(0,I.jsx)(`div`,{className:`mt-3 flex items-center gap-2`,children:(0,I.jsx)(`button`,{type:`button`,onClick:()=>m({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=V??X[0]?.repo??B[0];return e?(0,I.jsx)(`button`,{type:`button`,onClick:()=>A(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,I.jsx)(v,{size:22,strokeWidth:2.2})}):null})(),E&&(0,I.jsx)(_,{children:(0,I.jsx)(h,{repoRoot:E,open:!0,onClose:()=>A(null),onCreated:(e,t)=>{E&&W([E]),a(`success`,t?`Story #${e.id} created — starting its session`:`Story #${e.id} created`)}})}),(()=>{if(!C)return null;let e=Y.find(e=>e.repo===C.repo&&e.issue.id===C.id);return e?(0,I.jsx)(_,{children:(0,I.jsx)(g,{issue:e.issue,repoRoot:e.repo,busy:G,starting:K===e.issue.id,onClose:()=>T(null),onSave:t=>J(e.repo,e.issue.id,t),onStart:async({vendor:t,effort:n,placement:r,watch:i})=>{let a=await oe(e.repo,e.issue,t,n,r);i&&a?(T(null),$(a)):T(null)},onOpenSession:e.issue.taskId?()=>{let t=e.issue.taskId;T(null),t&&$(t)}:void 0,onPromptMerge:e.issue.taskId?()=>{let t=e.issue.taskId;t&&te(t,e.issue).then(()=>a(`success`,`Prompt inserted for story #${e.issue.id}`)).catch(e=>o(`prompt issue merge`,e))}:void 0},`${e.repo}:${e.issue.id}`)}):null})(),j&&(0,I.jsx)(x,{title:`Delete issue`,body:`Delete issue #${j.issue.id}: "${j.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:G,onConfirm:()=>void ae(j.repo,j.issue).then(e=>{e&&(M(null),C?.repo===j.repo&&C.id===j.issue.id&&T(null))}),onCancel:()=>M(null)})]})}export{R as Board};
1
+ import{l as e}from"./terminal-B6OlmT6e.js";import{f as t,y as n}from"./tabs-C_UMvAeW.js";import{d as r}from"./createLucideIcon-BFra8ckc.js";import{a as i,n as a,r as o}from"./toast-Da-Q67N5.js";import{n as s,t as c}from"./ViewToggle-Dy8qGxUZ.js";import{n as l}from"./store-LXLUDGEO.js";import{n as u}from"./active-task-D3aDSt8x.js";import{t as d}from"./external-store-CcZewmhW.js";import{t as f}from"./external-link-D72l1S75.js";import{a as p,i as m,n as h,r as g,t as _}from"./lazy-issue-panels-D77tReDb.js";import{t as v}from"./plus-BhhrqdEO.js";import{t as y}from"./search-DA3nII27.js";import{t as b}from"./x-CopxPdj3.js";import{n as ee,t as x}from"./ConfirmDialog-CUQLUsl5.js";import{_ as S,a as C,d as te,g as w,h as T,m as E,p as D,s as ne,u as O}from"./issues-89uT5swt.js";var k=e(n(),1),A={query:``,repo:null};function j(e){M.update(t=>({...t,...e}))}var M=d(A);function N(){return M.useSnapshot()}function P(e){e!==M.getSnapshot().query&&j({query:e})}function F(e){e!==M.getSnapshot().repo&&j({repo:e})}function re(e){let{issueRepos:t,issueData:n,refreshIssues:r}=e,[i,a]=(0,k.useState)(!1),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(new Map);return(0,k.useEffect)(()=>{u(e=>{if(e.size===0)return e;let r=new Map(e),i=!1;for(let e of t){let t=n[e];if(!(!t||!t.exists))for(let n of t.issues)n.taskId&&r.delete(`${e}:${n.id}`)&&(i=!0)}return i?r:e})},[t,n]),{issueBusy:i,quickStartingId:s,pendingLinks:l,saveIssue:async(e,t,n)=>{a(!0);try{return await T(e,t,n),r([e]),!0}catch(e){return o(`update issue`,e),!1}finally{a(!1)}},deleteIssueConfirmed:async(e,t)=>{a(!0);try{return await C(e,t.id),r([e]),!0}catch(e){return o(`delete issue`,e),!1}finally{a(!1)}},quickStart:async(e,t,n,r,i)=>{if(s===null){c(t.id);try{let{taskId:a,workspaceTaskId:o}=await E(e,t,{vendor:n,effort:r,placement:i});return i!==`project`&&u(n=>{let r=new Map(n);return r.set(`${e}:${t.id}`,{repo:e,issueId:t.id,taskId:a}),r}),o}catch(e){o(`quick start issue`,e);return}finally{c(null)}}}}}var I=r();function L({repo:e,column:t,onNewIssue:n,onPeekIssue:r,onOpenTask:i,onDeleteIssue:a}){return(0,I.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,I.jsxs)(`div`,{className:`mb-2 flex items-baseline gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] ${t.accent}`,children:t.title}),(0,I.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:t.cards.length+t.hiddenCount}),n&&(0,I.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,I.jsx)(v,{size:11,strokeWidth:2}),(0,I.jsx)(`span`,{children:`New story`})]})]}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pb-2`,children:[t.cards.length===0?(0,I.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=S(t)?t.taskId:void 0;return(0,I.jsxs)(`div`,{className:`group/wrap relative`,children:[(0,I.jsx)(m,{issue:t,onOpen:()=>r(t),onDelete:()=>a(t)}),n&&(0,I.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,I.jsx)(f,{size:10,strokeWidth:1.8}),(0,I.jsx)(`span`,{children:`open task`})]})]},`issue:${t.id}`)}),t.hiddenCount>0&&(0,I.jsxs)(`div`,{className:`p-2 text-center text-[10px] text-subtle`,children:[`+`,t.hiddenCount,` more — finish stories to thin this column`]})]})]})}function ie({board:e,onNewIssue:t,onPeekIssue:n,onOpenTask:r,onDeleteIssue:i}){return(0,I.jsx)(`div`,{className:`flex h-full min-w-max gap-4`,children:e.columns.map(a=>(0,I.jsx)(L,{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 R(){let{tasks:e,hydrated:n,daemonConnected:r}=l(),{query:d,repo:f}=N(),m=i(),S=(0,k.useRef)(null),[C,T]=(0,k.useState)(null),[E,A]=(0,k.useState)(null),[j,M]=(0,k.useState)(null),[L,R]=(0,k.useState)([]);(0,k.useEffect)(()=>{let e=!1;return ne().then(t=>{e||R(t)}).catch(e=>o(`load projects`,e)),()=>{e=!0}},[]);let z=(0,k.useMemo)(()=>O(e,L),[e,L]),B=(0,k.useMemo)(()=>z.map(e=>e.repo),[z]),V=(0,k.useMemo)(()=>D(z,f),[z,f]),{data:H,pending:U,refresh:W}=p(B),{issueBusy:G,quickStartingId:K,pendingLinks:q,saveIssue:J,deleteIssueConfirmed:ae,quickStart:oe}=re({issueRepos:B,issueData:H,refreshIssues:W}),{allIssues:Y,repoChips:se,projectBoards:X,shownCount:Z,hasAnyCard:Q}=(0,k.useMemo)(()=>w({issueData:H,issueRepos:B,pendingLinks:q,query:d,repoFilter:V}),[H,B,q,d,V]);(0,k.useEffect)(()=>{C&&(Y.some(e=>e.repo===C.repo&&e.issue.id===C.id)||T(null))},[Y,C]),(0,k.useEffect)(()=>{let e=e=>{if(C||E||j||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(),S.current?.focus()):e.key===`Escape`&&t===S.current&&d&&(e.preventDefault(),P(``))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d,C,E,j]),(0,k.useEffect)(()=>{f!==V&&F(V)},[V,f]);let ce=!!d,$=e=>{t(e),u(e),m({to:`/task/$taskId`,params:{taskId:e}})};return(0,I.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,I.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,I.jsx)(ee,{}),(0,I.jsx)(`span`,{className:`font-mono text-[13px] font-bold text-primary`,children:`[kobe]`}),(0,I.jsx)(c,{}),(0,I.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,I.jsx)(y,{size:13,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,I.jsx)(`input`,{ref:S,value:d,onChange:e=>P(e.target.value),placeholder:`Filter stories ( / )`,className:`w-44 bg-transparent text-[12px] text-fg placeholder:text-subtle focus:outline-none`}),d&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>P(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear filter`,title:`Clear filter`,children:(0,I.jsx)(b,{size:13,strokeWidth:2})})]}),z.length>0&&(0,I.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,I.jsx)(`span`,{className:`shrink-0 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Project`}),(0,I.jsx)(`select`,{value:V??``,onChange:e=>F(e.target.value),title:V??`Select project`,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg focus:outline-none`,children:z.map(e=>{let t=se.find(t=>t.repo===e.repo)?.count??0;return(0,I.jsxs)(`option`,{value:e.repo,title:e.repo,className:`bg-surface text-fg`,children:[e.label,` · `,t,` · `,e.repo]},e.repo)})})]}),(0,I.jsx)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[11px] text-subtle`,children:(0,I.jsxs)(`span`,{children:[Z,` stor`,Z===1?`y`:`ies`]})})]}),(0,I.jsx)(s,{}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden p-4`,children:!n||U&&!Q?(0,I.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Loading…`}):Z===0&&ce&&Q?(0,I.jsxs)(`div`,{className:`text-[12px] leading-relaxed text-subtle`,children:[(0,I.jsx)(`p`,{children:`No stories match.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{P(``)},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&&!r?(0,I.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Can't reach the daemon — issue list may be incomplete.`}):X[0]?(0,I.jsx)(ie,{board:X[0],onNewIssue:A,onPeekIssue:e=>T({repo:X[0].repo,id:e.id}),onOpenTask:$,onDeleteIssue:(e,t)=>M({repo:e,issue:t})}):(0,I.jsxs)(`div`,{className:`text-[12px] leading-relaxed text-subtle`,children:[(0,I.jsx)(`p`,{children:`No projects yet. Create a task from the workspace to track stories against its repo.`}),(0,I.jsx)(`div`,{className:`mt-3 flex items-center gap-2`,children:(0,I.jsx)(`button`,{type:`button`,onClick:()=>m({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=V??X[0]?.repo??B[0];return e?(0,I.jsx)(`button`,{type:`button`,onClick:()=>A(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,I.jsx)(v,{size:22,strokeWidth:2.2})}):null})(),E&&(0,I.jsx)(_,{children:(0,I.jsx)(h,{repoRoot:E,open:!0,onClose:()=>A(null),onCreated:(e,t)=>{E&&W([E]),a(`success`,t?`Story #${e.id} created — starting its session`:`Story #${e.id} created`)}})}),(()=>{if(!C)return null;let e=Y.find(e=>e.repo===C.repo&&e.issue.id===C.id);return e?(0,I.jsx)(_,{children:(0,I.jsx)(g,{issue:e.issue,repoRoot:e.repo,busy:G,starting:K===e.issue.id,onClose:()=>T(null),onSave:t=>J(e.repo,e.issue.id,t),onStart:async({vendor:t,effort:n,placement:r,watch:i})=>{let a=await oe(e.repo,e.issue,t,n,r);i&&a?(T(null),$(a)):T(null)},onOpenSession:e.issue.taskId?()=>{let t=e.issue.taskId;T(null),t&&$(t)}:void 0,onPromptMerge:e.issue.taskId?()=>{let t=e.issue.taskId;t&&te(t,e.issue).then(()=>a(`success`,`Prompt inserted for story #${e.issue.id}`)).catch(e=>o(`prompt issue merge`,e))}:void 0},`${e.repo}:${e.issue.id}`)}):null})(),j&&(0,I.jsx)(x,{title:`Delete issue`,body:`Delete issue #${j.issue.id}: "${j.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:G,onConfirm:()=>void ae(j.repo,j.issue).then(e=>{e&&(M(null),C?.repo===j.repo&&C.id===j.issue.id&&T(null))}),onCancel:()=>M(null)})]})}export{R as Board};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTerminal-Ci4mphvC.js","assets/terminal-B6OlmT6e.js","assets/tabs-C6drmk5t.js","assets/createLucideIcon-B3ImGkvG.js","assets/store-DfONeFqN.js","assets/rotate-cw-BxAflhQC.js","assets/web-transport-BS7imUMS.js","assets/ChatTerminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
- import{l as e}from"./terminal-B6OlmT6e.js";import{c as t,y as n}from"./tabs-C6drmk5t.js";import{d as r,t as i}from"./createLucideIcon-B3ImGkvG.js";import{i as a}from"./store-DfONeFqN.js";import{t as o}from"./ChatTranscript-ChbwT5aF.js";import{t as s}from"./external-link-D0CjtZaF.js";import{t as c}from"./x-BtkkvyxG.js";import{n as l,t as u}from"./activity-BjTd1D8q.js";import{t as d}from"./use-focus-trap-Bxa2qAjl.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-Ci4mphvC.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 ${u(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)(c,{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
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTerminal-Dq5p6wd6.js","assets/terminal-B6OlmT6e.js","assets/tabs-C_UMvAeW.js","assets/createLucideIcon-BFra8ckc.js","assets/store-LXLUDGEO.js","assets/rotate-cw-Dg0ivobX.js","assets/web-transport-BS7imUMS.js","assets/ChatTerminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
+ import{l as e}from"./terminal-B6OlmT6e.js";import{c as t,y as n}from"./tabs-C_UMvAeW.js";import{d as r,t as i}from"./createLucideIcon-BFra8ckc.js";import{i as a}from"./store-LXLUDGEO.js";import{t as o}from"./ChatTranscript-hdh-Z0CK.js";import{t as s}from"./external-link-D72l1S75.js";import{t as c}from"./x-CopxPdj3.js";import{n as l,t as u}from"./activity-BjTd1D8q.js";import{t as d}from"./use-focus-trap-Zurfhrn8.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-Dq5p6wd6.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 ${u(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)(c,{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,4 +1,4 @@
1
- import{l as e,n as t}from"./terminal-B6OlmT6e.js";import{s as n,y as r}from"./tabs-C6drmk5t.js";import{d as i,o as a,t as o}from"./createLucideIcon-B3ImGkvG.js";import{n as s}from"./store-DfONeFqN.js";import{t as c}from"./rotate-cw-BxAflhQC.js";import{t as l}from"./web-transport-BS7imUMS.js";var u=o(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),d=`3.7.8`,f=d,p=typeof Buffer==`function`,m=typeof TextDecoder==`function`?new TextDecoder:void 0,h=typeof TextEncoder==`function`?new TextEncoder:void 0,g=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),_=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(g),v=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,y=String.fromCharCode.bind(String),ee=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),te=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),ne=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),re=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=g[t>>18&63]+g[t>>12&63]+g[t>>6&63]+g[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},b=typeof btoa==`function`?e=>btoa(e):p?e=>Buffer.from(e,`binary`).toString(`base64`):re,ie=p?e=>Buffer.from(e).toString(`base64`):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(y.apply(null,e.subarray(n,n+4096)));return b(t.join(``))},ae=(e,t=!1)=>t?te(ie(e)):ie(e),x=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?y(192|t>>>6)+y(128|t&63):y(224|t>>>12&15)+y(128|t>>>6&63)+y(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return y(240|t>>>18&7)+y(128|t>>>12&63)+y(128|t>>>6&63)+y(128|t&63)}},oe=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,S=e=>e.replace(oe,x),se=p?e=>Buffer.from(e,`utf8`).toString(`base64`):h?e=>ie(h.encode(e)):e=>b(S(e)),ce=(e,t=!1)=>t?te(se(e)):se(e),le=e=>ce(e,!0),C=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return y((t>>>10)+55296)+y((t&1023)+56320);case 3:return y((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return y((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},T=e=>e.replace(C,w),ue=e=>{if(e=e.replace(/\s+/g,``),!v.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=_[e.charAt(a++)]<<18|_[e.charAt(a++)]<<12|(n=_[e.charAt(a++)])<<6|(r=_[e.charAt(a++)]),n===64?i.push(y(t>>16&255)):r===64?i.push(y(t>>16&255,t>>8&255)):i.push(y(t>>16&255,t>>8&255,t&255));return i.join(``)},de=typeof atob==`function`?e=>atob(ne(e)):p?e=>Buffer.from(e,`base64`).toString(`binary`):ue,fe=p?e=>ee(Buffer.from(e,`base64`)):e=>ee(de(e).split(``).map(e=>e.charCodeAt(0))),pe=e=>fe(he(e)),me=p?e=>Buffer.from(e,`base64`).toString(`utf8`):m?e=>m.decode(fe(e)):e=>T(de(e)),he=e=>ne(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),ge=e=>me(he(e)),_e=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},ve=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),ye=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,ve(t));e(`fromBase64`,function(){return ge(this)}),e(`toBase64`,function(e){return ce(this,e)}),e(`toBase64URI`,function(){return ce(this,!0)}),e(`toBase64URL`,function(){return ce(this,!0)}),e(`toUint8Array`,function(){return pe(this)})},be=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,ve(t));e(`toBase64`,function(e){return ae(this,e)}),e(`toBase64URI`,function(){return ae(this,!0)}),e(`toBase64URL`,function(){return ae(this,!0)})},xe={version:d,VERSION:f,atob:de,atobPolyfill:ue,btoa:b,btoaPolyfill:re,fromBase64:ge,toBase64:ce,encode:ce,encodeURI:le,encodeURL:le,utob:S,btou:T,decode:ge,isValid:_e,fromUint8Array:ae,toUint8Array:pe,extendString:ye,extendUint8Array:be,extendBuiltins:()=>{ye(),be()}},Se=class{constructor(e=new we,t=new Ce){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){let n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(`;`);if(t.length<2)return!0;let n=t[0],r=t[1];if(r===`?`){let e=this._provider.readText(n);return e instanceof Promise?e.then(e=>(this._readText(n,e),!0)):(this._readText(n,e),!0)}let i=``;try{i=this._base64.decodeText(r)}catch{}let a=this._provider.writeText(n,i);return a instanceof Promise?a.then(()=>!0):!0}},Ce=class{async readText(e){return e===`c`?navigator.clipboard.readText():Promise.resolve(``)}async writeText(e,t){return e===`c`?navigator.clipboard.writeText(t):Promise.resolve()}},we=class{encodeText(e){return xe.encode(e)}decodeText(e){let t=xe.decode(e);return!xe.isValid(e)||xe.encode(t)!==e?``:t}},Te=2,Ee=1,De=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Te,Math.floor(u/e.css.cell.width)),rows:Math.max(Ee,Math.floor(l/e.css.cell.height))}}},Oe=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ke=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function Ae(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var je=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<Oe.length;++e)E.fill(0,Oe[e][0],Oe[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:Ae(e,ke)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Ct.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ct.createPropertyValue(0,n,r)}},Me=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Le.isErrorNoTelemetry(e)?new Le(e.message+`
1
+ import{l as e,n as t}from"./terminal-B6OlmT6e.js";import{s as n,y as r}from"./tabs-C_UMvAeW.js";import{d as i,o as a,t as o}from"./createLucideIcon-BFra8ckc.js";import{n as s}from"./store-LXLUDGEO.js";import{t as c}from"./rotate-cw-Dg0ivobX.js";import{t as l}from"./web-transport-BS7imUMS.js";var u=o(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),d=`3.7.8`,f=d,p=typeof Buffer==`function`,m=typeof TextDecoder==`function`?new TextDecoder:void 0,h=typeof TextEncoder==`function`?new TextEncoder:void 0,g=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),_=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(g),v=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,y=String.fromCharCode.bind(String),ee=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),te=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),ne=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),re=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=g[t>>18&63]+g[t>>12&63]+g[t>>6&63]+g[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},b=typeof btoa==`function`?e=>btoa(e):p?e=>Buffer.from(e,`binary`).toString(`base64`):re,ie=p?e=>Buffer.from(e).toString(`base64`):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(y.apply(null,e.subarray(n,n+4096)));return b(t.join(``))},ae=(e,t=!1)=>t?te(ie(e)):ie(e),x=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?y(192|t>>>6)+y(128|t&63):y(224|t>>>12&15)+y(128|t>>>6&63)+y(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return y(240|t>>>18&7)+y(128|t>>>12&63)+y(128|t>>>6&63)+y(128|t&63)}},oe=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,S=e=>e.replace(oe,x),se=p?e=>Buffer.from(e,`utf8`).toString(`base64`):h?e=>ie(h.encode(e)):e=>b(S(e)),ce=(e,t=!1)=>t?te(se(e)):se(e),le=e=>ce(e,!0),C=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return y((t>>>10)+55296)+y((t&1023)+56320);case 3:return y((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return y((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},T=e=>e.replace(C,w),ue=e=>{if(e=e.replace(/\s+/g,``),!v.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=_[e.charAt(a++)]<<18|_[e.charAt(a++)]<<12|(n=_[e.charAt(a++)])<<6|(r=_[e.charAt(a++)]),n===64?i.push(y(t>>16&255)):r===64?i.push(y(t>>16&255,t>>8&255)):i.push(y(t>>16&255,t>>8&255,t&255));return i.join(``)},de=typeof atob==`function`?e=>atob(ne(e)):p?e=>Buffer.from(e,`base64`).toString(`binary`):ue,fe=p?e=>ee(Buffer.from(e,`base64`)):e=>ee(de(e).split(``).map(e=>e.charCodeAt(0))),pe=e=>fe(he(e)),me=p?e=>Buffer.from(e,`base64`).toString(`utf8`):m?e=>m.decode(fe(e)):e=>T(de(e)),he=e=>ne(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),ge=e=>me(he(e)),_e=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},ve=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),ye=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,ve(t));e(`fromBase64`,function(){return ge(this)}),e(`toBase64`,function(e){return ce(this,e)}),e(`toBase64URI`,function(){return ce(this,!0)}),e(`toBase64URL`,function(){return ce(this,!0)}),e(`toUint8Array`,function(){return pe(this)})},be=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,ve(t));e(`toBase64`,function(e){return ae(this,e)}),e(`toBase64URI`,function(){return ae(this,!0)}),e(`toBase64URL`,function(){return ae(this,!0)})},xe={version:d,VERSION:f,atob:de,atobPolyfill:ue,btoa:b,btoaPolyfill:re,fromBase64:ge,toBase64:ce,encode:ce,encodeURI:le,encodeURL:le,utob:S,btou:T,decode:ge,isValid:_e,fromUint8Array:ae,toUint8Array:pe,extendString:ye,extendUint8Array:be,extendBuiltins:()=>{ye(),be()}},Se=class{constructor(e=new we,t=new Ce){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){let n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(`;`);if(t.length<2)return!0;let n=t[0],r=t[1];if(r===`?`){let e=this._provider.readText(n);return e instanceof Promise?e.then(e=>(this._readText(n,e),!0)):(this._readText(n,e),!0)}let i=``;try{i=this._base64.decodeText(r)}catch{}let a=this._provider.writeText(n,i);return a instanceof Promise?a.then(()=>!0):!0}},Ce=class{async readText(e){return e===`c`?navigator.clipboard.readText():Promise.resolve(``)}async writeText(e,t){return e===`c`?navigator.clipboard.writeText(t):Promise.resolve()}},we=class{encodeText(e){return xe.encode(e)}decodeText(e){let t=xe.decode(e);return!xe.isValid(e)||xe.encode(t)!==e?``:t}},Te=2,Ee=1,De=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Te,Math.floor(u/e.css.cell.width)),rows:Math.max(Ee,Math.floor(l/e.css.cell.height))}}},Oe=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ke=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function Ae(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var je=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<Oe.length;++e)E.fill(0,Oe[e][0],Oe[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:Ae(e,ke)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Ct.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ct.createPropertyValue(0,n,r)}},Me=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Le.isErrorNoTelemetry(e)?new Le(e.message+`
2
2
 
3
3
  `+e.stack):Error(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{l as e,o as t}from"./terminal-B6OlmT6e.js";import{y as n}from"./tabs-C6drmk5t.js";import{d as r,t as i}from"./createLucideIcon-B3ImGkvG.js";import{n as a}from"./store-DfONeFqN.js";import{t as o}from"./rotate-cw-BxAflhQC.js";import{t as s}from"./search-cqUzSqUT.js";import{t as c}from"./x-BtkkvyxG.js";import{t as l}from"./web-transport-BS7imUMS.js";import{t as u}from"./time-kviT26Tm.js";var d=i(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=i(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),p=e(n(),1);function m(e,n){return t.get(`/api/history/sessions`,{query:{worktreePath:e,vendor:n},label:`/api/history/sessions`})}async function h(e,n){let{messages:r}=await t.get(`/api/history/messages`,{query:{vendor:e,sessionId:n},label:`/api/history/messages`});return r}function g(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 _(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function v(e,t,n,r=80){return t-e-n<r}var y=90;function b(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>y?`${n.slice(0,y-1)}…`:n}try{let t=JSON.stringify(e.input);return!t||t===`{}`||t===`null`?``:t.length>y?`${t.slice(0,y-1)}…`:t}catch{return``}}function x(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function S(e){switch(e.type){case`text`:case`thinking`:return e.text;case`tool_call`:return`${e.name} ${b(e)}`;case`tool_result`:return x(e.output)}}function C(e){return e.blocks.map(S).join(` `)}function w(e,t){return!(t&&e.type===`tool_call`)}function T(e,t){return e.blocks.some(e=>e.type===`text`||e.type===`thinking`?e.text.trim()!==``:e.type===`tool_call`&&!t)}var E=r(),D=600;function O({call:e,result:t}){let[n,r]=(0,p.useState)(!1),i=b(e),a=t?x(t.output):``,o=!n&&a.length>D,s=o?`${a.slice(0,D)}…`:a,c=a.length>0;return(0,E.jsxs)(`div`,{className:`my-1`,children:[(0,E.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,E.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?.isError?`text-kobe-red`:`text-kobe-green`}`,children:`⏺`}),(0,E.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-fg`,children:e.name}),i&&(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-subtle`,children:i}),c&&(0,E.jsx)(`span`,{className:`shrink-0 text-subtle`,children:n?(0,E.jsx)(d,{size:12}):(0,E.jsx)(f,{size:12})})]}),(n||!n&&a&&a.length<=D)&&a&&(0,E.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,E.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 k({text:e}){let[t,n]=(0,p.useState)(!1);return(0,E.jsxs)(`div`,{className:`my-1`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-baseline gap-2 text-[11px] italic text-subtle hover:text-muted`,children:[(0,E.jsx)(`span`,{children:`✱`}),(0,E.jsx)(`span`,{children:t?`thinking`:`thinking…`}),t?(0,E.jsx)(d,{size:11}):(0,E.jsx)(f,{size:11})]}),t&&(0,E.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 A({message:e,results:t,hideTools:n}){let r=[],i=u(e.timestamp),a=!1;return e.blocks.forEach((o,s)=>{if(!w(o,n))return;let c=`${e.timestamp}-${s}`;if(o.type===`text`){if(!o.text.trim())return;e.role===`user`?(r.push((0,E.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,E.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] font-bold text-primary`,children:`❯`}),(0,E.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,E.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,title:e.timestamp,children:i})]},c)),a=!0):r.push((0,E.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,E.jsx)(O,{call:o,result:t.get(o.callId)},c));return}if(o.type===`thinking`){o.text.trim()&&r.push((0,E.jsx)(k,{text:o.text},c));return}}),r.length===0?null:(0,E.jsx)(E.Fragment,{children:r})}var j=2500;function M({worktreePath:e,vendor:t}){let{daemonConnected:n,streamConnected:r}=a(),i=l({daemonConnected:n,streamConnected:r}),[u,d]=(0,p.useState)([]),[f,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(!0),[S,w]=(0,p.useState)([]),[D,O]=(0,p.useState)(``),[k,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(!0),z=(0,p.useRef)(-1),B=(0,p.useRef)(null),V=(0,p.useRef)(!0),H=(0,p.useRef)(0),U=(0,p.useRef)(!0),W=(0,p.useRef)(null);(0,p.useEffect)(()=>{U.current=b,W.current=f},[b,f]);let G=(0,p.useCallback)(async(n=!1)=>{if(!e)return;let r=H.current;try{let i=await m(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 h(t,o):[];if(r!==H.current)return;d(i.sessions),w(s),y(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,p.useRef)(G);(0,p.useEffect)(()=>{K.current=G},[G]),(0,p.useEffect)(()=>{z.current=-1,I(!1),U.current=!0,W.current=null,V.current=!0,x(!0),y(null),O(``),M(!1),R(!0),K.current(!0);let e=window.setInterval(()=>{document.hidden||K.current()},j);return()=>window.clearInterval(e)},[e,t]);let q=e=>{let n=e===u.at(-1);U.current=n,W.current=e,x(n),y(e);let r=++H.current;h(t,e).then(e=>{r===H.current&&w(e)}).catch(e=>{r===H.current&&P(e instanceof Error?e.message:String(e))})};(0,p.useEffect)(()=>{let e=B.current;e&&V.current&&(e.scrollTop=e.scrollHeight)},[S]);let J=()=>{let e=B.current;if(!e)return;let t=v(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,p.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,p.useMemo)(()=>g(S),[S]),Q=(0,p.useMemo)(()=>S.map(e=>C(e).toLowerCase()),[S]),$=(0,p.useMemo)(()=>{let e=D.trim().toLowerCase();return S.filter((t,n)=>(!e||Q[n].includes(e))&&T(t,k))},[S,Q,D,k]);return e?(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,E.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-surface px-2`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Chat`}),u.length>0&&(0,E.jsx)(`select`,{value:f??``,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,E.jsxs)(`option`,{value:e,children:[`#`,t+1,` `,e.slice(0,8),t===u.length-1?` (latest)`:``]},e))}),(0,E.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[10px] text-subtle`,children:[Z.contextTokens>0&&(0,E.jsxs)(`span`,{title:`Live context estimate (last turn's full prompt)`,children:[`ctx `,_(Z.contextTokens)]}),Z.outputTokens>0&&(0,E.jsxs)(`span`,{title:`Session tokens in / out`,children:[`⇡`,_(Z.inputTokens),` ⇣`,_(Z.outputTokens)]}),(0,E.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,E.jsx)(o,{size:11,strokeWidth:2})})]})]}),S.length>0&&(0,E.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,E.jsx)(s,{size:11,strokeWidth:2,className:`shrink-0 text-subtle`}),(0,E.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Escape`&&D&&(e.preventDefault(),O(``))},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`}),D.trim()&&(0,E.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:[$.length,`/`,S.length]}),D.trim()&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>O(``),className:`shrink-0 text-subtle transition-colors hover:text-fg`,"aria-label":`clear transcript search`,title:`Clear search`,children:(0,E.jsx)(c,{size:12,strokeWidth:2})}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>M(e=>!e),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${k?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,title:k?`Show tool calls`:`Hide tool calls — read just the conversation`,children:k?`tools off`:`tools`})]}),(0,E.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,E.jsx)(`div`,{ref:B,onScroll:J,className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:N?i?(0,E.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,E.jsxs)(`div`,{className:`flex flex-col items-start gap-2 py-4`,children:[(0,E.jsx)(`span`,{className:`text-[12px] text-kobe-red`,children:`Couldn't load the transcript.`}),(0,E.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,E.jsx)(o,{size:11,strokeWidth:2}),`Retry`]})]}):F?S.length===0?(0,E.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,E.jsxs)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:[`No messages match “`,D.trim(),`”.`]}):$.map((e,t)=>(0,E.jsx)(A,{message:e,results:X,hideTools:k},`${e.sessionId}-${t}`)):(0,E.jsx)(`div`,{className:`py-4 text-[12px] text-subtle`,children:`Loading transcript…`})}),!L&&$.length>0&&(0,E.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,E.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`This task has no worktree yet.`})}export{M as t};
1
+ import{l as e,o as t}from"./terminal-B6OlmT6e.js";import{y as n}from"./tabs-C_UMvAeW.js";import{d as r,t as i}from"./createLucideIcon-BFra8ckc.js";import{n as a}from"./store-LXLUDGEO.js";import{t as o}from"./rotate-cw-Dg0ivobX.js";import{t as s}from"./search-DA3nII27.js";import{t as c}from"./x-CopxPdj3.js";import{t as l}from"./web-transport-BS7imUMS.js";import{t as u}from"./time-kviT26Tm.js";var d=i(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=i(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),p=e(n(),1);function m(e,n){return t.get(`/api/history/sessions`,{query:{worktreePath:e,vendor:n},label:`/api/history/sessions`})}async function h(e,n){let{messages:r}=await t.get(`/api/history/messages`,{query:{vendor:e,sessionId:n},label:`/api/history/messages`});return r}function g(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 _(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function v(e,t,n,r=80){return t-e-n<r}var y=90;function b(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>y?`${n.slice(0,y-1)}…`:n}try{let t=JSON.stringify(e.input);return!t||t===`{}`||t===`null`?``:t.length>y?`${t.slice(0,y-1)}…`:t}catch{return``}}function x(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function S(e){switch(e.type){case`text`:case`thinking`:return e.text;case`tool_call`:return`${e.name} ${b(e)}`;case`tool_result`:return x(e.output)}}function C(e){return e.blocks.map(S).join(` `)}function w(e,t){return!(t&&e.type===`tool_call`)}function T(e,t){return e.blocks.some(e=>e.type===`text`||e.type===`thinking`?e.text.trim()!==``:e.type===`tool_call`&&!t)}var E=r(),D=600;function O({call:e,result:t}){let[n,r]=(0,p.useState)(!1),i=b(e),a=t?x(t.output):``,o=!n&&a.length>D,s=o?`${a.slice(0,D)}…`:a,c=a.length>0;return(0,E.jsxs)(`div`,{className:`my-1`,children:[(0,E.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,E.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?.isError?`text-kobe-red`:`text-kobe-green`}`,children:`⏺`}),(0,E.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-fg`,children:e.name}),i&&(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-subtle`,children:i}),c&&(0,E.jsx)(`span`,{className:`shrink-0 text-subtle`,children:n?(0,E.jsx)(d,{size:12}):(0,E.jsx)(f,{size:12})})]}),(n||!n&&a&&a.length<=D)&&a&&(0,E.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,E.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 k({text:e}){let[t,n]=(0,p.useState)(!1);return(0,E.jsxs)(`div`,{className:`my-1`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-baseline gap-2 text-[11px] italic text-subtle hover:text-muted`,children:[(0,E.jsx)(`span`,{children:`✱`}),(0,E.jsx)(`span`,{children:t?`thinking`:`thinking…`}),t?(0,E.jsx)(d,{size:11}):(0,E.jsx)(f,{size:11})]}),t&&(0,E.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 A({message:e,results:t,hideTools:n}){let r=[],i=u(e.timestamp),a=!1;return e.blocks.forEach((o,s)=>{if(!w(o,n))return;let c=`${e.timestamp}-${s}`;if(o.type===`text`){if(!o.text.trim())return;e.role===`user`?(r.push((0,E.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,E.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] font-bold text-primary`,children:`❯`}),(0,E.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,E.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,title:e.timestamp,children:i})]},c)),a=!0):r.push((0,E.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,E.jsx)(O,{call:o,result:t.get(o.callId)},c));return}if(o.type===`thinking`){o.text.trim()&&r.push((0,E.jsx)(k,{text:o.text},c));return}}),r.length===0?null:(0,E.jsx)(E.Fragment,{children:r})}var j=2500;function M({worktreePath:e,vendor:t}){let{daemonConnected:n,streamConnected:r}=a(),i=l({daemonConnected:n,streamConnected:r}),[u,d]=(0,p.useState)([]),[f,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(!0),[S,w]=(0,p.useState)([]),[D,O]=(0,p.useState)(``),[k,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(!0),z=(0,p.useRef)(-1),B=(0,p.useRef)(null),V=(0,p.useRef)(!0),H=(0,p.useRef)(0),U=(0,p.useRef)(!0),W=(0,p.useRef)(null);(0,p.useEffect)(()=>{U.current=b,W.current=f},[b,f]);let G=(0,p.useCallback)(async(n=!1)=>{if(!e)return;let r=H.current;try{let i=await m(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 h(t,o):[];if(r!==H.current)return;d(i.sessions),w(s),y(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,p.useRef)(G);(0,p.useEffect)(()=>{K.current=G},[G]),(0,p.useEffect)(()=>{z.current=-1,I(!1),U.current=!0,W.current=null,V.current=!0,x(!0),y(null),O(``),M(!1),R(!0),K.current(!0);let e=window.setInterval(()=>{document.hidden||K.current()},j);return()=>window.clearInterval(e)},[e,t]);let q=e=>{let n=e===u.at(-1);U.current=n,W.current=e,x(n),y(e);let r=++H.current;h(t,e).then(e=>{r===H.current&&w(e)}).catch(e=>{r===H.current&&P(e instanceof Error?e.message:String(e))})};(0,p.useEffect)(()=>{let e=B.current;e&&V.current&&(e.scrollTop=e.scrollHeight)},[S]);let J=()=>{let e=B.current;if(!e)return;let t=v(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,p.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,p.useMemo)(()=>g(S),[S]),Q=(0,p.useMemo)(()=>S.map(e=>C(e).toLowerCase()),[S]),$=(0,p.useMemo)(()=>{let e=D.trim().toLowerCase();return S.filter((t,n)=>(!e||Q[n].includes(e))&&T(t,k))},[S,Q,D,k]);return e?(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,E.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-surface px-2`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Chat`}),u.length>0&&(0,E.jsx)(`select`,{value:f??``,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,E.jsxs)(`option`,{value:e,children:[`#`,t+1,` `,e.slice(0,8),t===u.length-1?` (latest)`:``]},e))}),(0,E.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[10px] text-subtle`,children:[Z.contextTokens>0&&(0,E.jsxs)(`span`,{title:`Live context estimate (last turn's full prompt)`,children:[`ctx `,_(Z.contextTokens)]}),Z.outputTokens>0&&(0,E.jsxs)(`span`,{title:`Session tokens in / out`,children:[`⇡`,_(Z.inputTokens),` ⇣`,_(Z.outputTokens)]}),(0,E.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,E.jsx)(o,{size:11,strokeWidth:2})})]})]}),S.length>0&&(0,E.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,E.jsx)(s,{size:11,strokeWidth:2,className:`shrink-0 text-subtle`}),(0,E.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Escape`&&D&&(e.preventDefault(),O(``))},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`}),D.trim()&&(0,E.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:[$.length,`/`,S.length]}),D.trim()&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>O(``),className:`shrink-0 text-subtle transition-colors hover:text-fg`,"aria-label":`clear transcript search`,title:`Clear search`,children:(0,E.jsx)(c,{size:12,strokeWidth:2})}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>M(e=>!e),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${k?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,title:k?`Show tool calls`:`Hide tool calls — read just the conversation`,children:k?`tools off`:`tools`})]}),(0,E.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,E.jsx)(`div`,{ref:B,onScroll:J,className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:N?i?(0,E.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,E.jsxs)(`div`,{className:`flex flex-col items-start gap-2 py-4`,children:[(0,E.jsx)(`span`,{className:`text-[12px] text-kobe-red`,children:`Couldn't load the transcript.`}),(0,E.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,E.jsx)(o,{size:11,strokeWidth:2}),`Retry`]})]}):F?S.length===0?(0,E.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,E.jsxs)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:[`No messages match “`,D.trim(),`”.`]}):$.map((e,t)=>(0,E.jsx)(A,{message:e,results:X,hideTools:k},`${e.sessionId}-${t}`)):(0,E.jsx)(`div`,{className:`py-4 text-[12px] text-subtle`,children:`Loading transcript…`})}),!L&&$.length>0&&(0,E.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,E.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`This task has no worktree yet.`})}export{M as t};
@@ -1 +1 @@
1
- import{l as e}from"./terminal-B6OlmT6e.js";import{y as t}from"./tabs-C6drmk5t.js";import{d as n}from"./createLucideIcon-B3ImGkvG.js";import{r,t as i}from"./desktop-BMy3eltH.js";import{t as a}from"./use-focus-trap-Bxa2qAjl.js";var o=n();function s({label:e,tone:t,onClick:n}){return(0,o.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 c(){if(!r())return null;let e=i();return(0,o.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,o.jsx)(`legend`,{className:`sr-only`,children:`Window controls`}),(0,o.jsx)(s,{label:`Close window`,tone:`close`,onClick:()=>e?.close()}),(0,o.jsx)(s,{label:`Minimize window`,tone:`minimize`,onClick:()=>e?.minimize()}),(0,o.jsx)(s,{label:`Zoom window`,tone:`zoom`,onClick:()=>e?.toggleMaximize()})]})}var l=e(t(),1);function u({title:e,body:t,confirmLabel:n,danger:r=!1,busy:i=!1,onConfirm:s,onCancel:c}){let u=(0,l.useRef)(null),d=(0,l.useRef)(null);return a(d),(0,l.useEffect)(()=>{u.current?.focus();let e=e=>{e.key===`Escape`&&c()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]),(0,o.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:c,onKeyDown:()=>{},role:`presentation`,children:(0,o.jsxs)(`div`,{ref:d,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,o.jsx)(`div`,{className:`border-b border-line px-3 py-2 text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:e}),(0,o.jsx)(`p`,{className:`px-3 py-3 text-[12px] leading-relaxed text-muted`,children:t}),(0,o.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-line px-3 py-2`,children:[(0,o.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,o.jsx)(`button`,{ref:u,type:`button`,onClick:s,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{c as n,u as t};
1
+ import{l as e}from"./terminal-B6OlmT6e.js";import{y as t}from"./tabs-C_UMvAeW.js";import{d as n}from"./createLucideIcon-BFra8ckc.js";import{r,t as i}from"./desktop-DnKVqhdT.js";import{t as a}from"./use-focus-trap-Zurfhrn8.js";var o=n();function s({label:e,tone:t,onClick:n}){return(0,o.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 c(){if(!r())return null;let e=i();return(0,o.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,o.jsx)(`legend`,{className:`sr-only`,children:`Window controls`}),(0,o.jsx)(s,{label:`Close window`,tone:`close`,onClick:()=>e?.close()}),(0,o.jsx)(s,{label:`Minimize window`,tone:`minimize`,onClick:()=>e?.minimize()}),(0,o.jsx)(s,{label:`Zoom window`,tone:`zoom`,onClick:()=>e?.toggleMaximize()})]})}var l=e(t(),1);function u({title:e,body:t,confirmLabel:n,danger:r=!1,busy:i=!1,onConfirm:s,onCancel:c}){let u=(0,l.useRef)(null),d=(0,l.useRef)(null);return a(d),(0,l.useEffect)(()=>{u.current?.focus();let e=e=>{e.key===`Escape`&&c()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]),(0,o.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/60`,onClick:c,onKeyDown:()=>{},role:`presentation`,children:(0,o.jsxs)(`div`,{ref:d,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,o.jsx)(`div`,{className:`border-b border-line px-3 py-2 text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:e}),(0,o.jsx)(`p`,{className:`px-3 py-3 text-[12px] leading-relaxed text-muted`,children:t}),(0,o.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-line px-3 py-2`,children:[(0,o.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,o.jsx)(`button`,{ref:u,type:`button`,onClick:s,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{c as n,u as t};
@@ -1 +1 @@
1
- import{l as e}from"./terminal-B6OlmT6e.js";import{y as t}from"./tabs-C6drmk5t.js";import{d as n}from"./createLucideIcon-B3ImGkvG.js";import{t as r}from"./SlideOver-BL608zkP.js";import{f as i,i as a}from"./issues-D1vtEzDa.js";import{n as o,t as s}from"./RichEditor-zHTUYZU1.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};
1
+ import{l as e}from"./terminal-B6OlmT6e.js";import{y as t}from"./tabs-C_UMvAeW.js";import{d as n}from"./createLucideIcon-BFra8ckc.js";import{t as r}from"./SlideOver-BlmF_2fr.js";import{f as i,i as a}from"./issues-89uT5swt.js";import{n as o,t as s}from"./RichEditor-CTJuSqgK.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};
@@ -1 +1 @@
1
- import{l as e}from"./terminal-B6OlmT6e.js";import{y as t}from"./tabs-C6drmk5t.js";import{d as n,t as r}from"./createLucideIcon-B3ImGkvG.js";import{t as i}from"./external-link-D0CjtZaF.js";import{t as a}from"./SlideOver-BL608zkP.js";import{n as o,r as s}from"./issues-D1vtEzDa.js";import{n as c,t as l}from"./RichEditor-zHTUYZU1.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(),m=[{id:`task`,label:`New worktree`,hint:`isolated branch, tab in its own task workspace`},{id:`projectWorktree`,label:`Worktree · tab in project`,hint:`isolated branch, chat tab lives in the project workspace`},{id:`project`,label:`Project checkout`,hint:`no worktree — the engine works directly on the checkout`}];function h({issue:e,repoRoot:t,busy:n,starting:r,onClose:h,onSave:g,onStart:_,onOpenSession:v,onPromptMerge:y}){let[b,x]=(0,f.useState)(e.title),[S,C]=(0,f.useState)(e.body),[w,T]=(0,f.useState)(void 0),[E,D]=(0,f.useState)(void 0),[O,k]=(0,f.useState)(`task`),[A,j]=(0,f.useState)(null),M=!!e.taskId,N=s(e.status)&&!M,P=b!==e.title||S!==e.body,F=P&&b.trim().length>0&&!n,I=o[e.status];return(0,p.jsx)(a,{open:!0,wide:!0,onClose:h,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:b,onChange:e=>x(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:S,onChange:C,repoRoot:t,placeholder:`context, constraints, acceptance criteria — paste a screenshot to attach it`},e.id)]}),A&&(0,p.jsx)(`p`,{className:`text-[11px] text-kobe-red`,role:`alert`,children:A}),(0,p.jsx)(`div`,{className:`flex justify-end`,children:(0,p.jsx)(`button`,{type:`button`,disabled:!F,onClick:()=>{F&&(j(null),g({title:b,body:S}).catch(e=>{j(e instanceof Error?e.message:`failed to save issue`)}))},title:P?`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] ${I.accent}`,children:I.title}),(0,p.jsxs)(`span`,{className:`font-mono text-[10px] text-subtle`,children:[`created `,e.created]})]}),M&&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:w,effort:E,disabled:!N,onChange:e=>{T(e.vendor),D(e.effort)}})]}),(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:`Workspace`}),(0,p.jsx)(`div`,{className:`flex flex-col gap-1`,children:m.map(e=>(0,p.jsxs)(`button`,{type:`button`,disabled:!N,onClick:()=>k(e.id),title:e.hint,className:`border px-2 py-1 text-left text-[11px] transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${O===e.id?`border-primary bg-inset text-fg`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,children:[(0,p.jsx)(`span`,{className:`block`,children:e.label}),(0,p.jsx)(`span`,{className:`block text-[10px] text-subtle`,children:e.hint})]},e.id))})]}),(0,p.jsx)(`div`,{className:`mt-auto flex flex-col gap-2 border-t border-line pt-3`,children:M?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>v?.(),disabled:!v,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:()=>y?.(),disabled:!y||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`})]}):N?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>_({vendor:w,effort:E,placement:O,watch:!1}),title:`Spawn the 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:()=>_({vendor:w,effort:E,placement:O,watch:!0}),title:`Spawn the session and open its 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)(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{h as IssuePeek};
1
+ import{l as e}from"./terminal-B6OlmT6e.js";import{y as t}from"./tabs-C_UMvAeW.js";import{d as n,t as r}from"./createLucideIcon-BFra8ckc.js";import{t as i}from"./external-link-D72l1S75.js";import{t as a}from"./SlideOver-BlmF_2fr.js";import{n as o,r as s}from"./issues-89uT5swt.js";import{n as c,t as l}from"./RichEditor-CTJuSqgK.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(),m=[{id:`task`,label:`New worktree`,hint:`isolated branch, tab in its own task workspace`},{id:`projectWorktree`,label:`Worktree · tab in project`,hint:`isolated branch, chat tab lives in the project workspace`},{id:`project`,label:`Project checkout`,hint:`no worktree — the engine works directly on the checkout`}];function h({issue:e,repoRoot:t,busy:n,starting:r,onClose:h,onSave:g,onStart:_,onOpenSession:v,onPromptMerge:y}){let[b,x]=(0,f.useState)(e.title),[S,C]=(0,f.useState)(e.body),[w,T]=(0,f.useState)(void 0),[E,D]=(0,f.useState)(void 0),[O,k]=(0,f.useState)(`task`),[A,j]=(0,f.useState)(null),M=!!e.taskId,N=s(e.status)&&!M,P=b!==e.title||S!==e.body,F=P&&b.trim().length>0&&!n,I=o[e.status];return(0,p.jsx)(a,{open:!0,wide:!0,onClose:h,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:b,onChange:e=>x(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:S,onChange:C,repoRoot:t,placeholder:`context, constraints, acceptance criteria — paste a screenshot to attach it`},e.id)]}),A&&(0,p.jsx)(`p`,{className:`text-[11px] text-kobe-red`,role:`alert`,children:A}),(0,p.jsx)(`div`,{className:`flex justify-end`,children:(0,p.jsx)(`button`,{type:`button`,disabled:!F,onClick:()=>{F&&(j(null),g({title:b,body:S}).catch(e=>{j(e instanceof Error?e.message:`failed to save issue`)}))},title:P?`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] ${I.accent}`,children:I.title}),(0,p.jsxs)(`span`,{className:`font-mono text-[10px] text-subtle`,children:[`created `,e.created]})]}),M&&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:w,effort:E,disabled:!N,onChange:e=>{T(e.vendor),D(e.effort)}})]}),(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:`Workspace`}),(0,p.jsx)(`div`,{className:`flex flex-col gap-1`,children:m.map(e=>(0,p.jsxs)(`button`,{type:`button`,disabled:!N,onClick:()=>k(e.id),title:e.hint,className:`border px-2 py-1 text-left text-[11px] transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${O===e.id?`border-primary bg-inset text-fg`:`border-line bg-bg text-muted hover:border-primary hover:text-fg`}`,children:[(0,p.jsx)(`span`,{className:`block`,children:e.label}),(0,p.jsx)(`span`,{className:`block text-[10px] text-subtle`,children:e.hint})]},e.id))})]}),(0,p.jsx)(`div`,{className:`mt-auto flex flex-col gap-2 border-t border-line pt-3`,children:M?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>v?.(),disabled:!v,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:()=>y?.(),disabled:!y||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`})]}):N?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>_({vendor:w,effort:E,placement:O,watch:!1}),title:`Spawn the 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:()=>_({vendor:w,effort:E,placement:O,watch:!0}),title:`Spawn the session and open its 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)(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{h as IssuePeek};
@@ -1 +1 @@
1
- import{l as e}from"./terminal-B6OlmT6e.js";import{c as t,y as n}from"./tabs-C6drmk5t.js";import{d as r}from"./createLucideIcon-B3ImGkvG.js";import{a as i,r as a}from"./toast-B5B1PUen.js";import{n as o}from"./store-DfONeFqN.js";import{t as ee}from"./arrow-left-CTu620DY.js";import{a as s,i as c,n as l,r as u,t as d}from"./lazy-issue-panels-CqdZEwZJ.js";import{t as f}from"./plus-DZE7jB02.js";import{t as p}from"./search-cqUzSqUT.js";import{t as m}from"./x-BtkkvyxG.js";import{n as h,t as g}from"./ConfirmDialog-DLIhXq7i.js";import{a as _,c as v,d as y,h as b,l as te,m as ne,n as re,s as ie,t as x,u as ae}from"./issues-D1vtEzDa.js";var S=e(n(),1);function C(e,t,n){let r=e.find(e=>e.length>0)?.[0]??null;if(t==null)return r;let i=-1,a=-1;for(let[n,r]of e.entries()){let e=r.indexOf(t);if(e!==-1){i=n,a=e;break}}if(i===-1)return r;if(n===`up`||n===`down`){let r=e[i],o=n===`up`?a-1:a+1;return r[Math.max(0,Math.min(o,r.length-1))]??t}let o=n===`left`?-1:1;for(let n=i+o;n>=0&&n<e.length;n+=o){let r=e[n];if(r.length!==0)return r[Math.min(a,r.length-1)]??t}return t}var w=r();function T(){let{tasks:e,hydrated:n}=o(),r=i(),[T,oe]=(0,S.useState)([]);(0,S.useEffect)(()=>{let e=!1;return ie().then(t=>{e||oe(t)}).catch(e=>a(`load projects`,e)),()=>{e=!0}},[]);let E=(0,S.useMemo)(()=>ae(e,T),[e,T]),[D,O]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(E.length===0){D!==null&&O(null);return}(!D||!E.some(e=>e.repo===D))&&O(E[0]?.repo??null)},[E,D]);let{data:k,failed:A,pending:se}=s((0,S.useMemo)(()=>D?[D]:[],[D])),j=D?k[D]:void 0,[M,N]=(0,S.useState)(``),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null),[R,z]=(0,S.useState)(null),[B,V]=(0,S.useState)(null),[H,U]=(0,S.useState)(!1),[W,G]=(0,S.useState)(!1),[ce,K]=(0,S.useState)(!1),q=j?.issues??[],J=(0,S.useMemo)(()=>v(q,{query:M}),[q,M]),Y=(0,S.useMemo)(()=>te(J),[J]),X=J.length,Z=R==null?null:q.find(e=>e.id===R),Q=B==null?null:q.find(e=>e.id===B);(0,S.useEffect)(()=>{R!=null&&!q.some(e=>e.id===R)&&z(null),B!=null&&!q.some(e=>e.id===B)&&V(null)},[q,R,B]),(0,S.useEffect)(()=>L(null),[D]),(0,S.useEffect)(()=>{if(P||R!=null||B!=null)return;let e=e=>{let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n=e.key===`ArrowUp`?`up`:e.key===`ArrowDown`?`down`:e.key===`ArrowLeft`?`left`:e.key===`ArrowRight`?`right`:null;if(n){e.preventDefault();let t=C(x.map(e=>Y[e].map(e=>e.id)),I,n);t!=null&&L(t);return}(e.key===`Enter`||e.key===` `)&&I!=null&&J.some(e=>e.id===I)&&(e.preventDefault(),z(I))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y,J,I,P,R,B]),(0,S.useEffect)(()=>{I!=null&&document.querySelector(`[data-issue-card="${I}"]`)?.scrollIntoView({block:`nearest`})},[I]);let $=e=>{r({to:`/task/$taskId`,params:{taskId:e}})};return(0,w.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,w.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,w.jsx)(h,{}),(0,w.jsxs)(`button`,{type:`button`,onClick:()=>r({to:`/`}),className:`flex items-center gap-1.5 text-muted transition-colors hover:text-fg`,title:`Back to workspace`,children:[(0,w.jsx)(ee,{size:15,strokeWidth:1.8}),(0,w.jsx)(`span`,{className:`text-[12px]`,children:`Workspace`})]}),(0,w.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Issues`}),(0,w.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,w.jsx)(p,{size:13,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,w.jsx)(`input`,{value:M,onChange:e=>N(e.target.value),placeholder:`Filter stories ( #id, title, body )`,className:`w-52 bg-transparent text-[12px] text-fg placeholder:text-subtle focus:outline-none`}),M&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>N(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear filter`,title:`Clear filter`,children:(0,w.jsx)(m,{size:13,strokeWidth:2})})]}),E.length>0&&(0,w.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,w.jsx)(`span`,{className:`shrink-0 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Project`}),(0,w.jsx)(`select`,{value:D??``,onChange:e=>O(e.target.value),title:D??`Select project`,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg focus:outline-none`,children:E.map(e=>(0,w.jsxs)(`option`,{value:e.repo,title:e.repo,className:`bg-surface text-fg`,children:[e.label,` · `,e.count,` · `,e.repo]},e.repo))})]}),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[11px] text-subtle`,children:[(0,w.jsxs)(`span`,{children:[X,` stor`,X===1?`y`:`ies`]}),(0,w.jsxs)(`button`,{type:`button`,disabled:!D,onClick:()=>F(!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,w.jsx)(f,{size:13,strokeWidth:1.8}),`New story`]})]})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden p-4`,children:D?!n||se&&!j?(0,w.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Loading…`}):D&&A[D]?(0,w.jsx)(`p`,{className:`text-[12px] text-kobe-red`,children:A[D]}):X===0?(0,w.jsx)(`p`,{className:`text-[12px] text-subtle`,children:M?`No stories match your filter.`:`No stories yet. Capture one with New story.`}):(0,w.jsx)(`div`,{className:`flex h-full min-h-0 gap-4`,children:x.map(e=>{let t=re[e],n=Y[e];return(0,w.jsxs)(`section`,{className:`flex h-full min-h-0 w-72 shrink-0 flex-col`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[(0,w.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] ${t.accent}`,children:t.title}),(0,w.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:n.length})]}),(0,w.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pr-0.5`,children:n.map(e=>(0,w.jsx)(c,{issue:e,selected:e.id===I,onOpen:()=>{L(e.id),z(e.id)},onDelete:()=>V(e.id)},e.id))})]},e)})}):(0,w.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`No projects yet. Create a task from the workspace to track stories against its repo.`})}),D&&P&&(0,w.jsx)(d,{children:(0,w.jsx)(l,{repoRoot:D,open:P,onClose:()=>F(!1),onCreated:(e,t)=>{t&&e.taskId&&$(e.taskId)}})}),D&&Z&&(0,w.jsx)(d,{children:(0,w.jsx)(u,{issue:Z,repoRoot:D,busy:H,starting:W,onClose:()=>z(null),onSave:async e=>{if(!D||R==null)return!1;U(!0);try{return await b(D,R,{title:e.title.trim(),body:e.body}),!0}catch(e){return a(`save issue`,e),!1}finally{U(!1)}},onStart:e=>{!D||!Z||(G(!0),ne(D,Z,e).then(({workspaceTaskId:t})=>{z(null),e.watch&&$(t)}).catch(e=>a(`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&&y(e,Z).catch(e=>a(`prompt issue merge`,e))}:void 0})}),Q&&(0,w.jsx)(g,{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:ce,onConfirm:()=>{!D||B==null||(K(!0),_(D,B).then(()=>V(null)).catch(e=>a(`delete issue`,e)).finally(()=>K(!1)))},onCancel:()=>V(null)})]})}export{T as IssuesPage};
1
+ import{l as e}from"./terminal-B6OlmT6e.js";import{c as t,y as n}from"./tabs-C_UMvAeW.js";import{d as r}from"./createLucideIcon-BFra8ckc.js";import{a as i,r as a}from"./toast-Da-Q67N5.js";import{n as o}from"./store-LXLUDGEO.js";import{t as ee}from"./arrow-left-CVsK1Z_1.js";import{a as s,i as c,n as l,r as u,t as d}from"./lazy-issue-panels-D77tReDb.js";import{t as f}from"./plus-BhhrqdEO.js";import{t as p}from"./search-DA3nII27.js";import{t as m}from"./x-CopxPdj3.js";import{n as h,t as g}from"./ConfirmDialog-CUQLUsl5.js";import{a as _,c as v,d as y,h as b,l as te,m as ne,n as re,s as ie,t as x,u as ae}from"./issues-89uT5swt.js";var S=e(n(),1);function C(e,t,n){let r=e.find(e=>e.length>0)?.[0]??null;if(t==null)return r;let i=-1,a=-1;for(let[n,r]of e.entries()){let e=r.indexOf(t);if(e!==-1){i=n,a=e;break}}if(i===-1)return r;if(n===`up`||n===`down`){let r=e[i],o=n===`up`?a-1:a+1;return r[Math.max(0,Math.min(o,r.length-1))]??t}let o=n===`left`?-1:1;for(let n=i+o;n>=0&&n<e.length;n+=o){let r=e[n];if(r.length!==0)return r[Math.min(a,r.length-1)]??t}return t}var w=r();function T(){let{tasks:e,hydrated:n}=o(),r=i(),[T,oe]=(0,S.useState)([]);(0,S.useEffect)(()=>{let e=!1;return ie().then(t=>{e||oe(t)}).catch(e=>a(`load projects`,e)),()=>{e=!0}},[]);let E=(0,S.useMemo)(()=>ae(e,T),[e,T]),[D,O]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(E.length===0){D!==null&&O(null);return}(!D||!E.some(e=>e.repo===D))&&O(E[0]?.repo??null)},[E,D]);let{data:k,failed:A,pending:se}=s((0,S.useMemo)(()=>D?[D]:[],[D])),j=D?k[D]:void 0,[M,N]=(0,S.useState)(``),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null),[R,z]=(0,S.useState)(null),[B,V]=(0,S.useState)(null),[H,U]=(0,S.useState)(!1),[W,G]=(0,S.useState)(!1),[ce,K]=(0,S.useState)(!1),q=j?.issues??[],J=(0,S.useMemo)(()=>v(q,{query:M}),[q,M]),Y=(0,S.useMemo)(()=>te(J),[J]),X=J.length,Z=R==null?null:q.find(e=>e.id===R),Q=B==null?null:q.find(e=>e.id===B);(0,S.useEffect)(()=>{R!=null&&!q.some(e=>e.id===R)&&z(null),B!=null&&!q.some(e=>e.id===B)&&V(null)},[q,R,B]),(0,S.useEffect)(()=>L(null),[D]),(0,S.useEffect)(()=>{if(P||R!=null||B!=null)return;let e=e=>{let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n=e.key===`ArrowUp`?`up`:e.key===`ArrowDown`?`down`:e.key===`ArrowLeft`?`left`:e.key===`ArrowRight`?`right`:null;if(n){e.preventDefault();let t=C(x.map(e=>Y[e].map(e=>e.id)),I,n);t!=null&&L(t);return}(e.key===`Enter`||e.key===` `)&&I!=null&&J.some(e=>e.id===I)&&(e.preventDefault(),z(I))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y,J,I,P,R,B]),(0,S.useEffect)(()=>{I!=null&&document.querySelector(`[data-issue-card="${I}"]`)?.scrollIntoView({block:`nearest`})},[I]);let $=e=>{r({to:`/task/$taskId`,params:{taskId:e}})};return(0,w.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,w.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,w.jsx)(h,{}),(0,w.jsxs)(`button`,{type:`button`,onClick:()=>r({to:`/`}),className:`flex items-center gap-1.5 text-muted transition-colors hover:text-fg`,title:`Back to workspace`,children:[(0,w.jsx)(ee,{size:15,strokeWidth:1.8}),(0,w.jsx)(`span`,{className:`text-[12px]`,children:`Workspace`})]}),(0,w.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Issues`}),(0,w.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,w.jsx)(p,{size:13,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,w.jsx)(`input`,{value:M,onChange:e=>N(e.target.value),placeholder:`Filter stories ( #id, title, body )`,className:`w-52 bg-transparent text-[12px] text-fg placeholder:text-subtle focus:outline-none`}),M&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>N(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear filter`,title:`Clear filter`,children:(0,w.jsx)(m,{size:13,strokeWidth:2})})]}),E.length>0&&(0,w.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,w.jsx)(`span`,{className:`shrink-0 text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Project`}),(0,w.jsx)(`select`,{value:D??``,onChange:e=>O(e.target.value),title:D??`Select project`,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg focus:outline-none`,children:E.map(e=>(0,w.jsxs)(`option`,{value:e.repo,title:e.repo,className:`bg-surface text-fg`,children:[e.label,` · `,e.count,` · `,e.repo]},e.repo))})]}),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[11px] text-subtle`,children:[(0,w.jsxs)(`span`,{children:[X,` stor`,X===1?`y`:`ies`]}),(0,w.jsxs)(`button`,{type:`button`,disabled:!D,onClick:()=>F(!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,w.jsx)(f,{size:13,strokeWidth:1.8}),`New story`]})]})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden p-4`,children:D?!n||se&&!j?(0,w.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Loading…`}):D&&A[D]?(0,w.jsx)(`p`,{className:`text-[12px] text-kobe-red`,children:A[D]}):X===0?(0,w.jsx)(`p`,{className:`text-[12px] text-subtle`,children:M?`No stories match your filter.`:`No stories yet. Capture one with New story.`}):(0,w.jsx)(`div`,{className:`flex h-full min-h-0 gap-4`,children:x.map(e=>{let t=re[e],n=Y[e];return(0,w.jsxs)(`section`,{className:`flex h-full min-h-0 w-72 shrink-0 flex-col`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[(0,w.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] ${t.accent}`,children:t.title}),(0,w.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:n.length})]}),(0,w.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pr-0.5`,children:n.map(e=>(0,w.jsx)(c,{issue:e,selected:e.id===I,onOpen:()=>{L(e.id),z(e.id)},onDelete:()=>V(e.id)},e.id))})]},e)})}):(0,w.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`No projects yet. Create a task from the workspace to track stories against its repo.`})}),D&&P&&(0,w.jsx)(d,{children:(0,w.jsx)(l,{repoRoot:D,open:P,onClose:()=>F(!1),onCreated:(e,t)=>{t&&e.taskId&&$(e.taskId)}})}),D&&Z&&(0,w.jsx)(d,{children:(0,w.jsx)(u,{issue:Z,repoRoot:D,busy:H,starting:W,onClose:()=>z(null),onSave:async e=>{if(!D||R==null)return!1;U(!0);try{return await b(D,R,{title:e.title.trim(),body:e.body}),!0}catch(e){return a(`save issue`,e),!1}finally{U(!1)}},onStart:e=>{!D||!Z||(G(!0),ne(D,Z,e).then(({workspaceTaskId:t})=>{z(null),e.watch&&$(t)}).catch(e=>a(`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&&y(e,Z).catch(e=>a(`prompt issue merge`,e))}:void 0})}),Q&&(0,w.jsx)(g,{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:ce,onConfirm:()=>{!D||B==null||(K(!0),_(D,B).then(()=>V(null)).catch(e=>a(`delete issue`,e)).finally(()=>K(!1)))},onCancel:()=>V(null)})]})}export{T as IssuesPage};