@wjarka/cezarion 0.14.4 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +4 -1
  2. package/dist/automations/types.d.ts +2 -0
  3. package/dist/contract/automations.d.ts +8 -0
  4. package/dist/contract/index.js +4 -0
  5. package/dist/contract/runs.d.ts +10 -2
  6. package/dist/contract/skills.d.ts +1 -0
  7. package/dist/contract/workflows.d.ts +6 -0
  8. package/dist/delegation/cli.js +60 -1
  9. package/dist/delegation/cli.js.map +1 -1
  10. package/dist/index.js +1 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/runs/store.d.ts +1 -0
  13. package/dist/server/server.d.ts +72 -0
  14. package/dist/server/server.js +6 -5
  15. package/dist/server/server.js.map +1 -1
  16. package/dist/workflows/run.d.ts +4 -0
  17. package/dist/workflows/run.js +64 -19
  18. package/dist/workflows/run.js.map +1 -1
  19. package/dist/workflows/types.d.ts +3 -0
  20. package/dist/workflows/types.js +2 -1
  21. package/dist/workflows/types.js.map +1 -1
  22. package/package.json +3 -3
  23. package/web/dist/assets/{agent-accounts-BxBsIXGa.js → agent-accounts-4EqNShyp.js} +1 -1
  24. package/web/dist/assets/{alert-dialog-BOp2HnnL.js → alert-dialog-CVF_qvQ8.js} +1 -1
  25. package/web/dist/assets/{collapsible-bb0csfMs.js → collapsible-DVDGHZAE.js} +1 -1
  26. package/web/dist/assets/{commit-list-DOWYQ7G6.js → commit-list-BuNsBn8P.js} +1 -1
  27. package/web/dist/assets/{compare-variants-B1XteHt-.js → compare-variants-BnQ1O8Ix.js} +1 -1
  28. package/web/dist/assets/{diff-BjLZHKfD2.js → diff-DWmKlqw52.js} +2 -2
  29. package/web/dist/assets/{diff-controls-DaO836o4.js → diff-controls-CuqRa-63.js} +1 -1
  30. package/web/dist/assets/{diff-stat-DpHwISUB.js → diff-stat-BXriPIds.js} +1 -1
  31. package/web/dist/assets/{diff-view-BaYxuP8L.js → diff-view-DLPDcgEV.js} +1 -1
  32. package/web/dist/assets/{dropdown-menu-DAmCVaLJ.js → dropdown-menu-IsTcumXE.js} +1 -1
  33. package/web/dist/assets/{git-toolbar-rk3doc2w.js → git-toolbar-BjMzETip.js} +1 -1
  34. package/web/dist/assets/{github-BhnijVvD.js → github-BvowTAuy.js} +1 -1
  35. package/web/dist/assets/{image-preview-CFHgISfb.js → image-preview-WXKTY8KT.js} +1 -1
  36. package/web/dist/assets/index-Cz3N9b18.js +7 -0
  37. package/web/dist/assets/{markdown-Ir62-VMS.js → markdown-gFxX4dDH.js} +1 -1
  38. package/web/dist/assets/pill-BlaWNkHk.js +1 -0
  39. package/web/dist/assets/{project-router-CvFAMDcP.js → project-router-CX1jLqj-.js} +1 -1
  40. package/web/dist/assets/{prompt-templates-BGGpAIzb.js → prompt-templates-DwdQcfSc.js} +1 -1
  41. package/web/dist/assets/{repo-git-QEHH7y-w.js → repo-git-DnbE8dR5.js} +1 -1
  42. package/web/dist/assets/{run-diff-DrQsmf3-.js → run-diff-Mfc85irR.js} +1 -1
  43. package/web/dist/assets/run-header-CDO3LV4z.js +1 -0
  44. package/web/dist/assets/{skills-DOT1odMt.js → skills-DHfsyXTQ.js} +1 -1
  45. package/web/dist/assets/{tab-link-CkIV8ixq.js → tab-link-DhREnUYE.js} +1 -1
  46. package/web/dist/assets/{task-changes-CUQTi97I.js → task-changes-Cfo-vtEl.js} +1 -1
  47. package/web/dist/assets/{task-commits-D_N8-awD.js → task-commits-CvK4flXT.js} +1 -1
  48. package/web/dist/assets/{task-files-CfYcMt07.js → task-files-BwVGUObK.js} +1 -1
  49. package/web/dist/assets/{task-thread-Bnd_Pc07.js → task-thread-g1vc4tKn.js} +6 -6
  50. package/web/dist/assets/{textarea-DfvlPIgO.js → textarea-DCP8bOOf.js} +1 -1
  51. package/web/dist/assets/{thread-loading-B0WsjYr0.js → thread-loading-D9DbIsIS.js} +1 -1
  52. package/web/dist/assets/{token-metrics-BLzFUb8F.js → token-metrics-PSnNTJZF.js} +1 -1
  53. package/web/dist/assets/{utils-GZNjgma4.js → utils-DNvmfH6b.js} +1 -1
  54. package/web/dist/assets/{workflows-C1I-xV9B.js → workflows-BDdUJIFT.js} +3 -3
  55. package/web/dist/assets/{zoomable-image-COhBxkky.js → zoomable-image-yNqiuVu7.js} +1 -1
  56. package/web/dist/index.html +13 -13
  57. package/web/dist/assets/index-DTsigc4h.js +0 -7
  58. package/web/dist/assets/pill-BoBISMI9.js +0 -1
  59. package/web/dist/assets/run-header-BKeByMek.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,$r as i,B as a,Fn as o,Hn as s,Kr as c,Q as l,Qr as u,Rn as d,Xr as f,Yt as p,bt as m,d as h,da as g,dr as _,et as v,kt as y,mn as b,ni as x,nt as S,sa as C,tt as w,vt as T,xt as ee,yt as te}from"./alert-dialog-BOp2HnnL.js";import{n as E,t as D}from"./utils-GZNjgma4.js";import{c as ne,i as re,l as ie,r as ae,t as oe}from"./dropdown-menu-DAmCVaLJ.js";import{a as se,i as ce,r as le}from"./agent-accounts-BxBsIXGa.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as k}from"./external-link-BE6y205O.js";import{t as ue}from"./square-terminal-B6RYYieR.js";var de=O(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),A=O(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),fe=O(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),pe=O(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),me=O(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),he=O(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ge=O(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),_e=O(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),ve=O(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ye=O(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),j=O(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),be=O(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),xe=O(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),Se=O(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Ce=O(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),we=O(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Te=O(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Ee=O(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),De=O(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Oe=O(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),ke=O(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),M=e(t(),1),N=n(),Ae=a(`inline-block size-[7px] shrink-0 rounded-full`,{variants:{tone:{success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,running:`bg-running`,neutral:`bg-soft-foreground`},pulse:{true:`animate-pulse motion-reduce:animate-none`,false:``}},defaultVariants:{tone:`neutral`,pulse:!1}});function P({className:e,tone:t=`neutral`,pulse:n=!1,...r}){return(0,N.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:D(Ae({tone:t,pulse:n,className:e})),...r})}var je=[`done`,`failed`,`cancelled`],Me=[`done`,`failed`];function Ne(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function Pe(e){return je.includes(e)}function F(e){return e.archived||Ne(e)||!Me.includes(e.status)?!1:e.finishedAt!==void 0}function I(e){let t=e.finishedAt;return t===void 0||!F(e)?!1:e.seenAt===void 0||e.seenAt<t}function Fe(e){return!Ne(e)&&Pe(e.status)&&!I(e)}function Ie(e){return e.reduce((e,t)=>I(t)?e+1:e,0)}var L=(0,M.createContext)(null);function Le({children:e}){let[t,n]=(0,M.useState)(()=>new Map),r=(0,M.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,M.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=s((0,M.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,M.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,N.jsx)(L.Provider,{value:o,children:e})}var R=(0,M.createContext)(null);function Re({projectId:e,requests:t,children:n}){let r=(0,M.useContext)(L),i=(0,M.useId)();(0,M.useEffect)(()=>{if(r)return r.publish(i,t),()=>r.retract(i)},[r,i,t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let a=s(r?ze:t),o=r?.lookup??a,c=(0,M.useMemo)(()=>({lookup:o,projectId:e}),[o,e]);return(0,N.jsx)(R.Provider,{value:c,children:n})}var ze=[];function Be(e,t,n){let r=(0,M.useContext)(R),i=n??r?.projectId;return!r||!i||t===void 0?Ve:r.lookup({projectId:i,kind:e,number:t})}var Ve=Object.freeze({state:`idle`}),He={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},Ue={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},We={draft:m,"review-required":ee,"changes-requested":y,"checks-pending":null,"checks-failing":S,ready:l,merged:T,closed:te,open:r,completed:l,"not-planned":w};function z({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:a,projectId:o,className:s,compact:c=!1}){let{kind:l,number:d,url:f}=e,m=Be(l,d,o),h=n??m.status,g=i(h),_=l===`PR`&&(r??m.conflicting)===!0,v=_?u:g,y=D(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[10px] font-normal`,He[v?.tone??`accent`],s),b=Je(m,v,_?g:void 0),x=d?`${!c&&l===`Issue`?`Issue `:``}#${d}`:l,S=l===`PR`?`pull request`:`issue`,C=`Open the ${S} for ${t}${v?` — ${v.label}`:``}`,w=(0,N.jsxs)(N.Fragment,{children:[_?(0,N.jsx)(p,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,N.jsx)(Xe,{status:v?h:void 0}),x]}),T=!f||!E(f)?(0,N.jsx)(`span`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},"aria-label":v?`${S} ${x} — ${v.label}`:void 0,className:y,children:w}):(0,N.jsx)(`a`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:b?void 0:f,"aria-label":C,className:D(y,Ue[v?.tone??`accent`]),children:w});if(!b)return T;let ee=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`span`,{className:`block font-medium`,children:[l===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,b.headline]}),(0,N.jsx)(`span`,{className:`block`,children:b.detail}),b.also?(0,N.jsx)(`span`,{className:`block opacity-70`,children:b.also}):null,f&&E(f)?(0,N.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,N.jsx)(qe,{chip:T,action:_?a:void 0,state:m.state,children:ee})}var B=(0,M.createContext)(()=>{});function Ge(){return(0,M.useContext)(B)}var Ke=150,V=120;function qe({chip:e,action:t,state:n,children:r}){let[i,a]=(0,M.useState)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useRef)(void 0),l=(0,M.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,M.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,M.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,N.jsxs)(le,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,N.jsx)(ce,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Ke)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,V)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,N.jsxs)(se,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,V)},children:[(0,N.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,N.jsx)(B.Provider,{value:u,children:t}):null]})]})}function Je(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${Ye(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function Ye(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Xe({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,N.jsx)(v,{"data-slot":`status-dot`,"data-tone":`pending`,className:`size-3 animate-pulse motion-reduce:animate-none`,"aria-hidden":`true`});let t=We[e];return t?(0,N.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}var H={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function U(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function W(e){return e.runner??`claude`}function G(e,t){let n=g(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${H[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${H[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function Ze(e,t){return G(U(e),t)}function Qe(e,t){return G(W(e),t)}function K(e){let t=d(),n=U(e);return t.isSuccess&&t.data?Ze(e,t.data):{provider:n,usable:!0}}function $e(e){let t=d(),n=W(e);return t.isSuccess&&t.data?Qe(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var et={folder:ve,terminal:ue,vscode:me,cursor:Se,zed:ke,windsurf:Oe,sublime:_e,idea:ge,pycharm:xe,webstorm:j,goland:Te,rubymine:ye,phpstorm:pe,clion:he,rider:fe,"android-studio":Ee,xcode:be,warp:we,claude:A,codex:De,opencode:A,pi:A};function q(e){return e.icon&&et[e.icon]||k}function J(e){let t=/^cli:(claude|codex|opencode|pi|cursor)$/.exec(e);return t?t[1]:void 0}function tt({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,N.jsxs)(oe,{children:[(0,N.jsx)(ie,{asChild:!0,children:(0,N.jsxs)(h,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,N.jsx)(k,{"aria-hidden":`true`}),n]})}),(0,N.jsxs)(ae,{align:`end`,children:[o,o&&e.length>0?(0,N.jsx)(ne,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=q(e);return(0,N.jsxs)(re,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,N.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}function Y(e){return e===`running`||e===`queued`||e===`waiting`}function X(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}function Z(e){return[...e.steps].reverse().find(e=>e.sessionId)?.backend??e.runner??`claude`}var nt=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function rt(e,t){if(nt.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`cursor`:return;case`opencode`:return`opencode --session ${t}`;default:return`claude --resume ${t}`}}function it(e){if(Y(e.status))return;let t=X(e);if(t===void 0||!nt.test(t))return;let n=Z(e),r=n===`cursor`?e.cliResumeCommand:rt(n,t);if(r!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${r}`:r}function at(e,t){let n=J(t);return!n||Y(e.status)?!1:n===Z(e)&&X(e)!==void 0}function ot(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function Q(e){let t=Y(e.status),n=X(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(n||ot(e)),terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:F(e)&&!I(e),cancel:t,deleteRun:!t}}function st(e,t=!1){return!Q(e).finish||e.status!==`waiting`||e.delegation?.role===`root`?!1:f(e,t).bucket===`waiting`}function ct(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function lt(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function ut(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var dt=[50,100,200,400,800,1e3,1e3,1e3,1e3],ft=e=>new Promise(t=>setTimeout(t,e));function pt(e){return e instanceof x&&e.status===409&&e.message===`run is still active`}async function mt(e,t=ft){for(let n=0;;n+=1)try{return await e()}catch(e){let r=dt[n];if(!pt(e)||r===void 0)throw e;await t(r)}}function ht(e){return Y(e.status)?`live`:Q(e).continueRun?`resume`:`unavailable`}function gt(e,t){let n=_(e.id,t),r=b(e.id,t),i=K(e),a=$e(e),[o,s]=(0,M.useState)(void 0),[c,l]=(0,M.useState)(!1),u=(0,M.useRef)(!1),d=ht(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await mt(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof x&&n.status===409&&X(e)!==void 0){try{await mt(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function $({run:e,projectId:t,prNumber:n}){let r=gt(e,t),i=Ge(),[a,o]=(0,M.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(ct(n));t?C(t,{tone:`danger`}):(C(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(h,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,N.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function _t({projectId:e,runId:t,prNumber:n}){let r=o(e,t);return r.data?(0,N.jsx)($,{run:r.data,projectId:e,prNumber:n}):(0,N.jsx)(h,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function vt({run:e,reference:t,className:n,compact:r=!1}){return(0,N.jsx)(z,{reference:t,taskTitle:c(e),conflictAction:(0,N.jsx)($,{run:e,prNumber:t.number}),className:n,compact:r})}function yt(e,t){let[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(``),o=(0,M.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function bt({editor:e,className:t}){return(0,N.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:D(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function xt({className:e,dot:t,pulse:n=!1,children:r,...i}){return(0,N.jsxs)(`span`,{"data-slot":`pill`,className:D(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...i,children:[t?(0,N.jsx)(P,{tone:t,pulse:n}):null,r]})}export{Ce as A,Re as C,I as D,Fe as E,ve as M,de as N,Ie as O,z as S,F as T,Q as _,_t as a,q as b,at as c,ot as d,Z as f,it as g,ut as h,$ as i,j,P as k,lt as l,st as m,bt as n,vt as o,X as p,yt as r,gt as s,xt as t,Y as u,tt as v,Le as w,K as x,J as y};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Fr as i,Ft as a,J as o,Jt as s,K as c,Kr as l,Lr as u,Mn as d,Mr as f,Nn as p,Pn as m,Pr as h,Q as g,Qn as _,Ri as v,Rn as y,Ta as b,V as x,Vn as ee,Wr as te,X as S,Xr as ne,Y as re,Yr as ie,a as C,ar as w,c as ae,cr as T,d as E,et as oe,fa as se,fn as ce,gt as le,i as ue,in as D,ir as de,it as O,jn as fe,kn as pe,kr as me,n as he,ni as ge,nt as k,o as A,oi as _e,r as j,s as M,sa as N,st as ve,t as P,tn as F,tt as ye,un as be,wn as xe,xi as Se,yi as Ce,zi as we,zr as Te}from"./alert-dialog-BOp2HnnL.js";import{n as I,t as L}from"./utils-GZNjgma4.js";import{a as R,c as Ee,i as z,l as B,n as De,r as V,t as Oe}from"./dropdown-menu-DAmCVaLJ.js";import{n as ke,r as Ae,t as je}from"./collapsible-bb0csfMs.js";import{n as Me,t as Ne}from"./agent-accounts-BxBsIXGa.js";import{t as H}from"./createLucideIcon-BHp8sXmF.js";import{A as Pe,C as Fe,N as Ie,S as U,_ as W,b as Le,c as Re,f as ze,g as Be,i as Ve,m as He,n as Ue,r as We,t as Ge,y as Ke}from"./pill-BoBISMI9.js";import{c as qe,s as Je,t as G,u as Ye}from"./project-router-CvFAMDcP.js";import{t as Xe}from"./square-terminal-B6RYYieR.js";import{t as Ze}from"./markdown-Ir62-VMS.js";import{t as Qe}from"./diff-stat-DpHwISUB.js";import{n as $e,t as et}from"./token-metrics-BLzFUb8F.js";import{t as K}from"./tab-link-CkIV8ixq.js";import{t as tt}from"./use-desktop-BaYgO7YW.js";var nt=H(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),rt=H(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),it=H(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),q=e(t(),1),J=n();function at(e){let t=r();return b({mutationFn:t=>_e(e,t),onSuccess:()=>t.invalidateQueries({queryKey:D.runs.all}),onError:e=>N(e.message,{tone:`danger`})})}function ot(e){return e.archived?`Unarchive`:`Archive task`}function st({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,J.jsx)(P,{open:t,onOpenChange:n,children:(0,J.jsxs)(ue,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(M,{children:[(0,J.jsx)(ae,{children:`Archive task?`}),(0,J.jsxs)(C,{children:[`Move “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(j,{children:`Cancel`}),(0,J.jsx)(he,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function ct({run:e,className:t}){let[n,r]=(0,q.useState)(!1),i=at(e.id),a=ot(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(E,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":a,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:i.isPending,className:L(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?i.mutate(!1):r(!0),children:[e.archived?(0,J.jsx)(Ie,{"aria-hidden":`true`}):(0,J.jsx)(x,{"aria-hidden":`true`}),a]}),(0,J.jsx)(st,{run:e,open:n,onOpenChange:r,onConfirm:()=>{i.mutate(!0),r(!1)}})]})}function lt(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function ut({slot:e,icon:t,title:n,meta:r,open:i,onToggle:a,children:o}){return(0,J.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":i?`open`:`collapsed`,className:`min-w-0 border-t border-border first:border-t-0`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:a,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-left hover:bg-muted/40`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,J.jsx)(`span`,{className:`min-w-0 shrink truncate text-[13.5px] font-semibold text-foreground`,children:n}),(0,J.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[12.5px] text-muted-foreground tabular-nums`,children:r}),(0,J.jsx)(S,{"aria-hidden":!0,className:L(`ml-auto size-4 shrink-0 text-soft-foreground transition-transform`,i&&`rotate-180`)})]}),i?(0,J.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:o}):null]})}var dt=`flex min-h-11 min-w-0 items-center rounded-md px-2 text-sm text-foreground hover:bg-muted break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;function ft({run:e}){return!e.delegation||e.delegation.role===`invalid`?null:(0,J.jsx)(mt,{run:e})}function Y(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId):[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])].slice(0,32)}function pt(e){let t=e.delegation,n=t!==void 0&&t.role!==`invalid`,r=w(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=Y(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function mt({run:e}){let t=w(e.id),n=tt(),[r,i]=(0,q.useState)(null),a=n||r===e.id,s=(0,q.useId)(),c=T(),u=e.delegation,d=u?.role===`worker`?u.parentRunId:t.data?.parentRunId,f=new Map(t.data?.workers.map(e=>[e.workerId,e])),p=Y(u,t.data),m=u&&u.role!==`invalid`?u.wait:void 0,h=ie(u);return(0,J.jsxs)(`section`,{"aria-label":`Task relationships`,className:`min-w-0 border-t border-border py-2 text-sm text-muted-foreground`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-2 text-left text-xs md:hidden`,"aria-expanded":a,"aria-controls":s,onClick:()=>i(r===e.id?null:e.id),children:[(0,J.jsx)(le,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),u?.role===`worker`?`Worker session`:`Parent`,(0,J.jsx)(o,{"aria-hidden":`true`,className:`ml-1 size-4`}),u?.role===`worker`?`Parent & workers`:p.length>0?`Workers ${p.length}`:t.isSuccess?`Workers 0`:t.isError?`Workers unavailable`:`Workers…`,(0,J.jsx)(S,{"aria-hidden":`true`,className:`ml-auto size-4 ${a?`rotate-180`:``}`})]}),u?.role===`worker`&&u.destroy?(0,J.jsx)(X,{state:u.destroy}):null,m?(0,J.jsx)(bt,{wait:m,dependencyLabel:h}):null,(0,J.jsxs)(`div`,{id:s,hidden:!a,children:[d?(0,J.jsx)(xt,{id:d}):null,p.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-1 overflow-y-auto`,children:p.map(e=>{let n=f.get(e),r=c.data?.find(t=>t.id===e);return(0,J.jsxs)(`li`,{className:`min-w-0 rounded-md bg-muted/40 px-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(G,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:dt,children:r?l(r):`Worker ${e.slice(0,8)}`}),(0,J.jsx)(`span`,{className:`px-2 text-xs`,children:n?.status??(t.isSuccess?`Record unavailable or deleted`:`Status unavailable`)})]}),n?.destroy?(0,J.jsx)(X,{state:n.destroy}):null]},e)})}):u?.role===`root`&&t.isSuccess?(0,J.jsx)(`p`,{className:`px-2`,children:`No workers`}):null,t.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-2`,children:`Offline — relationship details will refresh when connected.`}):t.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-2`,children:`Loading relationships…`}):null,t.isError?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,J.jsx)(E,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry relationships`})]}):null]})]})}function ht({run:e,open:t,onToggle:n}){let r=w(e.id),i=T(),a=tt(),o=e.delegation,s=o?.role===`worker`?o.parentRunId:r.data?.parentRunId,u=new Map(r.data?.workers.map(e=>[e.workerId,e])),d=Y(o,r.data),f=o&&o.role!==`invalid`?o.wait:void 0,p=ie(o);return(0,J.jsx)(ut,{slot:`workers`,icon:(0,J.jsx)(le,{className:`size-4`}),title:`Workers`,meta:gt({ids:d,workers:u,parentId:s,desktop:a,query:r}),open:t,onToggle:n,children:(0,J.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[o?.role===`worker`&&o.destroy?(0,J.jsx)(X,{state:o.destroy}):null,f?(0,J.jsx)(bt,{wait:f,dependencyLabel:p}):null,s?(0,J.jsx)(xt,{id:s}):null,d.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:d.map(e=>{let t=u.get(e),n=i.data?.find(t=>t.id===e),a=t?vt(t.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,J.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":t?.status,className:`min-w-0`,children:[(0,J.jsxs)(G,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,J.jsx)(_t,{status:t?.status}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n?l(n):`Worker ${e.slice(0,8)}`}),(0,J.jsx)(`span`,{className:L(`max-w-[45%] shrink-0 truncate text-xs`,yt(t?.status)),children:a}),(0,J.jsx)(c,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),t?.destroy?(0,J.jsx)(X,{state:t.destroy}):null]},e)})}):o?.role===`root`&&r.isSuccess?(0,J.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,J.jsx)(E,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function gt({ids:e,workers:t,parentId:n,desktop:r,query:i}){if(e.length===0)return i.isError?`Unavailable`:i.isPending?`Linking…`:n?`Parent linked`:`No workers`;let a=`${e.length} linked`;if(!r)return a;let o=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&o.set(e,(o.get(e)??0)+1)}return[a,...[...o.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function _t({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,J.jsx)(g,{"aria-hidden":!0,className:L(t,`text-success`)}):e===`failed`?(0,J.jsx)(k,{"aria-hidden":!0,className:L(t,`text-danger`)}):e===`cancelled`?(0,J.jsx)(ye,{"aria-hidden":!0,className:L(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,J.jsx)(Ye,{role:`status`,"aria-label":`Worker running`,className:L(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,J.jsx)(oe,{"aria-hidden":!0,className:L(t,`text-soft-foreground`)})}function vt(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function yt(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function bt({wait:e,dependencyLabel:t}){return(0,J.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,` `,`Deadline: `,(0,J.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]})}function xt({id:e}){let t=_(e);return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(G,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,className:dt,children:t.data?`Parent · ${l(t.data)}`:`Parent task ${e}`}),t.isError?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`px-2 text-xs`,children:`Parent record unavailable or deleted`}),(0,J.jsx)(E,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}function X({state:e}){return e.phase===`complete`&&e.remaining.length===0&&e.error===void 0?null:(0,J.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${e.error}`:``]})}function Z(e){switch(e){case`done`:return`done`;case`running`:case`waiting`:case`review`:return`active`;case`failed`:case`cancelled`:return`failed`;case`pending`:case`skipped`:return`pending`}}function St(e){if(e.length===0)return 0;let t=new Set([`done`,`failed`,`cancelled`,`skipped`]),n=new Set([`running`,`waiting`,`review`]),r=0;for(let i of e)t.has(i.status)?r+=1:n.has(i.status)&&(r+=.5);return r/e.length}function Ct({steps:e}){if(e.length===0)return null;let t=St(e)*100;return(0,J.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,J.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":Z(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,J.jsx)(wt,{visual:Z(t.status)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,J.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-[11.5px] text-soft-foreground tabular-nums`,children:[t.kind,` · step `,n+1,` of `,e.length]})]},t.id)),(0,J.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function wt({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,J.jsx)(g,{"aria-hidden":!0,className:L(t,`text-success`)});case`active`:return(0,J.jsx)(Ye,{role:`status`,"aria-label":`Step running`,className:L(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,J.jsx)(k,{"aria-hidden":!0,className:L(t,`text-danger`)});case`pending`:return(0,J.jsx)(oe,{"aria-hidden":!0,className:L(t,`text-soft-foreground`)})}}function Tt(e){let t=e.findIndex(e=>Z(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>Z(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function Et({visual:e}){return(0,J.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:L(`size-1.5 rounded-full`,e===`done`?`bg-success`:e===`failed`?`bg-danger`:e===`active`?`bg-pending`:`bg-soft-foreground`,e===`active`&&`animate-pulse motion-reduce:animate-none`)})}var Dt=new Map;function Ot({runId:e,steps:t}){let[n,r]=(0,q.useState)(()=>Dt.get(e)??!1);if(t.length===0)return null;let i=t=>{Dt.set(e,t),r(t)},a=Tt(t),o=t[a],s=St(t)*100;return(0,J.jsxs)(je,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,J.jsxs)(Ae,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group flex min-h-11 w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground md:min-h-[30px] md:gap-2.5`,children:[(0,J.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,J.jsx)(Et,{visual:Z(e.status)},e.id))}),(0,J.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,J.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,J.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,J.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,J.jsx)(S,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,J.jsx)(ke,{children:(0,J.jsx)(`div`,{className:`pt-2`,children:(0,J.jsx)(Ct,{steps:t})})})]})}function kt(e){let t=r();return b({mutationFn:()=>Se(e),onSuccess:()=>t.invalidateQueries({queryKey:D.runs.all}),onError:e=>N(e.message,{tone:`danger`})})}var At=new Map;function jt({run:e,tab:t=`session`,hasPendingHumanAsk:n=!1,onMarkedUnread:r}){let i=ne(e,n),a=W(e),o=t===`session`&&He(e,n),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),d=Mt(e,r),[,f]=(0,q.useReducer)(e=>e+1,0),p=(0,q.useId)(),m=Je(),h=JSON.stringify([m,e.id]),g=At.get(h)??!1,_=()=>{At.set(h,!g),f()},v=T(),y=xe(),b=et(y.data),x=e.status===`queued`?te(v.data??[]).get(e.id):void 0;return(0,J.jsxs)(`header`,{"data-slot":`run-header`,className:L(`relative z-20 bg-background px-[18px] pt-[18px] md:px-9 md:pt-7`,t===`session`&&`md:sticky md:top-0`),children:[(0,J.jsxs)(`div`,{className:`w-full`,children:[(0,J.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,J.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[10px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:e.delegation?.role===`worker`?`Worker session`:e.delegation?.role===`root`?`Parent session`:`Task session`}),(0,J.jsx)(Nt,{run:e}),(0,J.jsxs)(Ge,{dot:i.tone,pulse:i.pulse,children:[i.label,x===void 0?``:` #${x}`]}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[(0,J.jsx)(E,{variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":g?`Hide run details`:`Show run details`,"aria-controls":p,"aria-expanded":g,onClick:_,children:(0,J.jsx)(S,{"aria-hidden":`true`,className:L(`transition-transform motion-reduce:transition-none`,g&&`rotate-180`)})}),t!==`session`&&a.archive?(0,J.jsx)(ct,{run:e}):null,(0,J.jsx)(Lt,{run:e,actions:d,finishPromoted:o,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)})]})]}),(0,J.jsx)(`div`,{id:p,"data-slot":`run-details`,className:L(g?`block`:`hidden`,`md:block`),children:(0,J.jsx)(Pt,{run:e,showTokens:b.tokens,showCost:b.cost,automationsAvailable:y.data?.capabilities?.automations===!0})}),(0,J.jsx)(Ft,{run:e}),(0,J.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:[&>a]:min-h-11`,children:[(0,J.jsx)(K,{to:`/tasks/${e.id}`,active:t===`session`,children:`Session`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/changes`,active:t===`changes`,children:`Changes`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/commits`,active:t===`commits`,children:`Commits`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/files`,active:t===`files`,children:`Files`})]}),t===`session`?null:(0,J.jsx)(ft,{run:e}),t!==`session`&&e.steps.length>0?(0,J.jsx)(`div`,{className:`border-t border-border pt-1 pb-0 md:pt-2 md:pb-1`,children:(0,J.jsx)(Ot,{runId:e.id,steps:e.steps})}):null,s?(0,J.jsx)(zt,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,J.jsx)(Q,{run:e,canResume:W(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,J.jsx)(Rt,{run:e,actions:d})]})}function Q({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let a=fe(),o=y(),s=b({mutationFn:t=>v(e.id,t),onError:e=>N(e.message,{tone:`danger`})}),c=se(o.data),l=e=>!o.isSuccess||c.includes(e??`claude`),u=t&&l(ze(e)),d=e.worktreePath?(a.data?.targets??[]).filter(e=>{let t=Ke(e.id);return t===void 0||l(t)}).map(t=>({target:t,...Re(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];if(!u&&d.length===0)return null;let f=()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>N(`Worktree path copied`)).catch(()=>N(`Path: ${t}`))};if(r)return(0,J.jsx)(z,{onSelect:r,children:`Open in…`});let p=Be(e);return(0,J.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,J.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,J.jsx)(F,{})})]}),e.worktreePath?(0,J.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,J.jsxs)(`div`,{className:`task-open-targets mt-4 flex flex-wrap gap-3`,children:[u?(0,J.jsxs)(E,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,J.jsx)(Xe,{}),`Terminal (resume session)`]}):null,d.map(({target:e,suffix:t,title:n})=>{let r=Le(e);return(0,J.jsxs)(E,{variant:`outline`,"data-target":e.id,title:n,disabled:s.isPending,onClick:()=>s.mutate(e.id),children:[(0,J.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,J.jsxs)(E,{variant:`outline`,onClick:f,children:[(0,J.jsx)(O,{}),`Copy worktree path`]}):null]}),p?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-border pt-5`,children:[(0,J.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,J.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:p}),(0,J.jsxs)(E,{variant:`outline`,onClick:()=>void $(p,`Command copied to clipboard.`),children:[(0,J.jsx)(O,{}),`Copy resume command`]})]}):null]})}function Mt(e,t){let n=r(),i=qe(),[a,o]=(0,q.useState)(null),s=()=>n.invalidateQueries({queryKey:D.runs.all}),c=e=>N(e.message,{tone:`danger`}),l=kt(e.id),u=p(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},f=pe();return{finish:l,pin:d,markUnread:{isPending:f.isPending,mutate:()=>{t?.(),f.mutate(e.id,{onError:c})}},delete:b({mutationFn:()=>Ce(e.id),onSuccess:()=>{s(),i(`/`)},onError:c}),terminal:b({mutationFn:()=>we(e.id),onError:e=>{if(e instanceof ge&&e.command){$(e.command,`No terminal found — command copied to clipboard.`);return}c(e)}}),confirming:a,setConfirming:o}}async function $(e,t){try{await navigator.clipboard.writeText(e),N(t)}catch{N(`Run manually: ${e}`)}}function Nt({run:e}){let t=d(e.id),n=l(e),r=We(n,e=>t.mutate({title:e},{onError:e=>N(e.message,{tone:`danger`})}));return r.editing?(0,J.jsx)(Ue,{editor:r,className:`flex-1 text-[15px] font-semibold`}):(0,J.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,J.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:n}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:r.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,J.jsx)(Pe,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Pt({run:e,showTokens:t,showCost:n,automationsAvailable:r}){let a=m(),o=ee(),s=(0,q.useMemo)(()=>u(e,a),[e,a]),c=(0,q.useMemo)(()=>o===void 0?[]:s.map(e=>({projectId:o,kind:e.kind,number:e.number})),[s,o]),d=[(0,J.jsx)(`span`,{className:`max-md:max-w-full max-md:break-all`,children:Te(e)},`workflow`)];e.branch&&d.push((0,J.jsx)(`span`,{"data-slot":`branch-chip`,className:`rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium max-md:max-w-full max-md:break-all`,children:e.branch},`branch`));let p=s.filter(e=>e.kind===`PR`);for(let t of p)d.push((0,J.jsx)(U,{reference:t,taskTitle:l(e),className:`h-5`,conflictAction:(0,J.jsx)(Ve,{run:e,prNumber:t.number})},`pr-${t.number}`));let g=i(e);g&&I(g)&&!p.some(e=>e.url===g)&&d.push((0,J.jsx)(U,{reference:{kind:`PR`,url:g},taskTitle:l(e),className:`h-5`},`pr`));let _=h(e,a);if(_&&I(_)){let t=f(_);d.push((0,J.jsx)(U,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:_},taskTitle:l(e),className:`h-5`},`issue`))}e.diffStat&&d.push((0,J.jsx)(Qe,{stat:e.diffStat},`diff`)),e.automation&&d.push(r?(0,J.jsx)(G,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,J.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`));let v=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&v.push((0,J.jsx)($e,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&v.push((0,J.jsx)(`span`,{className:`tabular-nums`,children:me(e.costUsd)},`cost`)),(0,J.jsx)(Fe,{projectId:o,requests:c,children:(0,J.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[d.map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0?(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 max-md:min-w-0 max-md:max-w-full`,children:[v.map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0?(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,J.jsx)(It,{run:e})]})]})})}function Ft({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,J.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Automatic checks paused — 40/40 reached`});let t=e.monitoringWakeAt?new Date(e.monitoringWakeAt):null,n=t&&Number.isFinite(t.getTime())?t:null;if(!n)return(0,J.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Parked — no automatic check scheduled`});let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n);return(0,J.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,J.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function It({run:e}){let t=ce(),n=be(),{accounts:r}=Me(),i=e.runner??t.data?.defaultRunner??`claude`,a=e.model??`auto`,s=e.effort||void 0,c=[...e.steps].reverse().find(e=>e.profileId),l=c?.profileId,u=c?.backend??i,d=n.data?.profiles.find(e=>e.id===l),f=l===void 0||n.isPending?void 0:n.isError?l:d?Ne(r,u)?l==="default"?`default`:d.label:void 0:`${l} (removed)`,p=e.modelIdentity&&e.modelIdentity!==a?e.modelIdentity:void 0,m=[i,f,a,s].filter(Boolean).join(` · `);return(0,J.jsxs)(Oe,{children:[(0,J.jsx)(B,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:m,"aria-label":`Agent: ${i}, ${f?`account ${f}, `:``}model ${a}${s?`, effort ${s}`:``}`,className:`flex min-w-0 shrink items-center max-md:min-h-11 gap-1.5 rounded-sm px-1 py-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,J.jsx)(o,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{"data-slot":`agent-badge-summary`,className:`truncate font-mono text-[11px]`,children:m})]})}),(0,J.jsxs)(V,{align:`end`,className:`min-w-[9rem] max-md:max-w-[calc(100vw-2rem)] max-md:break-all`,children:[(0,J.jsxs)(R,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,i]}),f?(0,J.jsxs)(R,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,f]}):null,(0,J.jsxs)(R,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,a]}),s?(0,J.jsxs)(R,{"data-slot":`agent-badge-effort`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`effort: `,s]}):null,p?(0,J.jsxs)(R,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,p]}):null]})]})}function Lt({run:e,actions:t,finishPromoted:n,onToggleNotes:r,onOpenChooser:i}){let o=W(e),c=Be(e);return(0,J.jsxs)(Oe,{children:[(0,J.jsx)(B,{asChild:!0,children:(0,J.jsx)(E,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,J.jsx)(ve,{"aria-hidden":`true`})})}),(0,J.jsxs)(V,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,J.jsx)(R,{className:`px-2 py-3 text-[10px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,J.jsxs)(z,{onSelect:r,children:[(0,J.jsx)(nt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,J.jsx)(Q,{run:e,canResume:o.terminal,onResume:()=>t.terminal.mutate(),onOpen:i}),c?(0,J.jsxs)(z,{onSelect:()=>void $(c,`Command copied to clipboard.`),children:[(0,J.jsx)(O,{"aria-hidden":`true`}),` Copy resume command`]}):null,o.finish&&!n?(0,J.jsxs)(z,{disabled:t.finish.isPending,onSelect:()=>t.setConfirming(`finish`),children:[(0,J.jsx)(re,{"aria-hidden":`true`}),` Finish`]}):null,o.markUnread?(0,J.jsxs)(z,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,J.jsx)(rt,{"aria-hidden":`true`}),` Mark unread`]}):null,o.pin?(0,J.jsxs)(De,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,J.jsx)(it,{"aria-hidden":`true`}):(0,J.jsx)(a,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,o.deleteRun?(0,J.jsx)(Ee,{}):null,o.deleteRun?(0,J.jsxs)(z,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,J.jsx)(s,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function Rt({run:e,actions:t}){let n=t.confirming,r=(0,q.useRef)(n);n!==null&&(r.current=n);let i=n??r.current,a=i===`finish`?`Finish task?`:`Delete task permanently?`,o=i===`finish`?`Review and finish`:`Delete task`;return(0,J.jsx)(P,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,J.jsxs)(ue,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(M,{children:[(0,J.jsx)(ae,{className:i===`delete`?`text-danger`:void 0,children:a}),(0,J.jsx)(C,{children:(0,J.jsxs)(J.Fragment,{children:[i===`finish`?`Finish “`:`Delete “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),i===`finish`?`”. Continue through the existing change-review gate before finalizing.`:`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(j,{children:`Cancel`}),(0,J.jsx)(he,{className:i===`delete`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:()=>{i===`finish`?t.finish.mutate():t.delete.mutate(),t.setConfirming(null)},children:o})]})]})})}function zt({runId:e,onClose:t}){let n=de(e);return(0,J.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,J.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,J.jsx)(F,{})})]}),n.isPending?(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,J.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,J.jsx)(Ze,{children:n.data}):(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,J.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,J.jsx)(E,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void $(n.data??``,`Notes copied`),children:`Copy notes`}),(0,J.jsx)(E,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Z as a,ut as c,nt as d,Tt as i,lt as l,kt as n,ht as o,Ct as r,pt as s,jt as t,ct as u};