@wjarka/cezarion 0.18.0-dev.7909 → 0.18.0-dev.7917

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 (72) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/{accounts-section-C7qacMAX.js → accounts-section-BvrCdhB1.js} +1 -1
  3. package/web/dist/assets/activity-motion-CyQUo8rH.js +2 -0
  4. package/web/dist/assets/{activity-route-DkSc-BB_.js → activity-route-BZPRmiNI.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-DBqtxqrI.js → agent-config-section-DEeDIcK_.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-AHmatJKy.js → agent-defaults-section-RYnao4vB.js} +1 -1
  7. package/web/dist/assets/{appearance-Uyrw7pjm.js → appearance-obeD0TrH.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-w_cfxV6m.js → archive-on-merge-field-DP12N-QW.js} +1 -1
  9. package/web/dist/assets/attention-CSFsCoi5.js +1 -0
  10. package/web/dist/assets/automations-route-bJYe7JKX.js +1 -0
  11. package/web/dist/assets/{commit-diff-panel-Ba-6F5So.js → commit-diff-panel-yCI8kY--.js} +1 -1
  12. package/web/dist/assets/{diff-D3RVmX07.js → diff-B9wl20YA.js} +2 -2
  13. package/web/dist/assets/{diff-view-CYIMlq04.js → diff-view-C-HieogW.js} +1 -1
  14. package/web/dist/assets/{file-preview-jj3RWAaW.js → file-preview-BzialgZg.js} +1 -1
  15. package/web/dist/assets/{folder-browser-CH0gdxd-.js → folder-browser-B8_lzQT7.js} +1 -1
  16. package/web/dist/assets/{git-toolbar-BOaq9GcR.js → git-toolbar-lvqVHT9o.js} +1 -1
  17. package/web/dist/assets/{github-wkggyCqa.js → github-CQhVzG31.js} +1 -1
  18. package/web/dist/assets/{global-activity-route-BTrelHAD.js → global-activity-route-Cnk7K6kB.js} +1 -1
  19. package/web/dist/assets/index-D0DvUgTj.js +21 -0
  20. package/web/dist/assets/{label-D6DhdNb7.js → label-CYqEyapm.js} +1 -1
  21. package/web/dist/assets/{markdown-i80v6qNq.js → markdown-BLWEExIH.js} +1 -1
  22. package/web/dist/assets/{notifications-section-GGsdkedq.js → notifications-section-Ci4iCnOt.js} +1 -1
  23. package/web/dist/assets/{open-in-menu-DgScIVvr.js → open-in-menu-JhT-c8K6.js} +1 -1
  24. package/web/dist/assets/preview-pane-connected-COUwLzj1.js +3 -0
  25. package/web/dist/assets/{project-location-4UN0Eqf-.js → project-location-BMreyTgv.js} +1 -1
  26. package/web/dist/assets/{project-router-UyyzK1j2.js → project-router-DG3CwEiO.js} +1 -1
  27. package/web/dist/assets/project-scope-context-BairiAvs.js +4 -0
  28. package/web/dist/assets/{projects-section-DjeKfkRK.js → projects-section-I4Umh57f.js} +1 -1
  29. package/web/dist/assets/{prompt-templates-section-CPH3RU9O.js → prompt-templates-section-Byinr-jH.js} +1 -1
  30. package/web/dist/assets/queries-bg9YtgmX.js +1 -0
  31. package/web/dist/assets/{reference-chip-DGOmeh0l.js → reference-chip-Bphmq8DU.js} +1 -1
  32. package/web/dist/assets/{remote-settings-notice-BFDdo8X5.js → remote-settings-notice-CcYe1mbK.js} +1 -1
  33. package/web/dist/assets/{repo-git-PaJ9uJ6o.js → repo-git-tmqJIA3Y.js} +1 -1
  34. package/web/dist/assets/{report-reader-DDDg-Iyz.js → report-reader-GE7zBDlE.js} +1 -1
  35. package/web/dist/assets/{reports-DRSGsu5b.js → reports-Dzd6o31r.js} +1 -1
  36. package/web/dist/assets/{resources-section-Dwx13rfP.js → resources-section-D6yjk2_7.js} +1 -1
  37. package/web/dist/assets/run-header-Cc5Flvc9.js +2 -0
  38. package/web/dist/assets/{runners-BFhbiSKy.js → runners-GyEIYtzT.js} +1 -1
  39. package/web/dist/assets/settings-agent-picker-gDWJBt2q.js +1 -0
  40. package/web/dist/assets/{settings-shell-De1IxHYf.js → settings-shell-1kV0mCGg.js} +1 -1
  41. package/web/dist/assets/{sidebar-section-CYKz48EO.js → sidebar-section-bytwajV6.js} +1 -1
  42. package/web/dist/assets/skills-oC915Joa.js +1 -0
  43. package/web/dist/assets/{tab-link-BmEGnV4R.js → tab-link-BrrGCBYJ.js} +1 -1
  44. package/web/dist/assets/{task-changes-CvbqO0ug.js → task-changes-CgEF750z.js} +1 -1
  45. package/web/dist/assets/{task-commits-kVuYqkqB.js → task-commits-CmewNVBz.js} +1 -1
  46. package/web/dist/assets/{task-files-DOFkMbFg.js → task-files-x0fUUNIG.js} +1 -1
  47. package/web/dist/assets/{task-github-item-13sbVXYb.js → task-github-item-DuwLqcE4.js} +1 -1
  48. package/web/dist/assets/{task-groups-Dc7pXgaS.js → task-groups-Ccol3P2t.js} +1 -1
  49. package/web/dist/assets/task-thread-DkgKDQSG.js +9 -0
  50. package/web/dist/assets/{tasks-table-lb5Dy-8O.js → tasks-table-CbfBNxAB.js} +1 -1
  51. package/web/dist/assets/{thread-state-BwzJmXzv.js → thread-state-Nzl4pHXB.js} +1 -1
  52. package/web/dist/assets/use-hand-to-agent-state-BMWlCZBX.js +1 -0
  53. package/web/dist/assets/{useInfiniteQuery-rgb-nitU.js → useInfiniteQuery-C8q14xTE.js} +1 -1
  54. package/web/dist/assets/useQuery-Berjv5Ts.js +1 -0
  55. package/web/dist/assets/{workflows-35bEvVkH.js → workflows-BV5oZdB_.js} +3 -3
  56. package/web/dist/assets/{workspace-tools-Bw4MyHOW.js → workspace-tools-NWKvRhWg.js} +1 -1
  57. package/web/dist/assets/{worktrees-section-CLwPLrl2.js → worktrees-section--MUxuXUq.js} +4 -4
  58. package/web/dist/assets/{ws-D3-jE1IB.js → ws-BYbBRDfC.js} +1 -1
  59. package/web/dist/index.html +15 -15
  60. package/web/dist/assets/activity-motion-CkAbct6K.js +0 -2
  61. package/web/dist/assets/attention-BMiaqJnx.js +0 -1
  62. package/web/dist/assets/automations-route-BBzRefYM.js +0 -1
  63. package/web/dist/assets/index-CRfojAQ1.js +0 -21
  64. package/web/dist/assets/preview-pane-connected-B3mexb-I.js +0 -3
  65. package/web/dist/assets/project-scope-context-BRvkKGX1.js +0 -4
  66. package/web/dist/assets/queries-CQWAcH8p.js +0 -1
  67. package/web/dist/assets/run-header-q5egOxrK.js +0 -2
  68. package/web/dist/assets/settings-agent-picker-YO8UtetZ.js +0 -1
  69. package/web/dist/assets/skills-hTBIyeAr.js +0 -1
  70. package/web/dist/assets/task-thread-B0d0xyLV.js +0 -9
  71. package/web/dist/assets/use-hand-to-agent-state-wRTXiZqE.js +0 -1
  72. package/web/dist/assets/useQuery-SVV6EtG7.js +0 -1
