@wjarka/cezarion 0.14.9-dev.941 → 0.14.9-dev.942

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.
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Ai as i,Ba as a,Cr as o,G as s,Ga as c,H as l,It as u,Jt as d,Oi as f,Qt as p,Ra as m,Rt as h,Ut as g,X as _,Xt as v,Y as y,Yt as b,Zi as x,a as ee,br as S,c as C,ct as te,d as w,ea as T,gr as ne,i as E,in as re,it as ie,l as D,o as O,ot as ae,r as oe,s as k,st as se,t as ce,tn as le,u as A,ui as ue,ya as j}from"./centered-state-kOb8j_BL.js";import{t as M}from"./utils-BW1-Ibnd.js";import{i as N,l as de,r as P,t as fe}from"./dropdown-menu-78Ug-7x2.js";import{i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./textarea-D2Gx4GDI.js";import{i as ye,l as be,s as xe}from"./skills-DFBiAuJG.js";import{h as Se,i as Ce}from"./index-D-m3edXI.js";import{n as we}from"./skill-empty-hint-oOtzR3v0.js";var F=e(n()),I=e(t());function Te(){var e=[...arguments];return(0,I.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var L=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function R(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ee(e){return`nodeType`in e}function z(e){return e?R(e)?e:Ee(e)?e.ownerDocument?.defaultView??window:window:window}function B(e){let{Document:t}=z(e);return e instanceof t}function V(e){return!R(e)&&e instanceof z(e).HTMLElement}function De(e){return e instanceof z(e).SVGElement}function Oe(e){return e?R(e)?e.document:Ee(e)?B(e)?e:V(e)||De(e)?e.ownerDocument:document:document:document}var H=L?I.useLayoutEffect:I.useEffect;function ke(e){let t=(0,I.useRef)(e);return H(()=>{t.current=e}),(0,I.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ae(){let e=(0,I.useRef)(null);return[(0,I.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,I.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function U(e,t){t===void 0&&(t=[e]);let n=(0,I.useRef)(e);return H(()=>{n.current!==e&&(n.current=e)},t),n}function je(e,t){let n=(0,I.useRef)();return(0,I.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Me(e){let t=ke(e),n=(0,I.useRef)(null);return[n,(0,I.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ne(e){let t=(0,I.useRef)();return(0,I.useEffect)(()=>{t.current=e},[e]),t.current}var Pe={};function Fe(e,t){return(0,I.useMemo)(()=>{if(t)return t;let n=Pe[e]==null?0:Pe[e]+1;return Pe[e]=n,e+`-`+n},[e,t])}function Ie(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var W=Ie(1),Le=Ie(-1);function Re(e){return`clientX`in e&&`clientY`in e}function ze(e){if(!e)return!1;let{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function Be(e){if(!e)return!1;let{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ve(e){if(Be(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Re(e)?{x:e.clientX,y:e.clientY}:null}var G=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[G.Translate.toString(e),G.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),He=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ue(e){return e.matches(He)?e:e.querySelector(He)}var K={display:`none`};function We(e){let{id:t,value:n}=e;return I.createElement(`div`,{id:t,style:K},n)}function Ge(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return I.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Ke(){let[e,t]=(0,I.useState)(``);return{announce:(0,I.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var qe=(0,I.createContext)(null);function Je(e){let t=(0,I.useContext)(qe);(0,I.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ye(){let[e]=(0,I.useState)(()=>new Set),t=(0,I.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,I.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Xe={draggable:`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Ai as i,Ba as a,Cr as o,G as s,Ga as c,H as l,It as u,Jt as d,Oi as f,Qt as p,Ra as m,Rt as h,Ut as g,X as _,Xt as v,Y as y,Yt as b,Zi as x,a as ee,br as S,c as C,ct as te,d as w,ea as T,gr as ne,i as E,in as re,it as ie,l as D,o as O,ot as ae,r as oe,s as k,st as se,t as ce,tn as le,u as A,ui as ue,ya as j}from"./centered-state-kOb8j_BL.js";import{t as M}from"./utils-BW1-Ibnd.js";import{i as N,l as de,r as P,t as fe}from"./dropdown-menu-78Ug-7x2.js";import{i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./textarea-D2Gx4GDI.js";import{i as ye,l as be,s as xe}from"./skills-DFBiAuJG.js";import{h as Se,i as Ce}from"./index-BZB0C-In.js";import{n as we}from"./skill-empty-hint-oOtzR3v0.js";var F=e(n()),I=e(t());function Te(){var e=[...arguments];return(0,I.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var L=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function R(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ee(e){return`nodeType`in e}function z(e){return e?R(e)?e:Ee(e)?e.ownerDocument?.defaultView??window:window:window}function B(e){let{Document:t}=z(e);return e instanceof t}function V(e){return!R(e)&&e instanceof z(e).HTMLElement}function De(e){return e instanceof z(e).SVGElement}function Oe(e){return e?R(e)?e.document:Ee(e)?B(e)?e:V(e)||De(e)?e.ownerDocument:document:document:document}var H=L?I.useLayoutEffect:I.useEffect;function ke(e){let t=(0,I.useRef)(e);return H(()=>{t.current=e}),(0,I.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ae(){let e=(0,I.useRef)(null);return[(0,I.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,I.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function U(e,t){t===void 0&&(t=[e]);let n=(0,I.useRef)(e);return H(()=>{n.current!==e&&(n.current=e)},t),n}function je(e,t){let n=(0,I.useRef)();return(0,I.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Me(e){let t=ke(e),n=(0,I.useRef)(null);return[n,(0,I.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ne(e){let t=(0,I.useRef)();return(0,I.useEffect)(()=>{t.current=e},[e]),t.current}var Pe={};function Fe(e,t){return(0,I.useMemo)(()=>{if(t)return t;let n=Pe[e]==null?0:Pe[e]+1;return Pe[e]=n,e+`-`+n},[e,t])}function Ie(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var W=Ie(1),Le=Ie(-1);function Re(e){return`clientX`in e&&`clientY`in e}function ze(e){if(!e)return!1;let{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function Be(e){if(!e)return!1;let{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ve(e){if(Be(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Re(e)?{x:e.clientX,y:e.clientY}:null}var G=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[G.Translate.toString(e),G.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),He=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ue(e){return e.matches(He)?e:e.querySelector(He)}var K={display:`none`};function We(e){let{id:t,value:n}=e;return I.createElement(`div`,{id:t,style:K},n)}function Ge(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return I.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Ke(){let[e,t]=(0,I.useState)(``);return{announce:(0,I.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var qe=(0,I.createContext)(null);function Je(e){let t=(0,I.useContext)(qe);(0,I.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ye(){let[e]=(0,I.useState)(()=>new Set),t=(0,I.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,I.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Xe={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -47,7 +47,7 @@
47
47
  }
48
48
  })()
49
49
  </script>
50
- <script type="module" crossorigin src="/assets/index-D-m3edXI.js"></script>
50
+ <script type="module" crossorigin src="/assets/index-BZB0C-In.js"></script>
51
51
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
52
52
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
53
53
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
@@ -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{$r as r,Ba as i,Br as a,Dn as o,Fa as s,Fn as c,Fr as l,Ft as u,Ga as d,Gn as f,Gr as p,Hn as m,In as h,J as g,Jt as _,K as ee,Ln as v,Mn as y,Nn as b,Q as te,Rn as ne,Rr as re,Ur as ie,V as ae,Vn as oe,Vr as se,X as x,Xi as ce,Yi as le,Zr as ue,a as de,c as S,cr as fe,d as C,et as pe,fr as w,gt as me,hi as he,i as ge,ii as _e,in as ve,it as T,ki as ye,l as be,lr as E,mn as xe,nr as Se,nt as Ce,o as D,r as O,ri as we,s as Te,st as Ee,tn as De,tt as Oe,u as k,ui as ke,un as Ae,wa as je,ya as A}from"./centered-state-kOb8j_BL.js";import{n as j,t as M}from"./utils-BW1-Ibnd.js";import{a as N,c as Me,i as P,l as F,n as Ne,r as I,t as L}from"./dropdown-menu-78Ug-7x2.js";import{n as Pe,r as Fe,t as Ie}from"./collapsible-KSKVv9J9.js";import{n as Le,t as Re}from"./agent-accounts-Bh1l3ZSb.js";import{a as ze,i as Be,n as Ve,o as He,r as Ue,s as We,t as Ge}from"./textarea-D2Gx4GDI.js";import{t as R}from"./createLucideIcon-BHp8sXmF.js";import{A as Ke,C as z,P as qe,_ as B,a as Je,b as Ye,i as V,j as Xe,l as Ze,n as Qe,p as $e,r as et,t as tt,v as H,w as nt,x as rt}from"./pill-0JHCf1v8.js";import{c as it,s as U,t as W,u as at}from"./project-router-CS_oeLqi.js";import{t as ot}from"./message-square-B-MD-8rD.js";import{t as st}from"./square-terminal-B6RYYieR.js";import{n as ct,t as lt}from"./markdown-DlvW2wEx.js";import{t as ut}from"./diff-stat-C3Id3W_C.js";import{n as dt,t as ft}from"./token-metrics-BQvw6Yoj.js";import{t as G}from"./tab-link-D6eAdJez.js";import{t as pt}from"./use-desktop-BaYgO7YW.js";var mt=R(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),ht=R(`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`}]]),gt=R(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),_t=R(`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`}]]),vt=R(`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`}]]),K=R(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),q=e(t(),1),J=n();function yt(e){let t=d();return i({mutationFn:t=>he(e,t),onSuccess:()=>t.invalidateQueries({queryKey:ve.runs.all}),onError:e=>A(e.message,{tone:`danger`})})}function bt(e){return e.archived?`Unarchive`:`Archive task`}function xt({run:e,open:t,onOpenChange:n,onConfirm:i}){return(0,J.jsx)(O,{open:t,onOpenChange:n,children:(0,J.jsxs)(D,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(be,{children:[(0,J.jsx)(k,{children:`Archive task?`}),(0,J.jsxs)(Te,{children:[`Move “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:r(e),children:r(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,J.jsxs)(S,{children:[(0,J.jsx)(de,{children:`Cancel`}),(0,J.jsx)(ge,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:i,children:`Archive task`})]})]})})}function St({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,q.useState)(!1),a=yt(e.id),o=bt(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(C,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:M(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,J.jsx)(qe,{"aria-hidden":`true`}):(0,J.jsx)(ae,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:M(n&&`max-md:sr-only`),children:o})]}),(0,J.jsx)(xt,{run:e,open:r,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function Ct({run:e}){let t=U(),n=oe(),r=b(e.id),[i,a]=(0,q.useState)(null),o=(n.data?.projects?.find(e=>e.id===(t??n.data?.bootProject)))?.webhook?.url,s=e.notify===!0;return!o&&!s?null:(0,J.jsxs)(J.Fragment,{children:[s?(0,J.jsxs)(L,{children:[(0,J.jsx)(F,{asChild:!0,children:(0,J.jsxs)(C,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":o?`Notifying ${V(o)} — webhook actions`:`Notifying — webhook actions`,children:[(0,J.jsx)(Ke,{tone:`success`}),(0,J.jsx)(`span`,{children:`Notifying`}),(0,J.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,J.jsxs)(I,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[o?(0,J.jsx)(N,{className:`truncate px-2 py-1.5 font-mono text-[11px] font-normal text-muted-foreground`,children:V(o)}):null,o?(0,J.jsxs)(P,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,J.jsx)(ot,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,J.jsxs)(P,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>A(`Stopped notifying the webhook`),onError:e=>A(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,J.jsx)(mt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,J.jsxs)(C,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,J.jsx)(K,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),o?(0,J.jsx)(wt,{mode:i,url:o,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),A(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>A(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function wt({mode:e,url:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,q.useId)(),o=(0,q.useId)(),[s,c]=(0,q.useState)(``);(0,q.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=V(t);return(0,J.jsx)(Ve,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,J.jsx)(Ue,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,J.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,J.jsxs)(He,{className:`text-left`,children:[(0,J.jsx)(We,{children:l?`Send a note to the webhook`:`Hand off to webhook`}),(0,J.jsx)(Be,{children:l?`The bot at ${u} gets this note with the task's current status.`:`The bot at ${u} will start receiving this task's status updates. Add a note for it (optional).`})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,J.jsx)(Ge,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,J.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,J.jsx)(gt,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,J.jsxs)(ze,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,J.jsxs)(C,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,J.jsx)(K,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Tt({runId:e,children:t}){let n=s(),r=(0,q.useMemo)(()=>({runId:e}),[e]);return n?(0,J.jsx)(Et,{runId:e,children:t}):(0,J.jsx)(ct.Provider,{value:r,children:t})}function Et({runId:e,children:t}){let n=U(),r=(0,q.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,J.jsx)(ct.Provider,{value:r,children:t})}function Dt(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function Ot({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-[14px] font-semibold text-foreground`,children:n}),(0,J.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}),(0,J.jsx)(x,{"aria-hidden":!0,className:M(`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 kt=`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 At({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 jt(e){let t=e.delegation,n=t!==void 0&&t.role!==`invalid`,r=E(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=E(e.id),n=pt(),[i,a]=(0,q.useState)(null),o=n||i===e.id,s=(0,q.useId)(),c=w(),l=e.delegation,u=l?.role===`worker`?l.parentRunId:t.data?.parentRunId,d=new Map(t.data?.workers.map(e=>[e.workerId,e])),f=Y(l,t.data),p=l&&l.role!==`invalid`?l.wait:void 0,m=we(l);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":o,"aria-controls":s,onClick:()=>a(i===e.id?null:e.id),children:[(0,J.jsx)(me,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),l?.role===`worker`?`Worker session`:`Parent`,(0,J.jsx)(g,{"aria-hidden":`true`,className:`ml-1 size-4`}),l?.role===`worker`?`Parent & workers`:f.length>0?`Workers ${f.length}`:t.isSuccess?`Workers 0`:t.isError?`Workers unavailable`:`Workers…`,(0,J.jsx)(x,{"aria-hidden":`true`,className:`ml-auto size-4 ${o?`rotate-180`:``}`})]}),l?.role===`worker`&&l.destroy?(0,J.jsx)(X,{state:l.destroy}):null,p?(0,J.jsx)(Rt,{wait:p,dependencyLabel:m}):null,(0,J.jsxs)(`div`,{id:s,hidden:!o,children:[u?(0,J.jsx)(zt,{id:u}):null,f.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-1 overflow-y-auto`,children:f.map(e=>{let n=d.get(e),i=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)(W,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:kt,children:i?r(i):`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)})}):l?.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)(C,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry relationships`})]}):null]})]})}function Nt({run:e,open:t,onToggle:n}){let i=E(e.id),a=w(),o=pt(),s=e.delegation,c=s?.role===`worker`?s.parentRunId:i.data?.parentRunId,l=new Map(i.data?.workers.map(e=>[e.workerId,e])),u=Y(s,i.data),d=s&&s.role!==`invalid`?s.wait:void 0,f=we(s);return(0,J.jsx)(Ot,{slot:`workers`,icon:(0,J.jsx)(me,{className:`size-4`}),title:`Workers`,meta:Pt({ids:u,workers:l,parentId:c,desktop:o,query:i}),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:[s?.role===`worker`&&s.destroy?(0,J.jsx)(X,{state:s.destroy}):null,d?(0,J.jsx)(Rt,{wait:d,dependencyLabel:f}):null,c?(0,J.jsx)(zt,{id:c}):null,u.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:u.map(e=>{let t=l.get(e),n=a.data?.find(t=>t.id===e),o=t?It(t.status):i.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)(W,{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)(Ft,{status:t?.status}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n?r(n):`Worker ${e.slice(0,8)}`}),(0,J.jsx)(`span`,{className:M(`max-w-[45%] shrink-0 truncate text-xs`,Lt(t?.status)),children:o}),(0,J.jsx)(ee,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),t?.destroy?(0,J.jsx)(X,{state:t.destroy}):null]},e)})}):s?.role===`root`&&i.isSuccess?(0,J.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,i.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):i.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,i.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)(C,{variant:`outline`,className:`min-h-11`,onClick:()=>void i.refetch(),children:`Retry relationships`})]}):null]})})}function Pt({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 Ft({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,J.jsx)(te,{"aria-hidden":!0,className:M(t,`text-success`)}):e===`failed`?(0,J.jsx)(Ce,{"aria-hidden":!0,className:M(t,`text-danger`)}):e===`cancelled`?(0,J.jsx)(Oe,{"aria-hidden":!0,className:M(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,J.jsx)(at,{role:`status`,"aria-label":`Worker running`,className:M(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,J.jsx)(pe,{"aria-hidden":!0,className:M(t,`text-soft-foreground`)})}function It(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function Lt(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function Rt({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 zt({id:e}){let t=Se(e);return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,className:kt,children:t.data?`Parent · ${r(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)(C,{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 Bt(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 Q({steps:e}){if(e.length===0)return null;let t=Bt(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)(Vt,{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-[11px] 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 Vt({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,J.jsx)(te,{"aria-hidden":!0,className:M(t,`text-success`)});case`active`:return(0,J.jsx)(at,{role:`status`,"aria-label":`Step running`,className:M(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,J.jsx)(Ce,{"aria-hidden":!0,className:M(t,`text-danger`)});case`pending`:return(0,J.jsx)(pe,{"aria-hidden":!0,className:M(t,`text-soft-foreground`)})}}function Ht(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 Ut({visual:e}){return(0,J.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:M(`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 Wt=new Map;function Gt({runId:e,steps:t}){let[n,r]=(0,q.useState)(()=>Wt.get(e)??!1);if(t.length===0)return null;let i=t=>{Wt.set(e,t),r(t)},a=Ht(t),o=t[a],s=Bt(t)*100;return(0,J.jsxs)(Ie,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,J.jsxs)(Fe,{"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)(Ut,{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)(x,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,J.jsx)(Pe,{children:(0,J.jsx)(`div`,{className:`pt-2`,children:(0,J.jsx)(Q,{steps:t})})})]})}var Kt=new Map;function qt({run:e,tab:t=`session`,hasPendingHumanAsk:n=!1,onMarkedUnread:r}){let i=_e(e,n),a=H(e),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),d=Yt(e,r),[,f]=(0,q.useReducer)(e=>e+1,0),p=(0,q.useId)(),m=U(),h=JSON.stringify([m,e.id]),g=Kt.get(h)??!1,_=()=>{Kt.set(h,!g),f()},ee=w(),v=o(),y=ft(v.data),b=e.status===`queued`?ue(ee.data??[]).get(e.id):void 0;return(0,J.jsxs)(`header`,{"data-slot":`run-header`,className:M(`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-[12px] 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)(Xt,{run:e}),(0,J.jsxs)(tt,{dot:i.tone,pulse:i.pulse,children:[i.label,b===void 0?``:` #${b}`]}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[(0,J.jsx)(C,{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)(x,{"aria-hidden":`true`,className:M(`transition-transform motion-reduce:transition-none`,g&&`rotate-180`)})}),t!==`session`&&a.archive?(0,J.jsx)(St,{run:e}):null,(0,J.jsx)(Ct,{run:e}),(0,J.jsx)(nn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)})]})]}),(0,J.jsx)(`div`,{id:p,"data-slot":`run-details`,className:M(g?`block`:`hidden`,`md:block`),children:(0,J.jsx)(Zt,{run:e,showTokens:y.tokens,showCost:y.cost,automationsAvailable:v.data?.capabilities?.automations===!0})}),(0,J.jsx)($t,{run:e}),(0,J.jsx)(en,{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)(G,{to:`/tasks/${e.id}`,active:t===`session`,children:`Session`}),(0,J.jsx)(G,{to:`/tasks/${e.id}/changes`,active:t===`changes`,children:`Changes`}),(0,J.jsx)(G,{to:`/tasks/${e.id}/commits`,active:t===`commits`,children:`Commits`}),(0,J.jsx)(G,{to:`/tasks/${e.id}/files`,active:t===`files`,children:`Files`})]}),t===`session`?null:(0,J.jsx)(At,{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)(Gt,{runId:e.id,steps:e.steps})}):null,s?(0,J.jsx)(an,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,J.jsx)(Jt,{run:e,canResume:H(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,J.jsx)(rn,{run:e,actions:d})]})}function Jt({run:e,canResume:t,onResume:n,onOpen:r,onClose:a}){let o=c(),s=m(),l=i({mutationFn:t=>le(e.id,t),onError:e=>A(e.message,{tone:`danger`})}),u=je(s.data),d=e=>!s.isSuccess||u.includes(e??`claude`),f=t&&d($e(e)),p=e.worktreePath?(o.data?.targets??[]).filter(e=>{let t=Ye(e.id);return t===void 0||d(t)}).map(t=>({target:t,...Ze(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];if(!f&&p.length===0)return null;let h=()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>A(`Worktree path copied`)).catch(()=>A(`Path: ${t}`))};if(r)return(0,J.jsx)(P,{onSelect:r,children:`Open in…`});let g=B(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)(C,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:a,children:(0,J.jsx)(De,{})})]}),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:[f?(0,J.jsxs)(C,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,J.jsx)(st,{}),`Terminal (resume session)`]}):null,p.map(({target:e,suffix:t,title:n})=>{let r=rt(e);return(0,J.jsxs)(C,{variant:`outline`,"data-target":e.id,title:n,disabled:l.isPending,onClick:()=>l.mutate(e.id),children:[(0,J.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,J.jsxs)(C,{variant:`outline`,onClick:h,children:[(0,J.jsx)(T,{}),`Copy worktree path`]}):null]}),g?(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:g}),(0,J.jsxs)(C,{variant:`outline`,onClick:()=>void $(g,`Command copied to clipboard.`),children:[(0,J.jsx)(T,{}),`Copy resume command`]})]}):null]})}function Yt(e,t){let n=d(),r=it(),[a,o]=(0,q.useState)(null),s=()=>n.invalidateQueries({queryKey:ve.runs.all}),c=e=>A(e.message,{tone:`danger`}),l=v(),u={isPending:l.isPending,mutate:()=>l.mutate({id:e.id,pinned:!e.pinned})},f=y();return{pin:u,markUnread:{isPending:f.isPending,mutate:()=>{t?.(),f.mutate(e.id,{onError:c})}},delete:i({mutationFn:()=>ye(e.id),onSuccess:()=>{s(),r(`/`)},onError:c}),terminal:i({mutationFn:()=>ce(e.id),onError:e=>{if(e instanceof ke&&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),A(t)}catch{A(`Run manually: ${e}`)}}function Xt({run:e}){let t=h(e.id),n=r(e),i=et(n,e=>t.mutate({title:e},{onError:e=>A(e.message,{tone:`danger`})}));return i.editing?(0,J.jsx)(Qe,{editor:i,className:`flex-1 text-[16px] 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:i.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)(Xe,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Zt({run:e,showTokens:t,showCost:n,automationsAvailable:i}){let o=ne(),s=f(),c=(0,q.useMemo)(()=>ie(e,o),[e,o]),u=(0,q.useMemo)(()=>s===void 0?[]:c.map(e=>({projectId:s,kind:e.kind,number:e.number})),[c,s]),d=[(0,J.jsx)(`span`,{className:`min-w-0 max-w-full break-all`,children:p(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 m=c.filter(e=>e.kind===`PR`);for(let t of m)d.push((0,J.jsx)(z,{reference:t,taskTitle:r(e),className:`h-5`,conflictAction:(0,J.jsx)(Je,{run:e,prNumber:t.number})},`pr-${t.number}`));let h=se(e);h&&j(h)&&!m.some(e=>e.url===h)&&d.push((0,J.jsx)(z,{reference:{kind:`PR`,url:h},taskTitle:r(e),className:`h-5`},`pr`));let g=a(e,o);if(g&&j(g)){let t=re(g);d.push((0,J.jsx)(z,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:g},taskTitle:r(e),className:`h-5`},`issue`))}e.diffStat&&d.push((0,J.jsx)(ut,{stat:e.diffStat},`diff`)),e.automation&&d.push(i?(0,J.jsx)(W,{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 _=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&_.push((0,J.jsx)(dt,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd!==void 0&&_.push((0,J.jsx)(`span`,{className:`tabular-nums`,children:l(e.costUsd)},`cost`)),(0,J.jsx)(nt,{projectId:s,requests:u,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 min-w-0 max-w-full items-center gap-1.5`,children:[_.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)(tn,{run:e})]})]})})}function Qt(e){let t=e.ciWait;return[`running`,`queued`,`waiting`].includes(e.status)&&t&&t.phase!==`delivered`&&t.phase!==`withdrawn`?t:void 0}function $t({run:e}){let t=Qt(e),n=t??e.lastCiWait;if(!t&&e.lastCiWaitError)return(0,J.jsx)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mt-1 min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.lastCiWaitError});if(!n)return null;let r=n.result,i={passed:`CI checks passed — observed checks only; not merge approval`,failed:`CI checks failed — inspect the PR checks`,cancelled:`CI wait cancelled`,skipped:`CI checks skipped — inspect the PR checks`,no_checks:`No CI checks found — inspect the PR workflows`,deadline:`CI wait timed out — inspect the PR checks`,error:`CI wait unavailable — inspect access and the PR checks`,head_changed:`CI head changed — ${r?.headSha.slice(0,7)} → ${r?.observedHeadSha?.slice(0,7)??`unknown`}`},a=t?n.phase===`wake-pending`?e.status!==`running`||e.activity===`monitoring`?`CI result ready — waiting for capacity`:`CI result ready — current turn still working`:`Waiting for CI`:r?i[r.outcome]:n.phase===`withdrawn`?`CI wait cancelled`:`CI wait unavailable`,o=t?n.deadline:r?.observedAt,s=o?new Date(o):void 0,c=s&&Number.isFinite(s.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(s):void 0,l=`${n.repository}#${n.prNumber}`;return(0,J.jsxs)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mt-1 min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1`,children:[(0,J.jsx)(`span`,{children:a}),(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`—`}),j(n.prUrl)?(0,J.jsx)(`a`,{href:n.prUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-11 min-w-11 max-w-full items-center rounded-sm px-1 font-medium text-foreground underline underline-offset-2 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:l}):(0,J.jsx)(`span`,{children:l})]}),c?(0,J.jsxs)(`p`,{children:[t?`Deadline`:`Observed`,` `,(0,J.jsx)(`time`,{dateTime:o,children:c})]}):t?(0,J.jsx)(`p`,{children:`CI deadline unavailable`}):null]})}function en({run:e}){if(Qt(e)||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 tn({run:e}){let t=xe(),n=Ae(),{accounts:r}=Le(),i=e.runner??t.data?.defaultRunner??`claude`,a=e.model??`auto`,o=e.effort||`auto`,s=[...e.steps].reverse().find(e=>e.profileId),c=s?.profileId,l=s?.backend??i,u=n.data?.profiles.find(e=>e.id===c&&e.provider===l),d=c===void 0||n.isPending?void 0:n.isError?c:c==="default"?Re(r,l)?`default`:void 0:u?Re(r,l)?u.label:void 0:`${c} (removed)`,f=e.modelIdentity&&e.modelIdentity!==a?e.modelIdentity:void 0,p=[i,d,a,o].filter(Boolean).join(` · `);return(0,J.jsxs)(L,{children:[(0,J.jsx)(F,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:p,"aria-label":`Agent: ${i}, ${d?`account ${d}, `:``}model ${a}${o?`, effort ${o}`:``}`,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)(g,{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:p})]})}),(0,J.jsxs)(I,{align:`end`,className:`min-w-[9rem] max-md:max-w-[calc(100vw-2rem)] max-md:break-all`,children:[(0,J.jsxs)(N,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,i]}),d?(0,J.jsxs)(N,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,d]}):null,(0,J.jsxs)(N,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,a]}),o?(0,J.jsxs)(N,{"data-slot":`agent-badge-effort`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`effort: `,o]}):null,f?(0,J.jsxs)(N,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,f]}):null]})]})}function nn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=H(e),a=B(e);return(0,J.jsxs)(L,{children:[(0,J.jsx)(F,{asChild:!0,children:(0,J.jsx)(C,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,J.jsx)(Ee,{"aria-hidden":`true`})})}),(0,J.jsxs)(I,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,J.jsx)(N,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,J.jsxs)(P,{onSelect:n,children:[(0,J.jsx)(ht,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,J.jsx)(Jt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,J.jsxs)(P,{onSelect:()=>void $(a,`Command copied to clipboard.`),children:[(0,J.jsx)(T,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,J.jsxs)(P,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,J.jsx)(_t,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,J.jsxs)(Ne,{"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)(vt,{"aria-hidden":`true`}):(0,J.jsx)(u,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,i.deleteRun?(0,J.jsx)(Me,{}):null,i.deleteRun?(0,J.jsxs)(P,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,J.jsx)(_,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function rn({run:e,actions:t}){let n=t.confirming;return(0,J.jsx)(O,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,J.jsxs)(D,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(be,{children:[(0,J.jsx)(k,{className:`text-danger`,children:`Delete task permanently?`}),(0,J.jsx)(Te,{children:(0,J.jsxs)(J.Fragment,{children:[`Delete “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:r(e),children:r(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,J.jsxs)(S,{children:[(0,J.jsx)(de,{children:`Cancel`}),(0,J.jsx)(ge,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function an({runId:e,onClose:t}){let n=fe(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)(C,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,J.jsx)(De,{})})]}),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)(Tt,{runId:e,children:(0,J.jsx)(lt,{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)(C,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void $(n.data??``,`Notes copied`),children:`Copy notes`}),(0,J.jsx)(C,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Nt as a,Dt as c,K as d,ht as f,Z as i,Tt as l,Q as n,jt as o,Ht as r,Ot as s,qt as t,St as u};