@hearsay-tools/squawk 0.19.0-dev.9160 → 0.19.0-dev.9168

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 (89) hide show
  1. package/dist/delegation/routes.d.ts +78 -78
  2. package/dist/delegation/workspace-removal.d.ts +1 -1
  3. package/dist/delegation/workspace-removal.js +1 -1
  4. package/dist/delegation/workspace-removal.js.map +1 -1
  5. package/dist/features/hosts/routes.d.ts +44 -44
  6. package/dist/features/webhooks/routes.d.ts +38 -38
  7. package/dist/git-command.d.ts +11 -0
  8. package/dist/git-command.js +14 -0
  9. package/dist/git-command.js.map +1 -1
  10. package/dist/git-worktree-claims.d.ts +96 -0
  11. package/dist/git-worktree-claims.js +219 -0
  12. package/dist/git-worktree-claims.js.map +1 -0
  13. package/dist/git-worktree-lock.d.ts +4 -3
  14. package/dist/git-worktree-lock.js +220 -66
  15. package/dist/git-worktree-lock.js.map +1 -1
  16. package/dist/server/models-routes.d.ts +12 -12
  17. package/dist/server/providers-routes.d.ts +58 -58
  18. package/dist/server/repo-routes.d.ts +13 -13
  19. package/dist/server/runners-routes.d.ts +10 -10
  20. package/dist/server/runs-routes.d.ts +16 -16
  21. package/dist/server/server.d.ts +58 -58
  22. package/dist/server/workspace-live-routes.d.ts +5 -5
  23. package/dist/server/workspace-routes.d.ts +85 -85
  24. package/package.json +4 -4
  25. package/web/dist/assets/{accounts-section-m_1ntZJh.js → accounts-section-Bnr89jmC.js} +1 -1
  26. package/web/dist/assets/{activity-motion-DDqgr8eF.js → activity-motion-BW0tAmYF.js} +1 -1
  27. package/web/dist/assets/{activity-route-BlEZZxyI.js → activity-route-C2zP5vVV.js} +1 -1
  28. package/web/dist/assets/{agent-config-section-wICtFVks.js → agent-config-section-CwK_izpU.js} +1 -1
  29. package/web/dist/assets/{agent-defaults-section-BC9Ypg0g.js → agent-defaults-section-RyEogH0g.js} +1 -1
  30. package/web/dist/assets/{appearance-fkDdWPlG.js → appearance-DvoRcoRX.js} +1 -1
  31. package/web/dist/assets/{archive-on-merge-field-B6kX09p-.js → archive-on-merge-field-DWPtF9dh.js} +1 -1
  32. package/web/dist/assets/ask-card-D-om0EtP.js +9 -0
  33. package/web/dist/assets/{automations-route-BfOpJjLK.js → automations-route-DfGE4xWT.js} +1 -1
  34. package/web/dist/assets/{commit-list-StLehTiQ.js → commit-list-CPJLP4DU.js} +1 -1
  35. package/web/dist/assets/{diff-DEw-tkVq.js → diff-BQJN6jzN.js} +2 -2
  36. package/web/dist/assets/{diff-controls-CSO8HgZ0.js → diff-controls-AsSX7gfO.js} +1 -1
  37. package/web/dist/assets/{diff-view-BcU4Rnuo.js → diff-view-BW5bbiaq.js} +1 -1
  38. package/web/dist/assets/{discard-changes-dialog-BEsdWdyJ.js → discard-changes-dialog-Bv4yc0N1.js} +1 -1
  39. package/web/dist/assets/{file-preview-_4nAs_Ai.js → file-preview-CnrFxbea.js} +1 -1
  40. package/web/dist/assets/{git-toolbar-DXnIUFi1.js → git-toolbar-C7iolhIi.js} +1 -1
  41. package/web/dist/assets/{github-g-Ykk4uE.js → github-DGElvfMU.js} +1 -1
  42. package/web/dist/assets/{global-activity-route-OsAvUny-.js → global-activity-route-Dijwg4OL.js} +1 -1
  43. package/web/dist/assets/index-BVRdRJAN.css +1 -0
  44. package/web/dist/assets/{index-Dp7K74Jw.js → index-DPfg7xSB.js} +4 -4
  45. package/web/dist/assets/{markdown-BB-PN03o.js → markdown-Cljq4S1h.js} +1 -1
  46. package/web/dist/assets/{option-select-Bmm4ktgQ.js → option-select-BcTkv-7t.js} +1 -1
  47. package/web/dist/assets/{preferences-section-dKDCZSWD.js → preferences-section-CEKXGhEj.js} +1 -1
  48. package/web/dist/assets/{preview-pane-connected-DBbCXW1b.js → preview-pane-connected-CKRBfx7t.js} +1 -1
  49. package/web/dist/assets/{project-location-DJjcFmsE.js → project-location-hufc_p8y.js} +1 -1
  50. package/web/dist/assets/{projects-section-CVFyzORg.js → projects-section-vOFZ4lbx.js} +1 -1
  51. package/web/dist/assets/{prompt-templates-section-Jj1YbCwG.js → prompt-templates-section-Caash2nq.js} +1 -1
  52. package/web/dist/assets/{remote-settings-notice-Czl9yS5W.js → remote-settings-notice-fNgh5LdN.js} +1 -1
  53. package/web/dist/assets/{repo-git-C9N9wa5l.js → repo-git-5MK_RAR6.js} +1 -1
  54. package/web/dist/assets/{report-reader-Ci4sWoe1.js → report-reader-CK1WDtEH.js} +1 -1
  55. package/web/dist/assets/{reports-CQPRtR5G.js → reports-B-GImLAo.js} +1 -1
  56. package/web/dist/assets/{resources-section-lLpdP6MD.js → resources-section-ApF3gXrw.js} +1 -1
  57. package/web/dist/assets/{review-notes-drafts-BjXqp0gY.js → review-notes-drafts-BdjEFs1G.js} +1 -1
  58. package/web/dist/assets/{review-panel-B4dp-Rol.js → review-panel-D4zmYH8O.js} +1 -1
  59. package/web/dist/assets/{review-strip-BE71YjB6.js → review-strip-BpHXklAn.js} +1 -1
  60. package/web/dist/assets/{run-header-DvbVw3uo.js → run-header-BUe92WWr.js} +1 -1
  61. package/web/dist/assets/{select-CYo1lo6a.js → select-CwDhRDtw.js} +1 -1
  62. package/web/dist/assets/{session-context-section-B_NEOGby.js → session-context-section-C87jx7RB.js} +1 -1
  63. package/web/dist/assets/{settings-agent-picker-DeAST7qR.js → settings-agent-picker-Dk8yJ57U.js} +1 -1
  64. package/web/dist/assets/{settings-save-bar-Dd3bTznK.js → settings-save-bar-cu8BKCGT.js} +1 -1
  65. package/web/dist/assets/{settings-shell-Bt7NYun7.js → settings-shell-mhQfQKf1.js} +1 -1
  66. package/web/dist/assets/{sidebar-section-DdrFJBTL.js → sidebar-section-DOQ5N1L6.js} +1 -1
  67. package/web/dist/assets/{skills-DNCuhhKf.js → skills-DXJ1gQBD.js} +1 -1
  68. package/web/dist/assets/{task-changes-CdAzeh9M.js → task-changes-D9Sdmpmw.js} +1 -1
  69. package/web/dist/assets/{task-commits-CzZJZj2x.js → task-commits-A0UIqxpL.js} +1 -1
  70. package/web/dist/assets/{task-file-scope-BuFeMG6a.js → task-file-scope-ID220XKo.js} +1 -1
  71. package/web/dist/assets/{task-files-BFdMVAb3.js → task-files-Id2tuAAG.js} +1 -1
  72. package/web/dist/assets/{task-github-item-Dv0Uflz7.js → task-github-item-YKUcwp2o.js} +1 -1
  73. package/web/dist/assets/task-thread-A_vkygGX.js +2 -0
  74. package/web/dist/assets/{task-thread-a6CXLxwn.css → task-thread-BObu0KsD.css} +1 -1
  75. package/web/dist/assets/{thread-state-DqBwIoCM.js → thread-state-6-BzRrJ_.js} +1 -1
  76. package/web/dist/assets/{use-finish-run-CFEVvqeg.js → use-finish-run-DO-nnAaa.js} +1 -1
  77. package/web/dist/assets/{use-hand-to-agent-state-BYN578_s.js → use-hand-to-agent-state-CADaL8U8.js} +1 -1
  78. package/web/dist/assets/use-path-bases-CFAmFn_E.js +1 -0
  79. package/web/dist/assets/{workflows-IT5WTfLr.js → workflows-DOLG-Rns.js} +1 -1
  80. package/web/dist/assets/{workspace-tools-D_opTe6D.js → workspace-tools-DTCJVDTE.js} +1 -1
  81. package/web/dist/assets/{worktrees-section-B8ycJMoK.js → worktrees-section-BOHDbywt.js} +1 -1
  82. package/web/dist/index.html +2 -2
  83. package/dist/git-worktree-lock-helper.d.ts +0 -30
  84. package/dist/git-worktree-lock-helper.js +0 -300
  85. package/dist/git-worktree-lock-helper.js.map +0 -1
  86. package/web/dist/assets/ask-card-Cue5EajQ.js +0 -9
  87. package/web/dist/assets/index-D_WkVdwL.css +0 -1
  88. package/web/dist/assets/task-thread-C98mqSie.js +0 -2
  89. package/web/dist/assets/use-path-bases-B238cLk1.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{J as t,Vt as n,X as r,Z as i,dn as a}from"./queries-IlC9MZgh.js";import{Tt as o,Yn as s,wt as c}from"./toaster-DNnL8v10.js";import{g as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{C as u,M as d}from"./design-icons-QbNMZniQ.js";import{t as f}from"./run-header-DvbVw3uo.js";import{t as p}from"./project-router-Dc6KBQsv.js";import{b as m}from"./task-groups-DCg4iOB9.js";import{f as h,l as g,m as _}from"./page-shell-BdjH5hyc.js";import{t as v}from"./centered-state-N8vWM_Hw.js";import{Bn as y,D as b,E as x}from"./index-Dp7K74Jw.js";import{t as S}from"./change-counts-BLLRvt46.js";import{t as C}from"./code-workbench-B0GIezrD.js";import{t as w}from"./file-text-nGpo7MVd.js";import{i as T,r as E,t as D}from"./commit-list-StLehTiQ.js";import{i as O,n as k,r as A}from"./selected-file-CfBWFB6p.js";var j=e();function M(){let{id:e}=l(),n=t(e);return n.isPending?(0,j.jsx)(b,{tab:`changes`}):n.isError?(0,j.jsx)(x,{tab:`changes`,error:n.error}):(0,j.jsx)(N,{run:n.data})}function N({run:e}){let{sha:t}=l(),n=i(e.id,m(e)),r=_(),a=t??n.data?.commits[0]?.sha,o=t!==void 0&&(!r||n.isError||n.data?.commits.length===0);return(0,j.jsxs)(g,{route:`task-commits`,density:h(n.data?.commits.length??0),flushPadding:!0,children:[(0,j.jsx)(f,{run:e,tab:`commits`}),o?(0,j.jsx)(F,{runId:e.id,sha:t}):n.isPending?(0,j.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{size:16}),tone:n.error instanceof s&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof s&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,j.jsx)(P,{run:e,commits:n.data.commits,selectedSha:a})]})}function P({run:e,commits:t,selectedSha:n}){let i=r(e.id,n),a=L(e.id,t),s=A(e.id,`commit:${n??``}`,i.data?.files),c=O(e.id);return(0,j.jsx)(C,{className:`px-4 py-5 md:px-9`,treeSlot:`task-commits-pane`,tree:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(D,{slot:`task-commits`,selectedSha:n,heading:(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:a.get(t.sha)}))}),n&&i.data&&i.data.files.length>0?(0,j.jsx)(R,{runId:e.id,sha:n,files:i.data.files,selected:c,onPick:t=>{k(e.id,t),s.reveal(t)}}):null]}),children:n?(0,j.jsx)(T,{commit:i,sha:n,slot:`task-commit-preview`,heading:`h3`,diffRef:s,loadFileText:t=>w(()=>o(e.id,n,t))}):null})}function F({runId:e,sha:t}){let n=r(e,t);return(0,j.jsx)(E,{commit:n,sha:t,diffRef:A(e,`commit:${t}`,n.data?.files),backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,loadFileText:n=>w(()=>o(e,t,n))})}var I=12;function L(e,t){let r=t.length<=I,i=a({queries:t.map(t=>({queryKey:n.runs.commit(e,t.sha),queryFn:({signal:n})=>c(e,t.sha,{signal:n}),enabled:r,retry:!1}))}),o=new Map;return i.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&o.set(r,e.data.stat)}),o}function R({runId:e,sha:t,files:n,selected:r,onPick:i}){return(0,j.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,j.jsx)(y,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,j.jsx)(p,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,j.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,"aria-current":e.path===r?`true`:void 0,onClick:()=>i(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground aria-[current=true]:bg-muted aria-[current=true]:text-foreground`,children:[(0,j.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,j.jsx)(S,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{M as TaskCommitsRoute};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{J as t,Vt as n,X as r,Z as i,dn as a}from"./queries-IlC9MZgh.js";import{Tt as o,Yn as s,wt as c}from"./toaster-DNnL8v10.js";import{g as l}from"./chunk-KS7C4IRE-BdLLx37K.js";import{C as u,M as d}from"./design-icons-QbNMZniQ.js";import{t as f}from"./run-header-BUe92WWr.js";import{t as p}from"./project-router-Dc6KBQsv.js";import{b as m}from"./task-groups-DCg4iOB9.js";import{f as h,l as g,m as _}from"./page-shell-BdjH5hyc.js";import{t as v}from"./centered-state-N8vWM_Hw.js";import{Bn as y,D as b,E as x}from"./index-DPfg7xSB.js";import{t as S}from"./change-counts-BLLRvt46.js";import{t as C}from"./code-workbench-B0GIezrD.js";import{t as w}from"./file-text-nGpo7MVd.js";import{i as T,r as E,t as D}from"./commit-list-CPJLP4DU.js";import{i as O,n as k,r as A}from"./selected-file-CfBWFB6p.js";var j=e();function M(){let{id:e}=l(),n=t(e);return n.isPending?(0,j.jsx)(b,{tab:`changes`}):n.isError?(0,j.jsx)(x,{tab:`changes`,error:n.error}):(0,j.jsx)(N,{run:n.data})}function N({run:e}){let{sha:t}=l(),n=i(e.id,m(e)),r=_(),a=t??n.data?.commits[0]?.sha,o=t!==void 0&&(!r||n.isError||n.data?.commits.length===0);return(0,j.jsxs)(g,{route:`task-commits`,density:h(n.data?.commits.length??0),flushPadding:!0,children:[(0,j.jsx)(f,{run:e,tab:`commits`}),o?(0,j.jsx)(F,{runId:e.id,sha:t}):n.isPending?(0,j.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{size:16}),tone:n.error instanceof s&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof s&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,j.jsx)(v,{icon:(0,j.jsx)(d,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,j.jsx)(P,{run:e,commits:n.data.commits,selectedSha:a})]})}function P({run:e,commits:t,selectedSha:n}){let i=r(e.id,n),a=L(e.id,t),s=A(e.id,`commit:${n??``}`,i.data?.files),c=O(e.id);return(0,j.jsx)(C,{className:`px-4 py-5 md:px-9`,treeSlot:`task-commits-pane`,tree:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(D,{slot:`task-commits`,selectedSha:n,heading:(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:a.get(t.sha)}))}),n&&i.data&&i.data.files.length>0?(0,j.jsx)(R,{runId:e.id,sha:n,files:i.data.files,selected:c,onPick:t=>{k(e.id,t),s.reveal(t)}}):null]}),children:n?(0,j.jsx)(T,{commit:i,sha:n,slot:`task-commit-preview`,heading:`h3`,diffRef:s,loadFileText:t=>w(()=>o(e.id,n,t))}):null})}function F({runId:e,sha:t}){let n=r(e,t);return(0,j.jsx)(E,{commit:n,sha:t,diffRef:A(e,`commit:${t}`,n.data?.files),backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,loadFileText:n=>w(()=>o(e,t,n))})}var I=12;function L(e,t){let r=t.length<=I,i=a({queries:t.map(t=>({queryKey:n.runs.commit(e,t.sha),queryFn:({signal:n})=>c(e,t.sha,{signal:n}),enabled:r,retry:!1}))}),o=new Map;return i.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&o.set(r,e.data.stat)}),o}function R({runId:e,sha:t,files:n,selected:r,onPick:i}){return(0,j.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,j.jsx)(y,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,j.jsx)(p,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,j.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,"aria-current":e.path===r?`true`:void 0,onClick:()=>i(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground aria-[current=true]:bg-muted aria-[current=true]:text-foreground`,children:[(0,j.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,j.jsx)(S,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{M as TaskCommitsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{f as r,g as i}from"./chunk-KS7C4IRE-BdLLx37K.js";import{x as a}from"./index-Dp7K74Jw.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{c as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{f as r,g as i}from"./chunk-KS7C4IRE-BdLLx37K.js";import{x as a}from"./index-DPfg7xSB.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{c as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,J as i,M as a,P as o,z as s}from"./queries-IlC9MZgh.js";import{Yn as c,it as l,mt as u}from"./toaster-DNnL8v10.js";import{_ as d,g as f,h as p,p as m}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as h}from"./dist-CCX8mhHc.js";import{C as g,E as _,Q as v,Z as ee,ct as y,d as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./run-header-DvbVw3uo.js";import{a as C,i as w,n as T,o as E,r as te}from"./file-preview-_4nAs_Ai.js";import{t as D}from"./button-BV_AiLj2.js";import{l as O}from"./page-shell-BdjH5hyc.js";import{t as k}from"./centered-state-N8vWM_Hw.js";import{t as A}from"./use-search-params-writer-DD5PEEZw.js";import{C as j,D as M,E as N,lr as P,vr as F,x as I,zn as L}from"./index-Dp7K74Jw.js";import{t as R}from"./task-file-scope-BuFeMG6a.js";import{t as z}from"./code-workbench-B0GIezrD.js";import{t as B}from"./middle-truncated-name-jUQS2QzL.js";import{n as V,t as H}from"./selected-file-CfBWFB6p.js";var U=x(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ne=x(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),W=e(t(),1),G=n();function K({runId:e,path:t,artifactId:n,worktreePath:r}){let i=s(e,n?null:t),o=a(e,n),c=n?o:i,d=(0,W.useContext)(I),f=m(),p=f.pathname.replace(/\/files\/?$/,`/report`)+f.search,h=c.data,g=(0,W.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...d,basePath:h.path}:null,[h,d,e]);if(!t&&!n)return(0,G.jsx)(te,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,G.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:`Could not load this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=w(h.path,r,t);if(h.type!==`file`)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,G.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,G.jsx)(I.Provider,{value:g,children:(0,G.jsx)(T,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:v?l(e,v.id,`image`):u(e,t),...v?{downloadUrl:l(e,v.id,`download`),snapshot:(0,G.jsx)(L,{iso:v.createdAt})}:{}},v?.id??h.path)})}var q=new Map;function J(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var Y=(0,W.createContext)(null);function X(){let{key:e}=m(),t=p()===`POP`,[n,r]=(0,W.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var Z=()=>document.querySelector(`[data-slot="main"]`);function re(e,t){let n=(0,W.useRef)(null),r=m(),i=p()===`POP`?r.key:J(r.state),[a]=(0,W.useState)(()=>{let t=i?q.get(i):void 0;return t?.runId===e?t:null}),o=(0,W.useRef)(new Set(a?.folders??[])),s=(0,W.useRef)(new Set),[c,l]=(0,W.useState)(0),u=(0,W.useRef)(a===null),d=(0,W.useCallback)(()=>{u.current&&q.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:Z()?.scrollTop??0})},[r.key,e]),f=(0,W.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,W.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=Z();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,W.useEffect)(()=>{d();let e=[n.current,Z()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:f}}function ie({runId:e,selected:t,onSelect:n}){return(0,G.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Q({runId:e,path:t,depth:n,selected:i,onSelect:a}){let o=r(e,t),s=(0,W.useContext)(Y);return(0,W.useEffect)(()=>{if(!(!t||!s))return s.loading(t,o.isPending),()=>s.loading(t,!1)},[s,t,o.isPending]),o.isPending?(0,G.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):o.isError?(0,G.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,G.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,G.jsx)(G.Fragment,{children:o.data.entries.map(r=>r.type===`dir`?(0,G.jsx)(ae,{runId:e,name:r.chain??r.name,path:t===``?r.chain??r.name:`${t}/${r.chain??r.name}`,depth:n,selected:i,onSelect:a},r.name):(0,G.jsx)(oe,{name:r.name,path:t===``?r.name:`${t}/${r.name}`,size:r.size,depth:n,selected:i,onSelect:a},r.name))}):null}function ae({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let o=(0,W.useContext)(Y),[s,c]=(0,W.useState)(()=>o?.isOpen(n)??!1);return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":s?`open`:`closed`,"aria-expanded":s,onClick:()=>{o?.setOpen(n,!s),c(!s)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:h(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,s&&`rotate-90`)}),(0,G.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{title:n,className:`min-w-0 truncate font-normal`,children:t})]}),s?(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function oe({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=E(t)?ne:g;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:h(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,G.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(B,{name:e,path:t}),n===void 0?null:(0,G.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:C(n)})]})})}function $(){let{id:e}=f(),t=i(e),n=X();return t.isPending?(0,G.jsx)(M,{tab:`files`}):t.isError?(0,G.jsx)(N,{tab:`files`,error:t.error}):(0,G.jsx)(R,{runId:t.data.id,children:(0,G.jsx)(le,{run:t.data},`${t.data.id}:${n}`)})}function se(e,t,n,r){let i=s(e,r||n!==null?null:t),o=a(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:o).isPending}function ce(e,t,n,r){let i=e.id,a=e.worktreePath,[,o]=A(),s=p(),c=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(c.current)return;c.current=!0;let e=H(i);s===`POP`||t!==null||n!==null||e===null||o(t=>(t.set(`path`,e),t))},[s,n,t,i,o]),(0,W.useEffect)(()=>{t!==null&&!r&&V(i,j(t,a))},[r,t,i,a])}function le({run:e}){let t=r(e.id,``),n=o(e.id),[i,a]=d(),s=i.get(`path`),l=i.get(`artifact`),u=i.getAll(`path`).length>1||i.getAll(`artifact`).length>1||s!==null&&l!==null;ce(e,s,l,u);let[f,p]=(0,W.useState)(s??``);(0,W.useEffect)(()=>p(s??``),[s]);let m=(e,t)=>{let n=new URLSearchParams(i);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},h=t.isError&&t.error instanceof c&&t.error.status===409,g=se(e.id,s,l,u),_=re(e.id,!t.isPending&&g);return(0,G.jsxs)(O,{route:`task-files`,density:ue(t.isError),flushPadding:!0,children:[(0,G.jsx)(S,{run:e,tab:`files`}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),f.trim()&&m(`path`,f.trim())},children:[(0,G.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,G.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,G.jsx)(P,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:f,onChange:e=>p(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,G.jsx)(D,{type:`submit`,variant:`outline`,className:`shrink-0`,disabled:!f.trim(),children:`Open file`})]}),(0,G.jsx)(z,{className:`flex-none gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:gap-0 md:px-9`,treeRef:_.tree,treeSlot:`files-tree-pane`,treeClassName:`rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:overflow-y-auto md:overscroll-contain`,tree:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,G.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,G.jsx)(k,{icon:h?(0,G.jsx)(U,{}):(0,G.jsx)(y,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,G.jsx)(Y.Provider,{value:_.folders,children:(0,G.jsx)(ie,{runId:e.id,selected:s,onSelect:e=>m(`path`,e)})}),(0,G.jsx)(de,{artifacts:n,artifactId:l,onSelect:e=>m(`artifact`,e)})]}),children:u?(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):s!==null||l!==null||t.isSuccess?(0,G.jsx)(K,{runId:e.id,path:s,artifactId:l,worktreePath:e.worktreePath}):null}),(0,G.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function ue(e){return e?`empty`:`full`}function de({artifacts:e,artifactId:t,onSelect:n}){return(0,G.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,G.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,G.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,G.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,G.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,G.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,G.jsxs)(D,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2`,onClick:()=>void e.refetch(),children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,J as i,M as a,P as o,z as s}from"./queries-IlC9MZgh.js";import{Yn as c,it as l,mt as u}from"./toaster-DNnL8v10.js";import{_ as d,g as f,h as p,p as m}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as h}from"./dist-CCX8mhHc.js";import{C as g,E as _,Q as v,Z as ee,ct as y,d as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./run-header-BUe92WWr.js";import{a as C,i as w,n as T,o as E,r as te}from"./file-preview-CnrFxbea.js";import{t as D}from"./button-BV_AiLj2.js";import{l as O}from"./page-shell-BdjH5hyc.js";import{t as k}from"./centered-state-N8vWM_Hw.js";import{t as A}from"./use-search-params-writer-DD5PEEZw.js";import{C as j,D as M,E as N,lr as P,vr as F,x as I,zn as L}from"./index-DPfg7xSB.js";import{t as R}from"./task-file-scope-ID220XKo.js";import{t as z}from"./code-workbench-B0GIezrD.js";import{t as B}from"./middle-truncated-name-jUQS2QzL.js";import{n as V,t as H}from"./selected-file-CfBWFB6p.js";var U=x(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ne=x(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),W=e(t(),1),G=n();function K({runId:e,path:t,artifactId:n,worktreePath:r}){let i=s(e,n?null:t),o=a(e,n),c=n?o:i,d=(0,W.useContext)(I),f=m(),p=f.pathname.replace(/\/files\/?$/,`/report`)+f.search,h=c.data,g=(0,W.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...d,basePath:h.path}:null,[h,d,e]);if(!t&&!n)return(0,G.jsx)(te,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,G.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:`Could not load this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=w(h.path,r,t);if(h.type!==`file`)return(0,G.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,G.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,G.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,G.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,G.jsx)(D,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,G.jsx)(I.Provider,{value:g,children:(0,G.jsx)(T,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:v?l(e,v.id,`image`):u(e,t),...v?{downloadUrl:l(e,v.id,`download`),snapshot:(0,G.jsx)(L,{iso:v.createdAt})}:{}},v?.id??h.path)})}var q=new Map;function J(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var Y=(0,W.createContext)(null);function X(){let{key:e}=m(),t=p()===`POP`,[n,r]=(0,W.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var Z=()=>document.querySelector(`[data-slot="main"]`);function re(e,t){let n=(0,W.useRef)(null),r=m(),i=p()===`POP`?r.key:J(r.state),[a]=(0,W.useState)(()=>{let t=i?q.get(i):void 0;return t?.runId===e?t:null}),o=(0,W.useRef)(new Set(a?.folders??[])),s=(0,W.useRef)(new Set),[c,l]=(0,W.useState)(0),u=(0,W.useRef)(a===null),d=(0,W.useCallback)(()=>{u.current&&q.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:Z()?.scrollTop??0})},[r.key,e]),f=(0,W.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,W.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=Z();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,W.useEffect)(()=>{d();let e=[n.current,Z()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:f}}function ie({runId:e,selected:t,onSelect:n}){return(0,G.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Q({runId:e,path:t,depth:n,selected:i,onSelect:a}){let o=r(e,t),s=(0,W.useContext)(Y);return(0,W.useEffect)(()=>{if(!(!t||!s))return s.loading(t,o.isPending),()=>s.loading(t,!1)},[s,t,o.isPending]),o.isPending?(0,G.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):o.isError?(0,G.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,G.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,G.jsx)(G.Fragment,{children:o.data.entries.map(r=>r.type===`dir`?(0,G.jsx)(ae,{runId:e,name:r.chain??r.name,path:t===``?r.chain??r.name:`${t}/${r.chain??r.name}`,depth:n,selected:i,onSelect:a},r.name):(0,G.jsx)(oe,{name:r.name,path:t===``?r.name:`${t}/${r.name}`,size:r.size,depth:n,selected:i,onSelect:a},r.name))}):null}function ae({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let o=(0,W.useContext)(Y),[s,c]=(0,W.useState)(()=>o?.isOpen(n)??!1);return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":s?`open`:`closed`,"aria-expanded":s,onClick:()=>{o?.setOpen(n,!s),c(!s)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:h(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,s&&`rotate-90`)}),(0,G.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{title:n,className:`min-w-0 truncate font-normal`,children:t})]}),s?(0,G.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,G.jsx)(Q,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function oe({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=E(t)?ne:g;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:h(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,G.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(B,{name:e,path:t}),n===void 0?null:(0,G.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:C(n)})]})})}function $(){let{id:e}=f(),t=i(e),n=X();return t.isPending?(0,G.jsx)(M,{tab:`files`}):t.isError?(0,G.jsx)(N,{tab:`files`,error:t.error}):(0,G.jsx)(R,{runId:t.data.id,children:(0,G.jsx)(le,{run:t.data},`${t.data.id}:${n}`)})}function se(e,t,n,r){let i=s(e,r||n!==null?null:t),o=a(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:o).isPending}function ce(e,t,n,r){let i=e.id,a=e.worktreePath,[,o]=A(),s=p(),c=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(c.current)return;c.current=!0;let e=H(i);s===`POP`||t!==null||n!==null||e===null||o(t=>(t.set(`path`,e),t))},[s,n,t,i,o]),(0,W.useEffect)(()=>{t!==null&&!r&&V(i,j(t,a))},[r,t,i,a])}function le({run:e}){let t=r(e.id,``),n=o(e.id),[i,a]=d(),s=i.get(`path`),l=i.get(`artifact`),u=i.getAll(`path`).length>1||i.getAll(`artifact`).length>1||s!==null&&l!==null;ce(e,s,l,u);let[f,p]=(0,W.useState)(s??``);(0,W.useEffect)(()=>p(s??``),[s]);let m=(e,t)=>{let n=new URLSearchParams(i);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},h=t.isError&&t.error instanceof c&&t.error.status===409,g=se(e.id,s,l,u),_=re(e.id,!t.isPending&&g);return(0,G.jsxs)(O,{route:`task-files`,density:ue(t.isError),flushPadding:!0,children:[(0,G.jsx)(S,{run:e,tab:`files`}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),f.trim()&&m(`path`,f.trim())},children:[(0,G.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,G.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,G.jsx)(P,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:f,onChange:e=>p(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,G.jsx)(D,{type:`submit`,variant:`outline`,className:`shrink-0`,disabled:!f.trim(),children:`Open file`})]}),(0,G.jsx)(z,{className:`flex-none gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:gap-0 md:px-9`,treeRef:_.tree,treeSlot:`files-tree-pane`,treeClassName:`rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:overflow-y-auto md:overscroll-contain`,tree:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,G.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,G.jsx)(k,{icon:h?(0,G.jsx)(U,{}):(0,G.jsx)(y,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,G.jsx)(Y.Provider,{value:_.folders,children:(0,G.jsx)(ie,{runId:e.id,selected:s,onSelect:e=>m(`path`,e)})}),(0,G.jsx)(de,{artifacts:n,artifactId:l,onSelect:e=>m(`artifact`,e)})]}),children:u?(0,G.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):s!==null||l!==null||t.isSuccess?(0,G.jsx)(K,{runId:e.id,path:s,artifactId:l,worktreePath:e.worktreePath}):null}),(0,G.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function ue(e){return e?`empty`:`full`}function de({artifacts:e,artifactId:t,onSelect:n}){return(0,G.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,G.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,G.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,G.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,G.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,G.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,G.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,G.jsxs)(D,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2`,onClick:()=>void e.refetch(),children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{J as t,Vt as n,a as r,bt as i,n as a,un as o,vt as s,xt as c}from"./queries-IlC9MZgh.js";import{Fi as l,Y as u}from"./toaster-DNnL8v10.js";import{g as d}from"./chunk-KS7C4IRE-BdLLx37K.js";import{s as f}from"./dist-CCX8mhHc.js";import{S as p,T as m}from"./reference-chip-BjerVjzM.js";import{I as h,ct as g,m as _}from"./design-icons-QbNMZniQ.js";import{t as v}from"./run-header-DvbVw3uo.js";import{t as y}from"./external-link-BE6y205O.js";import{t as b}from"./search-x-I9Q8pgUa.js";import{t as x}from"./button-BV_AiLj2.js";import{t as S}from"./project-router-Dc6KBQsv.js";import{l as C}from"./page-shell-BdjH5hyc.js";import{t as w}from"./centered-state-N8vWM_Hw.js";import{E as T,T as E,hr as D}from"./index-Dp7K74Jw.js";import{l as O,n as k,t as A}from"./use-hand-to-agent-state-BYN578_s.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:n}=d(),r=t(n);return r.isPending?(0,j.jsx)(E,{kind:e}):r.isError?(0,j.jsx)(T,{tab:`github-item`,error:r.error}):(0,j.jsx)(P,{run:r.data,kind:e})}function P({run:e,kind:t}){let{n}=d(),a=Number(n),o=i(),l=c(),u=s(),f=l.isPending||u.isPending,m=p(e,o).some(e=>e.kind===t&&e.number===a),h=r(t,a,m);return(0,j.jsxs)(C,{route:`task-github-item`,density:m?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:a}}),m?(0,j.jsx)(H,{run:e,kind:t,number:a,repoBase:o,item:h}):f?(0,j.jsx)(E,{kind:t,number:a,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(D,{size:16}),tone:`neutral`,heading:`h2`,title:`#${n} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:r}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(n.githubItem(t,r)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:t,number:n,repoBase:r,reason:i,retryError:a,retryButton:o}){let s=t===`pr`?h:_,c=m(e,r).find(e=>e.kind===`PR`==(t===`pr`)&&e.number===n)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(s,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:a?.message??i,actions:(0,j.jsxs)(j.Fragment,{children:[o,c&&f(c)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let s=l(),c=o({mutationFn:e=>u(t,n,{refresh:!0}),onSuccess:(e,t)=>s.setQueryData(t,e)}),d=F(t,i),f=a(d?[n]:[],d),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(E,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(k,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{J as t,Vt as n,a as r,bt as i,n as a,un as o,vt as s,xt as c}from"./queries-IlC9MZgh.js";import{Fi as l,Y as u}from"./toaster-DNnL8v10.js";import{g as d}from"./chunk-KS7C4IRE-BdLLx37K.js";import{s as f}from"./dist-CCX8mhHc.js";import{S as p,T as m}from"./reference-chip-BjerVjzM.js";import{I as h,ct as g,m as _}from"./design-icons-QbNMZniQ.js";import{t as v}from"./run-header-BUe92WWr.js";import{t as y}from"./external-link-BE6y205O.js";import{t as b}from"./search-x-I9Q8pgUa.js";import{t as x}from"./button-BV_AiLj2.js";import{t as S}from"./project-router-Dc6KBQsv.js";import{l as C}from"./page-shell-BdjH5hyc.js";import{t as w}from"./centered-state-N8vWM_Hw.js";import{E as T,T as E,hr as D}from"./index-DPfg7xSB.js";import{l as O,n as k,t as A}from"./use-hand-to-agent-state-CADaL8U8.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:n}=d(),r=t(n);return r.isPending?(0,j.jsx)(E,{kind:e}):r.isError?(0,j.jsx)(T,{tab:`github-item`,error:r.error}):(0,j.jsx)(P,{run:r.data,kind:e})}function P({run:e,kind:t}){let{n}=d(),a=Number(n),o=i(),l=c(),u=s(),f=l.isPending||u.isPending,m=p(e,o).some(e=>e.kind===t&&e.number===a),h=r(t,a,m);return(0,j.jsxs)(C,{route:`task-github-item`,density:m?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:a}}),m?(0,j.jsx)(H,{run:e,kind:t,number:a,repoBase:o,item:h}):f?(0,j.jsx)(E,{kind:t,number:a,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(D,{size:16}),tone:`neutral`,heading:`h2`,title:`#${n} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:r}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(n.githubItem(t,r)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:t,number:n,repoBase:r,reason:i,retryError:a,retryButton:o}){let s=t===`pr`?h:_,c=m(e,r).find(e=>e.kind===`PR`==(t===`pr`)&&e.number===n)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(s,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:a?.message??i,actions:(0,j.jsxs)(j.Fragment,{children:[o,c&&f(c)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let s=l(),c=o({mutationFn:e=>u(t,n,{refresh:!0}),onSuccess:(e,t)=>s.setQueryData(t,e)}),d=F(t,i),f=a(d?[n]:[],d),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(E,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(k,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};
@@ -0,0 +1,2 @@
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{B as i,J as a,L as o,R as s,Vt as c,W as l,at as u,bt as d,cn as f,ct as p,en as m,g as h,in as g,ln as _,nt as v,q as y,qt as b,sn as x,tt as S,un as C,ut as w,vt as T}from"./queries-IlC9MZgh.js";import{Fi as E,Hr as D,Nt as O,Yn as k,at as A,bi as ee,ct as j,di as M,dt as N,fi as P,gi as F,hi as I,li as L,mi as R,n as z,nn as B,oi as V,ot as H,rn as U,ui as W,wi as te,yi as G}from"./toaster-DNnL8v10.js";import{g as K,n as ne,p as re}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as q,s as ie}from"./dist-CCX8mhHc.js";import{C as ae,D as oe,b as se,d as ce,g as le,i as ue,o as de,t as fe}from"./reference-chip-BjerVjzM.js";import{A as pe,B as me,V as he,_ as ge,b as _e,c as ve,ct as ye,d as be,ft as xe,g as Se,h as Ce,j as we,m as Te,n as Ee,o as De,ot as Oe,p as ke,u as Ae}from"./design-icons-QbNMZniQ.js";import{t as je}from"./createLucideIcon-BHp8sXmF.js";import{A as Me,C as Ne,D as Pe,E as Fe,F as Ie,I as Le,L as Re,M as ze,N as Be,O as Ve,P as He,R as Ue,S as We,T as Ge,_ as Ke,a as qe,b as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,i as et,j as tt,k as nt,l as rt,m as it,n as at,o as ot,p as st,r as ct,s as lt,t as ut,u as dt,v as ft,w as pt,x as mt,y as ht,z as gt}from"./ask-card-D-om0EtP.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,s as St,t as Ct}from"./run-header-BUe92WWr.js";import{t as wt}from"./eye-B8okNWXU.js";import{t as Tt}from"./loader-circle-CPBhhDbB.js";import{a as Et}from"./tool-display-CTbToGmi.js";import{t as Dt}from"./search-x-I9Q8pgUa.js";import{t as Ot}from"./preview-EtD19mg1.js";import{t as J}from"./button-BV_AiLj2.js";import{n as kt,r as At,t as jt}from"./collapsible-D5i3hm2L.js";import{a as Mt,i as Nt,o as Pt,r as Ft,t as It}from"./popover-BQolmvDR.js";import{s as Lt,t as Rt}from"./project-router-Dc6KBQsv.js";import"./attention-BI6592lk.js";import{D as zt,E as Bt,O as Vt,S as Ht,b as Ut,f as Y,u as Wt,w as Gt,x as Kt}from"./task-groups-DCg4iOB9.js";import"./read-state-BeVNfGkB.js";import{t as qt}from"./status-dot-Bmn4xhch.js";import{c as Jt,i as Yt,l as Xt,o as Zt,r as Qt,s as $t,t as en}from"./report-selection-CZ8eb9QP.js";import{l as tn,m as nn}from"./page-shell-BdjH5hyc.js";import{i as rn,t as an}from"./agent-accounts-D_ZKAmaW.js";import{t as on}from"./centered-state-N8vWM_Hw.js";import{An as sn,B as cn,Fn as ln,I as un,L as dn,Nn as fn,Q as pn,R as mn,Sn as hn,Tn as gn,Un as _n,Vn as vn,Wn as yn,X as bn,Z as xn,_n as Sn,b as Cn,bn as wn,c as Tn,ir as En,l as Dn,m as On,mn as kn,n as An,nt as jn,o as Mn,pn as Nn,r as Pn,tt as Fn,un as In,v as Ln,vn as Rn,w as zn,yn as Bn,z as Vn}from"./index-DPfg7xSB.js";import{t as Hn}from"./markdown-Cljq4S1h.js";import{t as Un}from"./task-file-scope-ID220XKo.js";import{t as Wn}from"./run-diff-ClfLRsHF.js";import{n as Gn,t as Kn}from"./use-finish-run-DO-nnAaa.js";import{i as qn}from"./automation-format-jKMOXcHS.js";import{a as Jn,i as Yn,n as Xn,o as Zn,r as Qn,t as $n}from"./thread-state-6-BzRrJ_.js";var er=je(`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`}]]),X=e(t(),1),Z=r();function tr(e,t,n,r,i,a,o,s,c){let l=Vt(e,kn(e)),u=l?l.model:e.model,d=l?l.effort:e.effort,f=!r&&!n&&u?{...i?.defaultModels,[t]:u}:i?.defaultModels,p=r?null:s,m=mn(t,o,a,[p,f?.[t]]),h=cn(p,t,o,f,a),g=dn(h,a),_=r?``:c??d??``,v=Vn(_,g);return{models:m,model:h,effortOptions:g,effort:v,mustClearStoredEffort:!r&&c===null&&_!==``&&v===``}}function nr(e,t,n,r){let i=Bt(e.steps),a=Vt(e,kn(e)),o=a?.agentProfile??e.agentProfile??i?.profileId??`default`;return{sessionStep:i,workerStep:a,account:n?r?.[t]??`default`:o}}function rr(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 ir(e,t,n,r){return!!t&&(r!==zt(t,e)||(n?.agentProfile??e.agentProfile??t.profileId??`default`)!==(t.profileId??`default`))}function ar({models:e,model:t,effortOptions:n,effort:r}){return{modelLabel:e.find(e=>e.id===t)?.label??`Runner default`,effortLabel:n.find(e=>e.value===r)?.label??`Runner default`}}function or(e){let t=p(),n=wn(e).continueRun,r=h(),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(null),u=`${e.id}:${Vt(e,kn(e))?.id??``}`,[d,f]=(0,X.useState)(u);d!==u&&(f(u),a(null),s(null),l(null));let v=Gn(e,i),{runners:y,canContinue:x,currentRunner:S,runner:w}=v,{sessionStep:E,workerStep:D,account:O}=nr(e,w,w!==S,rn().repoAccount),A=T(),ee=A.data?.capabilities?.localHandoff!==!1,M=m(),N=g(w,n&&!A.isPending&&!M.isPending,ee?O:null),P=r.data?.modelsLocked===!0,F=w!==S,I=tr(e,w,F,P,r.data,N.data,M.data,o,c),{models:L,model:R,effortOptions:z,effort:B}=I,{modelLabel:V,effortLabel:H}=ar(I),U=C({mutationFn:({text:t,images:n})=>x?j(_(e.id),rr(t,n,v.runnerOverride,P,F,o,c,I)):Promise.reject(Error(v.reason??`Connect an agent provider to continue.`)),onMutate:()=>_(e.id),onSuccess:(e,n,r)=>t.invalidateAfter(`continue`,r),onError:(e,n,r)=>{e instanceof k&&e.status===409&&r&&t.invalidateAfter(`continue`,r)}}),W=e.delegation?.role===`worker`,te=nn();return{skillRunner:w,skillAccount:O,available:n,canContinue:x,startsNewConversation:ir(e,E,D,w),reason:v.reason,providerPending:v.providerPending,pills:(0,Z.jsx)(sr,{compact:!te||e.status===`review`,summary:`${b(M.data,w)} · ${V} · ${H}`,children:(0,Z.jsxs)(xn,{children:[!W&&(y.length>1||v.signedOut.length>0)?(0,Z.jsx)(pn,{icon:(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:y,signedOut:v.signedOut,value:w,onPick:e=>{e!==w&&(a(e),s(null))}}):(0,Z.jsx)(bn,{icon:(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,readOnly:!0,disabledHint:W?`Owned workers keep their runner; change model or effort instead.`:void 0,slot:`session-runner-value`,ariaLabel:`Runner`,label:w,value:w,onPick:()=>{},options:[{value:w,label:w}]}),(0,Z.jsx)(bn,{icon:(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-model-pill`,ariaLabel:`Model`,label:V,value:R,readOnly:P,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>{s(e);let t=dn(e,N.data);B!==``&&Vn(B,t)===``&&l(``)},options:L.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:un(w,M.data,N)}),(0,Z.jsx)(bn,{icon:(0,Z.jsx)(pe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-effort-pill`,ariaLabel:`Effort`,label:H,value:B,readOnly:P,disabledHint:`Effort selection is locked to native coding-agent settings.`,onPick:e=>l(e),options:z.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]})},u),continueWith:(e,t)=>U.mutateAsync({text:e,images:t})}}function sr({compact:e,summary:t,children:n}){let[r,i]=(0,X.useState)(!1),a=jn(),[o,s]=(0,X.useState)(a);a!==o&&(s(a),a&&i(!1));let c=(0,X.useRef)(null),l=e&&!r;return(0,X.useEffect)(()=>{r&&(c.current?.querySelector(`button:not([disabled])`)??c.current)?.focus()},[r]),(0,Z.jsx)(`div`,{ref:c,"data-slot":`follow-up-engine`,"data-folded":l||void 0,tabIndex:l?void 0:-1,className:l?`min-w-0`:`session-engine-controls outline-hidden`,children:l?(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`follow-up-engine-summary`,"aria-expanded":!1,"aria-label":`Agent settings: ${t}`,title:`Change the runner, model or effort`,onClick:()=>i(!0),className:`inline-flex min-h-11 max-w-full min-w-0 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground transition-colors outline-hidden hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-4 shrink-0 text-accent-text`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]}):n})}var cr=120,lr=e=>e!==`pending`&&e!==`running`,ur=e=>e.kind===`tool`&&e.toolKind===`task`,dr=e=>ur(e)&&e.parentItemId===void 0,fr=e=>Be(e.kind)&&!(e.kind===`tool`&&e.toolKind===`plan`);function pr(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 mr(e){if(e.kind===`tool`)return hr(e.title);if(e.kind===`hook`)return hr(`${e.event} hook${e.status===`completed`?``:` ${e.status}`}`);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
2
+ `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return hr(n)}}}function hr(e){return e.length>cr?`${e.slice(0,cr-1).trimEnd()}…`:e}function gr(e,t=!1,n=e){let r=br(e,e=>e.items.some(dr));if(r===-1)return[];let i=e=>!t&&!lr(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(dr);n.length!==0&&(!s&&!n.some(i)&&(s=!0),(!s||n.some(a))&&o.unshift(...n))}let c=[...o,...e[r].items.filter(dr)];return r!==e.length-1&&!c.some(i)?[]:c.map(r=>_r(r,wr(n,e,r.id),t))}function _r(e,t,n){let r={id:e.id,title:ze(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=pr(e);i!==void 0&&(r.agentType=i),n&&!lr(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=mr(t[e]);if(n!==void 0){r.activity=n;break}}return r}function vr(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function yr(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function br(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function xr(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&&dr(e));if(a!==void 0)return _r(a,wr(r,e,t),n)}}function Sr(e,t){return br(e,e=>e.items.some(e=>e.id===t&&dr(e)))}function Cr(e,t,n){let r=[];for(let i=n;i<e.length;i+=1){let n=e[i];for(let e of n.items)fr(e)&&e.parentItemId===t&&e.id!==t&&r.push({entry:e,seqs:n.itemSeqs?.get(e.id)})}return r}function wr(e,t,n){let r=Sr(t,n);if(r===-1)return[];let i=Cr(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 Cr(e,n,Math.max(Sr(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:Tr(t,e))}return[...s.values()].sort(Er).map(({entry:e})=>e)}function Tr(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 Er(e,t){return e.seqs===void 0||t.seqs===void 0?0:e.seqs.first-t.seqs.first}function Dr(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`?tt(e.children).flatMap(n=>Dr(n,`${t}:${e.id}`)):e.kind===`streak`?e.blocks.flatMap(e=>Dr(e,t)):[]}function Or(e){return e.flatMap((e,t)=>e.content.kind===`block`?Dr(e.content.block,e.scope).map(n=>({...n,rowKey:e.key,rowIndex:t})):[])}function kr(e,t,n,r){let i=(0,X.useContext)(en),{projectId:a}=K(),o=(0,X.useMemo)(()=>Or(t),[t]);(0,X.useLayoutEffect)(()=>{if(!i)return;let t=[],s={runId:e,...a?{projectId:a}:{}};for(let e of o){let a=Re(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=Le(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 Ar(e){let t=E();return C({mutationFn:t=>N(e,t),retry:!1,networkMode:`always`,onSettled:()=>{t.invalidateQueries({queryKey:c.runs.all})}})}var jr=e=>(window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}),Mr=()=>navigator.onLine;function Nr({permission:e,runId:t,sessionOpen:n=!1}){return e.status!==`pending`||!n?(0,Z.jsx)(Fr,{permission:e,state:e.status===`resolved`?`resolved`:`expired`}):(0,Z.jsx)(Pr,{permission:e,runId:t},e.requestId)}function Pr({permission:e,runId:t}){let n=Ar(t),r=(0,X.useSyncExternalStore)(jr,Mr,()=>!1),i=(0,X.useRef)(!1),[a,o]=(0,X.useState)(`pending`),[s,c]=(0,X.useState)(),[l,u]=(0,X.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 k&&e.status===409?o(`expired`):(u(e instanceof Error?e.message:String(e)),o(`pending`))}finally{i.current=!1}}};return(0,Z.jsx)(Fr,{permission:{...e,...s===void 0?{}:{optionId:s}},state:a,offline:!r,error:l,onSelect:e=>{d(e)}})}function Fr({permission:e,state:t,offline:n=!1,error:r,onSelect:i}){let a=(0,X.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,Z.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-card-edge bg-card shadow-card p-3.5 text-sm [overflow-wrap:anywhere]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Permission request`}),(0,Z.jsx)(`h3`,{id:a,className:`font-semibold whitespace-pre-wrap`,children:e.title})]}),e.details?(0,Z.jsx)(`pre`,{className:`min-w-0 font-mono text-xs leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.details}):null,(0,Z.jsx)(`div`,{role:`group`,"aria-labelledby":a,className:`flex min-w-0 flex-col gap-2`,children:e.options.map(t=>(0,Z.jsx)(J,{type:`button`,variant:`outline`,size:`block`,disabled:s,"aria-pressed":e.optionId===t.id,className:`min-w-0 py-2 [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,Z.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[c,e.reason?` ${e.reason}`:``]}),r&&t===`pending`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r}):null]})}var Ir=(0,X.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function Lr(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 Rr(e,t,n=[]){let r={};for(let e of n)r[e.id]=Y(e);for(let e of t??[])r[e.id]=Y(e);return r[e.id]=Y(e),r}function zr(e,t){return t?.[e]??`Task`}function Br(e,t,n){return t?n?.[e]??`peer task`:zr(e,n)}function Vr(e,t){return e.senderRunId===t?`outbound`:`inbound`}function Hr(e){return e?.relationship===`peer`}function Ur(e){switch(e){case`request`:return`Request`;case`progress`:return`Progress`;case`follow-up`:return`Follow-up`;case`reply`:return`Reply`}}function Wr(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 Gr(e){if(e.outcome)return Wr(e.outcome.status);if(e.delivery===`not-delivered`)return Kr(`not-delivered`)}function Kr(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`consumed`:return`Read`;case`not-delivered`:return`Not delivered`}}function qr(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`?Hr(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 ${gn()} worker resume; workers cannot resume parents.`:e.state===`destroyed`?`Not delivered. This worker was destroyed.`:void 0:e.instruction}function Jr({id:e,peer:t,taskTitles:n,children:r}){return!t||n?.[e]!==void 0?r({title:zr(e,n),linkable:!0}):(0,Z.jsx)(Yr,{id:e,children:r})}function Yr({id:e,children:t}){let n=a(e);return n.data?t({title:Y(n.data),linkable:!0}):n.isPending?t({title:`Peer task`,linkable:!1}):t({title:n.error instanceof k&&n.error.status===404?`Deleted task`:`Task unavailable`,linkable:!1})}var Xr={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`}},Zr=`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 Qr({block:e,runId:t,taskTitles:n,recipientBackends:r}){return(0,Z.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,Z.jsx)($r,{batch:e,runId:t,taskTitles:n,recipientBackends:r},e.id))})}function $r({batch:e,runId:t,taskTitles:n,recipientBackends:r}){let i=Vr(e.messages[0]??{senderRunId:e.senderRunId},t),a=Hr(e.messages[0]),o=Xr[a?`peer`:i],s=ci(e.messages.map(e=>i===`outbound`?e.recipientRunId:e.senderRunId)),c=i===`outbound`?`SENT to`:`RECEIVED from`,l=`${c} ${s.map(e=>Br(e,a,n)).join(`, `)}`,u=e.messages[0],d=u?.createdAt??u?.recordedAt;return(0,Z.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":i,"data-relationship":a?`peer`:`family`,"data-kind":e.kind,className:q(`flex w-full min-w-0 flex-col gap-2 rounded-[8px] border p-3 md:px-4 md:py-[14px]`,o.classes),children:[(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`p`,{className:q(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,o.accent),children:[(0,Z.jsx)(`span`,{children:c}),s.map((e,t)=>(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,Z.jsx)(Jr,{id:e,peer:a,taskTitles:n,children:t=>(0,Z.jsx)(ii,{view:t,to:`/tasks/${e}`,label:`${c} ${t.title}`})})]},e))]}),a?(0,Z.jsx)(`span`,{"data-slot":`conversation-relationship`,className:`rounded-full border border-message-peer-border px-2 py-0.5 text-xs font-semibold tracking-[0.05em] text-foreground uppercase`,children:`Peer`}):null,(0,Z.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-xs font-semibold tracking-[0.05em] text-foreground uppercase`,children:Ur(e.kind)}),e.messages.length===1&&u?(0,Z.jsx)(ti,{message:u}):null]}),(0,Z.jsx)(ei,{at:d,className:`flex shrink-0 items-center justify-self-end gap-1 whitespace-nowrap text-xs text-soft-foreground`,children:e.messages.length>1?`First sent`:null})]}),(0,Z.jsx)(ri,{batch:e},`${t}:${u?.messageId??e.id}`),[...new Set(e.messages.map(e=>qr(e,r?.[e.recipientRunId])))].map(e=>e?(0,Z.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,Z.jsx)(ni,{messages:e.messages,peer:a,runId:t,taskTitles:n}):null,e.messages.length===1&&u?(0,Z.jsx)(ai,{message:u,runId:t,taskTitles:n}):null,(0,Z.jsx)(oi,{batch:e,heading:l})]})}function ei({at:e,className:t,children:n}){return e===void 0||Ke(e)===void 0?null:(0,Z.jsxs)(`span`,{className:t,children:[n,(0,Z.jsx)($e,{ts:e})]})}function ti({message:e}){let t=Gr(e),n=Kr(e.delivery),r=(e.messageKind===`request`||e.messageKind===`reply`)&&n!==t;return(0,Z.jsxs)(Z.Fragment,{children:[t?(0,Z.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:t}):null,r?(0,Z.jsx)(`span`,{"data-slot":`conversation-delivery`,className:`text-xs text-muted-foreground`,children:n}):null]})}function ni({messages:e,peer:t,runId:n,taskTitles:r}){return(0,Z.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.map(e=>{let i=Gr(e),a=e.createdAt??e.recordedAt;return(0,Z.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Jr,{id:e.recipientRunId,peer:t,taskTitles:r,children:t=>(0,Z.jsx)(ii,{view:t,to:`/tasks/${e.recipientRunId}`,label:`${t.title}${i?` — ${i}`:``}`})}),i?(0,Z.jsx)(`span`,{"data-slot":`conversation-outcome`,children:i}):null,Kr(e.delivery)===i?null:(0,Z.jsx)(`span`,{"data-slot":`conversation-delivery`,children:Kr(e.delivery)}),(0,Z.jsx)(ai,{message:e,runId:n,taskTitles:r}),(0,Z.jsx)(ei,{at:a,className:`ml-auto whitespace-nowrap`})]},e.id)})})}function ri({batch:e}){let t=Me(),n=`conversation-body:${e.messages[0]?.messageId??e.id}`,[r,i]=(0,X.useState)(()=>t?.get(n)??!1),a=(0,Z.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,Z.jsx)(Hn,{breaks:!0,children:e.text})});return e.kind!==`request`&&e.kind!==`reply`?a:(0,Z.jsxs)(jt,{"data-slot":`conversation-body`,open:r,onOpenChange:e=>{t?.set(n,e),i(e)},className:`min-w-0`,children:[(0,Z.jsxs)(At,{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,Z.jsx)(be,{"aria-hidden":!0,className:`size-3.5 shrink-0 group-data-[state=open]/body:rotate-90`}),r?`Hide message`:`Show message`]}),(0,Z.jsx)(kt,{children:a})]})}function ii({view:e,to:t,label:n}){return e.linkable?(0,Z.jsx)(Rt,{className:Zr,to:t,"aria-label":n,children:e.title}):(0,Z.jsx)(`span`,{"data-slot":`conversation-counterpart`,children:e.title})}function ai({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,X.useContext)(Ir),o=e.requestId?r.get(e.requestId):void 0,s=e.requestId?o?[o]:[]:i.get(e.messageId)??[],c=e.requestId?`request`:`reply`;return s.length===0?e.requestId||e.outcome?.replyId?(0,Z.jsxs)(`p`,{"data-slot":`conversation-connector`,className:`text-xs text-muted-foreground`,children:[`Linked `,c,` is outside loaded history.`]}):null:s.map(e=>{let r=Vr(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:q(Zr,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),(0,Z.jsx)(Jr,{id:i,peer:Hr(e.message),taskTitles:n,children:e=>(0,Z.jsxs)(Z.Fragment,{children:[`View `,c,` `,r?`to`:`from`,` `,e.title]})})]},e.message.messageId)})}function oi({batch:e,heading:t}){return(0,Z.jsxs)(jt,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,Z.jsxs)(At,{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,Z.jsx)(be,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,Z.jsx)(kt,{children:(0,Z.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-xs text-muted-foreground`,children:[(0,Z.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>si(e)).map((e,t)=>(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,Z.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function si(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},...Hr(e)?[{label:`Relationship`,value:`peer`}]:[],{label:`Delivery`,value:Kr(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 ci(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var li=e(n(),1),ui=`pending-ask`;function di(e){return e.querySelector(`[data-slot="ask-question"] :is(button, textarea):not(:disabled)`)||(e.tabIndex=-1,e)}function fi(e,t){if(e.dataset.askMode===`reply`){let n=(t??e.closest(`[data-slot="thread-dock"]`)??document).querySelector(`[data-slot="thread-composer-slot"]:not([hidden]) textarea:not(:disabled)`);if(n)return n}return di(e)}function pi(e){let t=e.querySelector(`[data-slot="ask-card"][data-pinned="true"]`);return t?fi(t,e):null}function mi(e,t){let n=`${ui}:${e}`;return r=>{if(!t())return!1;let i=[...r.querySelectorAll(`[data-row-key]`)].find(e=>e.dataset.rowKey===n);if(i)return pi(i);let a=[...r.querySelectorAll(`[data-slot="ask-card"][data-pinned="true"]`)].find(t=>t.dataset.askId===e);return a?fi(a,r):null}}function hi(e){return e<=0?`Jump to latest`:`Jump to latest (${e} ${e===1?`question`:`questions`} pending)`}function gi({onGoToQuestion:e}){return(0,Z.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,Z.jsx)(`span`,{className:`font-medium text-link-foreground`,children:`Question asked here`}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-go-to-question`,className:`px-2 text-foreground underline underline-offset-4`,onClick:e,children:`Go to the question`})]})}function _i(){let e=(0,X.useRef)(null);return(0,X.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let 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=()=>{let e=r.querySelector(`[data-slot="run-tabs"]`),a=r.getBoundingClientRect(),o=getComputedStyle(document.documentElement),s=document.documentElement.style.getPropertyValue(`--kb`)||(typeof o.getPropertyValue==`function`?o.getPropertyValue(`--kb`):``),c=Number.parseFloat(s)||0;n.clientHeight>0&&n.clientHeight<420?t.dataset.compactViewport=`true`:delete t.dataset.compactViewport,c>0||Mt(window)?t.dataset.keyboardOpen=`true`:delete t.dataset.keyboardOpen,r.style.setProperty(`--run-header-lead`,`${e?Math.max(0,e.getBoundingClientRect().top-a.top):0}px`),n.style.setProperty(`--thread-viewport-height`,`${n.clientHeight}px`),n.style.setProperty(`--thread-header-height`,`${vi(r)}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(),delete t.dataset.compactViewport,delete t.dataset.keyboardOpen,r.style.removeProperty(`--run-header-lead`),n.style.removeProperty(`--thread-header-height`),n.style.removeProperty(`--thread-footer-height`),n.style.removeProperty(`--thread-viewport-height`)}},[]),e}function vi(e){let t=Number.parseFloat(getComputedStyle(e).insetBlockStart)||0;return Math.max(0,e.getBoundingClientRect().height+Math.min(0,t))}var yi={viewKey:void 0,generation:0},bi=600,xi=24;function Si(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,X.useRef)(a);o.current=a;let s=(0,X.useRef)(e);s.current=e;let c=(0,X.useRef)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1),p=(0,X.useRef)(!0),m=(0,X.useRef)(!0),h=(0,X.useRef)(0),g=(0,X.useRef)(0),_=(0,X.useRef)(new Set),v=(0,X.useCallback)(e=>{for(let t of[..._.current])t(e)},[]),y=(0,X.useCallback)(e=>(_.current.add(e),()=>{_.current.delete(e)}),[]),b=(0,X.useRef)(null),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=(0,X.useCallback)(e=>{let t=c.current;if(!t)return;let n=w.current;n?n.scrollTo(e):t.scrollTop=e},[]),E=(0,X.useCallback)(()=>{let e=c.current;if(!e)return;let t=m.current?o.current.findIndex(e=>e.startsWith(`pending-ask:`)):-1,n=m.current?e.querySelector(`[data-slot="ask-card"][data-pinned="true"][data-resolved="false"]`):null,r=e.querySelector(`[data-slot="run-header"]`),i=r&&getComputedStyle(r).position===`sticky`?vi(r):0;n?T(e.scrollTop+n.getBoundingClientRect().top-e.getBoundingClientRect().top-i-12):t>=0&&w.current?w.current.scrollToIndex(t,{align:`start`,offset:-i-12}):T(e.scrollHeight-e.clientHeight)},[T]),D=(0,X.useCallback)(()=>{if(c.current){if(C.current!==e){C.current=e,m.current=!0;let t=pt(e);t&&!t.atBottom?(p.current=!1,b.current=t.top,S.current=We(e)?.rowKeys?{viewKey:e,top:t.top}:null):(p.current=!0,b.current=null,S.current=null)}b.current===null?p.current&&E():T(b.current)}},[e,T,E]),O=(0,X.useCallback)(e=>S.current?.viewKey===e,[]),k=(0,X.useCallback)(e=>{let t=S.current;return!t||!O(e)||e!==s.current?!1:(b.current=t.top,p.current=!1,S.current=null,!0)},[O]),A=(0,X.useCallback)(e=>{u(e),e&&(c.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="thread-transcript"], [data-slot="main"]`),D())},[n,D]),ee=(0,X.useCallback)(()=>{p.current&&E()},[E]),j=(0,X.useRef)(!1),M=(0,X.useRef)(0),N=(0,X.useRef)(!1),P=(0,X.useRef)(void 0),F=(0,X.useRef)(!1),I=(0,X.useRef)(!1),L=(0,X.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}}),[]),R=(0,X.useRef)(null),z=(0,X.useRef)(0);(0,X.useEffect)(()=>{if(!x())return;let e=e=>{b.current=null,S.current=null,z.current+=1,R.current=null,p.current=!1,m.current=!1,T(e)};return window.__cezThreadScrollTo=e,()=>{window.__cezThreadScrollTo===e&&delete window.__cezThreadScrollTo}},[T]);let B=(0,X.useCallback)(()=>{let e=R.current,t=c.current;if(!e||!t)return;R.current=null;let n=e.beforeTop+Math.max(0,t.scrollHeight-e.beforeHeight),r=t.getBoundingClientRect().top,i=e.anchor===void 0?-1:o.current.indexOf(e.anchor.key),a=w.current;a&&i>=0?a.scrollToIndex(i,{align:`start`,offset:-e.anchor.offset}):T(Pe(t.scrollTop,r,e.anchor,L(t),n))},[L,T]),V=(0,X.useCallback)(()=>{let e=c.current;if(!e||!r||j.current)return;b.current=null,S.current=null,p.current=!1,j.current=!0;let t=M.current+1;M.current=t;let n=e.scrollHeight,i=e.scrollTop,a=e.getBoundingClientRect().top,l=ht(a,L(e)),u=l===void 0?-1:o.current.indexOf(l.key),d=s.current,f=z.current;r().then(()=>{s.current===d&&z.current===f&&(R.current={beforeHeight:n,beforeTop:i,anchor:l,anchorIndex:u})},()=>{}).finally(()=>{M.current===t&&(j.current=!1)})},[L,r]);(0,X.useEffect)(()=>()=>clearTimeout(P.current),[]);let H=(0,X.useRef)(null),U=(0,X.useRef)(0),W=(0,X.useCallback)(()=>n===`document`?++yi.generation:++U.current,[n]),te=(0,X.useCallback)((e,t)=>n===`document`?yi.viewKey===e&&yi.generation===t:s.current===e&&U.current===t,[n]);(0,X.useEffect)(()=>()=>H.current?.disconnect(),[e,l]);let G=(0,X.useCallback)((t,n,r,i)=>{let a=c.current;if(!a||!l)return;b.current=null,S.current=null,z.current+=1,R.current=null,p.current=!1,h.current=0,f(!0),W(),H.current?.disconnect();let o=()=>[...l.querySelectorAll(`[data-row-key]`)].find(e=>e.dataset.rowKey===t),s=a.querySelector(`[data-slot="run-header"]`),u=s&&getComputedStyle(s).position===`sticky`?vi(s):0,d=(e,t)=>{let r=a.getBoundingClientRect(),o=t.getBoundingClientRect(),s=w.current;if(s&&i===void 0){let t=o.top-e.getBoundingClientRect().top;u+t+o.height>r.height&&s.scrollToIndex(n,{align:`start`,offset:t-u-12})}else(o.top<r.top+u||o.bottom>r.bottom)&&T(a.scrollTop+o.top-r.top-u-12)},m=()=>{let e=o();if(!e||getComputedStyle(e).visibility===`hidden`)return!1;let t=r?.(e)??e;return t===e?e.tabIndex=-1:d(e,t),t.focus({preventScroll:!0}),document.activeElement===t?(H.current?.disconnect(),!0):!1},g=w.current;if(i!==void 0)T(i);else if(g)g.scrollToIndex(n,{align:`start`,...u>0?{offset:-u}:{}});else{let e=o();e&&T(a.scrollTop+e.getBoundingClientRect().top-a.getBoundingClientRect().top-u)}m()||(H.current=new MutationObserver(()=>{m()}),H.current.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`]})),Fe(e,{top:i??a.scrollTop,atBottom:!1})},[l,T,e,W]),K=(0,X.useCallback)(t=>{let n=W(),r=s.current;H.current?.disconnect();let a=c.current;if(!a)return;b.current=null,S.current=null,z.current+=1,R.current=null,p.current=!0,m.current=!0,g.current=0,v({direction:`tail`}),Fe(e,{top:a.scrollHeight-a.clientHeight,atBottom:!0});let o=()=>{p.current&&E()},l=a.closest(`[data-slot="main"]`)??a.closest(`[data-route="task-thread"]`)??a,u=()=>te(r,n),d=()=>{let e=t?.(l);return e===!1?!0:e?(e.focus({preventScroll:!0}),document.activeElement===e):!1};(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{o(),requestAnimationFrame(()=>{if(o(),!t||!u()||d())return;H.current?.disconnect();let e=new MutationObserver(()=>{u()?d()&&e.disconnect():e.disconnect()});H.current=e,e.observe(l,{childList:!0,subtree:!0})})})})},[i,e,E,W,te,v]),ne=a.at(-1),re=a.length;return(0,X.useLayoutEffect)(()=>{z.current+=1,R.current=null,j.current=!1,n===`document`?yi.viewKey!==e&&(yi.viewKey=e,yi.generation+=1):U.current+=1},[e,n]),(0,X.useLayoutEffect)(()=>{let e=R.current;e?(e.anchor===void 0?-1:o.current.indexOf(e.anchor.key))>e.anchorIndex?B():R.current=null:p.current&&E()},[ne,re,B,E]),(0,X.useLayoutEffect)(()=>{!c.current||!l||D()},[l,D]),(0,X.useEffect)(()=>{let t=c.current,n=l;if(!t||!n)return;h.current=0;let r=null,i=!1,a=t.scrollTop,o,s=0,u,d=()=>{m.current&&!Je(t,80)&&(p.current=!1),m.current=!1},_=e=>{g.current=Date.now(),d(),u=e},y=()=>{W(),H.current?.disconnect(),b.current=null,S.current=null,z.current+=1,R.current=null,p.current=!1,h.current=0},x=()=>{b.current=null,S.current=null,z.current+=1,R.current=null,h.current=Date.now()},C=e=>{if(e.deltaY!==0)if(_(e.deltaY<0?`up`:`down`),e.deltaY<0){y();let e=!N.current;N.current=!0,clearTimeout(P.current),P.current=setTimeout(()=>{N.current=!1},180),e&&mt(t)&&V()}else x()},w=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(_(`up`),y(),!e.repeat&&mt(t)&&V()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&(_(`down`),x())},D=e=>{if(e.target!==t||e.button!==0||e.pointerType===`touch`||e.pointerType===`pen`||t.scrollHeight<=t.clientHeight)return;i=!0,I.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||(m.current=!1,b.current=null,S.current=null,Je(t,80)||(y(),x()))},k=()=>{i=!1},A=e=>{F.current=!1,r=e.touches[0]?.clientY??null},ee=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(r!==null&&n>r+1?(_(`up`),y(),!F.current&&mt(t)&&(F.current=!0,V())):r!==null&&n<r-1&&(_(`down`),x()),r=n)},j=e=>{if(e===0||!i&&Date.now()-g.current>=bi)return;let n=e<0?`up`:`down`;!i&&n!==u||(n!==o&&(o=n,s=0),s+=Math.abs(e),s>=xi&&(0,li.flushSync)(()=>v({direction:n,distanceFromBottom:t.scrollHeight-t.clientHeight-t.scrollTop})))},M=()=>{let n=p.current;j(t.scrollTop-a),i&&t.scrollTop!==a&&(d(),t.scrollTop<a?y():x()),i&&!I.current&&t.scrollTop<a&&mt(t)&&(I.current=!0,V()),a=t.scrollTop;let r=Je(t,80);r&&b.current===null&&(p.current||Date.now()-h.current<2e3)&&(p.current=!0),!n&&p.current&&v({direction:`tail`}),f(!r),b.current===null&&!O(e)&&Fe(e,{top:t.scrollTop,atBottom:r})};t.addEventListener(`scroll`,M,{passive:!0}),t.addEventListener(`wheel`,C,{passive:!0}),t.addEventListener(`touchstart`,A,{passive:!0}),t.addEventListener(`touchmove`,ee,{passive:!0}),t.addEventListener(`pointerdown`,D,{passive:!0}),window.addEventListener(`pointerup`,k,{passive:!0}),window.addEventListener(`pointercancel`,k,{passive:!0}),t.addEventListener(`keydown`,w);let L;if(typeof ResizeObserver<`u`){L=new ResizeObserver(()=>{let e=b.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;T(Math.min(e,n)),n>=e&&(b.current=null)}else p.current&&E()}),L.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&&L.observe(r),i&&L.observe(i)}return()=>{t.removeEventListener(`scroll`,M),t.removeEventListener(`wheel`,C),t.removeEventListener(`touchstart`,A),t.removeEventListener(`touchmove`,ee),t.removeEventListener(`pointerdown`,D),window.removeEventListener(`pointerup`,k),window.removeEventListener(`pointercancel`,k),t.removeEventListener(`keydown`,w),L?.disconnect()}},[e,l,V,T,E,O,W,v]),{attachContent:A,scrollElRef:c,virtualizerRef:w,restoreMeasurements:k,ownsMeasurementRestore:O,pillVisible:d,jumpToLatest:K,jumpToRow:G,loadOlder:V,restickIfStuck:ee,subscribeReaderScroll:y}}function Ci({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,Z.jsx)(wi,{runId:e,rows:t,controls:r}):(0,Z.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,className:`[overflow-anchor:none]`,children:t.map(e=>(0,Z.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 wi({runId:e,rows:t,controls:n}){return(0,Z.jsx)(Ti,{runId:e,rows:t,controls:n},e)}function Ti({runId:e,rows:t,controls:n}){let r=(0,X.useRef)(null),i=(0,X.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,X.useLayoutEffect)(()=>{i.current=t},[t]);let[c]=(0,X.useState)(()=>We(e)),[l,u]=(0,X.useState)(()=>({cache:Ne(e,t.length,t.map(e=>e.key)),generation:0})),d=(0,X.useRef)(l.cache===void 0&&c?.rowKeys?.length===c?.rows&&c!==void 0);(0,X.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,X.useRef)(t.length);f.current=t.length;let p=(0,X.useRef)(t.map(e=>e.key));p.current=t.map(e=>e.key);let m=(0,X.useRef)(null),h=(0,X.useCallback)(t=>{n.virtualizerRef.current=t,t?m.current=t:m.current&&=(d.current&&c?.rowKeys&&f.current<c.rows&&n.ownsMeasurementRestore(e)||Ge(e,{rows:f.current,cache:m.current.cache,rowKeys:p.current}),null)},[e,n.virtualizerRef,n.ownsMeasurementRestore,c]),[g,_]=(0,X.useState)(0);return(0,X.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,Z.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,className:`[overflow-anchor:none]`,children:(0,Z.jsx)(Mn,{ref:h,scrollRef:n.scrollElRef,startMargin:g,shift:s,...l.cache===void 0?{}:{cache:l.cache},children:t.map(e=>(0,Z.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 Ei({onJump:e,pendingQuestions:t=0}){return(0,Z.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 justify-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-sm hover:text-foreground max-md:size-11 max-md:p-0`,children:[(0,Z.jsx)(Ee,{"aria-hidden":!0,className:`size-3.5 max-md:size-4`}),(0,Z.jsx)(`span`,{className:`max-md:sr-only`,children:hi(t)})]})}function Di(e){return e.consumedAt?`consumed`:e.deliveredAt?`delivered`:`queued`}function Oi(e,t){let n=new Map((e.agentInputs??[]).map(e=>[e.id,Di(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 ki(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 Ai=new WeakMap;function ji(e,t){let n=Ai.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:(Ai.set(e,t),t)}function Mi(e,t){if(t!=null)return e.turns.flatMap(e=>e.items).find(e=>e.kind===`ask`&&e.id===t&&!e.resolved)}function Ni(e,t,n=t,r,i){let a=Mi(n,r),o=i?.pinPendingAskInTranscript!==!1,s=new Map(n.turns.flatMap(e=>e.items).filter(e=>e.kind===`permission`).map(e=>[e.requestId,e])),c=new Set,l=new Set(t.turns.map(e=>e.userMessage?.ask?.id)),u=[];e.task&&u.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[],ts:e.createdAt},entries:[]});for(let t of e.queuedMessages??[])u.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[],ts:t.createdAt},inDaySequence:!1,entries:[]});let d=t.turns.at(-1);for(let n of t.turns){let t=e.status===`review`&&n===d?Fi(n.items):n.items;u.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:ji(n.items,Oi(e,t.filter(t=>!e.task||!Jn(t,`opening`)).map(e=>e.kind===`ask`&&l.has(e.id)?{...e,placement:`origin`}:r!==void 0&&e.kind===`ask`?ki(e,r,a):e.kind===`permission`?(c.add(e.requestId),s.get(e.requestId)??(e.status===`pending`?{...e,status:`expired`}:e)):e)))})}let f=[...s.values()].filter(e=>e.status===`pending`&&!c.has(e.requestId));return f.length>0&&u.push({id:`pending-permissions`,entries:f,inDaySequence:!1}),a!==void 0&&o&&u.push({id:ui,entries:[{...a,placement:`pinned`}],inDaySequence:!1}),u}var Pi=`changes ready for review`;function Fi(e){return e.filter(e=>!(e.kind===`note`&&e.tone===`dim`&&e.text.startsWith(Pi)))}function Ii(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 Li(e,t){return[{id:`agent:${e}`,entries:t}]}function Ri(e){if(e.inDaySequence!==!1)return e.userMessage?.ts??e.startedAt??e.completedAt}function zi(e,t){let n=[],r;for(let t of e){let e=Ri(t),i=ft(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 tt(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 Bi({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,X.useMemo)(()=>zi(n,e),[n,e]),p=Si(`${e}:${t}`,{surface:r}),m=c??p;kr(e,f,m,r);let h=(0,X.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,X.useMemo)(()=>f.map(t=>({key:t.key,node:Vi(t,s?.[t.key],a,o,e,u,d)})),[s,a,o,f,e,u,d]),_=l??Ve(``,g.length),v=g.length===0?i??null:(0,Z.jsx)(Ci,{runId:`${e}:${t}`,rows:g,mode:_,controls:m});return(0,Z.jsx)(Un,{runId:e,children:(0,Z.jsx)(nt,{runId:e,children:(0,Z.jsx)(Ir.Provider,{value:h,children:r===`panel`?(0,Z.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,Z.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:v}),m.pillVisible?(0,Z.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,Z.jsx)(Ei,{onJump:m.jumpToLatest})}):null]}):v})})})}function Vi(e,t,n,r,i,a,o){switch(e.content.kind){case`user-message`:return(0,Z.jsx)(Hi,{message:e.content.message,actions:t});case`day-separator`:return(0,Z.jsx)(it,{ts:e.content.ts});case`turn-time`:return(0,Z.jsx)(Qe,{completedAt:e.content.completedAt,...e.content.startedAt===void 0?{}:{startedAt:e.content.startedAt}});case`block`:return(0,Z.jsx)(Ui,{block:e.content.block,scope:e.scope,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o});default:return qi(e.content)}}function Hi({message:e,actions:t}){return(0,Z.jsx)(Xe,{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,Z.jsx)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,children:(0,Z.jsx)(Ue,{ask:e.ask})}):void 0})}function Ui({block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){switch(e.kind){case`entry`:return(0,Z.jsx)(He.Provider,{value:`${t}:${e.entry.id}`,children:(0,Z.jsx)(Gi,{entry:e.entry,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o})});case`tool-card`:return(0,Z.jsx)(rt,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,Z.jsx)(Wi,{entries:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o})});case`context-group`:return(0,Z.jsx)(et,{group:e,scope:t});case`streak`:return(0,Z.jsx)(dt,{count:e.count,children:e.blocks.map(e=>(0,Z.jsx)(Ui,{block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o},e.id))});case`worker-conversation`:return(0,Z.jsx)(Qr,{block:e,runId:i,taskTitles:a,recipientBackends:o});default:return qi(e)}}function Wi({entries:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){return tt(e).map(e=>(0,Z.jsx)(Ui,{block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o},e.id))}function Gi({entry:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){switch(e.kind){case`message`:return e.role===`assistant`?(0,Z.jsx)(ct,{text:e.text,ts:e.ts}):(0,Z.jsx)(Xe,{text:e.text,ts:e.ts});case`reasoning`:return(0,Z.jsx)(Ye,{text:e.text});case`tool`:return(0,Z.jsx)(rt,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return e.attribution?(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-4 py-3 text-sm`,children:[(0,Z.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?` · ${Kr(e.delivery)}`:``]}),(0,Z.jsx)(st,{note:e})]}):(0,Z.jsx)(st,{note:e});case`conversation`:return(0,Z.jsx)(Qr,{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,Z.jsx)(ot,{image:e});case`ask`:return n===void 0?(0,Z.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,Z.jsx)(Nr,{permission:e,runId:i});case`provider-auth-required`:return(0,Z.jsx)(lt,{incident:e});case`preview-server`:return(0,Z.jsx)(Ki,{entry:e});case`hook`:return(0,Z.jsx)(qe,{item:e,cacheKey:`${t}:${e.id}`});default:return qi(e)}}function Ki({entry:e}){let t=On(),n=yn(T().data);return(0,Z.jsx)(Zn,{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 qi(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function Ji({runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,onClose:a,onBeforeOpenReport:o,onRestoreAgentFocus:s,taskTitles:c,recipientBackends:l}){let u=(0,X.useContext)(en),d=(0,X.useRef)(void 0),f=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>{d.current?.()},[u,e]),(0,Z.jsx)(Yt,{open:r!==void 0,onOpenChange:e=>{e||a()},children:(0,Z.jsx)(Zt,{"data-slot":`subagent-sheet`,side:`right`,onCloseAutoFocus:e=>{f.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,Z.jsx)(Ie.Provider,{value:e=>{let t=r?.id,n=[...document.querySelectorAll(`[data-agent-id]`)].find(e=>e.dataset.agentId===t);d.current?.(),d.current=u?.registerOpener(e,()=>{if(t&&s){s(t);return}n?.focus({preventScroll:!0})}),f.current=!0,o?.(),a()},children:(0,Z.jsx)(Yi,{runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,taskTitles:c,recipientBackends:l})})})})}function Yi({runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,taskTitles:a,recipientBackends:o}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Jt,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,Z.jsxs)(Xt,{className:`flex min-w-0 items-center gap-2 pr-8 text-[16px]`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r.title}),r.agentType===void 0?null:(0,Z.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:r.agentType})]}),(0,Z.jsxs)($t,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,Z.jsx)(Xi,{status:r.status}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[r.toolCalls,` `,r.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,Z.jsx)(Bi,{runId:e,viewId:`agent:${r.id}`,sections:Li(r.id,i),mode:`panel`,renderAsk:t,renderPermission:n,taskTitles:a,recipientBackends:o,empty:(0,Z.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 Xi({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,Z.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:q(`rounded-full px-2 py-0.5 text-xs 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})}function Zi(e){let t=E(),[n,r]=(0,X.useState)(),i=Ut(e);(0,X.useEffect)(()=>{(!i||n&&n!==e.id)&&r(void 0)},[i,e.id,n]);let a=C({mutationFn:async()=>{r(e.id);try{if(!(await H(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:c.runs.all})});return{stopping:!!e.stopping||a.isPending||i&&n===e.id,stop:()=>a.mutateAsync()}}function Qi({agents:e,onSelect:t}){return e.length===0?null:(0,Z.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map(e=>(0,Z.jsx)($i,{agent:e,onSelect:t},e.id))})}function $i({agent:e,onSelect:t}){let n=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ea,{status:e.status,stalled:e.stalled===!0}),(0,Z.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,Z.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,Z.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:yr(e)}),(0,Z.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,Z.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,Z.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,Z.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function ea({status:e,stalled:t=!1}){return t?(0,Z.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,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,Z.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,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Z.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,Z.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,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Z.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,Z.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,Z.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Z.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}function ta(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function na({entries:e}){return e.length===0?null:(0,Z.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map((e,t)=>(0,Z.jsx)(ra,{entry:e},`${t}:${e.content}`))})}function ra({entry:e}){return(0,Z.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:q(`flex min-h-5 min-w-0 flex-wrap items-start gap-x-2.5 gap-y-1 text-[13px] [&>svg]:mt-[3px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-disabled-foreground line-through`),children:[(0,Z.jsx)(ia,{status:e.status}),(0,Z.jsx)(`span`,{"data-slot":`plan-text`,className:`min-w-0 flex-1 basis-40 break-words`,children:e.content}),e.status===`in_progress`?(0,Z.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function ia({status:e}){return e===`cancelled`?(0,Z.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-disabled-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,Z.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,Z.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,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Z.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,Z.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,Z.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Z.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,Z.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,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function aa(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 oa(e,t){let n=aa(e);return n===`active`&&t===`waiting`?`paused`:n}function sa(e){return e===`active`?`running`:e}function ca(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 la({steps:e,runStatus:t=`running`}){if(e.length===0)return null;let n=ca(e)*100;return(0,Z.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((n,r)=>(0,Z.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":oa(n.status,t),className:`flex min-h-[22px] min-w-0 flex-wrap items-start gap-x-2 gap-y-0.5 text-[13px] text-muted-foreground [&>svg]:mt-[3px]`,children:[(0,Z.jsx)(ua,{visual:oa(n.status,t)}),(0,Z.jsx)(`span`,{"data-slot":`step-name`,className:`min-w-0 flex-1 basis-32 break-words font-medium text-foreground`,children:n.name}),n.iterations>1?(0,Z.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,n.iterations]}):null,(0,Z.jsxs)(`span`,{"data-slot":`step-meta`,className:`ml-auto max-w-full min-w-0 pl-2 text-right text-xs leading-5 break-words text-soft-foreground tabular-nums`,children:[n.pluginKind??n.kind,` · step `,r+1,` of `,e.length]})]},n.id)),(0,Z.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${n}%`}})})]})}function ua({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,Z.jsx)(ke,{"aria-hidden":!0,className:q(t,`text-success`)});case`active`:return(0,Z.jsx)(Tt,{role:`status`,"aria-label":`Step running`,className:q(t,`animate-spin stroke-pending motion-reduce:animate-none [html.light_&]:stroke-pending-strong`)});case`paused`:return(0,Z.jsx)(Te,{role:`img`,"aria-label":`Step paused`,className:q(t,da)});case`failed`:return(0,Z.jsx)(ge,{"aria-hidden":!0,className:q(t,`text-danger`)});case`pending`:return(0,Z.jsx)(Ce,{"aria-hidden":!0,className:q(t,`text-soft-foreground`)})}}var da=`stroke-pending [html.light_&]:stroke-pending-strong`,fa={done:`done`,failed:`failed`,cancelled:`cancelled`};function pa(e){let t=fa[e.status];return t?e.steps.map(e=>aa(e.status)===`active`?{...e,status:t}:e.status===`pending`?{...e,status:`skipped`}:e):ma(e)}function ma(e){let t=ha(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 ha(e,t){let n=t.findIndex(t=>t.id===e);if(n>=0)return n;let r=t.reduce((e,t,n)=>aa(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 ga(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function _a(e){return typeof e==`object`&&!!e&&!(0,X.isValidElement)(e)&&`keep`in e}function Q({slot:e,icon:t,title:n,meta:r,summary:i,aside:a,open:o,onToggle:s,className:c,children:l}){let u=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,Z.jsx)(`span`,{className:q(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),i??(_a(r)?(0,Z.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,Z.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,Z.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,Z.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,Z.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),d=s!==void 0;return(0,Z.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":d&&o?`open`:`collapsed`,className:q(`min-w-0 border-t border-border first:border-t-0`,c),children:[d?(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:s,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:[u,a,(0,Z.jsx)(Ae,{"aria-hidden":!0,className:q(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!a&&`ms-auto`,o&&`rotate-180`)})]}):(0,Z.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[u,a]}),d&&o?(0,Z.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:l}):null]})}function va(e){return I(e.delegation)}function ya(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 ba(e){let t=e.delegation,n=va(e),r=S(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=ya(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 xa(e){let t=S(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>Kt(e.status))}function Sa({run:e,open:t,onToggle:n}){let r=S(e.id),i=v(),a=nn(),o=e.delegation,s=new Map(r.data?.workers.map(e=>[e.workerId,e])),c=ya(o,r.data),l=B(e)??U(e),u=l?Ca(e,l):void 0,d=e=>i.data?.find(t=>t.id===e)??r.data?.titles?.find(t=>t.id===e),f=e=>{let t=d(e);return t?Y(t):`worker ${e.slice(0,8)}`};return(0,Z.jsx)(Q,{slot:`workers`,icon:(0,Z.jsx)(we,{className:`size-4`}),title:`Workers`,meta:wa({ids:c,workers:s,desktop:a,query:r}),aside:r.data?.capacity?(0,Z.jsx)(ja,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,Z.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,Z.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,l?(0,Z.jsx)(Oa,{wait:l,dependencyLabel:u}):null,c.length>0?(0,Z.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:c.map(t=>{let n=s.get(t),i=d(t),a=n?Ea(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,Z.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,Z.jsxs)(Rt,{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,Z.jsx)(Ta,{status:n?.status}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block truncate`,children:i?Y(i):`Worker ${t.slice(0,8)}`}),n?.supervisorRunId&&n.supervisorRunId!==e.id?(0,Z.jsxs)(`span`,{"data-slot":`worker-supervisor`,className:`block truncate text-xs text-muted-foreground`,children:[`Started by `,f(n.supervisorRunId)]}):null]}),(0,Z.jsx)(`span`,{className:q(`max-w-[45%] shrink-0 truncate text-xs`,Da(n?.status)),children:a}),(0,Z.jsx)(De,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,Z.jsx)(Na,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,Z.jsx)(La,{state:n.destroy}):null]},t)})}):va(e)&&r.isSuccess?(0,Z.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,Z.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,Z.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,Z.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,Z.jsx)(J,{variant:`outline`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function Ca(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return W(e)??L(n.role,t,`requestIds`in t&&P(n,t.requestIds))}function wa({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 Ta({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,Z.jsx)(ke,{"aria-hidden":!0,className:q(t,`text-semantic-green`)}):e===`failed`?(0,Z.jsx)(ge,{"aria-hidden":!0,className:q(t,`text-semantic-red`)}):e===`cancelled`?(0,Z.jsx)(Se,{"aria-hidden":!0,className:q(t,`text-soft-foreground`)}):e===`review`?(0,Z.jsx)(wt,{"aria-hidden":!0,className:q(t,`text-semantic-info`)}):e===`waiting`?(0,Z.jsx)(Te,{"aria-hidden":!0,className:q(t,`text-semantic-amber`)}):e===`running`?(0,Z.jsx)(Tt,{role:`status`,"aria-label":`Worker running`,className:q(t,`animate-spin stroke-status-running motion-reduce:animate-none`)}):(0,Z.jsx)(Ce,{"aria-hidden":!0,className:q(t,`text-soft-foreground`)})}function Ea(e){return fn(e)}function Da(e){return e===`done`?`text-semantic-green`:e===`failed`?`text-semantic-red`:e===`review`?`text-semantic-info`:e===`waiting`?`text-semantic-amber`:`text-muted-foreground`}function Oa({wait:e,dependencyLabel:t}){return(0,Z.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?sn(`waiting-on-workers`,t):`requestIds`in e&&e.requestIds?e.phase===`parked`?`Waiting for 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 for workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,`deadline`in e?(0,Z.jsxs)(Z.Fragment,{children:[` `,`Deadline: `,(0,Z.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: Squawk wakes this task when they have all settled.`]})}function ka(e){return e.delegation?.role===`worker`&&U(e)?.phase===`wake-pending`}function Aa({run:e}){let t=U(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,Z.jsx)(Oa,{wait:t,dependencyLabel:L(`worker`,t)}):null}function ja({capacity:e}){return(0,Z.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 Ma=new Set([`review`,`done`,`failed`,`cancelled`]);function Na({parentRunId:e,worker:t}){let n=o(e),[r,i]=(0,X.useState)(!1);if(!Ma.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let a=t.workerId.slice(0,8),s=!!t.destroy&&t.destroy.phase!==`complete`,c=n.error instanceof k?n.error.work:void 0;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`break-words text-xs`,children:F(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,Z.jsx)(J,{variant:`danger-ghost`,size:`sm`,"aria-label":`Confirm clean up of worker ${a}`,onClick:()=>{i(!1),n.mutate({workerId:t.workerId})},children:`Clean up`}),(0,Z.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>i(!1),children:`Cancel`})]}):(0,Z.jsx)(J,{variant:`outline`,size:`sm`,"aria-label":s?`Retry clean up of worker ${a}`:`Clean up worker ${a}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:s?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,Z.jsx)(`span`,{role:`status`,className:`break-words text-xs`,children:c?`Cleanup stopped: this worker holds ${Fa(c)}. Land or commit what you need first, or discard it.`:`Cleanup did not finish: ${n.error.message}`}):null,c&&!r&&!n.isPending?(0,Z.jsx)(J,{variant:`danger-ghost`,size:`sm`,"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 Pa=(e,t,n)=>`${e} ${e===1?t:n}`;function Fa(e){return[...e.uncommittedFiles?[Pa(e.uncommittedFiles,`uncommitted file`,`uncommitted files`)]:[],...e.commits?[`${Pa(e.commits,`commit`,`commits`)} no other branch reaches`]:[]].join(` and `)}function Ia(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function La({state:e}){if(!Ia(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,Z.jsx)(Ra,{at:t.nextAt});return(0,Z.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,Z.jsxs)(Z.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,Z.jsxs)(Z.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function Ra({at:e}){let t=Qt(3e4);return(0,Z.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:qn(t,Date.parse(e))})}function za({items:e,lead:t=0,room:n,className:r}){let i=(0,X.useRef)(null),[a,o]=(0,X.useState)(-1/0);return(0,X.useLayoutEffect)(()=>{let r=i.current;if(!r)return;let a=n?r.closest(n):null,s=()=>{let n=r.getBoundingClientRect().width;if(!n&&r.getClientRects().length===0)return;let i=n+Ba(a),s=getComputedStyle(r),c=Number.parseFloat(s.width),l=c>0?n/c:1,u=(Number.parseFloat(s.columnGap)||0)*l,d=Array.from(r.children,e=>e.getBoundingClientRect().width),f=e.map((e,t)=>({...e,width:d[t]??0})),p=-1/0,m=()=>f.reduce((e,t)=>e+t.width,0)+Math.max(0,f.length-1)*u+(f.length>0?t*l:0);for(let t of[...new Set(e.map(e=>e.priority))].sort((e,t)=>e-t)){if(m()<=i)break;p=t,f=f.filter(e=>e.priority>t)}o(e=>e===p?e:p)};if(s(),typeof ResizeObserver>`u`)return;let c=new ResizeObserver(s);c.observe(r);for(let e of r.children)c.observe(e);return a&&c.observe(a),()=>c.disconnect()},[e,t,n]),(0,Z.jsx)(`span`,{ref:i,"data-slot":`activity-summary`,className:q(`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`,r),children:e.map(n=>{let r=n.priority<=a,i=n===e.find(e=>e.priority>a);return(0,Z.jsxs)(`span`,{"data-summary-item":n.id,"data-hidden":r,"aria-hidden":r||void 0,inert:r||void 0,style:i&&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:[!i||t>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`activity-separator`,className:`before:content-['·']`}):null,n.content]},n.id)})})}function Ba(e){let t=e?.firstElementChild;return!e||!t?0:Math.max(0,e.getBoundingClientRect().width-t.getBoundingClientRect().width)}function Va({run:e,references:t}){return(0,Z.jsx)(`span`,{className:`inline-flex items-center gap-1.5`,children:t.map(t=>(0,Z.jsx)(fe,{reference:t,taskTitle:Y(e),inert:!0},le(t)))})}function Ha(e){return e.accountId===void 0||e.profilesPending?void 0:e.profilesError?e.accountId:e.accountId==="default"?an(e.accounts,e.accountBackend)?`default`:void 0:e.known?an(e.accounts,e.accountBackend)?e.known.label:void 0:`${e.accountId} (removed)`}function Ua(e){let t=m(),n=h(),r=w(),{accounts:i}=rn(),a=e.runner??n.data?.defaultRunner??`claude`,o=e.model??`auto`,s=e.effort||`auto`,c=[...e.steps].reverse().find(e=>e.profileId),l=c?.profileId,u=c?.backend??a,d=r.data?.profiles.find(e=>e.id===l&&e.provider===u),f=Ha({accountId:l,profilesPending:r.isPending,profilesError:r.isError,known:d,accounts:i,accountBackend:u}),p=e.modelIdentity&&e.modelIdentity!==o?e.modelIdentity:void 0;return{runner:e.removedRunner===void 0?b(t.data,a):G(e.removedRunner),...f?{account:f}:{},model:o,effort:s,...p?{identity:p}:{}}}var Wa=[`running`,`queued`,`waiting`];function Ga(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`||e?.kind===`plugin`):[]}function $(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 Ka(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 qa(e){return e.kind!==`worker`&&e.kind!==`peer`&&e.kind!==`subagent`}function Ja(e){let t=Ga(e.waits),n=Wa.includes(e.status),r=t.filter(t=>t.phase===`open`?n:t.phase===`resolved`&&qa(t)&&(n||e.status===`failed`)),i=r.some(e=>e.kind===`pr`),a=[...Ga(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 Ya(e){return Ja(e)!==void 0}function Xa(e){return(Ja(e)?.open??[]).filter(e=>e.kind===`pr`).map(e=>({kind:`PR`,number:e.prNumber,url:e.prUrl}))}function Za({run:e}){let t=Ja(e);if(!t)return null;let{open:n,lastCi:r,error:i,lastProcess:a}=t;return(0,Z.jsxs)(`div`,{"data-slot":`open-waits`,className:`flex min-w-0 flex-col gap-1`,children:[n.map(t=>t.kind===`pr`?(0,Z.jsx)($a,{run:e,wait:t},t.id):t.kind===`worker`?(0,Z.jsx)(eo,{wait:t},t.id):t.kind===`process`?(0,Z.jsx)(oo,{run:e,wait:t},t.id):t.kind===`peer`?(0,Z.jsx)(to,{wait:t},t.id):t.kind===`subagent`?(0,Z.jsx)(no,{wait:t},t.id):t.kind===`plugin`?(0,Z.jsx)(ro,{run:e,wait:t},t.id):(0,Z.jsx)(io,{run:e,wait:t},t.id)),i?(0,Z.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,Z.jsx)($a,{run:e,wait:r,settled:!0}):null,a?(0,Z.jsx)(oo,{run:e,wait:a,settled:!0}):null]})}function Qa(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?vn(r.headSha):`unknown`} → ${r?.observedHeadSha?vn(r.observedHeadSha):`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`?Ka(`${o} result ready`,e):t.until===`merge_or_blocked`?`Waiting for merge or blockage`:i?`Waiting for merge`:`Waiting for CI`}function $a({run:e,wait:t,settled:n=!1}){let r=t.result,i=t.until===`checks`?`CI`:`Merge`,a=n&&t.phase===`cancelled`,o=Qa(e,t,n),s=n?a?t.cancelledAt:r?.observedAt:t.deadline,c=$(s),l=`${t.repository}#${t.prNumber}`;return(0,Z.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,Z.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-baseline gap-x-3 gap-y-1`,children:[(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Status`}),(0,Z.jsx)(`dd`,{children:o}),(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Pull request`}),(0,Z.jsx)(`dd`,{className:`min-w-0`,children:ie(t.prUrl)?(0,Z.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:l}):(0,Z.jsx)(`span`,{children:l})}),c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:n?a?`Cancelled`:`Observed`:`Deadline`}),(0,Z.jsx)(`dd`,{children:(0,Z.jsx)(`time`,{dateTime:s,children:c})})]}):n?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Deadline`}),(0,Z.jsxs)(`dd`,{children:[i,` deadline unavailable`]})]})]})})}function eo({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=$(e.deadline);return(0,Z.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,Z.jsxs)(`p`,{children:[`Waiting for `,r,` `,i]}),a?(0,Z.jsxs)(`p`,{children:[`Deadline`,` `,(0,Z.jsx)(`time`,{dateTime:e.deadline,children:a})]}):(0,Z.jsx)(`p`,{children:`Worker wait deadline unavailable`})]})}function to({wait:e}){let t=e.peerIds.length,n=$(e.deadline);return(0,Z.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,Z.jsxs)(`p`,{children:[`Waiting for `,t,` `,t===1?`task`:`tasks`]}),n?(0,Z.jsxs)(`p`,{children:[`Deadline`,` `,(0,Z.jsx)(`time`,{dateTime:e.deadline,children:n})]}):(0,Z.jsx)(`p`,{children:`Peer wait deadline unavailable`})]})}function no({wait:e}){let t=(Array.isArray(e.children)?e.children:[]).filter(e=>e?.status===`running`).length,n=$(e.deadline);return(0,Z.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,Z.jsxs)(`p`,{children:[`Waiting for `,t,` `,t===1?`subagent`:`subagents`]}),n?(0,Z.jsxs)(`p`,{children:[`Check by`,` `,(0,Z.jsx)(`time`,{dateTime:e.deadline,children:n})]}):(0,Z.jsx)(`p`,{children:`Subagent wait deadline unavailable`})]})}function ro({run:e,wait:t}){let n=t.phase===`open`?$(t.deadline):void 0;return(0,Z.jsxs)(`div`,{"data-slot":`plugin-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`p`,{children:t.phase===`resolved`?Ka(t.summary,e):t.summary}),n?(0,Z.jsxs)(`p`,{children:[`Deadline`,` `,(0,Z.jsx)(`time`,{dateTime:t.deadline,children:n})]}):null]})}function io({run:e,wait:t}){let n=$(t.deadline);return(0,Z.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,Z.jsx)(`p`,{children:Ka(`Automatic check due`,e)}):n?(0,Z.jsxs)(`p`,{children:[`Next automatic check`,` `,(0,Z.jsx)(`time`,{dateTime:t.deadline,className:`font-medium text-foreground`,children:n})]}):(0,Z.jsx)(`p`,{children:`Automatic check time unavailable`}),t.note?(0,Z.jsx)(`p`,{children:t.note}):null]})}function ao(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 oo({run:e,wait:t,settled:n=!1}){let r=n&&t.phase===`cancelled`?`Process wait on PID ${t.pid} cancelled`:n?ao(t):t.phase===`resolved`?Ka(ao(t),e):`Waiting for PID ${t.pid}${t.note?` — ${t.note}`:``}`,i=!n&&t.phase===`open`?$(t.deadline):void 0;return(0,Z.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,Z.jsx)(`p`,{children:r}),i?(0,Z.jsxs)(`p`,{children:[`Until`,` `,(0,Z.jsx)(`time`,{dateTime:t.deadline,children:i})]}):null]})}var so=new Map,co=new Map;function lo(e){let{referenceProjectId:t,repoBase:n,references:r,requests:i}=bt(e.run);return(0,Z.jsx)(ue,{projectId:t,repoBase:n,requests:i,children:(0,Z.jsx)(uo,{...e,references:r,prNumbers:i.filter(e=>e.kind===`PR`).map(e=>e.number),hasReferences:r.length>0||!!ae(e.run)||!!se(e.run,n)})})}function uo({run:e,thread:t,currentThread:n,currentComplete:r=!0,pendingAsk:i=!1,onOpenWorker:a,readerScroll:o,presentation:s=`card`,prNumbers:c,hasReferences:l,references:u}){let d=nn(),f=Ua(e),[p,m]=(0,X.useState)(()=>i?!1:so.get(e.id)??!1),h=Oo(o,p),g=s===`panel`||h.open,[_,v]=(0,X.useState)({}),y=po(e,t??n,n,r,c),b=_t(e),x=t=>_[t]??co.get(`${e.id}:${t}`)??t===`workers`,S=t=>{let n=!x(t);co.set(`${e.id}:${t}`,n),v(e=>({...e,[t]:n}))},C=e=>({open:x(e),onToggle:()=>S(e)}),w=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col border-t border-border`,children:[(0,Z.jsx)(xo,{run:e,activity:y,...C(`status`)}),(0,Z.jsx)(So,{run:e,desktop:d,automations:y.automations,...C(`workflow`)}),(0,Z.jsx)(Co,{activity:y,desktop:d,onOpenWorker:a,...C(`subagents`)}),(0,Z.jsx)(wo,{run:e,...C(`workers`)}),(0,Z.jsx)(To,{activity:y,desktop:d,...C(`plan`)}),(0,Z.jsx)(Eo,{run:e,identity:f,activity:y,...C(`usage`)}),(0,Z.jsx)(Do,{run:e,references:u,conflicts:y.conflicts,hasReferences:l,onResume:()=>b.mutate(),...C(`workspace`)})]});return s===`panel`?(0,Z.jsxs)(`section`,{"data-slot":`run-activity-dock`,"data-presentation":`panel`,"data-state":`open`,"aria-label":`Session activity`,className:`flex min-w-0 flex-col bg-card`,children:[(0,Z.jsxs)(`div`,{className:`sticky inset-bs-0 z-10 flex items-center gap-2 bg-card px-3.5 py-2.5 text-[13px]`,children:[(0,Z.jsx)(me,{"aria-hidden":!0,className:`size-4 shrink-0 text-accent-text`}),(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Session activity`}),y.cost?(0,Z.jsx)(`span`,{"data-slot":`run-activity-cost`,className:`ms-auto shrink-0 font-mono text-[12px] text-muted-foreground tabular-nums`,children:y.cost}):null]}),w]}):(0,Z.jsxs)(`section`,{"data-slot":`run-activity-dock`,ref:h.ref,"data-state":g?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-xl border border-border bg-card shadow-xs`,children:[(0,Z.jsx)(vo,{run:e,identity:f,activity:y,references:u,open:g,onToggle:()=>{so.set(e.id,!g),m(!g),h.chose(!g)}}),g?w:null]})}function fo(e,t,n,r){let i=T(),a=An(i.data),o=v(),s=St(e,{queuePosition:e.status===`queued`?Wt(o.data??[]).get(e.id):void 0}),c=!Ht(e)&&e.status!==`queued`,l=(0,X.useMemo)(()=>r?gr(n.turns,c,t.turns):[],[r,n.turns,c,t.turns]),u=$n(n)??[],d=ba(e),f=vr(l),p=ta(u);return{health:i,line:s,...mo(e,s,d,r?f:void 0,p),...ho(e,a),agents:l,agentCounts:f,planEntries:u,planCounts:p}}function po(e,t,n,r,i){let a=fo(e,t,n,r),o=de(i);return{...a,conflicts:o,waitReferences:Xa(e),automations:_n(a.health.data)}}function mo(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`,glyph:o?(0,Z.jsx)(ke,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-success`}):(0,Z.jsx)(qt,{tone:t.attention.tone,shape:t.attention.shape,pulse:t.attention.pulse})}}function ho(e,t){return{cost:t.cost&&e.costUsd!==void 0?ce(e.costUsd):void 0,tokens:t.tokens&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?(0,Z.jsx)(Pn,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):void 0}}function go(e){return e.allComplete?`text-semantic-green`:e.failed&&`text-semantic-red`}function _o(e){let t=pa(e),n=ha(e.currentStepId,t);return t.length>0?{steps:t,index:n,step:t[n]}:void 0}function vo({run:e,identity:t,activity:n,references:r,open:i,onToggle:a}){let{cost:o}=n,s=[...new Map([...r,...n.waitReferences].map(e=>[le(e),e])).values()];return(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-label":yo(e,t,n,s,i),onClick:a,className:q(`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,Z.jsx)(me,{"aria-hidden":!0,className:`size-4 shrink-0 text-accent-text`}),(0,Z.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Activity`}),i?null:(0,Z.jsx)(bo,{run:e,identity:t,activity:n,summaryReferences:s}),i&&o?(0,Z.jsx)(`span`,{"data-slot":`run-activity-cost`,className:`ms-auto shrink-0 text-[13px] text-muted-foreground tabular-nums`,children:o}):null,(0,Z.jsx)(Ae,{"aria-hidden":!0,className:q(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,i&&!o&&`ms-auto`,i&&`rotate-180`)})]})}function yo(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=_o(e)?.step,u=l?`; step ${l.name}, ${sa(oa(l.status,e.status))}`:``,d=r.length?`; ${r.map(e=>`${e.kind} #${e.number}`).join(`; `)}`:``;return`${c}${u}; runner ${t.runner}; model ${t.model}; effort ${t.effort}${d}`}function bo({run:e,identity:t,activity:n,summaryReferences:r}){let{statusText:i,cost:a,conflicts:o}=n,s=_o(e)?.step,c=[{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,Z.jsx)(`span`,{"data-slot":`run-activity-cost`,children:a})}]:[],...r.length||o.length?[{id:`chips`,priority:0,content:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Va,{run:e,references:r}),o.length>0?(0,Z.jsxs)(`span`,{"data-slot":`run-activity-conflict`,className:`inline-flex items-center gap-1 font-medium text-conflict`,children:[(0,Z.jsx)(ye,{"aria-hidden":!0,className:`size-3.5`}),`Conflicts`]}):null]})}]:[]];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`run-activity-status`,title:i,className:q(`inline-flex min-w-[calc(0.875rem+3ch)] flex-[0_1_auto] items-center gap-1.5 text-[13px] whitespace-nowrap text-muted-foreground`,go(n)),children:[n.glyph,(0,Z.jsx)(`span`,{"data-slot":`run-activity-status-label`,className:`min-w-0 truncate`,children:i})]}),s?(0,Z.jsxs)(`span`,{"data-slot":`run-activity-step`,className:q(`flex max-w-max min-w-[calc(1.375rem+2ch)] flex-[1000_1_0] items-center gap-1.5 text-[13px] text-muted-foreground`,e.status===`waiting`&&`max-md:hidden`),children:[(0,Z.jsx)(Mo,{step:s,runStatus:e.status,decorative:!0}),(0,Z.jsx)(`span`,{"data-slot":`run-activity-step-name`,title:s.name,className:`min-w-0 truncate`,children:s.name})]}):null,(0,Z.jsx)(`span`,{className:`-ms-2 flex min-w-0 flex-[1_1_0]`,children:(0,Z.jsx)(za,{items:c,lead:8})})]})}function xo({run:e,activity:t,open:n,onToggle:r}){let{line:i,waitReferences:a}=t,o=ka(e);return(0,Z.jsxs)(Q,{slot:`status-row`,icon:t.glyph,title:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{"data-slot":`run-activity-status`,className:q(`truncate`,go(t)),children:t.statusText}),i.nextCheck?(0,Z.jsxs)(`span`,{"data-slot":`run-activity-next-check`,className:`whitespace-normal text-[13px] font-normal text-muted-foreground`,children:[`Next check `,(0,Z.jsx)(`time`,{dateTime:i.nextCheck.at,children:i.nextCheck.text})]}):null]}),summary:!n&&a.length>0?(0,Z.jsx)(za,{items:[{id:`chips`,priority:0,content:(0,Z.jsx)(Va,{run:e,references:a})}]}):void 0,open:n,onToggle:Ya(e)||o?r:void 0,children:[(0,Z.jsx)(Za,{run:e}),o?(0,Z.jsx)(Aa,{run:e}):null]})}function So({run:e,desktop:t,automations:n,open:r,onToggle:i}){let a=oe(e),o=_o(e);return!a&&!o?null:(0,Z.jsxs)(Q,{slot:`workflow`,icon:o?(0,Z.jsx)(Mo,{step:o.step,runStatus:e.status}):(0,Z.jsx)(xe,{className:`size-4`}),title:(0,Z.jsxs)(Z.Fragment,{children:[`Workflow`,a?(0,Z.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` · `,a]}):null]}),meta:o?{drop:o.step.name,keep:ga(o.index+1,o.steps.length,t,`step`)}:void 0,open:r,onToggle:i,children:[o?(0,Z.jsx)(la,{steps:o.steps,runStatus:e.status}):null,(0,Z.jsx)(jo,{run:e,available:n})]})}function Co({activity:e,desktop:t,onOpenWorker:n,open:r,onToggle:i}){let{agents:a,agentCounts:o}=e;return a.length===0?null:(0,Z.jsx)(Q,{slot:`subagents`,icon:(0,Z.jsx)(ve,{className:`size-4`}),title:`Subagents`,meta:ga(o.done,o.total,t),open:r,onToggle:i,children:(0,Z.jsx)(Qi,{agents:a,onSelect:n})})}function wo({run:e,open:t,onToggle:n}){return va(e)?(0,Z.jsx)(Sa,{run:e,open:t,onToggle:n}):null}function To({activity:e,desktop:t,open:n,onToggle:r}){let{planEntries:i,planCounts:a}=e;return i.length===0?null:(0,Z.jsx)(Q,{slot:`plan`,icon:(0,Z.jsx)(he,{className:`size-4`}),title:`Plan`,meta:ga(a.done,a.total,t),open:n,onToggle:r,children:(0,Z.jsx)(na,{entries:i})})}function Eo({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,Z.jsx)(Q,{slot:`usage`,icon:(0,Z.jsx)(er,{className:`size-4`}),title:`Usage & agent`,summary:(0,Z.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`contents`,children:(0,Z.jsx)(za,{items:c})}),open:r,onToggle:i,children:(0,Z.jsx)(Ao,{run:e,tokens:o,cost:a})})}function Do({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||Bn(e)||Ia(s)))return null;let c=n.length===1?`PR #${n[0]} conflicts`:`${n.length} PRs conflict`;return(0,Z.jsx)(Q,{slot:`workspace`,icon:(0,Z.jsx)(we,{className:`size-4`}),title:`Workspace`,summary:!a&&t.length>0?(0,Z.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`contents`,children:(0,Z.jsx)(za,{items:[...e.branch?[{id:`branch`,priority:0,content:(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.branch})}]:[],{id:`chips`,priority:1,content:(0,Z.jsx)(Va,{run:e,references:t})},...n.length>0?[{id:`conflicts`,priority:2,content:(0,Z.jsx)(`span`,{className:`font-medium text-conflict`,children:c})}]:[]]})}):void 0,meta:n.length>0?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-conflict`,children:[(0,Z.jsx)(ye,{"aria-hidden":!0,className:`size-3.5`}),c]}):e.branch?(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.branch}):void 0,open:a,onToggle:o,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 text-[13px] text-muted-foreground`,children:[s?(0,Z.jsx)(La,{state:s}):null,(0,Z.jsx)(xt,{run:e}),e.branch?(0,Z.jsx)(ko,{label:`Branch`,children:(0,Z.jsx)(yt,{branch:e.branch})}):null,e.worktreePath?(0,Z.jsx)(ko,{label:`Worktree`,children:(0,Z.jsx)(`span`,{className:`min-w-0 break-all font-mono text-[12px] text-foreground`,children:e.worktreePath})}):null,(0,Z.jsx)(vt,{run:e,canResume:wn(e).terminal,onResume:i})]})})}function Oo(e,t){let n=(0,X.useRef)(null),[r,i]=(0,X.useState)(!1),a=(0,X.useRef)(t);a.current=t;let o=(0,X.useRef)({active:!1,override:!1});return(0,X.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 ko({label:e,children:t}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-medium text-foreground`,children:e}),t]})}function Ao({run:e,tokens:t,cost:n}){let{runner:r,account:i,model:a,effort:o,identity:s}=Ua(e);return(0,Z.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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Tokens`}),(0,Z.jsx)(`dd`,{className:`min-w-0 text-[12px]`,children:t})]}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Cost`}),(0,Z.jsx)(`dd`,{className:`min-w-0 font-mono text-[12px] tabular-nums`,children:n})]}):null,(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Runner`}),(0,Z.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px]`,children:r}),i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Account`}),(0,Z.jsx)(`dd`,{"data-slot":`agent-badge-account`,className:`min-w-0 break-all font-mono text-[12px]`,children:i})]}):null,(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Model`}),(0,Z.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px]`,children:a}),(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Effort`}),(0,Z.jsx)(`dd`,{"data-slot":`agent-badge-effort`,className:`min-w-0 break-all font-mono text-[12px]`,children:o}),s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Identity`}),(0,Z.jsx)(`dd`,{"data-slot":`agent-badge-identity`,className:`min-w-0 break-all font-mono text-[12px]`,children:s})]}):null]})}function jo({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,Z.jsxs)(`p`,{className:`mt-2 text-[13px] text-muted-foreground`,children:[`Launched by`,` `,t?(0,Z.jsx)(Rt,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:q(n,`text-foreground underline underline-offset-2`),children:`Automation`}):(0,Z.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:n,children:`Automation`})]})}function Mo({step:e,runStatus:t,decorative:n=!1}){let r=oa(e.status,t),i=`size-4 shrink-0`;switch(r){case`active`:return(0,Z.jsx)(Tt,{...n?{"aria-hidden":!0}:{role:`status`,"aria-label":`Step running`},"data-slot":`workflow-glyph`,"data-visual":r,className:q(i,`animate-spin stroke-pending motion-reduce:animate-none [html.light_&]:stroke-pending-strong`)});case`paused`:return(0,Z.jsx)(Te,{...n?{"aria-hidden":!0}:{role:`img`,"aria-label":`Step paused`},"data-slot":`workflow-glyph`,"data-visual":r,className:q(i,da)});case`failed`:return(0,Z.jsx)(ge,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":r,className:q(i,`text-danger`)});case`pending`:return(0,Z.jsx)(Ce,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":r,className:q(i,`text-soft-foreground`)});case`done`:return(0,Z.jsx)(ke,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":r,className:q(i,`text-success`)})}}function No(e,t,n,r){let i=fo(e,t,n,r),a=va(e),o=S(e.id,{enabled:a}),s=(0,X.useMemo)(()=>{let t=e.delegation?.role===`root`?e.delegation.receipts.map(e=>e.workerId):[],n=o.data?.workers.map(e=>e.workerId)??[];return new Set([...t,...n]).size},[e.delegation,o.data?.workers]),c=pa(e),l=c.length>0?c[ha(e.currentStepId,c)]:void 0;return{statusText:i.statusText,glyph:i.glyph,allComplete:i.allComplete,failed:i.failed,activeStepName:l?.name,shownStepName:l&&oa(l.status,e.status)!==`done`?l.name:void 0,workerCount:s,agentCounts:i.agentCounts,cost:i.cost,nextCheckText:i.line.nextCheck?.text,line:i.line}}function Po(e,t){let n=[`Session activity: ${e.statusText}`];return e.nextCheckText&&n.push(`Next check ${e.nextCheckText}`),e.activeStepName&&n.push(`step ${e.activeStepName}`),e.workerCount>0&&n.push(`${e.workerCount} ${e.workerCount===1?`worker`:`workers`}`),e.agentCounts.total>0&&n.push(`${e.agentCounts.done}/${e.agentCounts.total} subagents`),e.cost&&n.push(`cost ${e.cost}`),t===`sidebar`&&n.push(`toggle activity sidebar`),n.join(`; `)}function Fo({props:e,align:t,sideOffset:n,collisionPadding:r=0,contentClassName:i,children:a}){let{run:o,thread:s,currentThread:c,currentComplete:l,onOpenWorker:u,open:d,onOpenChange:f,keepOpen:p=!1,onOpenAutoFocus:m}=e,h=e=>{p&&e.preventDefault()};return(0,Z.jsxs)(It,{open:d,onOpenChange:e=>{!e&&p||f(e)},children:[(0,Z.jsx)(Nt,{asChild:!0,children:a}),(0,Z.jsx)(Ft,{align:t,sideOffset:n,collisionPadding:r,"data-slot":`run-activity-popover`,className:i,onOpenAutoFocus:m,onInteractOutside:h,onPointerDownOutside:h,onFocusOutside:h,onEscapeKeyDown:h,children:(0,Z.jsx)(lo,{presentation:`panel`,run:o,thread:s,currentThread:c,currentComplete:l,onOpenWorker:u})})]})}function Io(e,t=!1){let n=t?`${e.workerCount}w`:`${e.workerCount} ${e.workerCount===1?`worker`:`workers`}`,r=`${e.agentCounts.done}/${e.agentCounts.total}${t?``:` agents`}`;return[...e.shownStepName?[{id:`step`,priority:0,content:(0,Z.jsx)(`span`,{"data-slot":`run-activity-step`,className:q(`truncate`,t?`max-w-[96px]`:`max-w-[140px]`),children:e.shownStepName})}]:[],...e.workerCount>0?[{id:`workers`,priority:3,content:(0,Z.jsx)(`span`,{"data-slot":`activity-workers-badge`,children:n})}]:[],...e.agentCounts.total>0?[{id:`subagents`,priority:2,content:(0,Z.jsx)(`span`,{"data-slot":`activity-subagents-badge`,children:r})}]:[],...e.cost?[{id:`cost`,priority:1,content:(0,Z.jsx)(`span`,{"data-slot":`run-activity-cost`,className:`font-mono text-xs`,children:e.cost})}]:[]]}function Lo(e){let{run:t,thread:n,currentThread:r,currentComplete:i,mode:a,open:o,onOpenChange:s}=e,c=No(t,n,r,i),l=Po(c,a),u=c.allComplete?`text-semantic-green`:c.failed?`text-semantic-red`:`text-foreground`,d=(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`run-activity-trigger`,"data-activity-mode":a,"aria-expanded":o,"aria-label":l,onClick:a===`sidebar`?()=>s(!o):void 0,className:q(`inline-flex min-h-9 max-w-full items-center gap-2 rounded-full border border-border bg-card px-3 py-1 text-[12px] font-medium text-foreground shadow-xs transition-colors`,`pointer-hover:bg-muted/60 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,o&&`border-accent-strong/60`),children:[(0,Z.jsxs)(`span`,{"data-slot":`pill`,className:`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[c.glyph,(0,Z.jsx)(`span`,{"data-slot":`run-activity-status`,className:u,children:(0,Z.jsx)(`span`,{"data-slot":`run-activity-status-label`,children:c.statusText})})]}),(0,Z.jsx)(`span`,{className:`-ms-2 grid min-w-0 grid-cols-[minmax(0,max-content)]`,children:(0,Z.jsx)(za,{items:Io(c),lead:8,room:`[data-slot='run-status-slot']`})}),(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:q(`size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,o&&`rotate-180`)})]});return(0,Z.jsx)(`span`,{"data-slot":`run-status-slot`,className:`hidden`,children:a===`sidebar`?d:(0,Z.jsx)(Fo,{props:e,align:`end`,sideOffset:6,contentClassName:`w-[380px] max-w-[calc(100vw-2rem)] max-h-[min(70dvh,540px)] overflow-y-auto overscroll-contain p-0`,children:d})})}var Ro=`[data-slot='mobile-status-room']`;function zo(e){let{run:t,thread:n,currentThread:r,currentComplete:i,open:a}=e,o=No(t,n,r,i),s=D(),c=Po(o,`popover`),{attention:l}=o.line;return(0,Z.jsx)(Fo,{props:e,align:`start`,sideOffset:10,collisionPadding:8,contentClassName:`w-[420px] max-w-[calc(100vw-1rem)] max-h-[min(65dvh,460px)] overflow-y-auto overscroll-contain p-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`run-activity-trigger-mobile`,"aria-expanded":a,"aria-label":c,className:q(`-mt-[18px] -mb-2 inline-flex h-11 max-w-full min-w-0 items-center gap-1.5 rounded-md pt-[18px] pb-2 text-start md:hidden`,`focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-ring`),children:[(0,Z.jsx)(En,{"data-slot":`mobile-run-status`,dot:l.tone,shape:l.shape,pulse:l.pulse&&!s,className:`min-w-0 px-2 py-px text-xs leading-4`,children:(0,Z.jsx)(`span`,{"data-slot":`run-activity-status-label`,className:`truncate`,children:o.line.label})}),(0,Z.jsx)(`span`,{className:`-ms-1.5 grid min-w-0 shrink-[1000] grid-cols-[minmax(0,max-content)]`,children:(0,Z.jsx)(za,{items:Io(o,!0),lead:6,room:Ro,className:`h-[18px] gap-1.5 text-xs`})}),(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:q(`size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,a&&`rotate-180`)})]})})}var Bo=2e3;function Vo(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 Ho(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 Uo(e,t){let n=E(),r=(0,X.useMemo)(()=>Vo(t),[t]),i=(0,X.useMemo)(()=>Ho(t),[t]),a=e?.id,o=e?.status;(0,X.useEffect)(()=>{if(!(r!==0&&(o===`running`||o===`waiting`))&&!(i!==0&&o===`running`)||a===void 0)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:c.runs.detail(a)}),n.invalidateQueries({queryKey:c.runs.list()})},Bo);return()=>clearTimeout(e)},[r,i,a,o,n])}function Wo(e){let t=e.querySelector(`[data-slot="ask-origin"]`);return t&&(t.tabIndex=-1),t}function Go({pendingAskId:e,askSeq:t,rows:n,history:r,jumpToRow:i}){let[a,o]=(0,X.useState)(void 0),s=(0,X.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,X.useEffect)(()=>{if(a===void 0)return;if(a!==e){o(void 0);return}let r=Ii(n,a,`origin`);if(r){o(void 0),i(r.key,r.index,Wo);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}}var Ko=12;function qo({run:e}){let t=E(),n=C({mutationFn:()=>A(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:c.runs.detail(e.id)}),t.invalidateQueries({queryKey:c.runs.list()}),z(`This task will not resume itself`)},onError:e=>z(e.message,{tone:`danger`})});if(!R(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,Z.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,Z.jsx)(qt,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,Z.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,Z.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,Ko,`)`]}):(0,Z.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Z.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Z.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,Z.jsx)(ne,{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 Jo(e){let t=e?.id,[n,r]=(0,X.useState)(void 0),i=!nn();return{phone:i,folded:i&&t!==void 0&&n===t,open:(0,X.useCallback)(()=>(0,li.flushSync)(()=>r(void 0)),[]),setFolded:(0,X.useCallback)(e=>{(0,li.flushSync)(()=>r(e?t:void 0))},[t])}}function Yo(e,t){if(e.phone)return{folded:e.folded,onFoldChange:n=>{e.setFolded(n),t.current?.querySelector(n?`[data-slot="ask-folded-row"]`:`[data-slot="ask-fold"]`)?.focus({preventScroll:!0})}}}function Xo({pinnedAskId:e,run:t,askModeState:n,replyPending:r,composerPending:i,folded:a}){let o=e!==void 0,s=Cn(t,o),c=n.askId===e?n.mode:`options`;return{hasPendingAsk:o,isReviewGate:s,askMode:c,decisionMode:o?`ask`:s?`review`:`composer`,unifiedReplyActive:o&&c===`reply`&&!a,composerHidden:s||o&&(c===`options`||a),optionDeliveryPending:o&&r&&!i}}function Zo(e){let{run:t,thread:n,pinnedAsk:r,pendingQuestions:i,scroll:a,onJump:o,onShowOrigin:s,sessionOpen:c,attention:l,queued:u,continuable:d,continueAction:f,stopAction:p,finishAction:m,needsAnswer:h,sendMessage:g,reply:_,providerBlocked:v,providerReason:y,removedRunnerNotice:b,fold:x}=e,S=(0,X.useRef)(null),C=wn(t,xa(t)).cancel,[w,T]=(0,X.useState)({askId:r?.id,mode:`options`}),[E,D]=(0,X.useState)(!1),O=e=>T({askId:r?.id,mode:e}),{hasPendingAsk:k,isReviewGate:A,askMode:ee,decisionMode:j,unifiedReplyActive:M,composerHidden:N,optionDeliveryPending:P}=Xo({pinnedAskId:r?.id,run:t,askModeState:w,replyPending:_.isPending,composerPending:E,folded:x.folded});return(0,Z.jsxs)(`div`,{ref:S,"data-slot":`thread-dock`,"data-pending-ask":h||void 0,"data-decision-mode":j,className:q(`relative z-10 shrink-0 bg-background py-1.5 md:pt-2.5 md:pb-4`,A&&`py-0 md:pt-0 md:pb-0`),children:[a.pillVisible?(0,Z.jsx)(`div`,{"data-slot":`thread-jump`,className:`pointer-events-none z-30 flex justify-center max-md:justify-end`,children:(0,Z.jsx)(Ei,{pendingQuestions:i,onJump:()=>{i>0&&x.open(),o()}})}):null,(0,Z.jsxs)(`div`,{"data-slot":`thread-footer-content`,className:q(`mx-auto flex w-full min-w-0 max-w-[var(--measure)] flex-col px-[14px] md:px-16`,M?`gap-0`:`gap-1.5 md:gap-2`),children:[A?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qo,{run:t}),(0,Z.jsx)(Qo,{run:t,sessionOpen:c,attention:l,queued:u,continuable:d,startsNewConversation:f.startsNewConversation,removedRunnerNotice:b})]}),r===void 0?null:(0,Z.jsx)(ut,{ask:{...r,placement:`pinned`},run:t,surface:`decision-zone`,mode:ee,onModeChange:O,hideReplyBody:!0,delivery:_,onShowOrigin:s,onStop:C?p.stop:void 0,stopping:p.stopping,onFinish:Sn(t)?()=>m.mutateAsync():void 0,finishing:m.isPending,fold:Yo(x,S)},r.id),(0,Z.jsx)(`div`,{"data-slot":`thread-composer-slot`,hidden:N,className:q(`min-w-0 w-full`,N&&`hidden`,M&&`rounded-b-xl border border-t-0 border-accent-strong/30 bg-accent-strong/[0.04] p-2.5 [html:not(.light)_&]:bg-card`),children:(0,Z.jsx)(ts,{run:t,thread:n,canStop:C,hasPendingAsk:k,composerHidden:N,optionDeliveryPending:P,onComposerPendingChange:D,stopAction:p,finishAction:m,attention:l,needsAnswer:h,continuable:d,continueAction:f,queued:u,sendMessage:g,reply:_,providerBlocked:v,providerReason:y,sessionOpen:c})})]})]})}function Qo({run:e,sessionOpen:t,attention:n,queued:r,continuable:i,startsNewConversation:a,removedRunnerNotice:o}){if(e.status===`waiting`&&t)return(0,Z.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(qt,{tone:n.tone,shape:n.shape,pulse:n.pulse}),n.bucket===`permission`?`Choose an approval option above to continue`:n.bucket===`waiting`?`The agent is paused, waiting for your reply`:`${ln(e,n).label} — you can send a message to resume`]});if(e.status===`running`){let t=St(e,{}),n=pa(e),r=n.length>0?n[ha(e.currentStepId,n)]:void 0;return(0,Z.jsxs)(`div`,{"data-slot":`running-hint`,className:`flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(qt,{tone:t.attention.tone,shape:t.attention.shape,pulse:t.attention.pulse}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[t.label,r?` · ${r.name}`:``]})]})}return r?(0,Z.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(qt,{tone:`neutral`,shape:`ring`}),`Messages you add now are folded into the prompt before the run starts.`]}):o===void 0?i&&a?(0,Z.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:`Starts a new agent conversation.`}):null:(0,Z.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:o})}function $o(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 es(e,t){let{run:n,hasPendingAsk:r,optionDeliveryPending:i,continuable:a,continueAction:o,queued:s,sendMessage:c,reply:l,providerBlocked:u,providerReason:d,sessionOpen:f}=e,p=async(e,t)=>{let n=await l.send(e,t);if(n!==void 0)throw Error(n)};return r?{onSubmit:p,pendingLabel:l.mode===`resume`?`Continuing…`:`Sending…`,disabled:u||l.blockedBy!==void 0||i,disabledReason:u?d:i?`Sending your answer…`:l.reason,placeholder:t?`Reply`:`Reply — / for skills, @ for files…`}:{onSubmit:a?(e,t)=>o.continueWith(e,t??[]):s?(e,t)=>c.mutateAsync({text:e,images:t}):p,pendingLabel:a?`Continuing…`:`Sending…`,disabled:u||!f&&!s&&!a,disabledReason:u?d:`Session closed — no session to resume.`,placeholder:(t?rs:is)(n,s,a)}}function ts(e){let{run:t,thread:n,canStop:r,hasPendingAsk:i,composerHidden:a,onComposerPendingChange:o,stopAction:s,finishAction:c,attention:l,needsAnswer:u,continuable:d,continueAction:f,providerBlocked:p}=e,m=!nn(),h=es(e,m),g=!i&&d&&!u;return(0,Z.jsx)(Fn,{...$o(t,d,f),onPendingChange:o,onStop:r?s.stop:void 0,onFinish:Sn(t)?()=>c.mutateAsync().catch(()=>void 0):void 0,finishing:c.isPending,stopOnEmpty:!i&&ns(t,l,u),stopping:s.stopping,retainDraftUntilSuccess:!0,compactFeedback:!0,pendingLabel:h.pendingLabel,failureHint:`Your draft is kept. Check the task status and connection, then retry.`,sessionControls:!i&&d?f.pills:void 0,onSubmit:h.onSubmit,disabled:h.disabled,disabledReason:h.disabledReason,footerEnd:p&&!f.providerPending?(0,Z.jsx)(Rt,{to:`/settings/agent-defaults#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):void 0,allowEmptySubmit:g,emptySubmitVariant:t.status===`review`?`outline`:`primary`,emptySubmitLabel:g?`Continue`:void 0,placeholder:h.placeholder,autocompleteSkills:!0,phoneRest:m,quickReplies:!a,getMentionCandidates:()=>Qn(n)})}function ns(e,t,n){return e.status===`queued`||e.status===`running`||e.status===`waiting`&&t.bucket===`none`&&!n}function rs(e,t,n){return t?`Add to the prompt`:n?`Add a prompt…`:e.status===`waiting`?`Reply`:`Message the agent`}function is(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 as(){let{id:e}=K(),t=a(e),n=Ot(e),r=t.data?.status,o=(0,X.useMemo)(()=>Xn(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),s=(0,X.useMemo)(()=>Xn(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),c=(0,X.useRef)(void 0),l=(0,X.useCallback)(e=>{c.current=e},[]),{mutate:u}=i();if((0,X.useEffect)(()=>{t.data&&c.current!==t.data.id&&Gt(t.data)&&u(t.data.id)},[u,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),Uo(t.data,n.visibleEvents),t.isPending)return(0,Z.jsx)(zn,{});if(t.isError){let e=t.error instanceof k&&t.error.status===404;return(0,Z.jsx)(tn,{route:`task-thread`,density:`empty`,flushPadding:!0,children:(0,Z.jsx)(on,{icon:e?(0,Z.jsx)(Dt,{}):(0,Z.jsx)(gt,{}),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,Z.jsx)(J,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(Rt,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,Z.jsx)(zn,{}):(0,Z.jsx)(ss,{run:t.data,thread:o,currentThread:s,history:n,onMarkedUnread:l})}var os=e=>({titles:Object.fromEntries(e.map(e=>[e.id,Y(e)])),backends:Object.fromEntries(e.map(e=>[e.id,e.currentStepBackend??e.runner]))});function ss({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){Lt();let a=te({queryKey:c.runs.list(),queryFn:({signal:e})=>O(f(),{signal:e}),select:os}),{pendingAsk:o,transcriptAsk:s,pendingAskId:l,historyLoading:p}=fs(r,n),m=V(e),h=Yn(e.status,e.error,t),g=Nn(e),_=!g&&e.status!==`queued`,v=e.status===`queued`,y=or(e),b=Zi(e),x=Kn(e.id),S=s||M(e),{hasContinuation:C,continuable:w}=ps(g,v,y),{openAgentId:T,setOpenAgentId:E,activityMode:D,activityOpen:k,setActivityOpen:A,showActivitySidebar:j,closeActivityPopover:N}=us(e.id),P=(0,X.useRef)(void 0),F=(0,X.useCallback)(e=>{let t=[...document.querySelectorAll(`[data-agent-id]`)].find(t=>t.dataset.agentId===e);if(t){t.focus({preventScroll:!0});return}P.current=e,A(!0)},[A]),I=(0,X.useCallback)(e=>{let t=P.current;if(!t)return;P.current=void 0;let n=[...document.querySelectorAll(`[data-agent-id]`)].find(e=>e.dataset.agentId===t);n&&(e.preventDefault(),n.focus({preventScroll:!0}))},[]),{openAgent:L,openAgentChildren:R}=cs(T,n,t,_),z=u(e.id),B=In(e),{providerBlocked:H,providerReason:U}=ms(g,hn(e),C,y),W=ds(e,v),G=p?void 0:l??null,K=(0,X.useMemo)(()=>Mi(n,G),[n,G]),ne=K?.questions.length??0,q=Jo(K),ie=q.open,ae=(0,X.useMemo)(()=>Ni(e,t,n,G,{pinPendingAskInTranscript:!1}),[e,t,n,G]),oe=(0,X.useMemo)(()=>zi(ae,e.id),[ae,e.id]),{taskTitles:ce,recipientBackends:le}=ls(e,a.data),ue=(0,X.useCallback)(t=>(0,Z.jsx)(Nr,{permission:t,runId:e.id,sessionOpen:g}),[e.id,g]),de=w&&e.removedRunner!==void 0?ee(e.removedRunner):void 0,fe=se(e,d()),{search:pe}=re(),me=Ve(pe,oe.length),he=Si(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:oe.map(({key:e})=>e)}),ge=Go({pendingAskId:l,askSeq:r?o?.seq:void 0,rows:oe,history:r,jumpToRow:he.jumpToRow}),_e=(0,X.useRef)(l);p||(_e.current=l);let ve=_i(),ye=(0,X.useRef)({reveal:ge.reveal});ye.current={reveal:ge.reveal};let be=(0,X.useCallback)(()=>{ie(),pi(ve.current??document.body)?.focus({preventScroll:!0})},[ve,ie]),xe=(0,X.useCallback)(t=>t.placement===`origin`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.context?(0,Z.jsx)(at,{text:t.context}):null,t.resolved?null:(0,Z.jsx)(gi,{onGoToQuestion:be})]}):(0,Z.jsx)(ut,{ask:t,run:e,onShowOrigin:()=>ye.current.reveal()}),[e,be]);Pt(he.restickIfStuck);let Se=r?.currentComplete??!0,Ce={run:e,thread:t,currentThread:n,currentComplete:Se,onOpenWorker:E,mode:D,open:k,onOpenChange:A,keepOpen:T!==void 0,onOpenAutoFocus:I};return(0,Z.jsxs)(tn,{route:`task-thread`,density:t.turns.length===0?`empty`:`full`,fillHeight:!0,flushPadding:!0,rootRef:ve,rootProps:{"data-run-id":e.id},className:`overflow-clip`,children:[(0,Z.jsx)(Ct,{run:e,onMarkedUnread:()=>i?.(e.id),desktopActivitySlot:(0,Z.jsx)(Lo,{...Ce}),mobileActivitySlot:(0,Z.jsx)(zo,{...Ce})}),(0,Z.jsxs)(`div`,{"data-slot":`thread-workspace`,children:[(0,Z.jsxs)(`div`,{"data-slot":`thread-main`,children:[(0,Z.jsx)(`div`,{"data-slot":`thread-transcript`,role:`region`,"aria-label":`Session transcript`,tabIndex:0,children:(0,Z.jsx)(hs,{run:e,thread:t,history:r,footer:h,issueUrl:fe,sections:ae,renderAsk:xe,renderPermission:ue,messageActions:W,scroll:he,mode:me,taskTitles:ce,recipientBackends:le})}),(0,Z.jsx)(Zo,{run:e,thread:t,pinnedAsk:K,pendingQuestions:ne,scroll:he,onJump:()=>{let e=ne>0?K?.id:void 0;he.jumpToLatest(e===void 0?void 0:mi(e,()=>_e.current===e))},onShowOrigin:()=>ye.current.reveal(),sessionOpen:g,attention:m,queued:v,continuable:w,continueAction:y,stopAction:b,finishAction:x,needsAnswer:S,sendMessage:z,reply:B,providerBlocked:H,providerReason:U,removedRunnerNotice:de,fold:q})]}),j?(0,Z.jsx)(`aside`,{"data-slot":`thread-activity-sidebar`,"aria-label":`Session activity`,children:(0,Z.jsx)(lo,{presentation:`panel`,run:e,thread:t,currentThread:n,currentComplete:Se,onOpenWorker:E})}):null]}),(0,Z.jsx)(Ji,{runId:e.id,renderAsk:xe,renderPermission:ue,agent:L,entries:R,taskTitles:ce,recipientBackends:le,onBeforeOpenReport:N,onRestoreAgentFocus:F,onClose:()=>E(void 0)})]})}function cs(e,t,n,r){return{openAgent:(0,X.useMemo)(()=>e===void 0?void 0:xr(t.turns,e,r,n.turns),[t.turns,e,r,n.turns]),openAgentChildren:(0,X.useMemo)(()=>e===void 0?[]:wr(n.turns,t.turns,e),[n.turns,t.turns,e])}}function ls(e,t){let n=e.delegation?.role===`root`||e.delegation?.role===`worker`,r=S(e.id,{enabled:n});return{taskTitles:(0,X.useMemo)(()=>({...Rr(e,void 0,r.data?.titles),...t?.titles,[e.id]:Y(e)}),[e,t,r.data]),recipientBackends:(0,X.useMemo)(()=>({...t?.backends,...Lr(e,void 0)}),[e,t])}}function us(e){let[t,n]=(0,X.useState)(void 0),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!0),[s,c]=(0,X.useState)(e);s!==e&&(c(e),n(void 0),i(!1));let l=On(),u=Dn()||l?.open===!0,d=Ln(`(min-width: 1600px)`,!1)&&!u?`sidebar`:`popover`;return{openAgentId:t,setOpenAgentId:n,activityMode:d,activityOpen:d===`sidebar`?a:r,setActivityOpen:d===`sidebar`?o:i,showActivitySidebar:d===`sidebar`&&a,closeActivityPopover:(0,X.useCallback)(()=>i(!1),[])}}function ds(e,t){let{mutateAsync:n}=l(e.id),{mutateAsync:r}=s(e.id),{mutateAsync:i}=y(e.id);return(0,X.useMemo)(()=>{if(!t)return;let a={task:{onEdit:async e=>{await n({task:e})},editLabel:`Edit the prompt`}};for(let t of e.queuedMessages??[])a[`queued:${t.id}`]={onEdit:e=>r({msgId:t.id,message:{text:e}}).then(()=>void 0),onRemove:()=>i(t.id).then(()=>void 0)};return a},[t,e.queuedMessages,n,r,i])}function fs(e,t){let n=e?Et(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 ps(e,t,n){let r=!e&&!t&&n.available;return{hasContinuation:r,continuable:r&&n.canContinue}}function ms(e,t,n,r){let i=e&&!t.usable,a=n&&!r.canContinue;return{providerBlocked:i||a,providerReason:i?t.reason:r.reason}}function hs({run:e,thread:t,history:n,footer:r,issueUrl:i,sections:a,renderAsk:o,renderPermission:s,messageActions:c,scroll:l,mode:u,taskTitles:d,recipientBackends:f}){let p=Tn()===`changes`;return(0,Z.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 [padding-block-end:12px] md:gap-3.5 md:px-16 md:py-5 md:[padding-block-end:24px]`,children:[n?(0,Z.jsx)(gs,{hasOlder:n.hasOlder,loading:n.isFetchingOlder,error:n.olderError,fallback:n.fallback,retainedPages:n.retainedPages,onLoad:l.loadOlder}):null,(0,Z.jsx)(Bi,{runId:e.id,viewId:`main`,sections:a,mode:`document`,renderAsk:o,renderPermission:s,messageActions:c,scrollControls:l,renderMode:u,taskTitles:d,recipientBackends:f}),t.turns.length===0?e.status===`queued`?(0,Z.jsx)(_s,{run:e}):(0,Z.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,Z.jsx)(Ze,{}):null,r&&r.state===`closed`?(0,Z.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":r.state,className:q(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,r.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[r.label,ie(ae(e))?(0,Z.jsx)(`a`,{"data-slot":`pr-link`,href:ae(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,ie(i)?(0,Z.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`&&!p?(0,Z.jsx)(Wn,{runId:e.id}):null]})}function gs({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,Z.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,Z.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-xs text-soft-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,Z.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,Z.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,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function _s({run:e}){let t=Rn(v().data??[],e.id);return(0,Z.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,Z.jsx)(qt,{tone:`neutral`,shape:`ring`}),(0,Z.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,Z.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{as as TaskThreadRoute};
@@ -1 +1 @@
1
- [data-slot=main]:has([data-route=task-thread]){min-block-size:0;min-inline-size:0;overflow:hidden}[data-route=task-thread]{block-size:100%;min-block-size:0;min-inline-size:0;overflow:clip}[data-route=task-thread] [data-slot=thread-workspace]{flex:1 1 0;min-block-size:0;min-inline-size:0;display:flex;overflow:clip}[data-route=task-thread] [data-slot=thread-main]{flex-direction:column;flex:1 1 0;min-block-size:0;min-inline-size:0;display:flex;position:relative;overflow:clip}[data-route=task-thread] [data-slot=thread-transcript]{overscroll-behavior-block:contain;flex:1 1 0;min-block-size:0;min-inline-size:0;scroll-padding-block:12px 56px;overflow:hidden auto}[data-route=task-thread] [data-slot=thread-transcript]:focus-visible{outline:2px solid var(--link-foreground);outline-offset:-2px}@media (forced-colors:active){[data-route=task-thread] [data-slot=thread-transcript]:focus-visible{outline-color:highlight}}[data-route=task-thread] [data-slot=thread-activity-sidebar]{overscroll-behavior-block:contain;border-inline-start:1px solid var(--border);background:var(--card);flex:0 0 320px;min-block-size:0;overflow-y:auto}.session-composer [data-slot=composer-editor]{border-color:var(--ring);border-radius:12px}.session-composer [data-slot=session-controls]{padding-block:0 10px;padding-inline:12px}.session-engine-controls{grid-template-columns:max-content minmax(0,1fr) max-content;gap:8px;min-inline-size:0;display:grid}.session-engine-controls [data-slot$=pill]{inline-size:100%;min-inline-size:0}.session-engine-controls [data-slot$=pill]>svg:last-child{margin-inline-start:auto}.session-engine-controls [data-slot=session-runner-value]{inline-size:100%;min-inline-size:0}.session-composer [data-slot=composer-toolbar]{grid-template-columns:minmax(0,1fr) auto;gap:8px;padding-block:0 12px;padding-inline:12px;display:grid}.session-composer [data-slot=composer-toolbar]>[data-slot=session-controls]{grid-area:1/1/auto/-1;min-inline-size:0;padding:0}.session-composer [data-slot=composer-footer-start]{flex-wrap:nowrap;grid-area:2/1;gap:8px}.session-composer [aria-label=Attach\ files],.session-composer [aria-label=Start\ dictation]{border:1px solid var(--border);border-radius:9px}.session-composer [data-slot=follow-up-model-pill]{min-block-size:36px}.session-composer [data-slot=follow-up-model-pill]>svg:last-child{margin-inline-start:auto}.session-composer [data-slot=composer-submit-row]{flex:none;grid-area:2/2;margin:0}.session-composer [data-slot=composer-toolbar]:has([data-folded]){grid-template-columns:auto minmax(0,1fr) auto}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=session-controls]{grid-area:1/2;align-self:center}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-footer-start]{grid-area:1/1}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-submit-row]{grid-area:1/3}[data-slot=run-actions-menu] [role^=menuitem]{min-block-size:44px}[data-route=task-thread] [data-slot=thread-dock]{z-index:10;border-block-start:1px solid var(--border);background:var(--background);flex:none;position:relative;container:thread-dock/inline-size}[data-route=task-thread] [data-slot=thread-jump]{margin-block-end:8px;padding-inline:16px;position:absolute;inset-block-end:100%;inset-inline:0}[data-route=task-thread] [data-slot=thread-footer-content]{--thread-footer-limit:min(60dvh, calc(var(--thread-viewport-height,100dvh) - var(--thread-header-height,0px) - var(--spacing) * 5.5));max-block-size:var(--thread-footer-limit);min-block-size:0;min-inline-size:0}[data-route=task-thread] [data-slot=thread-footer-content]>:not([data-slot=thread-composer-slot]):not(:has([data-slot=ask-card])){flex-shrink:0}[data-route=task-thread] [data-slot=thread-footer-content]>:has([data-slot=ask-card]){flex-direction:column;flex:0 auto;min-block-size:0;min-inline-size:0;display:flex}[data-route=task-thread] [data-slot=thread-footer-content] [data-slot=thread-composer-slot]{flex-direction:column;flex:0 auto;min-block-size:0;inline-size:100%;min-inline-size:0;display:flex}[data-route=task-thread] [data-slot=thread-footer-content] [data-slot=thread-composer-slot][hidden]{display:none}[data-route=task-thread] [data-slot=thread-footer-content] [data-slot=composer]{min-block-size:0;max-block-size:calc(var(--thread-footer-limit) - 24px);flex-direction:column;flex:0 auto;inline-size:100%;min-inline-size:0;display:flex}[data-route=task-thread] [data-slot=composer-editor]{flex-direction:column;min-block-size:0;display:flex;overflow-y:auto}[data-route=task-thread] [data-slot=composer-editor]>textarea{flex-shrink:1;min-block-size:44px}[data-route=task-thread] [data-slot=composer-thumbs]{flex-wrap:nowrap;flex-shrink:0;max-block-size:60px;overflow:auto}[data-route=task-thread] [data-slot=composer-toolbar]{flex-shrink:0}[data-route=task-thread] [data-slot=thread-dock] [data-slot=ask-card]{min-block-size:0;max-block-size:calc(var(--thread-footer-limit) - 24px);flex-direction:column;flex:0 auto;display:flex;overflow:clip}[data-route=task-thread] [data-slot=ask-body]{overscroll-behavior-block:contain;flex:auto;min-block-size:0;overflow-y:auto}@media (width>=768px){[data-route=task-thread] [data-slot=thread-jump]{padding-inline:64px}@container thread-dock (width<=680px){[data-slot=thread-dock]>[data-slot=thread-footer-content]{padding-inline:8px}.session-engine-controls{grid-template-columns:max-content minmax(0,1fr) max-content}.session-engine-controls :is([data-slot=runner-pill],[data-slot=session-runner-value],[data-slot=follow-up-effort-pill]){gap:6px;padding-inline:8px}.session-engine-controls :is([data-slot=runner-pill],[data-slot=follow-up-effort-pill])>svg:last-child{display:none}}}@media (width<=767px){[data-slot=run-title-row]>.group{max-inline-size:calc(100% - 52px)}.session-engine-controls{grid-template-columns:max-content minmax(0,1fr)}.session-engine-controls [data-slot=follow-up-model-pill]{grid-area:2/1/auto/-1}.session-engine-controls [data-slot=follow-up-effort-pill]{grid-area:1/2}.task-open-targets{flex-direction:column;align-items:flex-start}.session-composer [data-slot=composer-toolbar]{padding-block:0 8px}[data-route=task-thread] [data-slot=thread-footer-content]{--thread-footer-limit:min(50dvh, calc(var(--thread-viewport-height,100dvh) - var(--thread-header-height,0px) - 180px))}[data-route=task-thread][data-compact-viewport=true] [data-slot=paused-hint],[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-header]>span:first-child,[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-hint]{display:none}[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-header],[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-footer]{padding-block:4px}[data-route=task-thread][data-compact-viewport=true] [data-slot=thread-footer-content]{--thread-footer-limit:calc(var(--thread-viewport-height,100dvh) - var(--thread-header-height,0px) - 24px)}[data-route=task-thread][data-compact-viewport=true] [data-slot=thread-dock] [data-slot=ask-card],[data-route=task-thread][data-compact-viewport=true] [data-slot=thread-footer-content] [data-slot=composer]{max-block-size:var(--thread-footer-limit)}[data-route=task-thread] :is([data-slot=running-hint],[data-slot=paused-hint]){display:none}.session-composer [data-slot=composer-toolbar]:has([data-folded]){grid-template-columns:minmax(0,1fr) auto}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=session-controls]{grid-area:1/1/auto/-1;justify-self:start;max-inline-size:100%}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-footer-start]{grid-area:2/1}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-submit-row]{grid-area:2/2}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-editor]{flex-flow:wrap;align-items:center;gap:0 4px;padding:4px}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-editor]>textarea{flex:1 1 0;min-inline-size:0;padding-block:10px;padding-inline:8px}[data-route=task-thread] [data-slot=composer][data-rest] :is([data-slot=composer-toolbar],[data-slot=composer-footer-start]){display:contents}[data-route=task-thread] [data-slot=composer][data-rest] :is([aria-label=Attach\ files],[data-slot=composer-status]){display:none}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-submit-row]{flex:none;margin:0}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-actions]{min-inline-size:0}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=session-controls]{flex:1 0 100%;order:1;min-inline-size:0}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-editor]:has([data-slot=session-controls]){padding-block-end:0}@container thread-dock (width<=359px){[data-slot=composer][data-rest] [data-slot=composer-stop-label],[data-slot=composer][data-rest] [data-slot=composer-actions]>button:not([aria-label=Stop],[aria-label=Stopping…])>svg{display:none}[data-slot=composer][data-rest] [data-slot=composer-actions]>button:not([data-button-size=icon]){padding-inline:12px}}}[data-route=task-thread] [data-slot=assistant-message] :is(h1,h2,h3,h4,strong,[data-streamdown=strong]){color:var(--foreground)}[data-route=task-thread] [data-slot=assistant-message] h2{font-size:20px;line-height:1.4}@media (width<=767px){[data-route=task-thread] [data-slot=assistant-message] h2{letter-spacing:-.4px;font-size:18px}}[data-route=task-thread] .session-composer [data-slot=composer-editor]{border-color:var(--composer-border)}[data-route=task-thread] [data-slot=session-conversation]{overflow-anchor:none;padding-block:calc(var(--spacing) * 5.5) calc(var(--spacing) * 4);gap:calc(var(--spacing) * 4)}[data-route=task-thread] [data-slot=thread-row]{padding-block-end:calc(var(--spacing) * 4)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:is(p,ul,ol,table,blockquote){margin-block:calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:first-child,[data-route=task-thread] [data-slot=user-bubble] .thread-markdown>:first-child{margin-block-start:0}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:last-child,[data-route=task-thread] [data-slot=user-bubble] .thread-markdown>:last-child{margin-block-end:0}@media (width<=767px){[data-route=task-thread] [data-slot=session-conversation]{padding-block:calc(var(--spacing) * 4);gap:calc(var(--spacing) * 3.5)}[data-route=task-thread] [data-slot=thread-row]{padding-block-end:calc(var(--spacing) * 3.5)}}[data-route=task-thread] [data-slot=thread-footer][data-state=closed]{border-block-start:0;margin-block-start:0;padding-block-start:0}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>p:has(>:is(strong,[data-streamdown=strong]):only-child){margin-block-end:calc(var(--spacing) * 1)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>p:has(>:is(strong,[data-streamdown=strong]):only-child)+p{margin-block-start:calc(var(--spacing) * 1)}[data-route=task-thread] [data-slot=tool-card]{background:var(--task-brand-bg);border-radius:7px}[data-route=task-thread] [data-slot=tool-card]>button{padding-block:calc(var(--spacing) * 2.5);padding-inline:calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=tool-card]>[data-slot=collapsible-content]>div{background:0 0;border-block-start:0}[data-route=task-thread] [data-slot=tool-output] pre,[data-route=task-thread] [data-slot=tool-error]{padding-block:calc(var(--spacing) * 2) calc(var(--spacing) * 2.5);padding-inline:calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=tool-output-fade]{--tw-gradient-to:var(--task-brand-bg)}[data-slot=task-split][data-pane=open] [data-route=task-thread] [data-slot=session-conversation],[data-slot=task-split][data-pane=open] [data-route=task-thread] [data-slot=thread-dock]>[data-slot=thread-footer-content]{padding-inline:18px}[data-route=task-thread] [data-slot=ask-card]{scroll-margin-block:24px}[data-route=task-thread] [data-slot=composer-submit-row]>button{font-size:13px}
1
+ [data-slot=main]:has([data-route=task-thread]){min-block-size:0;min-inline-size:0;overflow:hidden}[data-route=task-thread]{block-size:100%;min-block-size:0;min-inline-size:0;overflow:clip}[data-route=task-thread] [data-slot=thread-workspace]{flex:1 1 0;min-block-size:0;min-inline-size:0;display:flex;overflow:clip}[data-route=task-thread] [data-slot=thread-main]{flex-direction:column;flex:1 1 0;min-block-size:0;min-inline-size:0;display:flex;position:relative;overflow:clip}[data-route=task-thread] [data-slot=thread-transcript]{overscroll-behavior-block:contain;flex:1 1 0;min-block-size:0;min-inline-size:0;scroll-padding-block:12px 56px;overflow:hidden auto}[data-route=task-thread] [data-slot=thread-transcript]:focus-visible{outline:2px solid var(--link-foreground);outline-offset:-2px}@media (forced-colors:active){[data-route=task-thread] [data-slot=thread-transcript]:focus-visible{outline-color:highlight}}[data-route=task-thread] [data-slot=thread-activity-sidebar]{overscroll-behavior-block:contain;border-inline-start:1px solid var(--border);background:var(--card);flex:0 0 320px;min-block-size:0;overflow-y:auto}.session-composer [data-slot=composer-editor]{border-color:var(--ring);border-radius:12px}.session-composer [data-slot=session-controls]{padding-block:0 10px;padding-inline:12px}.session-engine-controls{grid-template-columns:max-content minmax(0,1fr) max-content;gap:8px;min-inline-size:0;display:grid}.session-engine-controls [data-slot$=pill]{inline-size:100%;min-inline-size:0}.session-engine-controls [data-slot$=pill]>svg:last-child{margin-inline-start:auto}.session-engine-controls [data-slot=session-runner-value]{inline-size:100%;min-inline-size:0}.session-composer [data-slot=composer-toolbar]{grid-template-columns:minmax(0,1fr) auto;gap:8px;padding-block:0 12px;padding-inline:12px;display:grid}.session-composer [data-slot=composer-toolbar]>[data-slot=session-controls]{grid-area:1/1/auto/-1;min-inline-size:0;padding:0}.session-composer [data-slot=composer-footer-start]{flex-wrap:nowrap;grid-area:2/1;gap:8px}.session-composer [aria-label=Attach\ files],.session-composer [aria-label=Start\ dictation]{border:1px solid var(--border);border-radius:9px}.session-composer [data-slot=follow-up-model-pill]{min-block-size:36px}.session-composer [data-slot=follow-up-model-pill]>svg:last-child{margin-inline-start:auto}.session-composer [data-slot=composer-submit-row]{flex:none;grid-area:2/2;margin:0}.session-composer [data-slot=composer-toolbar]:has([data-folded]){grid-template-columns:auto minmax(0,1fr) auto}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=session-controls]{grid-area:1/2;align-self:center}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-footer-start]{grid-area:1/1}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-submit-row]{grid-area:1/3}[data-slot=run-actions-menu] [role^=menuitem]{min-block-size:44px}[data-route=task-thread] [data-slot=thread-dock]{z-index:10;border-block-start:1px solid var(--border);background:var(--background);flex:none;position:relative;container:thread-dock/inline-size}[data-route=task-thread] [data-slot=thread-jump]{margin-block-end:8px;padding-inline:16px;position:absolute;inset-block-end:100%;inset-inline:0}[data-route=task-thread] [data-slot=thread-footer-content]{--thread-footer-limit:min(60dvh, calc(var(--thread-viewport-height,100dvh) - var(--thread-header-height,0px) - var(--spacing) * 5.5));max-block-size:var(--thread-footer-limit);min-block-size:0;min-inline-size:0}[data-route=task-thread] [data-slot=thread-footer-content]>:not([data-slot=thread-composer-slot]):not(:has([data-slot=ask-card])){flex-shrink:0}[data-route=task-thread] [data-slot=thread-footer-content]>:has([data-slot=ask-card]){flex-direction:column;flex:0 auto;min-block-size:0;min-inline-size:0;display:flex}[data-route=task-thread] [data-slot=thread-footer-content] [data-slot=thread-composer-slot]{flex-direction:column;flex:0 auto;min-block-size:0;inline-size:100%;min-inline-size:0;display:flex}[data-route=task-thread] [data-slot=thread-footer-content] [data-slot=thread-composer-slot][hidden]{display:none}[data-route=task-thread] [data-slot=thread-footer-content] [data-slot=composer]{min-block-size:0;max-block-size:calc(var(--thread-footer-limit) - 24px);flex-direction:column;flex:0 auto;inline-size:100%;min-inline-size:0;display:flex}[data-route=task-thread] [data-slot=composer-editor]{flex-direction:column;min-block-size:0;display:flex;overflow-y:auto}[data-route=task-thread] [data-slot=composer-editor]>textarea{flex-shrink:1;min-block-size:44px}[data-route=task-thread] [data-slot=composer-thumbs]{flex-wrap:nowrap;flex-shrink:0;max-block-size:60px;overflow:auto}[data-route=task-thread] [data-slot=composer-toolbar]{flex-shrink:0}[data-route=task-thread] [data-slot=thread-dock] [data-slot=ask-card]{min-block-size:0;max-block-size:calc(var(--thread-footer-limit) - 24px);flex-direction:column;flex:0 auto;display:flex;overflow:clip}[data-route=task-thread] [data-slot=ask-body]{overscroll-behavior-block:contain;flex:auto;min-block-size:0;overflow-y:auto}@media (width>=768px){[data-route=task-thread] [data-slot=thread-jump]{padding-inline:64px}@container thread-dock (width<=680px){[data-slot=thread-dock]>[data-slot=thread-footer-content]{padding-inline:8px}.session-engine-controls{grid-template-columns:max-content minmax(0,1fr) max-content}.session-engine-controls :is([data-slot=runner-pill],[data-slot=session-runner-value],[data-slot=follow-up-effort-pill]){gap:6px;padding-inline:8px}.session-engine-controls :is([data-slot=runner-pill],[data-slot=follow-up-effort-pill])>svg:last-child{display:none}}}@media (width<=767px){[data-slot=run-title-row]>.group{max-inline-size:calc(100% - 52px)}.session-engine-controls{grid-template-columns:max-content minmax(0,1fr)}.session-engine-controls [data-slot=follow-up-model-pill]{grid-area:2/1/auto/-1}.session-engine-controls [data-slot=follow-up-effort-pill]{grid-area:1/2}.task-open-targets{flex-direction:column;align-items:flex-start}.session-composer [data-slot=composer-toolbar]{padding-block:0 8px}[data-route=task-thread] [data-slot=thread-footer-content]{--thread-footer-limit:min(50dvh, calc(var(--thread-viewport-height,100dvh) - var(--thread-header-height,0px) - 180px))}[data-route=task-thread] [data-slot=thread-footer-content]:has([data-slot=ask-card]){--thread-footer-limit:min(70dvh, calc(var(--thread-viewport-height,100dvh) - var(--thread-header-height,0px) - 96px - 13px))}[data-route=task-thread][data-compact-viewport=true] [data-slot=paused-hint],[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-header]>span:first-child,[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-hint]{display:none}[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-header],[data-route=task-thread][data-compact-viewport=true] [data-slot=ask-footer]{padding-block:4px}[data-route=task-thread][data-compact-viewport=true] [data-slot=thread-footer-content]{--thread-footer-limit:calc(var(--thread-viewport-height,100dvh) - var(--thread-header-height,0px) - 24px)}[data-route=task-thread][data-compact-viewport=true] [data-slot=thread-dock] [data-slot=ask-card],[data-route=task-thread][data-compact-viewport=true] [data-slot=thread-footer-content] [data-slot=composer]{max-block-size:var(--thread-footer-limit)}[data-route=task-thread] :is([data-slot=running-hint],[data-slot=paused-hint]){display:none}.session-composer [data-slot=composer-toolbar]:has([data-folded]){grid-template-columns:minmax(0,1fr) auto}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=session-controls]{grid-area:1/1/auto/-1;justify-self:start;max-inline-size:100%}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-footer-start]{grid-area:2/1}.session-composer [data-slot=composer-toolbar]:has([data-folded])>[data-slot=composer-submit-row]{grid-area:2/2}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-editor]{flex-flow:wrap;align-items:center;gap:0 4px;padding:4px}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-editor]>textarea{flex:1 1 0;min-inline-size:0;padding-block:10px;padding-inline:8px}[data-route=task-thread] [data-slot=composer][data-rest] :is([data-slot=composer-toolbar],[data-slot=composer-footer-start]){display:contents}[data-route=task-thread] [data-slot=composer][data-rest] :is([aria-label=Attach\ files],[data-slot=composer-status]){display:none}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-submit-row]{flex:none;margin:0}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-actions]{min-inline-size:0}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=session-controls]{flex:1 0 100%;order:1;min-inline-size:0}[data-route=task-thread] [data-slot=composer][data-rest] [data-slot=composer-editor]:has([data-slot=session-controls]){padding-block-end:0}@container thread-dock (width<=359px){[data-slot=ask-header][data-compact]{gap:4px;padding-inline:4px}[data-slot=ask-header][data-compact]~[data-slot=ask-footer],[data-slot=ask-header][data-compact] [data-slot=ask-mode-switch]>button{padding-inline:8px}[data-slot=ask-header][data-compact] [data-slot=ask-show-context]{padding-inline:6px}:is([data-slot=ask-header][data-compact] [data-slot=ask-show-context],[data-slot=ask-add-comment])>svg,[data-slot=composer][data-rest] [data-slot=composer-stop-label],[data-slot=composer][data-rest] [data-slot=composer-actions]>button:not([aria-label=Stop],[aria-label=Stopping…])>svg{display:none}[data-slot=composer][data-rest] [data-slot=composer-actions]>button:not([data-button-size=icon]){padding-inline:12px}}}[data-route=task-thread] [data-slot=assistant-message] :is(h1,h2,h3,h4,strong,[data-streamdown=strong]){color:var(--foreground)}[data-route=task-thread] [data-slot=assistant-message] h2{font-size:20px;line-height:1.4}@media (width<=767px){[data-route=task-thread] [data-slot=assistant-message] h2{letter-spacing:-.4px;font-size:18px}}[data-route=task-thread] .session-composer [data-slot=composer-editor]{border-color:var(--composer-border)}[data-route=task-thread] [data-slot=session-conversation]{overflow-anchor:none;padding-block:calc(var(--spacing) * 5.5) calc(var(--spacing) * 4);gap:calc(var(--spacing) * 4)}[data-route=task-thread] [data-slot=thread-row]{padding-block-end:calc(var(--spacing) * 4)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:is(p,ul,ol,table,blockquote){margin-block:calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:first-child,[data-route=task-thread] [data-slot=user-bubble] .thread-markdown>:first-child{margin-block-start:0}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:last-child,[data-route=task-thread] [data-slot=user-bubble] .thread-markdown>:last-child{margin-block-end:0}@media (width<=767px){[data-route=task-thread] [data-slot=session-conversation]{padding-block:calc(var(--spacing) * 4);gap:calc(var(--spacing) * 3.5)}[data-route=task-thread] [data-slot=thread-row]{padding-block-end:calc(var(--spacing) * 3.5)}}[data-route=task-thread] [data-slot=thread-footer][data-state=closed]{border-block-start:0;margin-block-start:0;padding-block-start:0}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>p:has(>:is(strong,[data-streamdown=strong]):only-child){margin-block-end:calc(var(--spacing) * 1)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>p:has(>:is(strong,[data-streamdown=strong]):only-child)+p{margin-block-start:calc(var(--spacing) * 1)}[data-route=task-thread] [data-slot=tool-card]{background:var(--task-brand-bg);border-radius:7px}[data-route=task-thread] [data-slot=tool-card]>button{padding-block:calc(var(--spacing) * 2.5);padding-inline:calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=tool-card]>[data-slot=collapsible-content]>div{background:0 0;border-block-start:0}[data-route=task-thread] [data-slot=tool-output] pre,[data-route=task-thread] [data-slot=tool-error]{padding-block:calc(var(--spacing) * 2) calc(var(--spacing) * 2.5);padding-inline:calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=tool-output-fade]{--tw-gradient-to:var(--task-brand-bg)}[data-slot=task-split][data-pane=open] [data-route=task-thread] [data-slot=session-conversation],[data-slot=task-split][data-pane=open] [data-route=task-thread] [data-slot=thread-dock]>[data-slot=thread-footer-content]{padding-inline:18px}[data-route=task-thread] [data-slot=ask-card]{scroll-margin-block:24px}[data-route=task-thread] [data-slot=composer-submit-row]>button{font-size:13px}