@@ -1,2 +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{n as r,t as i}from"./utils-DSMR_WLb.js";import{Dr as a,Fn as o,Jn as s,Kn as c,Lt as l,Pn as u,Qn as d,Rt as f,Zn as p,er as m,hr as h,i as g,jn as ee,k as _,mr as v,o as te,ti as y}from"./project-scope-context-BRvkKGX1.js";import{F as ne,Ht as re,I as b,J as ie,Jt as ae,L as oe,M as se,R as x,U as S,Yt as C,Z as ce,_t as w,gt as le,q as ue,qt as de,t as fe,ut as pe,vt as me,y as he,z as ge}from"./queries-CQWAcH8p.js";import{d as _e,h as ve}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as ye,d as be,f as xe,g as Se,m as Ce,o as we,p as Te,s as Ee}from"./tasks-table-lb5Dy-8O.js";import{n as T}from"./toaster-Bo5vCbz-.js";import{s as E}from"./runners-BFhbiSKy.js";import{A as De,F as Oe,a as ke,at as Ae,f as je,ft as D,g as Me,h as Ne,i as O,l as k,m as Pe,p as Fe,q as Ie,t as Le,v as A,x as Re}from"./design-icons-CzEoMH9c.js";import{t as j}from"./createLucideIcon-BHp8sXmF.js";import{t as ze}from"./app-window-CSHwDX9N.js";import{n as Be,r as Ve,t as He}from"./open-in-menu-DgScIVvr.js";import{t as Ue}from"./info-DA1x_4bz.js";import{a as We,t as Ge}from"./format-BNCkW110.js";import{t as Ke}from"./message-square-B-MD-8rD.js";import{i as qe,n as Je,t as M}from"./reference-chip-DGOmeh0l.js";import{t as Ye}from"./square-terminal-B6RYYieR.js";import{t as N}from"./button-BQ2y4XRB.js";import{a as P,i as F,l as I,n as L,p as R,r as z,t as B}from"./dropdown-menu-4e2iKSMT.js";import{i as Xe,r as Ze,t as Qe}from"./popover-BPgUYFyu.js";import{a as $e,i as et,o as tt,r as nt,s as rt,t as it}from"./dialog-BVF6dIeS.js";import{c as at,s as ot,t as V}from"./project-router-UyyzK1j2.js";import"./attention-BMiaqJnx.js";import{f as H,u as st,x as ct}from"./task-groups-Dc7pXgaS.js";import{t as U}from"./status-dot-DtAOFiIi.js";import{$n as lt,$t as ut,B as dt,Dn as ft,En as pt,Gt as mt,Hn as ht,Ht as gt,Jt as _t,Kt as vt,On as yt,R as bt,Un as xt,Ut as St,Vt as Ct,Wt as wt,a as Tt,cn as Et,en as Dt,fn as W,in as Ot,m as kt,o as At,pn as G,qn as jt,qt as Mt,r as Nt,rn as Pt,tn as Ft,z as It}from"./index-CRfojAQ1.js";import{r as Lt,t as Rt}from"./markdown-i80v6qNq.js";import{i as zt}from"./automation-format-1lHzRTbq.js";import{t as Bt}from"./textarea-vJt9undk.js";import{t as K}from"./tab-link-BmEGnV4R.js";var Vt=j(`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=j(`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`}]]),Ut=j(`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 Wt(e){let t=re();return C({mutationFn:t=>te(ae(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>de()),onError:e=>T(e.message,{tone:`danger`})})}function Gt(e){return e.archived?`Unarchive`:`Archive task`}function Kt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,J.jsx)(Ct,{open:t,onOpenChange:n,children:(0,J.jsxs)(wt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(Mt,{children:[(0,J.jsx)(_t,{children:`Archive task?`}),(0,J.jsxs)(mt,{children:[`Move “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:H(e),children:H(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,J.jsxs)(vt,{children:[(0,J.jsx)(St,{children:`Cancel`}),(0,J.jsx)(gt,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Y({run:e,className:t,compactOnMobile:n=!1}){let[r,a]=(0,q.useState)(!1),o=Wt(e.id),s=Gt(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(N,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":s,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:o.isPending,className:i(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?o.mutate(!1):a(!0),children:[e.archived?(0,J.jsx)(lt,{"aria-hidden":`true`}):(0,J.jsx)(Le,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:i(n&&`max-md:sr-only`),children:s})]}),(0,J.jsx)(Kt,{run:e,open:r,onOpenChange:a,onConfirm:()=>{o.mutate(!0),a(!1)}})]})}function qt({run:e,action:t,prUrl:n,patch:i}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,J.jsx)(N,{variant:`outline`,asChild:!0,children:(0,J.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,J.jsx)(N,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>T(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Jt({run:e,blocker:t,flags:n}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,J.jsx)(N,{variant:`outline`,asChild:!0,children:(0,J.jsx)(V,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,J.jsx)(N,{variant:`outline`,asChild:!0,children:(0,J.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,J.jsx)(Y,{run:e}):null]})]})}function Yt({run:e}){let t=x(e.id),n=G(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,J.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,J.jsx)(qt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,J.jsx)(Jt,{run:e,blocker:i,flags:n}):null]})}var Xt=[`running`,`queued`,`waiting`];function Zt(e,{queuePosition:t,now:n=new Date}){let r=ee(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Xt.includes(e.status)?$t(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Qt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function $t(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ge(n,t)}}async function X(e,t){try{await navigator.clipboard.writeText(e),T(t)}catch{T(`Run manually: ${e}`)}}function en(e){let t=S(),n=ce(),r=(0,q.useMemo)(()=>Se(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,q.useMemo)(()=>n===void 0?[]:r.filter(e=>ye(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function tn(e){return C({mutationFn:()=>f(e.id),onError:e=>{if(e instanceof g&&e.command){X(e.command,`No terminal found — command copied to clipboard.`);return}T(e.message,{tone:`danger`})}})}function Z(e,t){let n=oe(),r=ie(),i=E(),o=C({mutationFn:t=>l(e.id,t),onError:e=>T(e.message,{tone:`danger`})}),s=a(r.data,i.data),c=e=>!r.isSuccess||!i.isSuccess||s.includes(e??`claude`);return{canResumeHere:t&&c(Et(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Be(e.id);return t===void 0||i.isSuccess&&c(t)}).map(t=>({target:t,...Ot(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function nn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),o=E().data,s=W(e);return!r&&i.length===0&&!s?null:(0,J.jsxs)(J.Fragment,{children:[r||i.length>0?(0,J.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,J.jsxs)(N,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,J.jsx)(Ye,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Ve(e,o);return(0,J.jsxs)(N,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,J.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,J.jsxs)(N,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>T(`Worktree path copied`)).catch(()=>T(`Path: ${t}`))},children:[(0,J.jsx)(A,{}),`Copy worktree path`]}):null]}):null,s?(0,J.jsxs)(`div`,{"data-slot":`resume-command`,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:s}),(0,J.jsxs)(N,{variant:`outline`,onClick:()=>void X(s,`Command copied to clipboard.`),children:[(0,J.jsx)(A,{}),`Copy resume command`]})]}):null]})}function rn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),o=W(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,J.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,J.jsx)(He,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,J.jsxs)(F,{"data-target":`terminal-resume`,onSelect:n,children:[(0,J.jsx)(Ye,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,J.jsxs)(N,{variant:`outline`,size:`sm`,className:c,onClick:()=>void X(s,`Worktree path copied`),children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,J.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void X(o,`Command copied to clipboard.`),children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function an({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Z(e,t);return!a&&o.length===0?null:r?(0,J.jsx)(F,{onSelect:r,children:`Open in…`}):(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)(N,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,J.jsx)(D,{})})]}),e.worktreePath?(0,J.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,J.jsx)(`div`,{className:`mt-4`,children:(0,J.jsx)(nn,{run:e,canResume:t,onResume:n})})]})}function on({branch:e}){let[t,n]=(0,q.useState)(null),r=(0,q.useRef)(null);(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{T(`Could not copy branch. Select and copy: ${e}`)}};return(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,J.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,J.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function sn({run:e}){let t=S(),n=ce(),i=r=>n===void 0?void 0:xe(n,e.id,r,t),a=(0,q.useMemo)(()=>Se(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,J.jsx)(M,{reference:t,to:i(t),taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,J.jsx)(Ft,{run:e,prNumber:t.number})},Ee(t)));let l=Ce(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,J.jsx)(M,{reference:{kind:`PR`,url:l},taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,J.jsx)(M,{reference:t,to:i(t),taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},Ee(t)));let d=be(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=we(d);s.push((0,J.jsx)(M,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:H(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,J.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,J.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function cn(){let e=ot(),t=ue();return bt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var ln=e=>e.map(e=>`${e.name}: ${It(e.url)}`).join(`
2
- `);function un(e){return cn().length>0||e.notify===!0}function dn({run:e}){let t=cn(),n=t.length>0,r=b(e.id),[i,a]=(0,q.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,J.jsxs)(J.Fragment,{children:[o?(0,J.jsxs)(B,{children:[(0,J.jsx)(R,{asChild:!0,children:(0,J.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${dt(t)} — webhook actions`:`Notifying — webhook actions`,title:n?ln(t):void 0,children:[(0,J.jsx)(U,{tone:`success`}),(0,J.jsx)(`span`,{children:`Notifying`}),(0,J.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,J.jsxs)(z,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,J.jsx)(P,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,J.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:It(e.url),children:e.name},e.id))}):null,n?(0,J.jsxs)(F,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,J.jsx)(Ke,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,J.jsxs)(F,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>T(`Stopped notifying the webhook`),onError:e=>T(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,J.jsx)(Vt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,J.jsxs)(N,{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)(ht,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,J.jsx)(fn,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),T(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>T(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function fn({mode:e,targets: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=dt(t);return(0,J.jsx)(it,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,J.jsx)(nt,{"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)(tt,{className:`text-left`,children:[(0,J.jsx)(rt,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,J.jsx)(et,{children:(0,J.jsx)(`span`,{"data-webhook-destination":``,title:ln(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (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)(Bt,{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)(Ue,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,J.jsxs)($e,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,J.jsx)(N,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,J.jsxs)(N,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,J.jsx)(ht,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function pn({runId:e,children:t}){let n=_e(),r=(0,q.useMemo)(()=>({runId:e}),[e]);return n?(0,J.jsx)(mn,{runId:e,children:t}):(0,J.jsx)(Lt.Provider,{value:r,children:t})}function mn({runId:e,children:t}){let{projectId:n}=ve(),r=(0,q.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,J.jsx)(Lt.Provider,{value:r,children:t})}function hn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function gn(e){return typeof e==`object`&&!!e&&!(0,q.isValidElement)(e)&&`keep`in e}function _n({slot:e,icon:t,title:n,meta:r,summary:a,aside:o,open:s,onToggle:c,className:l,children:u}){let d=(0,J.jsxs)(J.Fragment,{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:i(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),a??(gn(r)?(0,J.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,J.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,J.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,J.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,J.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(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}))]}),f=c!==void 0;return(0,J.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:i(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,o,(0,J.jsx)(k,{"aria-hidden":!0,className:i(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!o&&`ms-auto`,s&&`rotate-180`)})]}):(0,J.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,o]}),f&&s?(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:u}):null]})}function Q(e){return v(e.delegation)}function vn(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function yn(e){let t=e.delegation,n=Q(e),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=vn(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 bn(e){let t=w(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>ct(e.status))}function xn({run:e,open:t,onToggle:n}){let r=w(e.id),a=me(),o=Dt(),s=e.delegation,c=new Map(r.data?.workers.map(e=>[e.workerId,e])),l=vn(s,r.data),u=p(e)??d(e),f=u?Sn(e,u):void 0,m=e=>a.data?.find(t=>t.id===e)??r.data?.titles?.find(t=>t.id===e),h=e=>{let t=m(e);return t?H(t):`worker ${e.slice(0,8)}`};return(0,J.jsx)(_n,{slot:`workers`,icon:(0,J.jsx)(De,{className:`size-4`}),title:`Workers`,meta:Cn({ids:l,workers:c,desktop:o,query:r}),aside:r.data?.capacity?(0,J.jsx)(An,{capacity:r.data.capacity}):void 0,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:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,u?(0,J.jsx)(Dn,{wait:u,dependencyLabel:f}):null,l.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:l.map(t=>{let n=c.get(t),a=m(t),o=n?Tn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,J.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,J.jsxs)(V,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,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)(wn,{status:n?.status}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate`,children:a?H(a):`Worker ${t.slice(0,8)}`}),n?.supervisorRunId&&n.supervisorRunId!==e.id?(0,J.jsxs)(`span`,{"data-slot":`worker-supervisor`,className:`block truncate text-xs text-muted-foreground`,children:[`Started by `,h(n.supervisorRunId)]}):null]}),(0,J.jsx)(`span`,{className:i(`max-w-[45%] shrink-0 truncate text-xs`,En(n?.status)),children:o}),(0,J.jsx)(ke,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,J.jsx)(Mn,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,J.jsx)(In,{state:n.destroy}):null]},t)})}):Q(e)&&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)(N,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function Sn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return o(e)??u(n.role,t,`requestIds`in t&&m(n,t.requestIds))}function Cn({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function wn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,J.jsx)(je,{"aria-hidden":!0,className:i(t,`text-success`)}):e===`failed`?(0,J.jsx)(Me,{"aria-hidden":!0,className:i(t,`text-danger`)}):e===`cancelled`?(0,J.jsx)(Ne,{"aria-hidden":!0,className:i(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,J.jsx)(We,{role:`status`,"aria-label":`Worker running`,className:i(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,J.jsx)(Pe,{"aria-hidden":!0,className:i(t,`text-soft-foreground`)})}function Tn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function En(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function Dn({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)}`:`requestIds`in e&&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`in e?(0,J.jsxs)(J.Fragment,{children:[` `,`Deadline: `,(0,J.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: Squawk wakes this task when they have all settled.`]})}function On(e){return e.delegation?.role===`worker`&&d(e)?.phase===`wake-pending`}function kn({run:e}){let t=d(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,J.jsx)(Dn,{wait:t,dependencyLabel:u(`worker`,t)}):null}function An({capacity:e}){return(0,J.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var jn=new Set([`review`,`done`,`failed`,`cancelled`]);function Mn({parentRunId:e,worker:t}){let n=he(e),[r,i]=(0,q.useState)(!1);if(!jn.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let a=t.workerId.slice(0,8),o=!!t.destroy&&t.destroy.phase!==`complete`,s=n.error instanceof g?n.error.work:void 0;return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`break-words text-xs`,children:h(t.workspace)?`Removes this worker's worktree and branch. Its result is saved first.`:`Stops this worker and frees its slot. It runs in this task's worktree, so no worktree or branch is removed. Its result is saved first.`}),(0,J.jsx)(N,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${a}`,onClick:()=>{i(!1),n.mutate({workerId:t.workerId})},children:`Clean up`}),(0,J.jsx)(N,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,J.jsx)(N,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":o?`Retry clean up of worker ${a}`:`Clean up worker ${a}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:o?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,J.jsx)(`span`,{role:`status`,className:`break-words text-xs`,children:s?`Cleanup stopped: this worker holds ${Pn(s)}. Land or commit what you need first, or discard it.`:`Cleanup did not finish: ${n.error.message}`}):null,s&&!r&&!n.isPending?(0,J.jsx)(N,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Discard work and clean up worker ${a}`,onClick:()=>n.mutate({workerId:t.workerId,discardWork:!0}),children:`Discard work and clean up`}):null]})}var Nn=(e,t,n)=>`${e} ${e===1?t:n}`;function Pn(e){return[...e.uncommittedFiles?[Nn(e.uncommittedFiles,`uncommitted file`,`uncommitted files`)]:[],...e.commits?[`${Nn(e.commits,`commit`,`commits`)} no other branch reaches`]:[]].join(` and `)}function Fn(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function In({state:e}){if(!Fn(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,J.jsx)(Ln,{at:t.nextAt});return(0,J.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,J.jsxs)(J.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,J.jsxs)(J.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function Ln({at:e}){let t=ut(3e4);return(0,J.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:zt(t,Date.parse(e))})}function Rn({id:e}){return(0,J.jsxs)(V,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,J.jsx)(O,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function zn({id:e}){let t=pe(e),n=t.data?H(t.data):e;return(0,J.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,J.jsxs)(V,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,J.jsx)(O,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,J.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,J.jsx)(N,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Bn=3,$=(e,t)=>e.kind===t.kind&&e.number===t.number;function Vn(e,t,n=Bn){let r=t?e.findIndex(e=>$(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Hn=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Un({tab:e}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(e.kind===`pr`?Oe:Fe,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,J.jsx)(Je,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Wn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Gn({servers:e}){let t=kt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,J.jsxs)(N,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,J.jsx)(ze,{"aria-hidden":`true`}),Wn(e,n),t.live?(0,J.jsx)(U,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Kn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function qn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,J.jsx)(Rn,{id:n}):(0,J.jsx)(zn,{id:n})}function Jn(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!Pt(e,r))?(0,J.jsx)(Y,{run:e}):null}function Yn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,J.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Xn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=un(t);return e&&(n||r||i)?(0,J.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,J.jsx)(dn,{run:t})]}):null}function Zn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,q.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,q.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,J.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,J.jsx)(K,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,J.jsx)(K,{to:Hn(e.id,t),active:n!==null&&$(t,n),replace:a,children:(0,J.jsx)(Un,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,J.jsxs)(B,{children:[(0,J.jsxs)(R,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,J.jsx)(z,{align:`end`,children:i.map(t=>(0,J.jsx)(F,{asChild:!0,children:(0,J.jsx)(V,{to:Hn(e.id,t),replace:a,children:(0,J.jsx)(Un,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function Qn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=ee(e),a=G(e),o=bn(e),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),d=$n(e,n),f=me(),p=se(),m=Zt(e,{queuePosition:e.status===`queued`?st(f.data??[]).get(e.id):void 0}),h=yt(),g=ft(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:te,repoBase:y,requests:ne}=en(e),re=(0,q.useMemo)(()=>Te(e,y),[e,y]),b=typeof t==`object`?t:null,{inline:ie,overflow:ae}=Vn(re,b),oe=p.data?.capabilities?.preview===!0,x=e.worktreePath&&oe?(0,J.jsx)(Gn,{servers:e.previewServers??[]}):null,S=(0,J.jsx)(rr,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),C=Jn(e,a,t,o);return(0,J.jsx)(qe,{projectId:te,repoBase:y,requests:ne,children:(0,J.jsxs)(`header`,{"data-slot":`run-header`,className:i(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,J.jsx)(Yn,{run:e}),(0,J.jsx)(Yt,{run:e}),(0,J.jsxs)(`div`,{className:`w-full`,children:[(0,J.jsx)(qn,{run:e}),_?(0,J.jsxs)(pt,{slot:_,children:[(0,J.jsx)(nr,{run:e}),(0,J.jsx)(qn,{run:e,compact:!0}),S]}):(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:Kn(e.delegation)}),(0,J.jsx)(tr,{run:e}),(0,J.jsx)(Nt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Qt(m)}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[C,x,(0,J.jsx)(dn,{run:e}),S]})]}),(0,J.jsx)(Xn,{shown:_!==null,run:e,archiveButton:C,previewToggle:x}),(0,J.jsx)(Zn,{run:e,tab:t,activeItem:b,inlineItemTabs:ie,overflowItemTabs:ae,phoneBar:v,isDesktop:g}),s?(0,J.jsx)(or,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,J.jsx)(an,{run:e,canResume:G(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,J.jsx)(ar,{run:e,actions:d})]})})}function $n(e,t){let n=y(),r=at(),[i,a]=(0,q.useState)(null),o=()=>n.invalidateQueries({queryKey:fe.runs.all}),s=e=>T(e.message,{tone:`danger`}),c=ge(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=ne();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:C({mutationFn:()=>_(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:tn(e),confirming:i,setConfirming:a}}function er(e){let t=x(e.id),n=H(e);return{title:n,editor:At(n,e=>t.mutate({title:e},{onError:e=>T(e.message,{tone:`danger`})}))}}function tr({run:e}){let{title:t,editor:n}=er(e);return n.editing?(0,J.jsx)(Tt,{editor:n,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:t}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.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)(xt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function nr({run:e}){let{title:t,editor:n}=er(e);return(0,J.jsxs)(Qe,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,J.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,J.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,J.jsx)(Xe,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm 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)(xt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,J.jsx)(Ze,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,J.jsx)(Tt,{editor:n,className:`text-[16px] font-semibold`})})]})}function rr({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=G(e),a=W(e),o=x(e.id),s=(0,q.useId)();return(0,J.jsxs)(B,{children:[(0,J.jsx)(R,{asChild:!0,children:(0,J.jsx)(N,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,J.jsx)(Re,{"aria-hidden":`true`})})}),(0,J.jsxs)(z,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,J.jsx)(P,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,J.jsxs)(F,{onSelect:n,children:[(0,J.jsx)(jt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,J.jsx)(an,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,J.jsxs)(F,{onSelect:()=>void X(a,`Command copied to clipboard.`),children:[(0,J.jsx)(A,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,J.jsxs)(F,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,J.jsx)(Ht,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,J.jsxs)(L,{"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)(Ut,{"aria-hidden":`true`}):(0,J.jsx)(Ie,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,J.jsx)(I,{}),(0,J.jsx)(P,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,J.jsx)(L,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:o.isPending,onCheckedChange:e=>o.mutate({archiveWhenDone:e},{onError:e=>T(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,J.jsx)(L,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:o.isPending,"aria-describedby":s,onCheckedChange:e=>o.mutate({autoMergePr:e},{onError:e=>T(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,J.jsx)(`p`,{id:s,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,J.jsx)(ir,{run:e,patch:o}),i.deleteRun?(0,J.jsx)(I,{}):null,i.deleteRun?(0,J.jsxs)(F,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,J.jsx)(Ae,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function ir({run:e,patch:t}){let n=(0,q.useId)(),r=(0,q.useId)(),i=(0,q.useId)(),a=e=>T(e.message,{tone:`danger`});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(I,{}),(0,J.jsx)(P,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,J.jsx)(L,{"data-slot":`allow-workers`,className:`min-h-11`,checked:s(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,J.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,J.jsx)(L,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:c(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,J.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,J.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function ar({run:e,actions:t}){let n=t.confirming;return(0,J.jsx)(Ct,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,J.jsxs)(wt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(Mt,{children:[(0,J.jsx)(_t,{className:`text-danger`,children:`Delete task permanently?`}),(0,J.jsx)(mt,{children:(0,J.jsxs)(J.Fragment,{children:[`Delete “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:H(e),children:H(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!h(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,J.jsxs)(vt,{children:[(0,J.jsx)(St,{children:`Cancel`}),(0,J.jsx)(gt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function or({runId:e,onClose:t}){let n=le(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)(N,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,J.jsx)(D,{})})]}),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)(pn,{runId:e,children:(0,J.jsx)(Rt,{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)(N,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void X(n.data??``,`Notes copied`),children:`Copy notes`}),(0,J.jsx)(N,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{en as _,Fn as a,bn as c,hn as d,pn as f,tn as g,rn as h,kn as i,yn as l,sn as m,In as n,On as o,on as p,xn as r,Q as s,Qn as t,_n as u,Zt as v,Y 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{t as r}from"./utils-DSMR_WLb.js";import{Tr as i,f as a,hn as o,ti as s}from"./project-scope-context-BRvkKGX1.js";import{M as c,Nt as l,Yt as u}from"./queries-CQWAcH8p.js";import{t as d}from"./useQuery-SVV6EtG7.js";import{i as f,n as p,s as m}from"./runners-BFhbiSKy.js";import{it as h,l as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-BQ2y4XRB.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-BVF6dIeS.js";import{zn as w}from"./index-CRfojAQ1.js";var T=e(t(),1),E=n();function D(e,t){return p(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var O=(e,t)=>e.length>f(t).length;function k(e,t){let n=i(e.data,t),r=!e.isPending&&!e.isError&&n?.enabled===!0&&n.status===`connected`;return{providerConnected:r,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:n?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:r?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:i,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let c=m().data,l=c===void 0,u=O(e,c);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:r(`gap-0.5 rounded-md border border-border bg-card p-0.5`,u?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let{providerConnected:d,providerReason:f}=k(i,c.runner.id),p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:a||l||!d||p&&o,onClick:()=>s(c.runner.id,c.account,p),className:r(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,u?(0,E.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}async function j(e,t){return o(await a.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return o(await a.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return o(await a.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return o(await a.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=s(),[r,i]=(0,T.useState)(!1),[a,o]=(0,T.useState)(null),[c,f]=(0,T.useState)(``),p=(0,T.useRef)(null),m=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=p.current;p.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),o(null),f(``),i(!1)};(0,T.useEffect)(()=>(m.current=!0,()=>{m.current=!1,h.current++;let e=p.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=u({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!m.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}p.current=e,o(e)}}),v=(0,T.useRef)(r);v.current=r;let y=d({queryKey:[`browser-sign-in`,a?.id],queryFn:()=>M(a.id),enabled:r&&a?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??a,x=u({mutationFn:()=>N(a.id,c),retry:!1,onSuccess:()=>{f(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(p.current=b,o(b),Promise.all([n.invalidateQueries({queryKey:l.agentProfiles}),n.invalidateQueries({queryKey:l.providerStatus}),n.invalidateQueries({queryKey:l.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:c,setRedirect:f,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:l,status:u,error:d,close:f,connect:p}=F(e,t);return c().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:p,children:`Connect`}),(0,E.jsx)(C,{open:r,onOpenChange:e=>{e||f()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,E.jsx)(_,{disabled:!a.trim()||l.isPending,onClick:()=>l.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,d?(0,E.jsx)(`p`,{role:`alert`,children:d.message}):null,u.isError&&i?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void u.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:f,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=(0,T.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,R as t};
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{Ct as i,ti as a}from"./project-scope-context-BRvkKGX1.js";import{Pt as o,p as s,t as c}from"./queries-CQWAcH8p.js";import{g as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as u}from"./toaster-Bo5vCbz-.js";import{s as d,t as f}from"./runners-BFhbiSKy.js";import{O as p,T as m,X as h,Y as g,ct as _,ot as v,u as y}from"./design-icons-CzEoMH9c.js";import{t as b}from"./button-BQ2y4XRB.js";import{t as x}from"./project-router-UyyzK1j2.js";import{f as S,l as C}from"./skills-pM_PouEs.js";import{H as w,U as T,xn as E,zn as D}from"./index-CRfojAQ1.js";var O=e(t(),1),k=n(),A=e=>e.split(`@`)[0]||e,j={project:0,user:1,plugin:2,system:3,other:4},M={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function N(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:A(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:M[t],kind:t}}function P(e){let t=new Map;for(let n of e){let e=N(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>j[e.kind]-j[t.kind]||e.label.localeCompare(t.label))}function F(e){let t=e.plugin?`${A(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var I={project:m,user:_,plugin:p,system:p,other:p};function L({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,O.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,k.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,k.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,k.jsx)(R,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,k.jsx)(z,{skill:e,open:e.id===t,runner:r,account:i},S(e))):null]},e.key)})})}function R({group:e,open:t,onToggle:n}){let i=I[e.kind];return(0,k.jsx)(`h2`,{className:`m-0`,children:(0,k.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,k.jsx)(y,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,k.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,k.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function z({skill:e,open:t,runner:n,account:r}){let i=E({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,k.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,k.jsxs)(`summary`,{className:`grid min-h-11 cursor-pointer list-none grid-cols-1 items-baseline gap-x-4 gap-y-0.5 py-2.5 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)] [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(`span`,{className:`truncate text-[13.5px] font-semibold`,title:e.name,children:F(e)}),e.description?(0,k.jsx)(`span`,{className:`truncate text-[13px] text-muted-foreground group-open/skill:hidden`,children:e.description}):null]}),(0,k.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,k.jsx)(T,{skill:e,heading:null,actions:(0,k.jsx)(b,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,k.jsx)(x,{to:i,children:`Start task`})})})})]})}function B(){let e=s(),[t,n]=(0,O.useState)(null),[i,a]=(0,O.useState)(null),[c,u]=(0,O.useState)(``),[d]=l(),f=t??e.data?.defaultRunner??`claude`,p=o(t??e.data?.defaultRunner,i),m=G(f,p.account),_=p.data??[];return(0,k.jsxs)(`div`,{"data-route":`skills`,className:`mx-auto grid min-h-full w-full max-w-[1100px] grid-cols-1 content-start gap-5 px-[18px] py-6 md:p-9 max-md:[padding-block-end:5rem]`,children:[(0,k.jsxs)(`header`,{children:[(0,k.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,k.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,k.jsx)(H,{runner:f,onChange:e=>{n(e),a(null)}}),(0,k.jsx)(U,{runner:f,account:i,onChange:a}),(0,k.jsx)(`span`,{className:`ml-auto text-xs text-soft-foreground`,"data-slot":`skills-count`,children:p.list?`${_.length} ${_.length===1?`skill`:`skills`}${p.list.source===`cache`?` · from cache`:``}`:null}),(0,k.jsxs)(b,{variant:`outline`,size:`sm`,onClick:()=>void m.run(),disabled:m.running||p.isPending,"data-slot":`skills-refresh`,children:[(0,k.jsx)(g,{"aria-hidden":`true`,className:r(`size-3.5`,m.running&&`motion-safe:animate-spin`)}),`Re-read`]})]}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(h,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,k.jsx)(D,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:c,onChange:e=>u(e.target.value),className:`h-10 bg-card pl-9 text-[13px]`})]}),(0,k.jsx)(W,{query:p}),p.isPending?(0,k.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,k.jsx)(V,{skills:_,search:c,openId:d.get(`skill`),runner:f,account:p.account??null,unchecked:p.unchecked})]})}function V({skills:e,search:t,openId:n,runner:r,account:i,unchecked:a}){if(e.length===0)return a?null:(0,k.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`No skills reported by this runner and account.`});let o=C(e,t);return o.length===0?(0,k.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No skills match “`,t.trim(),`”.`]}):(0,k.jsx)(L,{groups:P(o),openId:n,searching:t.trim()!==``,runner:r,account:i})}function H({runner:e,onChange:t}){let n=d().data;return n?(0,k.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-0.5 overflow-x-auto rounded-[10px] border border-border bg-card p-[3px]`,children:n.runners.map(r=>(0,k.jsx)(`button`,{type:`button`,"aria-pressed":r.id===e,onClick:()=>t(r.id),className:`h-8 shrink-0 rounded-[7px] px-3 text-[13px] text-muted-foreground focus-visible:outline-2 aria-pressed:bg-muted aria-pressed:font-semibold aria-pressed:text-foreground pointer-hover:text-foreground`,children:f(n,r.id)},r.id))}):null}function U({runner:e,account:t,onChange:n}){let r=w().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,k.jsxs)(`select`,{"aria-label":`Account`,value:t??``,onChange:e=>n(e.target.value||null),className:`h-[38px] rounded-md border border-border bg-card px-2.5 text-[13px] text-foreground focus-visible:outline-2`,children:[(0,k.jsx)(`option`,{value:``,children:`Account: project default`}),r.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function W({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,k.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,k.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,k.jsx)(v,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,k.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,k.jsx)(v,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function G(e,t){let n=a(),[r,o]=(0,O.useState)(!1),s=c.runnerSkills(e,t);return{running:r,run:async()=>{o(!0);try{n.setQueryData(s,await i(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:s.slice(0,3)})}catch(e){u(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{o(!1)}}}}export{B as SkillsRoute};
@@ -1,9 +0,0 @@
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{l as i,n as a,t as o}from"./utils-DSMR_WLb.js";import{n as s}from"./live-refetch-CZb2VOyu.js";import{$n as c,Dr as l,E as u,Hr as d,N as f,Vr as p,_ as m,cr as h,d as g,i as _,ir as v,jn as y,l as b,nr as x,ti as S,w as C,wt as w}from"./project-scope-context-BRvkKGX1.js";import{Gt as T,Ht as E,J as D,Jt as O,M as k,P as A,R as j,St as ee,U as te,Yt as M,_t as ne,b as N,it as re,l as P,mt as F,o as ie,p as I,qt as L,t as R,ut as z,vt as B}from"./queries-CQWAcH8p.js";import{t as ae}from"./useQuery-SVV6EtG7.js";import{f as oe,h as se,n as V,p as ce}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{d as le,m as ue,r as de,s as fe,v as pe}from"./tasks-table-lb5Dy-8O.js";import{n as H}from"./toaster-Bo5vCbz-.js";import{i as me,s as he,t as ge}from"./runners-BFhbiSKy.js";import{A as _e,B as U,F as ve,K as ye,X as be,at as xe,c as Se,dt as Ce,f as we,g as Te,it as Ee,k as De,l as Oe,m as ke,n as Ae,ot as je,s as Me,u as W,ut as Ne,v as Pe,y as Fe,z as Ie}from"./design-icons-CzEoMH9c.js";import{t as G}from"./createLucideIcon-BHp8sXmF.js";import{_ as Le,a as Re,c as ze,d as Be,f as Ve,g as He,h as Ue,i as We,l as Ge,m as Ke,n as qe,o as Je,p as Ye,r as Xe,s as Ze,t as Qe,u as $e,v as et,y as tt}from"./run-header-q5egOxrK.js";import{t as nt}from"./chevron-right-BENZ-1ZN.js";import{t as rt}from"./external-link-BE6y205O.js";import{t as it}from"./eye-B8okNWXU.js";import{n as at}from"./smartphone-Lr8Ug2z_.js";import{a as ot}from"./format-BNCkW110.js";import{t as st}from"./message-square-B-MD-8rD.js";import{a as ct,c as lt,i as ut,l as dt,n as ft,o as pt,r as mt,s as ht,t as gt}from"./thread-state-BwzJmXzv.js";import{i as _t,o as vt,t as yt,u as bt}from"./reference-chip-DGOmeh0l.js";import{t as xt}from"./square-terminal-B6RYYieR.js";import{t as K}from"./button-BQ2y4XRB.js";import{n as q,r as J,t as Y}from"./collapsible-BEV4FO-1.js";import{a as St}from"./popover-BPgUYFyu.js";import{s as Ct,t as X}from"./project-router-UyyzK1j2.js";import"./attention-BMiaqJnx.js";import{D as wt,E as Tt,S as Et,b as Dt,f as Z,u as Ot,w as kt}from"./task-groups-Dc7pXgaS.js";import{t as At}from"./status-dot-DtAOFiIi.js";import{n as jt,t as Mt}from"./centered-state-V15AR_qo.js";import{An as Nt,F as Pt,H as Ft,Hn as It,I as Lt,J as Rt,K as zt,M as Bt,Mn as Vt,N as Ht,Nn as Ut,P as Wt,V as Gt,X as Kt,Z as qt,an as Jt,dn as Yt,en as Xt,fn as Zt,gn as Qt,i as $t,j as en,jn as tn,kn as nn,l as rn,m as an,mn as on,n as sn,nn as cn,on as ln,pn as un,q as dn,qn as fn,rn as pn,s as mn,sn as hn,un as gn,vn as _n,x as vn,y as yn}from"./index-CRfojAQ1.js";import{i as bn,r as xn}from"./highlighter-DvLzHjjY.js";import{t as Sn}from"./zoomable-image-CIQl1Wpe.js";import{i as Cn,r as wn,s as Tn,t as En}from"./markdown-i80v6qNq.js";import{t as Dn}from"./textarea-vJt9undk.js";import{t as On}from"./report-title-D4Mbu2Er.js";var kn=G(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),An=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),jn=G(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Mn=G(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Nn=G(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Pn=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Fn=G(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Q=e(t(),1),$=r(),In=12;function Ln({run:e}){let t=S(),n=M({mutationFn:()=>b(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:R.runs.detail(e.id)}),t.invalidateQueries({queryKey:R.runs.list()}),H(`This task will not resume itself`)},onError:e=>H(e.message,{tone:`danger`})});if(!x(e))return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,$.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,$.jsx)(At,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,$.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,$.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,In,`)`]}):(0,$.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,$.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,$.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,$.jsx)(V,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}function Rn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var zn=/^[A-Za-z0-9_./:=+,@%-]+$/;function Bn(e){return e.replaceAll(`'`,`'\\''`)}function Vn(e){return e===``?`''`:zn.test(e)?e:`\u0027${Bn(e)}\u0027`}function Hn(e){if(!Rn(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(Vn).join(` `)}}function Un(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Wn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Gn(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Kn(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function qn(e){let t=Un(Wn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Kn(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){Kn(e[2])&&i.push({label:Gn(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:Gn(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Kn(t)&&i.push({label:t,href:t})}return i}var Jn=(0,Q.createContext)(void 0),Yn=(0,Q.createContext)(void 0);function Xn(e,t){let n=new Map;for(let r of qn(e)){let e=Cn(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Zn(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Qn({text:e,messageKey:t}){let n=(0,Q.useContext)(wn),r=(0,Q.useContext)(Yn),i=t??r;if(!n||i===void 0)return null;let a=Xn(e,n);return a.length===0?null:(0,$.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,$.jsx)($n,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function $n({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,Q.useContext)(Jn),s=(0,Q.useContext)(yn);(0,Q.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=P(r,n),l=oe(),u=ce();if(c.isError)return(0,$.jsx)(V,{id:Zn(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:l.pathname+l.search},children:i});let d=c.data?.artifact;if(d&&!Tn(d.name))return null;let f=new URLSearchParams(l.search);f.set(`report`,n),f.set(`card`,t);let p=new URLSearchParams(l.search).has(`report`)?l.state:null,m=new URLSearchParams(l.search);m.delete(`report`),m.delete(`card`);let h=`${l.pathname}${m.size?`?${m}`:``}`,g=window.navigation,_={reportCardEntry:!0,reportReturnTo:p?.reportReturnTo??h,reportReturnKey:p?.reportReturnKey??g?.currentEntry?.key,reportScrollTop:p?.reportScrollTop},v={pathname:l.pathname,search:`?${f}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,$.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,$.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:d?On(d):i}),(0,$.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,$.jsx)(V,{id:Zn(t,n),to:v,state:_,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=_.reportScrollTop??document.querySelector(`[data-slot="main"]`)?.scrollTop;u(v,{state:{..._,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var er={message:!0,reasoning:!0,tool:!0,hook:!0};function tr(e){return Object.hasOwn(er,e)&&er[e]}var nr=e=>e.kind===`tool`,rr=e=>e.kind===`conversation`,ir=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,ar=(e,t,n)=>`${e} ${e===1?t:n}`;function or(e,t){let n=[];return e>0&&n.push(ar(e,`file`,`files`)),t>0&&n.push(ar(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function sr(e){return`${e} earlier tool call${e===1?``:`s`}`}var cr=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function lr(e){for(let t of cr)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var ur=new WeakMap;function dr(e){let t=ur.get(e);if(t)return t;let n=fr(e);return ur.set(e,n),n}function fr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(nr).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=tr(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:or(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of pr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(rr(e)){s(),c.push(e);continue}l(),nr(e)&&ir(e)&&!r.has(e.id)?o.push(e):(s(),nr(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function pr(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var mr=new Map,hr=(0,Q.createContext)(null);function gr(){return(0,Q.useContext)(hr)}function _r({runId:e,children:t}){let n=(0,Q.useMemo)(()=>({get:t=>mr.get(e)?.get(t),set:(t,n)=>{let r=mr.get(e)??new Map;r.set(t,n),mr.set(e,r)}}),[e]);return(0,$.jsx)(hr.Provider,{value:n,children:t})}function vr(e){return e.scrollTop<Math.max(600,e.clientHeight)}function yr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function br(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function xr(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Sr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Cr=new Map;function wr(e,t){Cr.set(e,t)}function Tr(e){return Cr.get(e)}var Er=new Map;function Dr(e,t){Er.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function Or(e){return Er.get(e)}function kr(e,t,n){let r=Er.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var Ar=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),jr=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Mr=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Nr=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Pr=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Fr(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Ir(e){let t=Fr(e);return t===void 0?void 0:Ar.format(t)}function Lr(e){let t=Fr(e);return t===void 0?void 0:jr.format(t)}var Rr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function zr(e){let t=Fr(e);return t===void 0?void 0:Rr(t)}function Br(e,t=new Date){let n=Fr(e);if(n===void 0)return;let r=Rr(n);return r===Rr(t)?`Today`:r===Rr(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Mr:Nr).format(n)}function Vr(e,t){let n=Fr(e),r=Fr(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Hr({ts:e}){let t=Ir(e);return t===void 0?null:(0,$.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Lr(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Ur({startedAt:e,completedAt:t}){let n=Ir(t);if(n===void 0)return null;let r=Vr(e,t);return(0,$.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,$.jsx)(`time`,{dateTime:t,title:Lr(t),children:n}),r===void 0?null:(0,$.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Wr({ts:e}){let t=Br(e),n=Fr(e);if(t===void 0||n===void 0)return null;let r=Pr.format(n);return(0,$.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,$.jsx)(`time`,{dateTime:zr(e),title:r,children:t}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Gr={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Kr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let s=Gr[e],c=r===void 0?void 0:Ir(r);return(0,$.jsxs)(`article`,{...a,"data-role":e,"aria-label":s.speaker,className:o(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,$.jsxs)(`p`,{className:o(`m-0 flex w-full min-w-0 items-start gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,$.jsx)(st,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,$.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,$.jsx)(Hr,{ts:r})})]}),(0,$.jsx)(`div`,{className:o(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}function qr({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(e),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(),b=()=>{m(e),y(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}_(!0),y(void 0);try{await a?.(t),f(!1)}catch(e){y(e instanceof Error?e.message:`Could not save the message`)}finally{_(!1)}},S=async()=>{_(!0),y(void 0);try{await o?.()}catch(e){y(e instanceof Error?e.message:`Could not remove the message`)}finally{_(!1)}};return d?(0,$.jsxs)(Kr,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,$.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,$.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:g,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:g,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:g?(0,$.jsx)(ot,{className:`size-3.5 animate-spin`}):`Save`})]}),v?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:v}):null]}):(0,$.jsxs)(Kr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,$.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,$.jsx)(`button`,{type:`button`,"aria-label":s,onClick:b,disabled:g,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,$.jsx)(Fn,{className:`size-3.5`})}):null,o?(0,$.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:g,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,$.jsx)(xe,{className:`size-3.5`})}):null]}):null,v?(0,$.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:v}):null,l??(0,$.jsx)(En,{breaks:!0,children:e}),n.length>0?(0,$.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>h(e.split(`/`).pop()??``)?(0,$.jsx)(Sn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,$.jsxs)(`a`,{href:i(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,$.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,$.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}var Jr=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Yr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Xr(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Yr).forEach(e=>e.remove());let r=qn(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!Kn(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Zr(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Xr(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}function Qr({text:e,ts:t,messageKey:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Zr(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,$.jsxs)(Kr,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,$.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Jr,children:[(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Jr,children:[(0,$.jsx)(fn,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,$.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,$.jsx)(`div`,{ref:r,children:(0,$.jsx)(En,{breaks:!0,children:e})}),(0,$.jsx)(Qn,{text:e,messageKey:n})]})}function $r({note:e}){return e.icon===`handoff`?(0,$.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,$.jsx)(It,{className:`size-3`})}),(0,$.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,$.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:o(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function ei({incident:e}){let t=he().data;if(!t)return null;let n=ge(t,e.provider);return(0,$.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,$.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,$.jsx)(X,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function ti({text:e}){let t=(0,Q.useId)();if(e.trim()===``)return null;let n=e.split(`
2
- `,1)[0]??``,r=n.length<e.length;return(0,$.jsxs)(Y,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,$.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,$.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,$.jsx)(En,{inline:!0,children:n})}),r?(0,$.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,$.jsx)(J,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,$.jsx)(q,{children:(0,$.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,$.jsx)(En,{children:e})})})]})}function ni(){return(0,$.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,$.jsx)(ot,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,$.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var ri={read:fn,edit:Fn,delete:xe,move:Nn,search:be,execute:xt,think:An,fetch:at,task:Me,plan:U,other:Ce},ii=e=>e.split(`
3
- `).length;function ai({text:e,streaming:t}){let[n,r]=(0,Q.useState)(!1),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=ii(e),c=!t&&!n&&s>12;return(0,$.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=xr(e.currentTarget)}:void 0,className:o(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,$.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,$.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&s>12?(0,$.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${s} lines`}):null]})}function oi({diffs:e}){return(0,$.jsx)($.Fragment,{children:e.map((e,t)=>(0,$.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] wrap-anywhere text-muted-foreground`,children:e.path}),(0,$.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...si(e.oldText).map((e,t)=>(0,$.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...si(e.newText).map((e,t)=>(0,$.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
- `).map((e,t)=>(0,$.jsx)(ci,{text:e},t))})]},`${e.path}:${t}`))})}function si(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
5
- `)}function ci({text:e}){return(0,$.jsx)(`span`,{className:o(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function li(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function ui(e){let t=e.status===`running`||e.status===`pending`,n=lr(e.title),{verb:r,detail:i}=e.toolKind===`execute`&&n.detail===void 0?{verb:`Ran`,detail:e.title}:n;return{busy:t,verb:r,detail:i,expandedCommand:(e.toolKind===`execute`?Hn(e.input):ht(e.name).toolKind===e.toolKind?pt(e.name,e.input):void 0)??i,Icon:ri[e.toolKind]??Ce}}function di(e,t){return e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t>0}function fi({item:e,busy:t}){return(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,$.jsx)(ot,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,$.jsx)(`span`,{"data-slot":`tool-exit`,className:o(`rounded-full px-2 py-px font-mono text-[11px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})}function pi({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,$.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,$.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:t}),e.error!==void 0&&e.error!==``?(0,$.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap wrap-anywhere text-signal-word-red`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,$.jsx)(oi,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,$.jsx)(ai,{text:e.output,streaming:n}):null,r.length>0?(0,$.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:a?.(r,i??e.id)}):null]})}function mi({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=gr(),[a,s]=(0,Q.useState)(()=>n===void 0?null:i?.get(n)??null),c=e=>{n!==void 0&&i?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=ui(e),m=di(e,t.length),h=f!==void 0||m,g=h&&(a??(m&&li(e)));return(0,$.jsxs)(Y,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:g,onOpenChange:c,className:o(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,$.jsxs)(J,{disabled:!h,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:o(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,$.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:o(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,$.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,$.jsx)(fi,{item:e,busy:l})]}),(0,$.jsx)(q,{children:(0,$.jsx)(pi,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function hi(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function gi({item:e,cacheKey:t}){let n=gr(),[r,i]=(0,Q.useState)(()=>t===void 0?!1:n?.get(t)??!1),a=e=>{t!==void 0&&n?.set(t,e),i(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=hi(e);return(0,$.jsxs)(Y,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:a,className:o(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,$.jsxs)(J,{className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] hover:bg-muted`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,$.jsx)(kn,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,$.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,$.jsx)(`span`,{"data-slot":`hook-exit`,className:`rounded-full bg-danger/10 px-2 py-px font-mono text-[11px] font-semibold text-danger`,children:e.exitCode}):null]})]}),(0,$.jsx)(q,{children:(0,$.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,$.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:o(`px-3 py-2 font-mono text-xs leading-[1.7] whitespace-pre-wrap [overflow-wrap:anywhere]`,(e.kind===`error`||e.kind===`stop`)&&`text-signal-word-red`),children:e.text},t)),e.source===void 0?null:(0,$.jsx)(`p`,{"data-slot":`hook-source`,className:`px-3 pb-2 font-mono text-[11px] text-muted-foreground [overflow-wrap:anywhere]`,children:e.source}),l?(0,$.jsxs)(Y,{className:`border-t border-border`,children:[(0,$.jsxs)(J,{"data-slot":`hook-raw-toggle`,className:`group flex w-full items-center gap-1 px-3 py-1 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),`Raw output${typeof e.exitCode==`number`?` · exit ${e.exitCode}`:``}`]}),(0,$.jsxs)(q,{children:[e.stdout?(0,$.jsx)(`pre`,{"data-slot":`hook-stdout`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.stdout}):null,e.stderr?(0,$.jsx)(`pre`,{"data-slot":`hook-stderr`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-signal-word-red [overflow-wrap:anywhere]`,children:e.stderr}):null]})]}):null]})})]})}function _i({group:e,scope:t}){return(0,$.jsxs)(Y,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,$.jsxs)(J,{className:`group flex h-[34px] tabular-nums w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,$.jsx)(q,{children:(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,$.jsx)(mi,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function vi({count:e,children:t}){return(0,$.jsxs)(Y,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,$.jsxs)(J,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),sr(e)]}),(0,$.jsx)(q,{children:(0,$.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function yi({image:e}){return(0,$.jsx)(Sn,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function bi(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function xi(){let e=D(),t=he();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Si(e,t=null){let{providers:n,registered:r,providersPending:i,providersError:a,providersReady:o}=xi(),s=I(),c=hn(e),u=e.removedRunner!==void 0,d=c&&!e.runner||u,f=l(n.data,r.data),p=e.runner??(c||u?s.data?.defaultRunner:void 0)??`claude`,m=Lt(t,f,p),h=f.includes(p),g=(c?v(e.workflowDef,m,me(r.data)):[m]).filter(e=>!f.includes(e)),_=o&&(!d||s.isSuccess)&&g.length===0,y=bi({needsConfig:d,configPending:s.isPending,configError:s.isError,providersPending:i,providersError:a,canContinue:_,untouched:c,missing:g});return{runners:f,currentRunner:p,runner:m,currentRunnerConnected:h,canContinue:_,providerPending:i||d&&s.isPending,providerError:a,reason:y,runnerOverride:t!==null||!h||u?m:void 0}}function Ci(e,t,n,r,i,a,o,s,c){let l=!r&&!n&&e.model?{...i?.defaultModels,[t]:e.model}:i?.defaultModels,u=r?null:s,d=Ht(t,o,a,[u,l?.[t]]),f=Pt(u,t,o,l,a),p=Bt(f,a),m=r?``:c??e.effort??``,h=Wt(m,p);return{models:d,model:f,effortOptions:p,effort:h,mustClearStoredEffort:!r&&c===null&&m!==``&&h===``}}function wi(e,t,n,r){let i=Tt(e.steps),a=e.agentProfile??i?.profileId??`default`;return{sessionStep:i,account:n?r?.[t]??`default`:a}}function Ti(e,t,n,r,i,a,o,{model:s,effort:c,mustClearStoredEffort:l}){return{text:e.trim()?e:void 0,images:t.length?t:void 0,runner:n,model:!r&&(a!==null||i)?s:void 0,effort:!r&&(o!==null||i)?c:l?``:void 0}}function Ei(e,t,n){return!!t&&(n!==wt(t,e)||(e.agentProfile??t.profileId??`default`)!==(t.profileId??`default`))}function Di({models:e,model:t,effortOptions:n,effort:r}){return{modelLabel:e.find(e=>e.id===t)?.label??`auto`,effortLabel:n.find(e=>e.value===r)?.label??`auto`}}function Oi(e){let t=E(),n=un(e).continueRun,r=I(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(e.id);u!==e.id&&(d(e.id),a(null),s(null),l(null));let f=Si(e,i),{runners:p,canContinue:h,currentRunner:g,runner:v}=f,{sessionStep:y,account:b}=wi(e,v,v!==g,Ft().repoAccount),x=k(),S=x.data?.capabilities?.localHandoff!==!1,C=T(v,n&&!x.isPending,S?b:null),w=he(),D=r.data?.modelsLocked===!0,A=v!==g,j=Ci(e,v,A,D,r.data,C.data,w.data,o,c),{models:ee,model:te,effortOptions:ne,effort:N}=j,{modelLabel:re,effortLabel:P}=Di(j),F=M({mutationFn:({text:t,images:n})=>h?m(O(e.id),Ti(t,n,f.runnerOverride,D,A,o,c,j)):Promise.reject(Error(f.reason??`Connect an agent provider to continue.`)),onMutate:()=>O(e.id),onSuccess:(e,n,r)=>t.invalidateAfter(`continue`,r),onError:(e,n,r)=>{e instanceof _&&e.status===409&&r&&t.invalidateAfter(`continue`,r)}});return{skillRunner:v,skillAccount:b,available:n,canContinue:h,startsNewConversation:Ei(e,y,v),reason:f.reason,providerPending:f.providerPending,pills:(0,$.jsx)(`div`,{"data-slot":`follow-up-engine`,className:`session-engine-controls`,children:(0,$.jsxs)(dn,{children:[p.length>1?(0,$.jsx)(Rt,{icon:(0,$.jsx)(Ee,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:p,value:v,onPick:e=>{e!==v&&(a(e),s(null))}}):(0,$.jsx)(zt,{icon:(0,$.jsx)(Ee,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,readOnly:!0,slot:`session-runner-value`,ariaLabel:`Runner`,label:v,value:v,onPick:()=>{},options:[{value:v,label:v}]}),(0,$.jsx)(zt,{icon:(0,$.jsx)(Fe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-model-pill`,ariaLabel:`Model`,label:re,value:te,readOnly:D,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>{s(e);let t=Bt(e,C.data);N!==``&&Wt(N,t)===``&&l(``)},options:ee.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:en(v,w.data,C)}),(0,$.jsx)(zt,{icon:(0,$.jsx)(De,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-effort-pill`,ariaLabel:`Effort`,label:P,value:N,readOnly:D,disabledHint:`Effort selection is locked to native coding-agent settings.`,onPick:e=>l(e),options:ne.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]})}),continueWith:(e,t)=>F.mutateAsync({text:e,images:t})}}var ki=120,Ai=e=>e!==`pending`&&e!==`running`,ji=e=>e.kind===`tool`&&e.toolKind===`task`,Mi=e=>ji(e)&&e.parentItemId===void 0,Ni=e=>tr(e.kind)&&!(e.kind===`tool`&&e.toolKind===`plan`);function Pi(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function Fi(e){if(e.kind===`tool`)return Ii(e.title);if(e.kind===`hook`)return Ii(`${e.event} hook${e.status===`completed`?``:` ${e.status}`}`);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
6
- `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return Ii(n)}}}function Ii(e){return e.length>ki?`${e.slice(0,ki-1).trimEnd()}…`:e}function Li(e,t=!1,n=e){let r=Vi(e,e=>e.items.some(Mi));if(r===-1)return[];let i=e=>!t&&!Ai(e.status),a=e=>i(e)&&e.background===!0,o=[],s=!1;for(let t=r-1;t>=0;--t){let n=e[t].items.filter(Mi);n.length!==0&&(!s&&!n.some(i)&&(s=!0),(!s||n.some(a))&&o.unshift(...n))}let c=[...o,...e[r].items.filter(Mi)];return r!==e.length-1&&!c.some(i)?[]:c.map(r=>Ri(r,Gi(n,e,r.id),t))}function Ri(e,t,n){let r={id:e.id,title:lr(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=Pi(e);i!==void 0&&(r.agentType=i),n&&!Ai(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=Fi(t[e]);if(n!==void 0){r.activity=n;break}}return r}function zi(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Bi(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function Vi(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function Hi(e,t,n=!1,r=e){for(let i=e.length-1;i>=0;--i){let a=e[i].items.find(e=>e.id===t&&Mi(e));if(a!==void 0)return Ri(a,Gi(r,e,t),n)}}function Ui(e,t){return Vi(e,e=>e.items.some(e=>e.id===t&&Mi(e)))}function Wi(e,t,n){let r=[];for(let i=n;i<e.length;i+=1){let n=e[i];for(let e of n.items)Ni(e)&&e.parentItemId===t&&e.id!==t&&r.push({entry:e,seqs:n.itemSeqs?.get(e.id)})}return r}function Gi(e,t,n){let r=Ui(t,n);if(r===-1)return[];let i=Wi(t,n,r);if(e===t)return i.map(({entry:e})=>e);let a=t[r].itemSeqs?.get(n)?.first,o=e=>a===void 0||e.seqs===void 0||e.seqs.first>a,s=new Map;for(let t of Wi(e,n,Math.max(Ui(e,n),0)))o(t)&&!s.has(t.entry.id)&&s.set(t.entry.id,t);for(let e of i){let t=s.get(e.entry.id);s.set(e.entry.id,t===void 0?e:Ki(t,e))}return[...s.values()].sort(qi).map(({entry:e})=>e)}function Ki(e,t){return e.seqs===void 0||t.seqs===void 0?e:{entry:(t.seqs.last>e.seqs.last?t:e).entry,seqs:{first:Math.min(e.seqs.first,t.seqs.first),last:Math.max(e.seqs.last,t.seqs.last)}}}function qi(e,t){return e.seqs===void 0||t.seqs===void 0?0:e.seqs.first-t.seqs.first}function Ji(e,t){if(e.kind===`entry`){let n=e.entry;return n.kind===`message`&&n.role===`assistant`?[{messageKey:`${t}:${n.id}`,text:n.text}]:[]}return e.kind===`tool-card`?dr(e.children).flatMap(n=>Ji(n,`${t}:${e.id}`)):e.kind===`streak`?e.blocks.flatMap(e=>Ji(e,t)):[]}function Yi(e){return e.flatMap((e,t)=>e.content.kind===`block`?Ji(e.content.block,e.scope).map(n=>({...n,rowKey:e.key,rowIndex:t})):[])}function Xi(e,t,n,r){let i=(0,Q.useContext)(yn),{projectId:a}=se(),o=(0,Q.useMemo)(()=>Yi(t),[t]);(0,Q.useLayoutEffect)(()=>{if(!i)return;let t=[],s={runId:e,...a?{projectId:a}:{}};for(let e of o){let a=Xn(e.text,s);for(let e of a)t.push(i.register(e.artifactId,e.runId));r===`document`&&a.length>0&&t.push(i.registerOpener(e.messageKey,(t,r)=>{let i=Zn(e.messageKey,t);n.jumpToRow(e.rowKey,e.rowIndex,e=>[...e.querySelectorAll(`[id]`)].find(e=>e.id===i)??null,r)}))}return()=>{for(let e of t)e()}},[i,o,e,a,r,n.jumpToRow])}function Zi(e){let t=S();return M({mutationFn:t=>u(e,t),retry:!1,networkMode:`always`,onSettled:()=>{t.invalidateQueries({queryKey:R.runs.all})}})}var Qi=e=>(window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}),$i=()=>navigator.onLine;function ea({permission:e,runId:t,sessionOpen:n=!1}){return e.status!==`pending`||!n?(0,$.jsx)(na,{permission:e,state:e.status===`resolved`?`resolved`:`expired`}):(0,$.jsx)(ta,{permission:e,runId:t},e.requestId)}function ta({permission:e,runId:t}){let n=Zi(t),r=(0,Q.useSyncExternalStore)(Qi,$i,()=>!1),i=(0,Q.useRef)(!1),[a,o]=(0,Q.useState)(`pending`),[s,c]=(0,Q.useState)(),[l,u]=(0,Q.useState)(),d=async t=>{if(!(i.current||!r||a!==`pending`)){i.current=!0,o(`sending`),u(void 0);try{await n.mutateAsync({requestId:e.requestId,optionId:t}),c(t),o(`resolved`)}catch(e){e instanceof _&&e.status===409?o(`expired`):(u(e instanceof Error?e.message:String(e)),o(`pending`))}finally{i.current=!1}}};return(0,$.jsx)(na,{permission:{...e,...s===void 0?{}:{optionId:s}},state:a,offline:!r,error:l,onSelect:e=>{d(e)}})}function na({permission:e,state:t,offline:n=!1,error:r,onSelect:i}){let a=(0,Q.useId)(),o=e.options.find(t=>t.id===e.optionId),s=t!==`pending`||n||!i,c=t===`expired`?`Approval expired. This session can no longer accept a decision.`:t===`resolved`?`Decision sent: ${o?.label??`Recorded`}.`:t===`sending`?`Sending decision…`:n?`Offline. Reconnect to send a decision.`:`Choose an option to respond to this permission request.`;return(0,$.jsxs)(`section`,{"data-slot":`permission-card`,"data-request-id":e.requestId,"data-state":n&&t===`pending`?`offline`:t,"aria-labelledby":a,"aria-busy":t===`sending`,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 text-sm [overflow-wrap:anywhere]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Permission request`}),(0,$.jsx)(`h3`,{id:a,className:`font-semibold whitespace-pre-wrap`,children:e.title})]}),e.details?(0,$.jsx)(`pre`,{className:`min-w-0 font-mono text-xs leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.details}):null,(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":a,className:`flex min-w-0 flex-col gap-2`,children:e.options.map(t=>(0,$.jsx)(K,{type:`button`,variant:`outline`,disabled:s,"aria-pressed":e.optionId===t.id,className:`h-auto min-h-11 min-w-0 max-w-full justify-start py-2 text-start whitespace-normal [overflow-wrap:anywhere] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,onClick:()=>i?.(t.id),children:t.label},t.id))}),(0,$.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[c,e.reason?` ${e.reason}`:``]}),r&&t===`pending`?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r}):null]})}function ra(e,t){if(e.length===1)return[t.replace(RegExp(`^${ia(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function ia(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function aa(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}function oa({ask:e}){let t=e.answer===void 0?void 0:ra(e.questions,e.answer);return(0,$.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((n,r)=>{let i=t?.[r],a=aa(n,i),o=i!==void 0&&a.length===0;return(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":n.question,children:[(0,$.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[n.header,` · Question `,r+1,` of `,e.questions.length]}),(0,$.jsx)(`p`,{className:`break-words font-semibold`,children:n.question}),n.options?(0,$.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[n.options.map(e=>(0,$.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,$.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,$.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,$.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,$.jsx)(sa,{text:i}):null]})]}):i===void 0?null:(0,$.jsx)(sa,{text:i})]},n.id??r)}),!t&&e.answer!==void 0?(0,$.jsx)(sa,{text:e.answer}):null]})}function sa({text:e}){return(0,$.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}var ca=(0,Q.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function la(e,t){let n={};for(let e of t??[])n[e.id]=e.currentStepBackend??e.runner;return n[e.id]=e.steps.find(t=>t.id===e.currentStepId)?.backend??e.runner,n}function ua(e,t,n=[]){let r={};for(let e of n)r[e.id]=Z(e);for(let e of t??[])r[e.id]=Z(e);return r[e.id]=Z(e),r}function da(e,t){return t?.[e]??`Task`}function fa(e,t,n){return t?n?.[e]??`peer task`:da(e,n)}function pa(e,t){return e.senderRunId===t?`outbound`:`inbound`}function ma(e){return e?.relationship===`peer`}function ha(e){switch(e){case`request`:return`Request`;case`progress`:return`Progress`;case`follow-up`:return`Follow-up`;case`reply`:return`Reply`}}function ga(e){switch(e){case`pending`:return`Pending`;case`replied`:return`Replied`;case`replied-late`:return`Replied late`;case`timed-out`:return`Timed out`;case`cancelled`:return`Cancelled`;case`completed-without-reply`:return`Completed without reply`;case`failed`:return`Failed`;case`destroyed`:return`Destroyed`;case`sender-closed`:return`Sender closed`;case`human-fallback`:return`Sent to a human`;case`deleted`:return`Recipient deleted`}}function _a(e){if(e.outcome)return ga(e.outcome.status);if(e.delivery===`not-delivered`)return va(`not-delivered`)}function va(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`consumed`:return`Read`;case`not-delivered`:return`Not delivered`}}function ya(e,t){return e.instruction===void 0?e.delivery===`queued`?`${t?`Queued for delivery. This agent can receive messages during its current turn.`:`Queued for delivery. Timing depends on the recipient agent.`} Pending messages are batched within the size limit; human questions and scheduler capacity can delay delivery.`:e.state===`continuation-required`?ma(e)?`Not delivered. The recipient is not running. Only its human can continue it.`:`Not delivered. The recipient needs a new instruction to resume. A parent can resume its owned worker with ${Qt()} worker resume; workers cannot resume parents.`:e.state===`destroyed`?`Not delivered. This worker was destroyed.`:void 0:e.instruction}function ba({id:e,peer:t,taskTitles:n,children:r}){return!t||n?.[e]!==void 0?r({title:da(e,n),linkable:!0}):(0,$.jsx)(xa,{id:e,children:r})}function xa({id:e,children:t}){let n=z(e);return n.data?t({title:Z(n.data),linkable:!0}):n.isPending?t({title:`Peer task`,linkable:!1}):t({title:n.error instanceof _&&n.error.status===404?`Deleted task`:`Task unavailable`,linkable:!1})}var Sa={outbound:{classes:`border-message-outbound-border bg-message-outbound-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-outbound-accent`,accent:`text-message-outbound-accent`},inbound:{classes:`border-message-inbound-border bg-message-inbound-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-inbound-accent`,accent:`text-message-inbound-accent`},peer:{classes:`border-message-peer-border bg-message-peer-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-peer-accent`,accent:`text-message-peer-accent`}},Ca=`inline-flex min-h-11 max-w-full items-center break-words underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;function wa({block:e,runId:t,taskTitles:n,recipientBackends:r}){return(0,$.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,$.jsx)(Ta,{batch:e,runId:t,taskTitles:n,recipientBackends:r},e.id))})}function Ta({batch:e,runId:t,taskTitles:n,recipientBackends:r}){let i=pa(e.messages[0]??{senderRunId:e.senderRunId},t),a=ma(e.messages[0]),s=Sa[a?`peer`:i],c=Pa(e.messages.map(e=>i===`outbound`?e.recipientRunId:e.senderRunId)),l=i===`outbound`?`SENT to`:`RECEIVED from`,u=`${l} ${c.map(e=>fa(e,a,n)).join(`, `)}`,d=e.messages[0],f=d?.createdAt??d?.recordedAt;return(0,$.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":i,"data-relationship":a?`peer`:`family`,"data-kind":e.kind,className:o(`flex w-full min-w-0 flex-col gap-2 rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes),children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`p`,{className:o(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,$.jsx)(`span`,{children:l}),c.map((e,t)=>(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,$.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,$.jsx)(ba,{id:e,peer:a,taskTitles:n,children:t=>(0,$.jsx)(Aa,{view:t,to:`/tasks/${e}`,label:`${l} ${t.title}`})})]},e))]}),a?(0,$.jsx)(`span`,{"data-slot":`conversation-relationship`,className:`rounded-full border border-message-peer-border px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:`Peer`}):null,(0,$.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:ha(e.kind)}),e.messages.length===1&&d?(0,$.jsx)(Da,{message:d}):null]}),(0,$.jsx)(Ea,{at:f,className:`flex shrink-0 items-center justify-self-end gap-1 whitespace-nowrap text-[11px] text-soft-foreground`,children:e.messages.length>1?`First sent`:null})]}),(0,$.jsx)(ka,{batch:e},`${t}:${d?.messageId??e.id}`),[...new Set(e.messages.map(e=>ya(e,r?.[e.recipientRunId])))].map(e=>e?(0,$.jsx)(`p`,{"data-slot":`conversation-delivery-explanation`,className:`min-w-0 text-xs leading-relaxed text-muted-foreground [overflow-wrap:anywhere]`,children:e},e):null),e.kind===`request`&&e.messages.length>1?(0,$.jsx)(Oa,{messages:e.messages,peer:a,runId:t,taskTitles:n}):null,e.messages.length===1&&d?(0,$.jsx)(ja,{message:d,runId:t,taskTitles:n}):null,(0,$.jsx)(Ma,{batch:e,heading:u})]})}function Ea({at:e,className:t,children:n}){return e===void 0||Ir(e)===void 0?null:(0,$.jsxs)(`span`,{className:t,children:[n,(0,$.jsx)(Hr,{ts:e})]})}function Da({message:e}){let t=_a(e),n=va(e.delivery),r=(e.messageKind===`request`||e.messageKind===`reply`)&&n!==t;return(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:t}):null,r?(0,$.jsx)(`span`,{"data-slot":`conversation-delivery`,className:`text-xs text-muted-foreground`,children:n}):null]})}function Oa({messages:e,peer:t,runId:n,taskTitles:r}){return(0,$.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.map(e=>{let i=_a(e),a=e.createdAt??e.recordedAt;return(0,$.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(ba,{id:e.recipientRunId,peer:t,taskTitles:r,children:t=>(0,$.jsx)(Aa,{view:t,to:`/tasks/${e.recipientRunId}`,label:`${t.title}${i?` — ${i}`:``}`})}),i?(0,$.jsx)(`span`,{"data-slot":`conversation-outcome`,children:i}):null,va(e.delivery)===i?null:(0,$.jsx)(`span`,{"data-slot":`conversation-delivery`,children:va(e.delivery)}),(0,$.jsx)(ja,{message:e,runId:n,taskTitles:r}),(0,$.jsx)(Ea,{at:a,className:`ml-auto whitespace-nowrap`})]},e.id)})})}function ka({batch:e}){let t=gr(),n=`conversation-body:${e.messages[0]?.messageId??e.id}`,[r,i]=(0,Q.useState)(()=>t?.get(n)??!1),a=(0,$.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,$.jsx)(En,{breaks:!0,children:e.text})});return e.kind!==`request`&&e.kind!==`reply`?a:(0,$.jsxs)(Y,{"data-slot":`conversation-body`,open:r,onOpenChange:e=>{t?.set(n,e),i(e)},className:`min-w-0`,children:[(0,$.jsxs)(J,{type:`button`,"data-slot":`conversation-body-toggle`,className:`group/body inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-md px-2 text-start text-xs font-medium text-muted-foreground [@media(hover:hover)_and_(pointer:fine)]:hover:bg-background/40 [@media(hover:hover)_and_(pointer:fine)]:hover:text-foreground active:bg-background/60 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:`size-3.5 shrink-0 group-data-[state=open]/body:rotate-90`}),r?`Hide message`:`Show message`]}),(0,$.jsx)(q,{children:a})]})}function Aa({view:e,to:t,label:n}){return e.linkable?(0,$.jsx)(X,{className:Ca,to:t,"aria-label":n,children:e.title}):(0,$.jsx)(`span`,{"data-slot":`conversation-counterpart`,children:e.title})}function ja({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,Q.useContext)(ca),s=e.requestId?r.get(e.requestId):void 0,c=e.requestId?s?[s]:[]:i.get(e.messageId)??[],l=e.requestId?`request`:`reply`;return c.length===0?e.requestId||e.outcome?.replyId?(0,$.jsxs)(`p`,{"data-slot":`conversation-connector`,className:`text-xs text-muted-foreground`,children:[`Linked `,l,` is outside loaded history.`]}):null:c.map(e=>{let r=pa(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:o(Ca,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),(0,$.jsx)(ba,{id:i,peer:ma(e.message),taskTitles:n,children:e=>(0,$.jsxs)($.Fragment,{children:[`View `,l,` `,r?`to`:`from`,` `,e.title]})})]},e.message.messageId)})}function Ma({batch:e,heading:t}){return(0,$.jsxs)(Y,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,$.jsxs)(J,{type:`button`,className:`inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-md px-2 text-left text-xs font-medium text-muted-foreground hover:bg-background/40 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,$.jsx)(W,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,$.jsx)(q,{children:(0,$.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>Na(e)).map((e,t)=>(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,$.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function Na(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},...ma(e)?[{label:`Relationship`,value:`peer`}]:[],{label:`Delivery`,value:va(e.delivery)}];return e.requestId&&t.push({label:`Request`,value:e.requestId}),e.outcome?.replyId&&t.push({label:`Reply`,value:e.outcome.replyId}),e.state&&t.push({label:`State`,value:e.state}),e.createdAt&&t.push({label:`Created`,value:e.createdAt}),e.deliveredAt&&t.push({label:e.resumed?`Opening turn completed`:`Delivery acknowledged`,value:e.deliveredAt}),e.recordedAt&&t.push({label:`Event recorded`,value:e.recordedAt}),e.resumed&&t.push({label:`Continuation`,value:`Requested by parent with this instruction`}),e.deadline&&t.push({label:`Deadline`,value:e.deadline}),e.requestHash&&t.push({label:`Hash`,value:e.requestHash}),t}function Pa(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var Fa=e(n(),1),Ia=`pending-ask`;function La(e){return e.querySelector(`[data-slot="ask-question"] :is(button, textarea):not(:disabled)`)||(e.tabIndex=-1,e)}function Ra(e){let t=e.querySelector(`[data-slot="ask-card"][data-pinned="true"]`);return t?La(t):null}function za(e,t){let n=`${Ia}:${e}`;return e=>{if(!t())return!1;let r=[...e.querySelectorAll(`[data-row-key]`)].find(e=>e.dataset.rowKey===n);return r?Ra(r):null}}function Ba(e){return e<=0?`Jump to latest`:`Jump to latest (${e} ${e===1?`question`:`questions`} pending)`}function Va({onGoToQuestion:e}){return(0,$.jsxs)(`div`,{"data-slot":`ask-origin`,className:`flex flex-wrap items-center gap-x-2 rounded-lg border border-dashed border-accent-strong/40 px-3.5 py-1 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`font-medium text-link-foreground`,children:`Question asked here`}),(0,$.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-go-to-question`,className:`min-h-11 min-w-11 px-2 text-foreground underline underline-offset-4`,onClick:e,children:`Go to the question`})]})}var Ha={viewKey:void 0,generation:0},Ua=600,Wa=24;function Ga(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,Q.useRef)(e);o.current=e;let c=(0,Q.useRef)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(!0),m=(0,Q.useRef)(0),h=(0,Q.useRef)(0),g=(0,Q.useRef)(new Set),_=(0,Q.useCallback)(e=>{for(let t of[...g.current])t(e)},[]),v=(0,Q.useCallback)(e=>(g.current.add(e),()=>{g.current.delete(e)}),[]),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C=(0,Q.useCallback)(e=>{let t=c.current;if(!t)return;let n=S.current;n?n.scrollTo(e):t.scrollTop=e},[]),w=(0,Q.useCallback)(()=>{let e=c.current;e&&C(e.scrollHeight-e.clientHeight)},[C]),T=(0,Q.useCallback)(()=>{if(c.current){if(x.current!==e){x.current=e;let t=Tr(e);t&&!t.atBottom?(p.current=!1,y.current=t.top,b.current=Or(e)?.rowKeys?{viewKey:e,top:t.top}:null):(p.current=!0,y.current=null,b.current=null)}y.current===null?p.current&&w():C(y.current)}},[e,C,w]),E=(0,Q.useCallback)(e=>b.current?.viewKey===e,[]),D=(0,Q.useCallback)(e=>{let t=b.current;return!t||!E(e)||e!==o.current?!1:(y.current=t.top,p.current=!1,b.current=null,!0)},[E]),O=(0,Q.useCallback)(e=>{u(e),e&&(c.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),T())},[n,T]),k=(0,Q.useCallback)(()=>{p.current&&w()},[w]),A=(0,Q.useRef)(!1),j=(0,Q.useRef)(0),ee=(0,Q.useRef)(!1),te=(0,Q.useRef)(void 0),M=(0,Q.useRef)(!1),ne=(0,Q.useRef)(!1),N=(0,Q.useRef)(a);N.current=a;let re=(0,Q.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),P=(0,Q.useRef)(null),F=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(!s())return;let e=e=>{y.current=null,b.current=null,F.current+=1,P.current=null,p.current=!1,C(e)};return window.__cezThreadScrollTo=e,()=>{window.__cezThreadScrollTo===e&&delete window.__cezThreadScrollTo}},[C]);let ie=(0,Q.useCallback)(()=>{let e=P.current,t=c.current;if(!e||!t)return;P.current=null;let n=e.beforeTop+Math.max(0,t.scrollHeight-e.beforeHeight),r=t.getBoundingClientRect().top,i=e.anchor===void 0?-1:N.current.indexOf(e.anchor.key),a=S.current;a&&i>=0?a.scrollToIndex(i,{align:`start`,offset:-e.anchor.offset}):C(br(t.scrollTop,r,e.anchor,re(t),n))},[re,C]),I=(0,Q.useCallback)(()=>{let e=c.current;if(!e||!r||A.current)return;y.current=null,b.current=null,p.current=!1,A.current=!0;let t=j.current+1;j.current=t;let n=e.scrollHeight,i=e.scrollTop,a=e.getBoundingClientRect().top,s=yr(a,re(e)),l=s===void 0?-1:N.current.indexOf(s.key),u=o.current,d=F.current;r().then(()=>{o.current===u&&F.current===d&&(P.current={beforeHeight:n,beforeTop:i,anchor:s,anchorIndex:l})},()=>{}).finally(()=>{j.current===t&&(A.current=!1)})},[re,r]);(0,Q.useEffect)(()=>()=>clearTimeout(te.current),[]);let L=(0,Q.useRef)(null),R=(0,Q.useRef)(0),z=(0,Q.useCallback)(()=>n===`document`?++Ha.generation:++R.current,[n]),B=(0,Q.useCallback)((e,t)=>n===`document`?Ha.viewKey===e&&Ha.generation===t:o.current===e&&R.current===t,[n]);(0,Q.useEffect)(()=>()=>L.current?.disconnect(),[e,l]);let ae=(0,Q.useCallback)((t,n,r,i)=>{let a=c.current;if(!a||!l)return;y.current=null,b.current=null,F.current+=1,P.current=null,p.current=!1,m.current=0,f(!0),z(),L.current?.disconnect();let o=()=>[...l.querySelectorAll(`[data-row-key]`)].find(e=>e.dataset.rowKey===t),s=()=>{let e=o();if(!e||getComputedStyle(e).visibility===`hidden`)return!1;let t=r?.(e)??e;return t===e&&(e.tabIndex=-1),t.focus({preventScroll:!0}),document.activeElement===t?(L.current?.disconnect(),!0):!1},u=a.querySelector(`[data-slot="run-header"]`),d=u&&getComputedStyle(u).position===`sticky`?u.getBoundingClientRect().height:0,h=S.current;if(i!==void 0)C(i);else if(h)h.scrollToIndex(n,{align:`start`,...d>0?{offset:-d}:{}});else{let e=o();e&&C(a.scrollTop+e.getBoundingClientRect().top-a.getBoundingClientRect().top-d)}s()||(L.current=new MutationObserver(()=>{s()}),L.current.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`]})),wr(e,{top:i??a.scrollTop,atBottom:!1})},[l,C,e,z]),oe=(0,Q.useCallback)(t=>{let n=z(),r=o.current;L.current?.disconnect();let a=c.current;if(!a)return;y.current=null,b.current=null,F.current+=1,P.current=null,p.current=!0,h.current=0,_({direction:`tail`}),wr(e,{top:a.scrollHeight-a.clientHeight,atBottom:!0});let s=()=>{p.current&&w()},l=()=>B(r,n),u=()=>{let e=t?.(a);return e===!1?!0:e?(e.focus({preventScroll:!0}),document.activeElement===e):!1};(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{s(),requestAnimationFrame(()=>{if(s(),!t||!l()||u())return;L.current?.disconnect();let e=new MutationObserver(()=>{l()?u()&&e.disconnect():e.disconnect()});L.current=e,e.observe(a,{childList:!0,subtree:!0})})})})},[i,e,w,z,B,_]),se=a.at(-1),V=a.length;return(0,Q.useLayoutEffect)(()=>{F.current+=1,P.current=null,A.current=!1,n===`document`?Ha.viewKey!==e&&(Ha.viewKey=e,Ha.generation+=1):R.current+=1},[e,n]),(0,Q.useLayoutEffect)(()=>{let e=P.current;e?(e.anchor===void 0?-1:N.current.indexOf(e.anchor.key))>e.anchorIndex?ie():P.current=null:p.current&&w()},[se,V,ie,w]),(0,Q.useLayoutEffect)(()=>{!c.current||!l||T()},[l,T]),(0,Q.useEffect)(()=>{let t=c.current,n=l;if(!t||!n)return;m.current=0;let r=null,i=!1,a=t.scrollTop,o,s=0,u,d=e=>{h.current=Date.now(),u=e},g=()=>{z(),L.current?.disconnect(),y.current=null,b.current=null,F.current+=1,P.current=null,p.current=!1,m.current=0},v=()=>{y.current=null,b.current=null,F.current+=1,P.current=null,m.current=Date.now()},x=e=>{if(e.deltaY!==0)if(d(e.deltaY<0?`up`:`down`),e.deltaY<0){g();let e=!ee.current;ee.current=!0,clearTimeout(te.current),te.current=setTimeout(()=>{ee.current=!1},180),e&&vr(t)&&I()}else v()},S=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(d(`up`),g(),!e.repeat&&vr(t)&&I()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&(d(`down`),v())},T=e=>{if(e.target!==t||e.button!==0||e.pointerType===`touch`||e.pointerType===`pen`||t.scrollHeight<=t.clientHeight)return;i=!0,ne.current=!1,a=t.scrollTop;let n=t.getBoundingClientRect(),r=getComputedStyle(t),o=parseFloat(r.borderLeftWidth)||0,s=parseFloat(r.borderRightWidth)||0,c=n.left+t.clientLeft,l=c+t.clientWidth;!(e.clientX>=n.left+o&&e.clientX<c||e.clientX>=l&&e.clientX<n.right-s)||e.clientY<n.top+t.clientTop||e.clientY>=n.top+t.clientTop+t.clientHeight||(y.current=null,b.current=null,xr(t,80)||(g(),v()))},D=()=>{i=!1},O=e=>{M.current=!1,r=e.touches[0]?.clientY??null},k=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(r!==null&&n>r+1?(d(`up`),g(),!M.current&&vr(t)&&(M.current=!0,I())):r!==null&&n<r-1&&(d(`down`),v()),r=n)},A=e=>{if(e===0||!i&&Date.now()-h.current>=Ua)return;let n=e<0?`up`:`down`;!i&&n!==u||(n!==o&&(o=n,s=0),s+=Math.abs(e),s>=Wa&&(0,Fa.flushSync)(()=>_({direction:n,distanceFromBottom:t.scrollHeight-t.clientHeight-t.scrollTop})))},j=()=>{let n=p.current;A(t.scrollTop-a),i&&t.scrollTop!==a&&(t.scrollTop<a?g():v()),i&&!ne.current&&t.scrollTop<a&&vr(t)&&(ne.current=!0,I()),a=t.scrollTop;let r=xr(t,80);r&&y.current===null&&(p.current||Date.now()-m.current<2e3)&&(p.current=!0),!n&&p.current&&_({direction:`tail`}),f(!r),y.current===null&&!E(e)&&wr(e,{top:t.scrollTop,atBottom:r})};t.addEventListener(`scroll`,j,{passive:!0}),t.addEventListener(`wheel`,x,{passive:!0}),t.addEventListener(`touchstart`,O,{passive:!0}),t.addEventListener(`touchmove`,k,{passive:!0}),t.addEventListener(`pointerdown`,T,{passive:!0}),window.addEventListener(`pointerup`,D,{passive:!0}),window.addEventListener(`pointercancel`,D,{passive:!0}),t.addEventListener(`keydown`,S);let N;if(typeof ResizeObserver<`u`){N=new ResizeObserver(()=>{let e=y.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;C(Math.min(e,n)),n>=e&&(y.current=null)}else p.current&&w()}),N.observe(n);let e=n.closest(`[data-route="task-thread"]`),r=e?.querySelector(`[data-slot="run-header"]`),i=e?.querySelector(`[data-slot="thread-dock"]`);r&&N.observe(r),i&&N.observe(i)}return()=>{t.removeEventListener(`scroll`,j),t.removeEventListener(`wheel`,x),t.removeEventListener(`touchstart`,O),t.removeEventListener(`touchmove`,k),t.removeEventListener(`pointerdown`,T),window.removeEventListener(`pointerup`,D),window.removeEventListener(`pointercancel`,D),t.removeEventListener(`keydown`,S),N?.disconnect()}},[e,l,I,C,w,E,z,_]),{attachContent:O,scrollElRef:c,virtualizerRef:S,restoreMeasurements:D,ownsMeasurementRestore:E,pillVisible:d,jumpToLatest:oe,jumpToRow:ae,loadOlder:I,restickIfStuck:k,subscribeReaderScroll:v}}function Ka({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,$.jsx)(qa,{runId:e,rows:t,controls:r}):(0,$.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,className:`[overflow-anchor:none]`,children:t.map(e=>(0,$.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function qa({runId:e,rows:t,controls:n}){return(0,$.jsx)(Ja,{runId:e,rows:t,controls:n},e)}function Ja({runId:e,rows:t,controls:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(t),a=t[0]?.key,o=i.current[0]?.key,s=a!==o&&(t.some(e=>e.key===o)||i.current.some(e=>e.key===a));(0,Q.useLayoutEffect)(()=>{i.current=t},[t]);let[c]=(0,Q.useState)(()=>Or(e)),[l,u]=(0,Q.useState)(()=>({cache:kr(e,t.length,t.map(e=>e.key)),generation:0})),d=(0,Q.useRef)(l.cache===void 0&&c?.rowKeys?.length===c?.rows&&c!==void 0);(0,Q.useLayoutEffect)(()=>{let r=c?.rowKeys;if(!d.current){n.restoreMeasurements(e);return}if(!(!c||!r)){if(t.length>c.rows||t.some((e,t)=>e.key!==r[t])){d.current=!1,n.restoreMeasurements(e);return}t.length===c.rows&&(d.current=!1,n.restoreMeasurements(e)&&u({cache:c.cache,generation:1}))}},[c,t,n.restoreMeasurements,e]);let f=(0,Q.useRef)(t.length);f.current=t.length;let p=(0,Q.useRef)(t.map(e=>e.key));p.current=t.map(e=>e.key);let m=(0,Q.useRef)(null),h=(0,Q.useCallback)(t=>{n.virtualizerRef.current=t,t?m.current=t:m.current&&=(d.current&&c?.rowKeys&&f.current<c.rows&&n.ownsMeasurementRestore(e)||Dr(e,{rows:f.current,cache:m.current.cache,rowKeys:p.current}),null)},[e,n.virtualizerRef,n.ownsMeasurementRestore,c]),[g,_]=(0,Q.useState)(0);return(0,Q.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||_(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,$.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,className:`[overflow-anchor:none]`,children:(0,$.jsx)(mn,{ref:h,scrollRef:n.scrollElRef,startMargin:g,shift:s,...l.cache===void 0?{}:{cache:l.cache},children:t.map(e=>(0,$.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))},l.generation)})}function Ya({onJump:e,pendingQuestions:t=0}){return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,"data-pending-questions":t>0?t:void 0,onClick:()=>e(),className:`pointer-events-auto inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-3.5`}),Ba(t)]})}function Xa(e){return e.consumedAt?`consumed`:e.deliveredAt?`delivered`:`queued`}function Za(e,t){let n=new Map((e.agentInputs??[]).map(e=>[e.id,Xa(e)]));if(n.size===0)return t;let r=!1,i=t.map(e=>{if(e.kind!==`note`||!e.id.startsWith(`agent-input:`))return e;let t=n.get(e.id.slice(12));return!t||e.delivery===t?e:(r=!0,{...e,delivery:t})});return r?i:t}function Qa(e,t,n){return e.kind===`ask`?e.id===t?n===void 0?e:{...e,placement:`origin`}:e.resolved?e:{...e,resolved:!0}:e}var $a=new WeakMap;function eo(e,t){let n=$a.get(e);return n?.length===t.length&&t.every((e,t)=>{let r=n[t];return e===r||Object.keys(e).length===Object.keys(r).length&&Object.entries(e).every(([e,t])=>t===r[e])})?n:($a.set(e,t),t)}function to(e,t,n=t,r){let i=r==null?void 0:n.turns.flatMap(e=>e.items).find(e=>e.kind===`ask`&&e.id===r&&!e.resolved),a=new Map(n.turns.flatMap(e=>e.items).filter(e=>e.kind===`permission`).map(e=>[e.requestId,e])),o=new Set,s=new Set(t.turns.map(e=>e.userMessage?.ask?.id)),c=[];e.task&&c.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[],ts:e.createdAt},entries:[]});for(let t of e.queuedMessages??[])c.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[],ts:t.createdAt},inDaySequence:!1,entries:[]});for(let n of t.turns)c.push({id:n.id,userMessageKey:`${n.id}:user`,...n.userMessage===void 0?{}:{userMessage:{text:n.userMessage.text,ask:n.userMessage.ask,imageCount:n.userMessage.imageCount,images:n.userMessage.images,...n.userMessage.ts===void 0?{}:{ts:n.userMessage.ts}}},...n.startedAt===void 0?{}:{startedAt:n.startedAt},...n.completed?.ts===void 0?{}:{completedAt:n.completed.ts},entries:eo(n.items,Za(e,n.items.filter(t=>!e.task||!lt(t,`opening`)).map(e=>e.kind===`ask`&&s.has(e.id)?{...e,placement:`origin`}:r!==void 0&&e.kind===`ask`?Qa(e,r,i):e.kind===`permission`?(o.add(e.requestId),a.get(e.requestId)??(e.status===`pending`?{...e,status:`expired`}:e)):e)))});let l=[...a.values()].filter(e=>e.status===`pending`&&!o.has(e.requestId));return l.length>0&&c.push({id:`pending-permissions`,entries:l,inDaySequence:!1}),i!==void 0&&c.push({id:Ia,entries:[{...i,placement:`pinned`}],inDaySequence:!1}),c}function no(e,t,n){let r=e.findIndex(({content:e})=>e.kind===`block`&&e.block.kind===`entry`&&e.block.entry.kind===`ask`&&e.block.entry.id===t&&e.block.entry.placement===n);return r<0?void 0:{key:e[r].key,index:r}}function ro(e,t){return[{id:`agent:${e}`,entries:t}]}function io(e){if(e.inDaySequence!==!1)return e.userMessage?.ts??e.startedAt??e.completedAt}function ao(e,t){let n=[],r;for(let t of e){let e=io(t),i=zr(e);i!==void 0&&e!==void 0&&(r===void 0||i>r)&&(r!==void 0&&n.push({key:`${t.id}:day-separator`,scope:t.id,content:{kind:`day-separator`,ts:e}}),r=i),t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of dr(t.entries))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}});t.completedAt!==void 0&&n.push({key:`${t.id}:turn-time`,scope:t.id,content:{kind:`turn-time`,completedAt:t.completedAt,...t.startedAt===void 0?{}:{startedAt:t.startedAt}}})}return n}function oo({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,renderPermission:o,messageActions:s,scrollControls:c,renderMode:l,taskTitles:u,recipientBackends:d}){let f=(0,Q.useMemo)(()=>ao(n,e),[n,e]),p=Ga(`${e}:${t}`,{surface:r}),m=c??p;Xi(e,f,m,r);let h=(0,Q.useMemo)(()=>{let e=new Map;f.forEach((t,n)=>{if(!(t.content.kind!==`block`||t.content.block.kind!==`worker-conversation`))for(let r of t.content.block.batches)for(let i of r.messages)e.set(i.messageId,{message:i,rowKey:t.key,rowIndex:n})});let t=new Map;for(let n of e.values()){let{message:e}=n;if(e.messageKind!==`reply`||!e.requestId)continue;let r=t.get(e.requestId)??[];r.push(n),t.set(e.requestId,r)}return{targets:e,replies:t,navigate:e=>m.jumpToRow(e.rowKey,e.rowIndex)}},[f,m.jumpToRow]),g=(0,Q.useMemo)(()=>f.map(t=>({key:t.key,node:so(t,s?.[t.key],a,o,e,u,d)})),[s,a,o,f,e,u,d]),_=l??Sr(``,g.length),v=g.length===0?i??null:(0,$.jsx)(Ka,{runId:`${e}:${t}`,rows:g,mode:_,controls:m});return(0,$.jsx)(Ve,{runId:e,children:(0,$.jsx)(_r,{runId:e,children:(0,$.jsx)(ca.Provider,{value:h,children:r===`panel`?(0,$.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,$.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:v}),m.pillVisible?(0,$.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,$.jsx)(Ya,{onJump:m.jumpToLatest})}):null]}):v})})})}function so(e,t,n,r,i,a,o){switch(e.content.kind){case`user-message`:return(0,$.jsx)(co,{message:e.content.message,actions:t});case`day-separator`:return(0,$.jsx)(Wr,{ts:e.content.ts});case`turn-time`:return(0,$.jsx)(Ur,{completedAt:e.content.completedAt,...e.content.startedAt===void 0?{}:{startedAt:e.content.startedAt}});case`block`:return(0,$.jsx)(lo,{block:e.content.block,scope:e.scope,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o});default:return mo(e.content)}}function co({message:e,actions:t}){return(0,$.jsx)(qr,{text:e.text,imageCount:e.imageCount,images:e.images,...e.ts===void 0?{}:{ts:e.ts},onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel,children:e.ask?(0,$.jsx)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,children:(0,$.jsx)(oa,{ask:e.ask})}):void 0})}function lo({block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){switch(e.kind){case`entry`:return(0,$.jsx)(Yn.Provider,{value:`${t}:${e.entry.id}`,children:(0,$.jsx)(fo,{entry:e.entry,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o})});case`tool-card`:return(0,$.jsx)(mi,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,$.jsx)(uo,{entries:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o})});case`context-group`:return(0,$.jsx)(_i,{group:e,scope:t});case`streak`:return(0,$.jsx)(vi,{count:e.count,children:e.blocks.map(e=>(0,$.jsx)(lo,{block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o},e.id))});case`worker-conversation`:return(0,$.jsx)(wa,{block:e,runId:i,taskTitles:a,recipientBackends:o});default:return mo(e)}}function uo({entries:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){return dr(e).map(e=>(0,$.jsx)(lo,{block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o},e.id))}function fo({entry:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){switch(e.kind){case`message`:return e.role===`assistant`?(0,$.jsx)(Qr,{text:e.text,ts:e.ts}):(0,$.jsx)(qr,{text:e.text,ts:e.ts});case`reasoning`:return(0,$.jsx)(ti,{text:e.text});case`tool`:return(0,$.jsx)(mi,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return e.attribution?(0,$.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-4 py-3 text-sm`,children:[(0,$.jsxs)(`p`,{className:`mb-2 break-all text-xs text-muted-foreground`,children:[e.attribution.source===`agent`?`Agent input from parent ${e.attribution.parentRunId}`:`Worker lifecycle context for parent ${e.attribution.parentRunId}`,e.delivery?` · ${va(e.delivery)}`:``]}),(0,$.jsx)($r,{note:e})]}):(0,$.jsx)($r,{note:e});case`conversation`:return(0,$.jsx)(wa,{runId:i,taskTitles:a,recipientBackends:o,block:{kind:`worker-conversation`,id:e.id,batches:[{id:e.id,kind:e.messageKind,text:e.text,senderRunId:e.senderRunId,messages:[e]}]}});case`image`:return(0,$.jsx)(yi,{image:e});case`ask`:return n===void 0?(0,$.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`permission`:return r?r(e):(0,$.jsx)(ea,{permission:e,runId:i});case`provider-auth-required`:return(0,$.jsx)(ei,{incident:e});case`preview-server`:return(0,$.jsx)(po,{entry:e});case`hook`:return(0,$.jsx)(gi,{item:e,cacheKey:`${t}:${e.id}`});default:return mo(e)}}function po({entry:e}){let t=an(),n=k().data?.capabilities?.preview===!0;return(0,$.jsx)(dt,{entry:t?.worktreeRemoved?{kind:`preview-server`,id:e.id,server:e.server,state:`unavailable`}:e,inPreview:t!==null&&t.open&&t.port===e.server.port,onOpen:t!==null&&n?t.openPane:void 0})}function mo(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function ho({runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,onClose:a,taskTitles:o,recipientBackends:s}){let c=(0,Q.useContext)(yn),l=(0,Q.useRef)(void 0),u=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>()=>{l.current?.()},[c,e]),(0,$.jsx)(nn,{open:r!==void 0,onOpenChange:e=>{e||a()},children:(0,$.jsx)(Nt,{"data-slot":`subagent-sheet`,side:`right`,onCloseAutoFocus:e=>{u.current&&=(e.preventDefault(),!1)},className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:r===void 0?null:(0,$.jsx)(Jn.Provider,{value:e=>{let t=[...document.querySelectorAll(`[data-agent-id]`)].find(e=>e.dataset.agentId===r?.id);l.current?.(),l.current=c?.registerOpener(e,()=>{t?.focus({preventScroll:!0})}),u.current=!0,a()},children:(0,$.jsx)(go,{runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,taskTitles:o,recipientBackends:s})})})})}function go({runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,taskTitles:a,recipientBackends:o}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Vt,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,$.jsxs)(Ut,{className:`flex min-w-0 items-center gap-2 pr-8 text-[16px]`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:r.title}),r.agentType===void 0?null:(0,$.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:r.agentType})]}),(0,$.jsxs)(tn,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(_o,{status:r.status}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[r.toolCalls,` `,r.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,$.jsx)(oo,{runId:e,viewId:`agent:${r.id}`,sections:ro(r.id,i),mode:`panel`,renderAsk:t,renderPermission:n,taskTitles:a,recipientBackends:o,empty:(0,$.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function _o({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,$.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:o(`rounded-full px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}var vo=/^diff --git /;function yo(e){let t=e.replace(vo,``),n=t.lastIndexOf(` b/`);return bo(n>=0?t.slice(n+3):t)}function bo(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function xo(e){let t=bo(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function So(e){return{path:yo(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function Co(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=bo(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=bo(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=xo(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=xo(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function wo(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function To(e){let t=[],n=null,r=!1;for(let i of e.split(`
7
- `)){if(vo.test(i)){n=So(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):Co(n,i);continue}wo(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function Eo(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var Do=20,Oo=300;function ko({runId:e}){let t=S(),n=F(e);(0,Q.useEffect)(()=>{t.invalidateQueries({queryKey:R.runs.diff(e)})},[t,e]);let r=(0,Q.useMemo)(()=>To(n.data??``),[n.data]),[i,a]=(0,Q.useState)(!1);if(n.isPending)return(0,$.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(n.isError)return(0,$.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:n.error.message});if(r.length===0)return(0,$.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:n.data.trim()||`(no changes)`});let o=Eo(r),s=i?r:r.slice(0,Do);return(0,$.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,$.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[o.files,` `,o.files===1?`file`:`files`,` changed`]}),(0,$.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,o.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,o.deletions]})]})]}),s.map(e=>(0,$.jsx)(jo,{file:e},`${e.oldPath??``}→${e.path}`)),r.length>s.length?(0,$.jsxs)(K,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>a(!0),children:[`Show `,r.length-s.length,` more files`]}):null]})}var Ao={added:`added`,deleted:`deleted`,renamed:`renamed`};function jo({file:e}){let[t,n]=(0,Q.useState)(!0),r=Ao[e.status];return(0,$.jsxs)(Y,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-border bg-card`,children:[(0,$.jsxs)(J,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,$.jsx)(nt,{className:o(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,$.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,$.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] font-semibold tabular-nums`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),(0,$.jsx)(q,{children:(0,$.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,$.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,$.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,$.jsx)(Mo,{lines:e.lines})})})]})}function Mo({lines:e}){let[t,n]=(0,Q.useState)(!1),r=t?e:e.slice(0,Oo),i=r.join(`
8
- `),[a,s]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=!1;return xn(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=a?.text===i?a.tokens:bn(i,`diff`)?.tokens??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,$.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:o(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,$.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>Oo?(0,$.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function No(e){let t=S();return M({mutationFn:()=>f(e),onSuccess:()=>t.invalidateQueries({queryKey:R.runs.all}),onError:e=>H(e.message,{tone:`danger`})})}function Po({run:e}){return(0,$.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-accent-strong/30 bg-accent-strong/10 px-3.5 py-2.5`,children:[(0,$.jsx)(it,{className:`size-4 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,$.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,$.jsx)(ko,{runId:e.id}),(0,$.jsx)(Fo,{run:e})]})}function Fo({run:e}){let t=E(),n=S(),r=(0,Q.useRef)(null),[i,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(null),l=No(e.id),u=Si(e),d=()=>n.invalidateQueries({queryKey:R.runs.all}),f=M({mutationFn:async t=>u.canContinue?m(O(e.id),{text:`Review feedback:\n${t}`,runner:u.runnerOverride}):null,onMutate:()=>O(e.id),onSuccess:(e,n,r)=>{e!==null&&(o(``),t.invalidateAfter(`continue`,r))},onError:e=>H(e.message,{tone:`danger`})}),p=M({mutationFn:()=>C(e.id),onSuccess:e=>{H(`Draft PR created — ${e.url}`),d()},onError:e=>{e instanceof _&&e.manual!==void 0&&c(e.manual),H(e.message,{tone:`danger`})}}),h=()=>{let e=i.trim();if(e.length===0){H(`Write what to change first.`),r.current?.focus();return}f.mutate(e)};return(0,$.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,$.jsx)(Dn,{ref:r,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{qt({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())},className:`min-h-[52px] text-[13px]`}),u.canContinue?null:(0,$.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:u.reason}),u.providerPending?null:(0,$.jsx)(X,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(K,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:u.reason??`Send the notes back into the agent's session`,"aria-describedby":u.canContinue?void 0:`review-provider-guidance`,disabled:f.isPending||!u.canContinue,onClick:h,children:[(0,$.jsx)(Mn,{"aria-hidden":`true`}),`Send back`]}),a(e.pullRequestUrl)?(0,$.jsx)(K,{asChild:!0,variant:`outline`,size:`sm`,children:(0,$.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,$.jsx)(rt,{"aria-hidden":`true`}),`PR ↗`]})}):(0,$.jsxs)(K,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,$.jsxs)(K,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`ml-auto`,title:Jt(`review`),disabled:l.isPending,onClick:()=>l.mutate(),children:[(0,$.jsx)(Se,{"aria-hidden":`true`}),`Accept`]}):null]}),s===null?null:(0,$.jsx)(Io,{command:s})]})}function Io({command:e}){return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>H(`Command copied to clipboard.`)).catch(()=>H(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,$.jsx)(Pe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Lo(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Ro=1500;function zo({status:e}){let t=(0,Q.useRef)(e),[n,r]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Lo())return;r(!0);let i=setTimeout(()=>r(!1),Ro);return()=>clearTimeout(i)},[e]),n?(0,$.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,$.jsx)(jt,{}),(0,$.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,$.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}function Bo(e){let t=S(),[n,r]=(0,Q.useState)(),i=Dt(e);(0,Q.useEffect)(()=>{(!i||n&&n!==e.id)&&r(void 0)},[i,e.id,n]);let a=M({mutationFn:async()=>{r(e.id);try{if(!(await g(e.id)).cancelled)throw Error(`The task changed before Stop was accepted. Check its status and retry.`)}catch(e){throw r(void 0),e}},onSettled:()=>t.invalidateQueries({queryKey:R.runs.all})});return{stopping:!!e.stopping||a.isPending||i&&n===e.id,stop:()=>a.mutateAsync()}}function Vo({agents:e,onSelect:t}){return e.length===0?null:(0,$.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map(e=>(0,$.jsx)(Ho,{agent:e,onSelect:t},e.id))})}function Ho({agent:e,onSelect:t}){let n=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Uo,{status:e.status,stalled:e.stalled===!0}),(0,$.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,$.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,$.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Bi(e)}),(0,$.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,$.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,$.jsx)(`button`,{type:`button`,"data-agent-id":e.id,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,$.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function Uo({status:e,stalled:t=!1}){return t?(0,$.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,$.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,$.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,$.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,$.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,$.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,$.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,$.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}function Wo(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function Go({entries:e}){return e.length===0?null:(0,$.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map((e,t)=>(0,$.jsx)(Ko,{entry:e},`${t}:${e.content}`))})}function Ko({entry:e}){return(0,$.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:o(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,$.jsx)(qo,{status:e.status}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,$.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function qo({status:e}){return e===`cancelled`?(0,$.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,$.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,$.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,$.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,$.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,$.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,$.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,$.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function Jo(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 Yo(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 Xo({steps:e}){if(e.length===0)return null;let t=Yo(e)*100;return(0,$.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,$.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":Jo(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,$.jsx)(Zo,{visual:Jo(t.status)}),(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,$.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,$.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,$.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function Zo({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,$.jsx)(we,{"aria-hidden":!0,className:o(t,`text-success`)});case`active`:return(0,$.jsx)(ot,{role:`status`,"aria-label":`Step running`,className:o(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,$.jsx)(Te,{"aria-hidden":!0,className:o(t,`text-danger`)});case`pending`:return(0,$.jsx)(ke,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)})}}var Qo={done:`done`,failed:`failed`,cancelled:`cancelled`};function $o(e){let t=Qo[e.status];return t?e.steps.map(e=>Jo(e.status)===`active`?{...e,status:t}:e.status===`pending`?{...e,status:`skipped`}:e):es(e)}function es(e){let t=ts(e.currentStepId,e.steps);return e.steps.some((e,n)=>n!==t&&e.status===`waiting`)?e.steps.map((e,n)=>n!==t&&e.status===`waiting`?{...e,status:`done`}:e):e.steps}function ts(e,t){let n=t.findIndex(t=>t.id===e);if(n>=0)return n;let r=t.reduce((e,t,n)=>Jo(t.status)===`active`?n:e,-1);if(r>=0)return r;let i=t.findIndex(e=>e.status===`pending`);return i>=0?i:t.reduce((e,t,n)=>t.status===`skipped`?e:n,0)}function ns({items:e,lead:t=0}){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(-1/0);return(0,Q.useLayoutEffect)(()=>{let r=n.current;if(!r)return;let a=()=>{let n=r.getBoundingClientRect().width;if(!n&&r.getClientRects().length===0)return;let a=getComputedStyle(r),o=Number.parseFloat(a.width),s=o>0?n/o:1,c=(Number.parseFloat(a.columnGap)||0)*s,l=Array.from(r.children,e=>e.getBoundingClientRect().width),u=e.map((e,t)=>({...e,width:l[t]??0})),d=-1/0,f=()=>u.reduce((e,t)=>e+t.width,0)+Math.max(0,u.length-1)*c+(u.length>0?t*s:0);for(let t of[...new Set(e.map(e=>e.priority))].sort((e,t)=>e-t)){if(f()<=n)break;d=t,u=u.filter(e=>e.priority>t)}i(e=>e===d?e:d)};if(a(),typeof ResizeObserver>`u`)return;let o=new ResizeObserver(a);o.observe(r);for(let e of r.children)o.observe(e);return()=>o.disconnect()},[e,t]),(0,$.jsx)(`span`,{ref:n,"data-slot":`activity-summary`,className:`relative flex h-[max(1.5em,22px)] min-w-0 flex-1 items-center gap-2.5 overflow-clip whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:e.map(n=>{let i=n.priority<=r,a=n===e.find(e=>e.priority>r);return(0,$.jsx)(`span`,{"data-summary-item":n.id,"data-hidden":i,"aria-hidden":i||void 0,inert:i||void 0,style:a&&t?{marginInlineStart:t}:void 0,className:`inline-flex w-max shrink-0 items-center gap-1.5 data-[hidden=true]:invisible data-[hidden=true]:absolute`,children:n.content},n.id)})})}function rs({run:e,references:t}){return(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1.5`,children:t.map(t=>(0,$.jsx)(yt,{reference:t,taskTitle:Z(e),inert:!0},fe(t)))})}function is(e){return e.accountId===void 0||e.profilesPending?void 0:e.profilesError?e.accountId:e.accountId==="default"?Gt(e.accounts,e.accountBackend)?`default`:void 0:e.known?Gt(e.accounts,e.accountBackend)?e.known.label:void 0:`${e.accountId} (removed)`}function as(e){let t=I(),n=ie(),{accounts:r}=Ft(),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=is({accountId:c,profilesPending:n.isPending,profilesError:n.isError,known:u,accounts:r,accountBackend:l}),f=e.modelIdentity&&e.modelIdentity!==a?e.modelIdentity:void 0;return{runner:e.removedRunner===void 0?i:p(e.removedRunner),...d?{account:d}:{},model:a,effort:o,...f?{identity:f}:{}}}var os=[`running`,`queued`,`waiting`];function ss(e){return Array.isArray(e)?e.filter(e=>e?.kind===`pr`||e?.kind===`timer`||e?.kind===`worker`||e?.kind===`process`||e?.kind===`peer`||e?.kind===`subagent`):[]}function cs(e){let t=e?new Date(e):void 0;return t&&Number.isFinite(t.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(t):void 0}function ls(e,t){return`${e} — ${t.status===`failed`?`not delivered; Continue delivers it, Stop discards it`:t.status===`running`?`current turn still working`:`waiting for capacity`}`}function us(e){return e.kind!==`worker`&&e.kind!==`peer`&&e.kind!==`subagent`}function ds(e){let t=ss(e.waits),n=os.includes(e.status),r=t.filter(t=>t.phase===`open`?n:t.phase===`resolved`&&us(t)&&(n||e.status===`failed`)),i=r.some(e=>e.kind===`pr`),a=[...ss(e.lastWaits),...t.filter(e=>!r.includes(e)&&e.phase!==`open`)],o=i?void 0:a.filter(e=>e.kind===`pr`).at(-1),s=i?void 0:e.lastWaitsError,c=r.some(e=>e.kind===`process`)?void 0:a.filter(e=>e.kind===`process`).at(-1);return r.length||o||s||c?{open:r,lastCi:o,error:s,lastProcess:c}:void 0}function fs(e){return ds(e)!==void 0}function ps(e){return(ds(e)?.open??[]).filter(e=>e.kind===`pr`).map(e=>({kind:`PR`,number:e.prNumber,url:e.prUrl}))}function ms({run:e}){let t=ds(e);if(!t)return null;let{open:n,lastCi:r,error:i,lastProcess:a}=t;return(0,$.jsxs)(`div`,{"data-slot":`open-waits`,className:`flex min-w-0 flex-col gap-1`,children:[n.map(t=>t.kind===`pr`?(0,$.jsx)(gs,{run:e,wait:t},t.id):t.kind===`worker`?(0,$.jsx)(_s,{wait:t},t.id):t.kind===`process`?(0,$.jsx)(Ss,{run:e,wait:t},t.id):t.kind===`peer`?(0,$.jsx)(vs,{wait:t},t.id):t.kind===`subagent`?(0,$.jsx)(ys,{wait:t},t.id):(0,$.jsx)(bs,{run:e,wait:t},t.id)),i?(0,$.jsx)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:i}):r?(0,$.jsx)(gs,{run:e,wait:r,settled:!0}):null,a?(0,$.jsx)(Ss,{run:e,wait:a,settled:!0}):null]})}function hs(e,t,n){let r=t.result,i=t.until!==`checks`,a={passed:`CI checks passed — observed checks only; not merge approval`,stuck:`CI checks stuck in queue — inspect the PR checks`,failed:`CI checks failed — inspect the PR checks`,conflicting:i?`PR has merge conflicts — inspect the PR; not merged`:`PR has merge conflicts — inspect the PR; not merge approval`,cancelled:i?`Merge wait cancelled`:`CI wait cancelled`,skipped:`CI checks skipped — inspect the PR checks`,no_checks:`No CI checks found — inspect the PR workflows`,startup_failure:`CI workflow never started — inspect the PR workflows`,deadline:i?`Merge wait timed out — merge not confirmed`:`CI wait timed out — inspect the PR checks`,error:i?`Merge wait unavailable — inspect access and the PR`:`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`}`,merged:`PR merged`,closed:`PR closed without merge — inspect the PR`,blocked:`Initiated merge blocked — inspect the PR; not merged`},o=i?`Merge`:`CI`,s=n&&t.phase===`cancelled`;return n?s?`${o} wait cancelled`:r?a[r.outcome]:`${o} wait unavailable`:t.phase===`resolved`?ls(`${o} result ready`,e):t.until===`merge_or_blocked`?`Waiting for merge or blockage`:i?`Waiting for merge`:`Waiting for CI`}function gs({run:e,wait:t,settled:n=!1}){let r=t.result,i=t.until===`checks`?`CI`:`Merge`,o=n&&t.phase===`cancelled`,s=hs(e,t,n),c=n?o?t.cancelledAt:r?.observedAt:t.deadline,l=cs(c),u=`${t.repository}#${t.prNumber}`;return(0,$.jsx)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-[13px] text-muted-foreground [overflow-wrap:anywhere]`,children:(0,$.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-baseline gap-x-3 gap-y-1`,children:[(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Status`}),(0,$.jsx)(`dd`,{children:s}),(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Pull request`}),(0,$.jsx)(`dd`,{className:`min-w-0`,children:a(t.prUrl)?(0,$.jsx)(`a`,{href:t.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:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted`,children:u}):(0,$.jsx)(`span`,{children:u})}),l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:n?o?`Cancelled`:`Observed`:`Deadline`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`time`,{dateTime:c,children:l})})]}):n?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Deadline`}),(0,$.jsxs)(`dd`,{children:[i,` deadline unavailable`]})]})]})})}function _s({wait:e}){let t=e.workerIds!==void 0,n=new Set((t?e.outcomes:e.requestOutcomes)?.map(e=>`workerId`in e?e.workerId:e.requestId)),r=(e.workerIds??e.requestIds??[]).filter(e=>!n.has(e)).length,i=t?r===1?`worker`:`workers`:r===1?`request reply`:`request replies`,a=cs(e.deadline);return(0,$.jsxs)(`div`,{"data-slot":`worker-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,$.jsxs)(`p`,{children:[`Waiting on `,r,` `,i]}),a?(0,$.jsxs)(`p`,{children:[`Deadline`,` `,(0,$.jsx)(`time`,{dateTime:e.deadline,children:a})]}):(0,$.jsx)(`p`,{children:`Worker wait deadline unavailable`})]})}function vs({wait:e}){let t=e.peerIds.length,n=cs(e.deadline);return(0,$.jsxs)(`div`,{"data-slot":`peer-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,$.jsxs)(`p`,{children:[`Waiting on `,t,` `,t===1?`task`:`tasks`]}),n?(0,$.jsxs)(`p`,{children:[`Deadline`,` `,(0,$.jsx)(`time`,{dateTime:e.deadline,children:n})]}):(0,$.jsx)(`p`,{children:`Peer wait deadline unavailable`})]})}function ys({wait:e}){let t=(Array.isArray(e.children)?e.children:[]).filter(e=>e?.status===`running`).length,n=cs(e.deadline);return(0,$.jsxs)(`div`,{"data-slot":`subagent-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,$.jsxs)(`p`,{children:[`Waiting for `,t,` `,t===1?`subagent`:`subagents`]}),n?(0,$.jsxs)(`p`,{children:[`Check by`,` `,(0,$.jsx)(`time`,{dateTime:e.deadline,children:n})]}):(0,$.jsx)(`p`,{children:`Subagent wait deadline unavailable`})]})}function bs({run:e,wait:t}){let n=cs(t.deadline);return(0,$.jsxs)(`div`,{"data-slot":`monitoring-schedule`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[t.phase===`resolved`?(0,$.jsx)(`p`,{children:ls(`Automatic check due`,e)}):n?(0,$.jsxs)(`p`,{children:[`Next automatic check`,` `,(0,$.jsx)(`time`,{dateTime:t.deadline,className:`font-medium text-foreground`,children:n})]}):(0,$.jsx)(`p`,{children:`Automatic check time unavailable`}),t.note?(0,$.jsx)(`p`,{children:t.note}):null]})}function xs(e){let t=e.result;return t?t.outcome===`exit_file`?t.exitCode===void 0?`PID ${e.pid} wrote an exit file that is not an exit code`:`PID ${e.pid} exited with code ${t.exitCode}`:t.outcome===`exited`?e.startToken===void 0&&t.observedAt===e.registeredAt?`PID ${e.pid} was not running when the wait was registered`:`PID ${e.pid} exited, code unknown`:t.outcome===`deadline`?`PID ${e.pid} still running at the deadline`:`PID ${e.pid} could not be checked`:`PID ${e.pid} still running at the deadline`}function Ss({run:e,wait:t,settled:n=!1}){let r=n&&t.phase===`cancelled`?`Process wait on PID ${t.pid} cancelled`:n?xs(t):t.phase===`resolved`?ls(xs(t),e):`Waiting for PID ${t.pid}${t.note?` — ${t.note}`:``}`,i=!n&&t.phase===`open`?cs(t.deadline):void 0;return(0,$.jsxs)(`div`,{"data-slot":`process-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,$.jsx)(`p`,{children:r}),i?(0,$.jsxs)(`p`,{children:[`Until`,` `,(0,$.jsx)(`time`,{dateTime:t.deadline,children:i})]}):null]})}var Cs=new Map,ws=new Map;function Ts(e){let{referenceProjectId:t,repoBase:n,references:r,requests:i}=Le(e.run);return(0,$.jsx)(_t,{projectId:t,repoBase:n,requests:i,children:(0,$.jsx)(Es,{...e,references:r,prNumbers:i.filter(e=>e.kind===`PR`).map(e=>e.number),hasReferences:r.length>0||!!ue(e.run)||!!le(e.run,n)})})}function Es({run:e,thread:t,currentThread:n,currentComplete:r=!0,onOpenWorker:i,readerScroll:a,prNumbers:o,hasReferences:s,references:c}){let l=Xt(),u=as(e),[d,f]=(0,Q.useState)(()=>Cs.get(e.id)??!1),p=Hs(a,d),m=p.open,[h,g]=(0,Q.useState)({}),_=Ds(e,t??n,n,r,o),v=He(e),y=t=>h[t]??ws.get(`${e.id}:${t}`)??t===`workers`,b=t=>{let n=!y(t);ws.set(`${e.id}:${t}`,n),g(e=>({...e,[t]:n}))},x=e=>({open:y(e),onToggle:()=>b(e)});return(0,$.jsxs)(`section`,{"data-slot":`run-activity-dock`,ref:p.ref,"data-state":m?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-xl border border-border bg-card shadow-xs`,children:[(0,$.jsx)(Ms,{run:e,identity:u,activity:_,references:c,open:m,onToggle:()=>{Cs.set(e.id,!m),f(!m),p.chose(!m)}}),m?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col border-t border-border`,children:[(0,$.jsx)(Fs,{run:e,activity:_,...x(`status`)}),(0,$.jsx)(Is,{run:e,desktop:l,automations:_.automations,...x(`workflow`)}),(0,$.jsx)(Ls,{activity:_,desktop:l,onOpenWorker:i,...x(`subagents`)}),(0,$.jsx)(Rs,{run:e,...x(`workers`)}),(0,$.jsx)(zs,{activity:_,desktop:l,...x(`plan`)}),(0,$.jsx)(Bs,{run:e,identity:u,activity:_,...x(`usage`)}),(0,$.jsx)(Vs,{run:e,references:c,conflicts:_.conflicts,hasReferences:s,onResume:()=>v.mutate(),...x(`workspace`)})]}):null]})}function Ds(e,t,n,r,i){let a=k(),o=sn(a.data),s=B(),c=et(e,{queuePosition:e.status===`queued`?Ot(s.data??[]).get(e.id):void 0}),l=vt(i),u=!Et(e)&&e.status!==`queued`,d=(0,Q.useMemo)(()=>r?Li(n.turns,u,t.turns):[],[r,n.turns,u,t.turns]),f=gt(n)??[],p=Ge(e),m=zi(d),h=Wo(f);return{line:c,...Os(e,c,p,r?m:void 0,h),...ks(e,o),conflicts:l,waitReferences:ps(e),agents:d,agentCounts:m,planEntries:f,planCounts:h,automations:_n(a.data)}}function Os(e,t,n,r,i){let a=e.steps.every(e=>e.status===`done`||e.status===`skipped`),o=e.status===`done`&&a&&n===`complete`&&r!==void 0&&r.done===r.total&&i.done===i.total;return{allComplete:o,statusText:o?`All complete`:e.status!==`done`||r===void 0?t.label:n===`unknown`?`Workers unavailable`:n===`pending`?`In progress`:`Incomplete`,failed:t.attention.tone===`danger`||e.status===`cancelled`,glyph:o?(0,$.jsx)(we,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-success`}):(0,$.jsx)(At,{tone:t.attention.tone,shape:t.attention.shape,pulse:t.attention.pulse})}}function ks(e,t){return{cost:t.cost&&e.costUsd!==void 0?de(e.costUsd):void 0,tokens:t.tokens&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?(0,$.jsx)($t,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):void 0}}function As(e){return e.allComplete?`text-success`:e.failed&&`text-danger`}function js(e){let t=$o(e),n=ts(e.currentStepId,t);return t.length>0?{steps:t,index:n,step:t[n]}:void 0}function Ms({run:e,identity:t,activity:n,references:r,open:i,onToggle:a}){let{cost:s}=n,c=[...new Map([...r,...n.waitReferences].map(e=>[fe(e),e])).values()];return(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-label":Ns(e,t,n,c,i),onClick:a,className:o(`flex min-h-11 w-full min-w-0 items-center px-3.5 py-2 text-start text-[14px] hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,i?`gap-2.5`:`gap-2`),children:[(0,$.jsx)(Ie,{"aria-hidden":!0,className:`size-4 shrink-0 text-accent-text`}),(0,$.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Activity`}),i?null:(0,$.jsx)(Ps,{run:e,identity:t,activity:n,summaryReferences:c}),i&&s?(0,$.jsx)(`span`,{"data-slot":`run-activity-cost`,className:`ms-auto shrink-0 text-[13px] text-muted-foreground tabular-nums`,children:s}):null,(0,$.jsx)(Oe,{"aria-hidden":!0,className:o(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,i&&!s&&`ms-auto`,i&&`rotate-180`)})]})}function Ns(e,t,n,r,i){let{statusText:a,conflicts:o,cost:s}=n,c=`Session activity: ${a}${o.length?`; pull request conflicts`:``}${s?`; cost ${s}`:``}`;if(i)return c;let l=js(e)?.step,u=l?Jo(l.status):void 0,d=l?`; step ${l.name}, ${u===`active`?`running`:u}`:``,f=r.length?`; ${r.map(e=>`${e.kind} #${e.number}`).join(`; `)}`:``;return`${c}${d}; runner ${t.runner}; model ${t.model}; effort ${t.effort}${f}`}function Ps({run:e,identity:t,activity:n,summaryReferences:r}){let{statusText:i,cost:a,conflicts:s}=n,c=js(e)?.step,l=[{id:`runner`,priority:2,content:t.runner},{id:`model`,priority:4,content:t.model},{id:`effort`,priority:3,content:t.effort},...a?[{id:`cost`,priority:1,content:(0,$.jsx)(`span`,{"data-slot":`run-activity-cost`,children:a})}]:[],...r.length||s.length?[{id:`chips`,priority:0,content:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(rs,{run:e,references:r}),s.length>0?(0,$.jsxs)(`span`,{"data-slot":`run-activity-conflict`,className:`inline-flex items-center gap-1 font-medium text-conflict`,children:[(0,$.jsx)(je,{"aria-hidden":!0,className:`size-3.5`}),`Conflicts`]}):null]})}]:[]];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`run-activity-status`,title:i,className:o(`inline-flex min-w-[calc(0.875rem+3ch)] flex-[0_1_auto] items-center gap-1.5 text-[13px] whitespace-nowrap text-muted-foreground`,As(n)),children:[n.glyph,(0,$.jsx)(`span`,{"data-slot":`run-activity-status-label`,className:`min-w-0 truncate`,children:i})]}),c?(0,$.jsxs)(`span`,{"data-slot":`run-activity-step`,className:`flex max-w-max min-w-[calc(1.375rem+2ch)] flex-[1000_1_0] items-center gap-1.5 text-[13px] text-muted-foreground`,children:[(0,$.jsx)(Ks,{step:c,decorative:!0}),(0,$.jsx)(`span`,{"data-slot":`run-activity-step-name`,title:c.name,className:`min-w-0 truncate`,children:c.name})]}):null,(0,$.jsx)(`span`,{className:`-ms-2 flex min-w-0 flex-[1_1_0]`,children:(0,$.jsx)(ns,{items:l,lead:8})})]})}function Fs({run:e,activity:t,open:n,onToggle:r}){let{line:i,waitReferences:a}=t,s=Je(e);return(0,$.jsxs)($e,{slot:`status-row`,icon:t.glyph,title:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{"data-slot":`run-activity-status`,className:o(`truncate`,As(t)),children:t.statusText}),i.nextCheck?(0,$.jsxs)(`span`,{"data-slot":`run-activity-next-check`,className:`whitespace-normal text-[13px] font-normal text-muted-foreground`,children:[`Next check `,(0,$.jsx)(`time`,{dateTime:i.nextCheck.at,children:i.nextCheck.text})]}):null]}),summary:!n&&a.length>0?(0,$.jsx)(ns,{items:[{id:`chips`,priority:0,content:(0,$.jsx)(rs,{run:e,references:a})}]}):void 0,open:n,onToggle:fs(e)||s?r:void 0,children:[(0,$.jsx)(ms,{run:e}),s?(0,$.jsx)(We,{run:e}):null]})}function Is({run:e,desktop:t,automations:n,open:r,onToggle:i}){let a=pe(e),o=js(e);return!a&&!o?null:(0,$.jsxs)($e,{slot:`workflow`,icon:o?(0,$.jsx)(Ks,{step:o.step}):(0,$.jsx)(Ne,{className:`size-4`}),title:(0,$.jsxs)($.Fragment,{children:[`Workflow`,a?(0,$.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` · `,a]}):null]}),meta:o?{drop:o.step.name,keep:Be(o.index+1,o.steps.length,t,`step`)}:void 0,open:r,onToggle:i,children:[o?(0,$.jsx)(Xo,{steps:o.steps}):null,(0,$.jsx)(Gs,{run:e,available:n})]})}function Ls({activity:e,desktop:t,onOpenWorker:n,open:r,onToggle:i}){let{agents:a,agentCounts:o}=e;return a.length===0?null:(0,$.jsx)($e,{slot:`subagents`,icon:(0,$.jsx)(Me,{className:`size-4`}),title:`Subagents`,meta:Be(o.done,o.total,t),open:r,onToggle:i,children:(0,$.jsx)(Vo,{agents:a,onSelect:n})})}function Rs({run:e,open:t,onToggle:n}){return Ze(e)?(0,$.jsx)(Xe,{run:e,open:t,onToggle:n}):null}function zs({activity:e,desktop:t,open:n,onToggle:r}){let{planEntries:i,planCounts:a}=e;return i.length===0?null:(0,$.jsx)($e,{slot:`plan`,icon:(0,$.jsx)(U,{className:`size-4`}),title:`Plan`,meta:Be(a.done,a.total,t),open:n,onToggle:r,children:(0,$.jsx)(Go,{entries:i})})}function Bs({run:e,identity:t,activity:n,open:r,onToggle:i}){let{cost:a,tokens:o}=n,s=e.modelIdentity?.includes(`/`)?e.modelIdentity.split(`/`)[0]:void 0,c=[...s?[{id:`provider`,priority:2,content:s}]:[],{id:`model`,priority:4,content:t.model},{id:`effort`,priority:3,content:t.effort},...a?[{id:`cost`,priority:1,content:a}]:[],...o?[{id:`tokens`,priority:0,content:o}]:[]];return(0,$.jsx)($e,{slot:`usage`,icon:(0,$.jsx)(jn,{className:`size-4`}),title:`Usage & agent`,summary:(0,$.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`contents`,children:(0,$.jsx)(ns,{items:c})}),open:r,onToggle:i,children:(0,$.jsx)(Ws,{run:e,tokens:o,cost:a})})}function Vs({run:e,references:t,conflicts:n,hasReferences:r,onResume:i,open:a,onToggle:o}){let s=e.delegation?.role===`worker`?e.delegation.destroy:void 0;if(!(e.branch||e.worktreePath||r||Zt(e)||Re(s)))return null;let c=n.length===1?`PR #${n[0]} conflicts`:`${n.length} PRs conflict`;return(0,$.jsx)($e,{slot:`workspace`,icon:(0,$.jsx)(_e,{className:`size-4`}),title:`Workspace`,summary:!a&&t.length>0?(0,$.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`contents`,children:(0,$.jsx)(ns,{items:[...e.branch?[{id:`branch`,priority:0,content:(0,$.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.branch})}]:[],{id:`chips`,priority:1,content:(0,$.jsx)(rs,{run:e,references:t})},...n.length>0?[{id:`conflicts`,priority:2,content:(0,$.jsx)(`span`,{className:`font-medium text-conflict`,children:c})}]:[]]})}):void 0,meta:n.length>0?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-conflict`,children:[(0,$.jsx)(je,{"aria-hidden":!0,className:`size-3.5`}),c]}):e.branch?(0,$.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.branch}):void 0,open:a,onToggle:o,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 text-[13px] text-muted-foreground`,children:[s?(0,$.jsx)(qe,{state:s}):null,(0,$.jsx)(Ke,{run:e}),e.branch?(0,$.jsx)(Us,{label:`Branch`,children:(0,$.jsx)(Ye,{branch:e.branch})}):null,e.worktreePath?(0,$.jsx)(Us,{label:`Worktree`,children:(0,$.jsx)(`span`,{className:`min-w-0 break-all font-mono text-[12px] text-foreground`,children:e.worktreePath})}):null,(0,$.jsx)(Ue,{run:e,canResume:un(e).terminal,onResume:i})]})})}function Hs(e,t){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(!1),a=(0,Q.useRef)(t);a.current=t;let o=(0,Q.useRef)({active:!1,override:!1});return(0,Q.useEffect)(()=>e?.(e=>{if(e.direction===`tail`){o.current={active:!1,override:!1},i(!1);return}if(e.direction===`down`){i(!1);return}if(o.current.active=!0,o.current.override||!a.current)return;let t=n.current?.closest(`[data-slot="thread-dock"]`);!t||getComputedStyle(t).position!==`sticky`||e.distanceFromBottom<=t.getBoundingClientRect().height||i(!0)}),[e]),{ref:n,open:t&&!r,chose:e=>{i(!1),e&&o.current.active&&(o.current.override=!0)}}}function Us({label:e,children:t}){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`span`,{className:`w-20 shrink-0 font-medium text-foreground`,children:e}),t]})}function Ws({run:e,tokens:t,cost:n}){let{runner:r,account:i,model:a,effort:o,identity:s}=as(e);return(0,$.jsxs)(`dl`,{"data-slot":`agent-details`,className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-[13px]`,children:[t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Tokens`}),(0,$.jsx)(`dd`,{className:`min-w-0 text-[12px]`,children:t})]}):null,n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Cost`}),(0,$.jsx)(`dd`,{className:`min-w-0 font-mono text-[12px] tabular-nums`,children:n})]}):null,(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Runner`}),(0,$.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px]`,children:r}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Account`}),(0,$.jsx)(`dd`,{"data-slot":`agent-badge-account`,className:`min-w-0 break-all font-mono text-[12px]`,children:i})]}):null,(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Model`}),(0,$.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px]`,children:a}),(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Effort`}),(0,$.jsx)(`dd`,{"data-slot":`agent-badge-effort`,className:`min-w-0 break-all font-mono text-[12px]`,children:o}),s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Identity`}),(0,$.jsx)(`dd`,{"data-slot":`agent-badge-identity`,className:`min-w-0 break-all font-mono text-[12px]`,children:s})]}):null]})}function Gs({run:e,available:t}){if(!e.automation)return null;let n=`inline-flex min-h-11 items-center rounded-sm text-[13px] font-medium md:min-h-8`;return(0,$.jsxs)(`p`,{className:`mt-2 text-[13px] text-muted-foreground`,children:[`Launched by`,` `,t?(0,$.jsx)(X,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:o(n,`text-foreground underline underline-offset-2`),children:`Automation`}):(0,$.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:n,children:`Automation`})]})}function Ks({step:e,decorative:t=!1}){let n=Jo(e.status),r=`size-4 shrink-0`;switch(n){case`active`:return(0,$.jsx)(ot,{...t?{"aria-hidden":!0}:{role:`status`,"aria-label":`Step running`},"data-slot":`workflow-glyph`,"data-visual":n,className:o(r,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,$.jsx)(Te,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":n,className:o(r,`text-danger`)});case`pending`:return(0,$.jsx)(ke,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":n,className:o(r,`text-soft-foreground`)});case`done`:return(0,$.jsx)(we,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":n,className:o(r,`text-success`)})}}var qs={finish:`Closed when the task finished`,superseded:`Closed when the worker went on`,"parent-stopped":`Closed when the parent stopped`,"worker-stopped":`Closed when the worker stopped`,undeliverable:`Closed: not delivered`};function Js(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function Ys({ask:e,run:t,onShowOrigin:n}){let r=e.context?(0,$.jsx)(Zs,{text:e.context}):null;if(e.resolved)return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r,(0,$.jsxs)(Kr,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,$.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?qs[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,$.jsx)(oa,{ask:e})]})]});let i=e.placement===`pinned`&&n?n:void 0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r,e.routedToParent?(0,$.jsx)(Qs,{ask:e,onShowOrigin:i}):(0,$.jsx)($s,{ask:e,run:t,onShowOrigin:i})]})}function Xs({onShowOrigin:e}){return(0,$.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,className:`mbs-2 min-h-11 min-w-11 px-2 text-xs font-medium text-muted-foreground underline underline-offset-4`,onClick:e,children:`Show where it was asked`})}function Zs({text:e}){return(0,$.jsx)(Kr,{role:`agent`,children:(0,$.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,$.jsx)(En,{breaks:!0,children:e})})})}function Qs({ask:e,onShowOrigin:t}){return(0,$.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-lg border border-border bg-card px-4 pt-3.5 pb-3.5`,children:[(0,$.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,$.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`})}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,$.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,$.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,$.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,$.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,$.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,$.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,$.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,$.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`mt-3 text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,$.jsx)(X,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),t?(0,$.jsx)(Xs,{onShowOrigin:t}):null]})}function $s({ask:e,run:t,onShowOrigin:n}){let r=cn(t),i=r.blockedBy!==void 0,a=e.questions,o=a.length===1&&a[0]?.options!==void 0&&a[0]?.multiSelect!==!0,[s,c]=(0,Q.useState)({}),[l,u]=(0,Q.useState)({}),d=(e,t)=>c(n=>({...n,[e]:t})),f=e=>u(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),p=e=>{d(e,[]),u(t=>({...t,[e]:t[e]??``}))},m=a.some((e,t)=>!e.options||l[t]!==void 0),h=a.every((e,t)=>(s[t]?.length??0)>0||!!l[t]?.trim()),g=()=>void r.send(a.map((e,t)=>Js(e,s[t]??[],l[t])).join(`
9
- `)),_=r.mode===`resume`;return(0,$.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":r.mode,className:`rounded-lg border border-accent-strong/25 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card px-4 pt-3.5 pb-3.5`,children:[(0,$.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,$.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking`})}),(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:a.map((e,t)=>(0,$.jsx)(tc,{question:e,disabled:r.isPending||i,selected:s[t]??[],isOther:l[t]!==void 0,otherAnswer:l[t]??``,onSelect:n=>{i||(f(t),o?r.send(Js(e,n)):d(t,n))},onOtherToggle:()=>{i||(l[t]===void 0?p(t):f(t))},onOtherChange:e=>u(n=>({...n,[t]:e}))},e.id??t))}),(0,$.jsx)(ec,{oneTap:o,hasOtherAnswer:m,resuming:_,disabled:r.isPending||i||!h,questionCount:a.length,onSend:g}),r.blockedBy===`provider`?(0,$.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:r.reason}),(0,$.jsx)(X,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,r.blockedBy===`no-session`?(0,$.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:r.reason}):null,r.error?(0,$.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:r.error}):null,n?(0,$.jsx)(Xs,{onShowOrigin:n}):null]})}function ec({oneTap:e,hasOtherAnswer:t,resuming:n,disabled:r,questionCount:i,onSend:a}){return e&&!t?n?(0,$.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mbs-3 text-[11px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,$.jsxs)(`div`,{className:`mbs-3 flex items-center gap-2.5`,children:[(0,$.jsx)(K,{size:`sm`,className:`min-h-11`,disabled:r,onClick:a,children:n?`Send answer & reopen`:`Send answer`}),(0,$.jsx)(`span`,{"data-slot":n?`ask-resume-hint`:`ask-hint`,className:`text-[11px] text-soft-foreground`,children:n?`the session has ended — sending reopens it`:t?`${i>1?`answer each question above`:`enter your answer above`} — or type a reply below`:`${i>1?`answer each question`:`pick one or more`} — or type a reply below`})]})}function tc({question:e,disabled:t,selected:n,isOther:r,otherAnswer:i,onSelect:a,onOtherToggle:s,onOtherChange:c}){let l=(0,Q.useId)(),u=e.options,d=u!==void 0&&e.multiSelect===!0,f=e=>{if(!d){a([e]);return}a(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,$.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,$.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded-md bg-accent-strong px-1.5 py-0.5 text-[12px] font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),d?(0,$.jsx)(`span`,{className:`ml-auto text-[11px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,$.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map(e=>{let r=n.includes(e.label);return(0,$.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>f(e.label),className:o(`flex min-h-11 w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-accent-strong/50 hover:bg-accent-strong/[0.06] [html:not(.light)_&]:hover:bg-card disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong/60 bg-accent-strong/[0.06] [html:not(.light)_&]:bg-card`:`border-border bg-card`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[14px] font-semibold text-foreground`,children:[d?(0,$.jsx)(`span`,{"aria-hidden":!0,className:o(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,$.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})}),e.allowFreeText===!1?null:(0,$.jsxs)(`div`,{className:`mt-2`,children:[(0,$.jsx)(K,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:o(`w-full justify-start text-left`,r&&`border-accent-strong/60 bg-accent-strong/[0.06] [html:not(.light)_&]:bg-card`),children:`Other`}),r?(0,$.jsxs)(`div`,{className:`mt-2.5`,children:[(0,$.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,$.jsx)(Dn,{id:l,rows:2,value:i,disabled:t,onChange:e=>c(e.target.value),className:`bg-card`})]}):null]})]}):(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,$.jsx)(Dn,{id:l,rows:2,value:i,disabled:t,onChange:e=>c(e.target.value),className:`bg-card`})]})]})}var nc=2e3;function rc(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function ic(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`turn-end`&&r.seq>t&&(t=r.seq),(r.type===`turn.started`||r.type===`session.started`||r.type===`user-message`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function ac(e,t){let n=S(),r=(0,Q.useMemo)(()=>rc(t),[t]),i=(0,Q.useMemo)(()=>ic(t),[t]),a=e?.id,o=e?.status;(0,Q.useEffect)(()=>{if(!(r!==0&&(o===`running`||o===`waiting`))&&!(i!==0&&o===`running`)||a===void 0)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:R.runs.detail(a)}),n.invalidateQueries({queryKey:R.runs.list()})},nc);return()=>clearTimeout(e)},[r,i,a,o,n])}function oc(e){let t=e.querySelector(`[data-slot="ask-origin"]`);return t&&(t.tabIndex=-1),t}function sc({pendingAskId:e,askSeq:t,rows:n,history:r,jumpToRow:i}){let[a,o]=(0,Q.useState)(void 0),s=(0,Q.useCallback)(()=>o(e),[e]),c=r?.visibleEvents,l=t!==void 0&&(c?.some(({seq:e})=>e===t)??!1),u=r?.hasOlder??!1,d=r?.isFetchingOlder??!1,f=r?.olderError,p=r?.loadOlder;return(0,Q.useEffect)(()=>{if(a===void 0)return;if(a!==e){o(void 0);return}let r=no(n,a,`origin`);if(r){o(void 0),i(r.key,r.index,oc);return}if(!(p!==void 0&&u&&f===void 0&&t!==void 0&&!l)){o(void 0);return}d||p().catch(()=>{})},[a,e,n,c,l,u,d,f,p,t,i]),{reveal:s,seeking:a!==void 0&&a===e}}function cc(){let e=(0,Q.useRef)(null);return(0,Q.useLayoutEffect)(()=>{let t=e.current,n=t?.closest(`[data-slot="main"]`),r=t?.querySelector(`[data-slot="run-header"]`),i=t?.querySelector(`[data-slot="thread-dock"]`);if(!n||!r||!i)return;let a=()=>{n.style.setProperty(`--thread-viewport-height`,`${n.clientHeight}px`),n.style.setProperty(`--thread-header-height`,`${r.getBoundingClientRect().height}px`),n.style.setProperty(`--thread-footer-height`,`${i.getBoundingClientRect().height}px`)};a();let o=new ResizeObserver(a);return o.observe(r),o.observe(i),o.observe(n),()=>{o.disconnect(),n.style.removeProperty(`--thread-header-height`),n.style.removeProperty(`--thread-footer-height`),n.style.removeProperty(`--thread-viewport-height`)}},[]),e}function lc(){let{id:e}=se(),t=z(e),n=rn(e),r=t.data?.status,i=(0,Q.useMemo)(()=>ft(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,Q.useMemo)(()=>ft(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),o=(0,Q.useRef)(void 0),s=(0,Q.useCallback)(e=>{o.current=e},[]),{mutate:c}=A();if((0,Q.useEffect)(()=>{t.data&&o.current!==t.data.id&&kt(t.data)&&c(t.data.id)},[c,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),ac(t.data,n.visibleEvents),t.isPending)return(0,$.jsx)(vn,{});if(t.isError){let e=t.error instanceof _&&t.error.status===404;return(0,$.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(Mt,{icon:e?(0,$.jsx)(bt,{}):(0,$.jsx)(Pn,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,$.jsx)(K,{asChild:!0,variant:`outline`,children:(0,$.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,$.jsx)(vn,{}):(0,$.jsx)(dc,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:s})}var uc=e=>({titles:Object.fromEntries(e.map(e=>[e.id,Z(e)])),backends:Object.fromEntries(e.map(e=>[e.id,e.currentStepBackend??e.runner]))});function dc({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){Ct();let a=ae({queryKey:R.runs.list(),queryFn:({signal:e})=>w(L(),{signal:e}),select:uc}),{pendingAsk:o,transcriptAsk:s,pendingAskId:l,historyLoading:u}=fc(r,n),d=y(e),f=ut(e.status,e.error),p=ln(e),m=!p&&e.status!==`queued`,h=e.status===`queued`,g=Oi(e),_=Bo(e),v=No(e.id),b=s||c(e),{hasContinuation:x,continuable:S}=pc(p,h,g),[C,T]=(0,Q.useState)(void 0),[E,D]=(0,Q.useState)(e.id);E!==e.id&&(D(e.id),T(void 0));let O=(0,Q.useMemo)(()=>C===void 0?void 0:Hi(n.turns,C,m,t.turns),[n.turns,C,m,t.turns]),k=(0,Q.useMemo)(()=>C===void 0?[]:Gi(t.turns,n.turns,C),[t.turns,n.turns,C]),A=ee(e.id),M=cn(e),{providerBlocked:P,providerReason:F}=mc(p,on(e),x,g),{mutateAsync:ie}=j(e.id),{mutateAsync:I}=N(e.id),{mutateAsync:z}=re(e.id),B=(0,Q.useMemo)(()=>h?{onEditTask:async e=>{await ie({task:e})},onEditMessage:(e,t)=>I({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>z(e).then(()=>void 0)}:void 0,[h,ie,I,z]),se=u?void 0:l??null,V=(0,Q.useMemo)(()=>to(e,t,n,se),[e,t,n,se]),ce=(0,Q.useMemo)(()=>ao(V,e.id),[V,e.id]),ue=e.delegation?.role===`root`||e.delegation?.role===`worker`,de=ne(e.id,{enabled:ue}),fe=(0,Q.useMemo)(()=>({...ua(e,void 0,de.data?.titles),...a.data?.titles,[e.id]:Z(e)}),[e,a.data,de.data]),pe=(0,Q.useMemo)(()=>({...a.data?.backends,...la(e,void 0)}),[e,a.data]),H=(0,Q.useCallback)(t=>(0,$.jsx)(ea,{permission:t,runId:e.id,sessionOpen:p}),[e.id,p]),me=(0,Q.useMemo)(()=>{if(B===void 0)return;let t={task:{onEdit:B.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>B.onEditMessage(n.id,e),onRemove:()=>B.onRemoveMessage(n.id)};return t},[B,e.queuedMessages]),he=le(e,te()),{search:ge}=oe(),_e=Sr(ge,ce.length),U=Ga(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:ce.map(({key:e})=>e)}),{pinnedAsk:ve,pendingQuestions:ye}=hc(V),be=sc({pendingAskId:l,askSeq:r?o?.seq:void 0,rows:ce,history:r,jumpToRow:U.jumpToRow}),xe=(0,Q.useRef)(l);u||(xe.current=l);let Se=(0,Q.useRef)({rows:ce,jumpToRow:U.jumpToRow,reveal:be.reveal});Se.current={rows:ce,jumpToRow:U.jumpToRow,reveal:be.reveal};let Ce=(0,Q.useCallback)(t=>t.placement===`origin`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.resolved&&t.context?(0,$.jsx)(Zs,{text:t.context}):null,t.resolved?null:(0,$.jsx)(Va,{onGoToQuestion:()=>{let{rows:e,jumpToRow:n}=Se.current,r=no(e,t.id,`pinned`);r&&n(r.key,r.index,e=>Ra(e))}})]}):(0,$.jsx)(Ys,{ask:t,run:e,onShowOrigin:()=>Se.current.reveal()}),[e]);return St(U.restickIfStuck),(0,$.jsxs)(`div`,{ref:cc(),"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,$.jsx)(Qe,{run:e,onMarkedUnread:()=>i?.(e.id)}),(0,$.jsx)(gc,{run:e,thread:t,history:r,footer:f,issueUrl:he,sections:V,renderAsk:Ce,renderPermission:H,messageActions:me,scroll:U,mode:_e,taskTitles:fe,recipientBackends:pe}),(0,$.jsx)(zo,{status:e.status}),(0,$.jsx)(ho,{runId:e.id,renderAsk:Ce,renderPermission:H,agent:O,entries:k,taskTitles:fe,recipientBackends:pe,onClose:()=>T(void 0)}),(0,$.jsx)(_c,{run:e,thread:t,currentThread:n,currentComplete:r?.currentComplete??!0,scroll:U,pendingQuestions:ye,onJump:()=>{let e=ye>0?ve?.id:void 0;U.jumpToLatest(e===void 0?void 0:za(e,()=>xe.current===e))},onOpenWorker:T,sessionOpen:p,attention:d,queued:h,continuable:S,continueAction:g,stopAction:_,finishAction:v,needsAnswer:b,sendMessage:A,reply:M,providerBlocked:P,providerReason:F}),(0,$.jsx)(`div`,{"data-slot":`thread-tail-anchor`,"aria-hidden":`true`,className:`h-px shrink-0 md:hidden`})]})}function fc(e,t){let n=e?ct(e.currentEvents):void 0;return{pendingAsk:n,transcriptAsk:e?n!==void 0:t.turns.some(e=>e.items.some(e=>e.kind===`ask`&&!e.resolved)),pendingAskId:e?n?.requestId:t.turns.flatMap(e=>e.items).reverse().find(e=>e.kind===`ask`&&!e.resolved)?.id,historyLoading:e!==void 0&&(e.isPending||e.contextPending)}}function pc(e,t,n){let r=!e&&!t&&n.available;return{hasContinuation:r,continuable:r&&n.canContinue}}function mc(e,t,n,r){let i=e&&!t.usable,a=n&&!r.canContinue;return{providerBlocked:i||a,providerReason:i?t.reason:r.reason}}function hc(e){let t=e.at(-1),n=t?.id===`pending-ask`?t.entries[0]:void 0;return{pinnedAsk:n,pendingQuestions:n?.kind===`ask`?n.questions.length:0}}function gc({run:e,thread:t,history:n,footer:r,issueUrl:i,sections:s,renderAsk:c,renderPermission:l,messageActions:u,scroll:d,mode:f,taskTitles:p,recipientBackends:m}){return(0,$.jsxs)(`div`,{"data-slot":`session-conversation`,className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-2.5 px-[18px] py-3 md:gap-3.5 md:px-16 md:py-5`,children:[n?(0,$.jsx)(Sc,{hasOlder:n.hasOlder,loading:n.isFetchingOlder,error:n.olderError,fallback:n.fallback,retainedPages:n.retainedPages,onLoad:d.loadOlder}):null,(0,$.jsx)(oo,{runId:e.id,viewId:`main`,sections:s,mode:`document`,renderAsk:c,renderPermission:l,messageActions:u,scrollControls:d,renderMode:f,taskTitles:p,recipientBackends:m}),t.turns.length===0?e.status===`queued`?(0,$.jsx)(Cc,{run:e}):(0,$.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,$.jsx)(ni,{}):null,r&&r.state===`closed`?(0,$.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":r.state,className:o(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,r.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[r.label,a(ue(e))?(0,$.jsx)(`a`,{"data-slot":`pr-link`,href:ue(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,a(i)?(0,$.jsx)(`a`,{"data-slot":`issue-link`,href:i,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,$.jsx)(Po,{run:e}):null]})}function _c({run:e,thread:t,currentThread:n,currentComplete:r,scroll:i,pendingQuestions:a,onJump:o,onOpenWorker:s,sessionOpen:c,attention:l,queued:u,continuable:f,continueAction:p,stopAction:m,finishAction:h,needsAnswer:g,sendMessage:_,reply:v,providerBlocked:y,providerReason:b}){return(0,$.jsxs)(`div`,{"data-slot":`thread-dock`,className:`relative z-10 bg-background pt-1 pb-2 md:pt-1.5 md:pb-4`,children:[i.pillVisible?(0,$.jsx)(`div`,{"data-slot":`thread-jump`,className:`pointer-events-none z-30 flex justify-center`,children:(0,$.jsx)(Ya,{pendingQuestions:a,onJump:o})}):null,(0,$.jsxs)(`div`,{"data-slot":`thread-footer-content`,className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-1.5 px-[14px] md:gap-2.5 md:px-16`,children:[(0,$.jsx)(Ts,{run:e,thread:t,currentThread:n,currentComplete:r,onOpenWorker:s,readerScroll:i.subscribeReaderScroll},e.id),(0,$.jsx)(Ln,{run:e}),e.status===`waiting`&&c?(0,$.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,$.jsx)(At,{tone:l.tone,shape:l.shape,pulse:l.pulse}),l.bucket===`permission`?`Choose an approval option above to continue`:l.bucket===`waiting`?`The agent is paused, waiting for your reply`:`${l.label.charAt(0).toUpperCase()}${l.label.slice(1)} — you can send a message to resume`]}):null,u?(0,$.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,$.jsx)(At,{tone:`neutral`,shape:`ring`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,f&&e.removedRunner!==void 0?(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:d(e.removedRunner)}):f&&p.startsNewConversation?(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:`Starts a new agent conversation.`}):null,(0,$.jsx)(yc,{run:e,thread:t,stopAction:m,finishAction:h,attention:l,needsAnswer:g,continuable:f,continueAction:p,queued:u,sendMessage:_,reply:v,providerBlocked:y,providerReason:b,sessionOpen:c})]})]})}function vc(e,t,n){if(t)return{skillRunner:n.skillRunner,skillAccount:n.skillAccount};let r=e.steps.find(t=>t.id===e.currentStepId),i=e.workflowDef?.steps.find(t=>t.id===e.currentStepId);return{skillRunner:r?.backend??i?.runner??e.runner,skillAccount:r?.profileId??i?.agentProfile??e.agentProfile}}function yc({run:e,thread:t,stopAction:n,finishAction:r,attention:i,needsAnswer:a,continuable:o,continueAction:s,queued:c,sendMessage:l,reply:u,providerBlocked:d,providerReason:f,sessionOpen:p}){let m=ze(e);return(0,$.jsx)(Kt,{...vc(e,o,s),onStop:un(e,m).cancel?n.stop:void 0,onFinish:gn(e)?()=>r.mutateAsync().catch(()=>void 0):void 0,finishing:r.isPending,secondaryAction:pn(e,m)?(0,$.jsx)(tt,{run:e,compactOnMobile:!0}):void 0,stopOnEmpty:bc(e,i,a),stopping:n.stopping,retainDraftUntilSuccess:!0,compactFeedback:!0,pendingLabel:o?`Continuing…`:`Sending…`,failureHint:`Your draft is kept. Check the task status and connection, then retry.`,sessionControls:o?s.pills:void 0,onSubmit:o?(e,t)=>s.continueWith(e,t):c?(e,t)=>l.mutateAsync({text:e,images:t}):async(e,t)=>{let n=await u.send(e,t);if(n!==void 0)throw Error(n)},disabled:d||!p&&!c&&!o,disabledReason:d?f:`Session closed — no session to resume.`,footerEnd:d&&!s.providerPending?(0,$.jsx)(X,{to:`/settings/agent-defaults#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):void 0,allowEmptySubmit:o&&!a,emptySubmitLabel:o&&!a?`Continue`:void 0,placeholder:xc(e,c,o),autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>mt(t)})}function bc(e,t,n){return e.status===`queued`||e.status===`running`||e.status===`waiting`&&t.bucket===`none`&&!n}function xc(e,t,n){return t?`Add to the prompt — sent when the run starts…`:n?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`}function Sc({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,$.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,$.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,$.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":i,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:a,disabled:t,className:`rounded-md px-3 py-1.5 font-medium hover:bg-muted disabled:cursor-wait`,children:t?`Loading 100 earlier items…`:n?`Couldn’t load earlier items · Retry`:`Load 100 earlier items`}),(0,$.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Cc({run:e}){let t=Yt(B().data??[],e.id);return(0,$.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,$.jsx)(At,{tone:`neutral`,shape:`ring`}),(0,$.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,$.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{lc as TaskThreadRoute};