@open-mercato/cezar 0.15.0 → 0.15.1

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 (212) hide show
  1. package/dist/automations/github-poller.d.ts +8 -1
  2. package/dist/automations/github-poller.js +78 -13
  3. package/dist/automations/github-poller.js.map +1 -1
  4. package/dist/automations/pr-head.js +15 -1
  5. package/dist/automations/pr-head.js.map +1 -1
  6. package/dist/automations/prompts.js +2 -2
  7. package/dist/automations/types.d.ts +10 -0
  8. package/dist/automations/types.js +12 -1
  9. package/dist/automations/types.js.map +1 -1
  10. package/dist/config.d.ts +1 -0
  11. package/dist/config.js +6 -0
  12. package/dist/config.js.map +1 -1
  13. package/dist/contract/automations.d.ts +31 -1
  14. package/dist/contract/index.d.ts +1 -0
  15. package/dist/contract/index.js +161 -17
  16. package/dist/contract/projects.d.ts +46 -0
  17. package/dist/contract/runs.d.ts +15 -0
  18. package/dist/contract/skills.d.ts +1 -0
  19. package/dist/contract/telemetry.d.ts +124 -0
  20. package/dist/contract/workspace.d.ts +3 -0
  21. package/dist/core/cursor-agent-runner.d.ts +11 -0
  22. package/dist/core/cursor-agent-runner.js +48 -4
  23. package/dist/core/cursor-agent-runner.js.map +1 -1
  24. package/dist/core/disclaim-spawn.d.ts +10 -0
  25. package/dist/core/disclaim-spawn.js +105 -8
  26. package/dist/core/disclaim-spawn.js.map +1 -1
  27. package/dist/git-diff-base.js +26 -19
  28. package/dist/git-diff-base.js.map +1 -1
  29. package/dist/git-remotes.d.ts +43 -0
  30. package/dist/git-remotes.js +127 -0
  31. package/dist/git-remotes.js.map +1 -0
  32. package/dist/git-worktree.d.ts +43 -19
  33. package/dist/git-worktree.js +138 -54
  34. package/dist/git-worktree.js.map +1 -1
  35. package/dist/index.js +46 -6
  36. package/dist/index.js.map +1 -1
  37. package/dist/runs/auto-name.d.ts +17 -0
  38. package/dist/runs/auto-name.js +47 -2
  39. package/dist/runs/auto-name.js.map +1 -1
  40. package/dist/runs/event-history.d.ts +10 -2
  41. package/dist/runs/event-history.js +290 -120
  42. package/dist/runs/event-history.js.map +1 -1
  43. package/dist/runs/retention.js +1 -1
  44. package/dist/runs/retention.js.map +1 -1
  45. package/dist/runs/store.d.ts +16 -3
  46. package/dist/runs/store.js +89 -10
  47. package/dist/runs/store.js.map +1 -1
  48. package/dist/server/checkout.d.ts +4 -0
  49. package/dist/server/checkout.js +9 -5
  50. package/dist/server/checkout.js.map +1 -1
  51. package/dist/server/create-project.d.ts +77 -0
  52. package/dist/server/create-project.js +342 -0
  53. package/dist/server/create-project.js.map +1 -0
  54. package/dist/server/forge/github.d.ts +2 -0
  55. package/dist/server/forge/github.js +32 -10
  56. package/dist/server/forge/github.js.map +1 -1
  57. package/dist/server/forge/index.d.ts +1 -12
  58. package/dist/server/forge/index.js +7 -29
  59. package/dist/server/forge/index.js.map +1 -1
  60. package/dist/server/forge/types.d.ts +2 -0
  61. package/dist/server/git-changes.d.ts +15 -0
  62. package/dist/server/git-changes.js +51 -1
  63. package/dist/server/git-changes.js.map +1 -1
  64. package/dist/server/git.d.ts +3 -2
  65. package/dist/server/git.js +4 -3
  66. package/dist/server/git.js.map +1 -1
  67. package/dist/server/project-context.js +1 -1
  68. package/dist/server/project-context.js.map +1 -1
  69. package/dist/server/server.d.ts +609 -302
  70. package/dist/server/server.js +191 -12
  71. package/dist/server/server.js.map +1 -1
  72. package/dist/server/star-count.d.ts +27 -11
  73. package/dist/server/star-count.js +57 -28
  74. package/dist/server/star-count.js.map +1 -1
  75. package/dist/telemetry-cli.d.ts +10 -0
  76. package/dist/telemetry-cli.js +54 -0
  77. package/dist/telemetry-cli.js.map +1 -0
  78. package/dist/telemetry-service.json +1 -0
  79. package/dist/telemetry.d.ts +79 -0
  80. package/dist/telemetry.js +453 -0
  81. package/dist/telemetry.js.map +1 -0
  82. package/dist/workflows/run.d.ts +28 -0
  83. package/dist/workflows/run.js +111 -16
  84. package/dist/workflows/run.js.map +1 -1
  85. package/dist/workspace/config.d.ts +10 -0
  86. package/dist/workspace/config.js +16 -0
  87. package/dist/workspace/config.js.map +1 -1
  88. package/dist/workspace/projects-cli.js +3 -0
  89. package/dist/workspace/projects-cli.js.map +1 -1
  90. package/package.json +3 -3
  91. package/scripts/mock-claude.mjs +32 -17
  92. package/scripts/stamp-telemetry-service.mjs +20 -0
  93. package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
  94. package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
  95. package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
  96. package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
  97. package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
  98. package/web/dist/assets/button-BNnH7COh.js +100 -0
  99. package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
  100. package/web/dist/assets/check-DA37PQLT.js +1 -0
  101. package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
  102. package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
  103. package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
  104. package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
  105. package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
  106. package/web/dist/assets/composer-DKWLJeo9.js +18 -0
  107. package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
  108. package/web/dist/assets/diff-CrLUECGW.js +3 -0
  109. package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
  110. package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
  111. package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
  112. package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
  113. package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
  114. package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
  115. package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
  116. package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
  117. package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
  118. package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
  119. package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
  120. package/web/dist/assets/github-G5fU4gJd.js +1 -0
  121. package/web/dist/assets/index-BN3w52uE.js +21 -0
  122. package/web/dist/assets/index-CAvSSpvF.css +2 -0
  123. package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
  124. package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
  125. package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
  126. package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
  127. package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
  128. package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
  129. package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
  130. package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
  131. package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
  132. package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
  133. package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
  134. package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
  135. package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
  136. package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
  137. package/web/dist/assets/skills-SIMzpL0l.js +1 -0
  138. package/web/dist/assets/square-DsFAQaY9.js +1 -0
  139. package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
  140. package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
  141. package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
  142. package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
  143. package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
  144. package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
  145. package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
  146. package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
  147. package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
  148. package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
  149. package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
  150. package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
  151. package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
  152. package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
  153. package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
  154. package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
  155. package/web/dist/assets/upload-bwO_2kok.js +1 -0
  156. package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
  157. package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
  158. package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
  159. package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
  160. package/web/dist/assets/x-HaVPcg_B.js +1 -0
  161. package/web/dist/index.html +28 -31
  162. package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
  163. package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
  164. package/web/dist/assets/automations-route-BsflncpV.js +0 -1
  165. package/web/dist/assets/button-CjSjKnkd.js +0 -100
  166. package/web/dist/assets/check-DAAMuI4o.js +0 -1
  167. package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
  168. package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
  169. package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
  170. package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
  171. package/web/dist/assets/composer-DZx3cwQW.js +0 -18
  172. package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
  173. package/web/dist/assets/diff-LG2cl0PE.js +0 -3
  174. package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
  175. package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
  176. package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
  177. package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
  178. package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
  179. package/web/dist/assets/external-link-DPKRidDg.js +0 -1
  180. package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
  181. package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
  182. package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
  183. package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
  184. package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
  185. package/web/dist/assets/github-C4WaHPni.js +0 -1
  186. package/web/dist/assets/index-CiQrbvAq.js +0 -21
  187. package/web/dist/assets/index-WWaEax-B.css +0 -2
  188. package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
  189. package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
  190. package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
  191. package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
  192. package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
  193. package/web/dist/assets/skills-Dea5ynJK.js +0 -1
  194. package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
  195. package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
  196. package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
  197. package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
  198. package/web/dist/assets/task-files-MAPO-efK.js +0 -1
  199. package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
  200. package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
  201. package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
  202. package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
  203. package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
  204. package/web/dist/assets/tooltip--PYfu68E.js +0 -1
  205. package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
  206. package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
  207. package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
  208. package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
  209. package/web/dist/assets/use-now-CrM50BFB.js +0 -1
  210. package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
  211. package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
  212. package/web/dist/assets/x-BkwTUDpG.js +0 -1
@@ -1,12 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Et as r,Ft as i,Gi as a,Hi as o,Ji as s,Nt as c,Rn as l,St as u,Ur as d,Zn as f,g as p,m,n as h,r as g,w as _,yr as v}from"./toaster-Hj_czp_o.js";import{r as y}from"./button-CjSjKnkd.js";import{A as b,D as x,N as S,f as C,m as ee,u as te}from"./editable-title-CJSWyCcL.js";import{d as ne,g as w,h as re,t as T,u as E}from"./composer-DZx3cwQW.js";import{i as ie}from"./run-header-i1D5Lvfs.js";import{t as D}from"./file-Df5WtpM_.js";import{t as O}from"./x-BkwTUDpG.js";import{i as k,n as A,r as j,t as M}from"./tooltip--PYfu68E.js";import{n as N,t as P}from"./types-BTlmexWF.js";import"./diff-LG2cl0PE.js";var F=n(),I=e(t(),1),L=`diff-comments`;function R(e){if(e===``)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.id!=`string`||typeof t.path!=`string`||t.side!==`old`&&t.side!==`new`||typeof t.line!=`number`||typeof t.body!=`string`||n.push({id:t.id,path:t.path,side:t.side,line:t.line,body:t.body,excerpt:typeof t.excerpt==`string`?t.excerpt:``,...typeof t.oldPath==`string`&&t.oldPath!==``?{oldPath:t.oldPath}:{},...z(t.start)?{start:{side:t.start.side,line:t.start.line}}:{}})}return n}function z(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.side===`old`||t.side===`new`)&&typeof t.line==`number`}function B(e){return N(e,e.start)}function V(e){let t=e=>e.side===`old`?0:1,n=e=>e.start??e;return[...e].sort((e,r)=>e.path.localeCompare(r.path)||t(n(e))-t(n(r))||n(e).line-n(r).line)}var H=`Review comments on the diff:`;function ae(e){return e.length===0?``:`${H}\n\n${V(e).map(e=>{let t=e.side===`old`?`\`${e.oldPath??e.path}\` line ${e.line} (removed line${e.oldPath?`, renamed to \`${e.path}\``:``})`:`\`${e.path}\` line ${e.line}`;return`- ${e.start?le(e):t}:\n\n${K(ue(e.excerpt))}\n\n${K(e.body)}`}).join(`
2
-
3
- `)}`}var U=/^- `([^`]+)` (.+):$/;function W(e){let t=e.indexOf(`${H}\n\n`);if(t===-1||t>0&&e[t-1]!==`
4
- `)return;let n=e.slice(0,t).trim(),r=e.slice(t+28+2).split(`
5
- `),i=[],a=0;for(;a<r.length;){let e=U.exec(r[a]??``);if(!e){if((r[a]??``).trim()===``){a++;continue}return}a++;let t=[];for(;a<r.length&&!U.test(r[a]??``);)t.push((r[a]??``).replace(/^ {2}/,``)),a++;i.push(oe(e[1],e[2],t))}return i.length>0?{lead:n,items:i}:void 0}function oe(e,t,n){let r=/renamed to `([^`]+)`/.exec(t)?.[1],i=/lines? (\d+)/.exec(t),a=t.startsWith(`removed `)||t.includes(`(removed line`)?`old`:`new`,o=n;for(;o[0]?.trim()===``;)o=o.slice(1);let s=``,c=/^(`{3,})\s*$/.exec(o[0]??``);if(c){let e=o.findIndex((e,t)=>t>0&&e.trim()===c[1]);s=o.slice(1,e===-1?void 0:e).join(`
6
- `),o=e===-1?[]:o.slice(e+1)}else{let e=[];for(;o[0]?.startsWith(`> `);)e.push(o[0].slice(2)),o=o.slice(1);s=e.join(`
7
- `)}return{path:r??e,label:t,...i?{line:Number(i[1])}:{},side:a,excerpt:s,body:o.join(`
8
- `).trim()}}function se(e,t){let n=ae(t);return n===``?e:e.trim()===``?n:`${e}\n\n${n}`}function G(e){return/^\/([A-Za-z0-9][A-Za-z0-9._-]*)(?=\s|$)/.exec(e.trimStart())?.[1]}function ce(e,t){let n=G(e);return n===void 0||(t?.includes(n)??!1)}function le(e){let t=e.side===`old`||e.start?.side===`old`,n=e.oldPath&&t?` (removed lines numbered in \`${e.oldPath}\`)`:``;return`\`${e.path}\` ${B(e)}${n}`}function ue(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(e=>e.length)),n="`".repeat(Math.max(3,t+1));return`${n}\n${q(e).split(`
9
- `).map(e=>e.trimEnd()).join(`
10
- `)}\n${n}`}function K(e){return e.split(`
11
- `).map(e=>` ${e}`).join(`
12
- `)}var de=1e3;function fe(e,t=200){let n=q(e);return n.length<=t?n:`${n.slice(0,t)}…`}function q(e){return e.replace(/^(?:[ \t]*\r?\n)+/,``).replace(/\s+$/,``)}var pe=1e5;function J(e,t){let n=se(e,t);if(n.length>1e5)throw Error(`Too long with the ${t.length===1?`diff comment`:`${t.length} diff comments`} attached — shorten the message or remove some comments.`);return n}function me(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}var Y=new WeakMap;function he(e){let t=Y.get(e);return t||(t={lists:new Map,listeners:new Map,chains:new Map,removed:new Map,base:new Map,pending:new Map},Y.set(e,t)),t}var ge=[];function _e(e){let t=s(),n=he(t),r=u(e===``?void 0:e),i=r.data?.surfaces?.[L]?.text,a=(0,I.useMemo)(()=>R(typeof i==`string`?i:``),[i]),o=(0,I.useSyncExternalStore)((0,I.useCallback)(t=>{let r=n.listeners.get(e)??new Set;return r.add(t),n.listeners.set(e,r),()=>r.delete(t)},[e,n]),()=>n.lists.get(e));(0,I.useEffect)(()=>{if(!r.isSuccess)return;let t=n.lists.get(e);if(t===void 0){n.lists.set(e,a),n.base.set(e,a),n.listeners.get(e)?.forEach(e=>e());return}if((n.pending.get(e)??0)>0)return;let i=Z(t,a,n.base.get(e)??[],n.removed.get(e));n.base.set(e,a),i!==t&&(n.lists.set(e,i),n.listeners.get(e)?.forEach(e=>e()))},[r.isSuccess,e,a,n]),(0,I.useEffect)(()=>{if(e===``)return;let n=()=>{document.visibilityState===`visible`&&t.invalidateQueries({queryKey:m.runs.drafts(e)})};return window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,n),()=>{window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,n)}},[t,e]);let c=o??(r.isSuccess?a:ge),l=(0,I.useCallback)(()=>n.lists.get(e)??a,[e,a,n]),f=(0,I.useCallback)(r=>{n.lists.set(e,r),n.listeners.get(e)?.forEach(e=>e());let i=X(r);t.setQueryData(m.runs.drafts(e),e=>{let t={...e?.surfaces??{}};return i===``?delete t[L]:t[L]={text:i,images:[],updatedAt:new Date().toISOString()},{surfaces:t}})},[t,e,n]),p=(0,I.useCallback)((t,r=[])=>{if(X(t).length>1e5)return h(`Too many comments to keep as a draft — send the ones you have first.`,{tone:`danger`}),!1;if(r.length>0){let t=n.removed.get(e)??new Set;for(let e of r)t.add(e);n.removed.set(e,t)}f(t),n.pending.set(e,(n.pending.get(e)??0)+1);let i=(n.chains.get(e)??Promise.resolve()).catch(()=>{}).then(async()=>{let r=n.lists.get(e)??t,i=r;try{let t=(await v(e)).surfaces?.[L]?.text;i=Z(r,R(typeof t==`string`?t:``),n.base.get(e)??[],n.removed.get(e))}catch{}i!==r&&f(i);let a=X(i);a.length>1e5||(await d(e,L,{text:a,images:[]}),n.base.set(e,i))}).catch(()=>{}).finally(()=>{n.pending.set(e,Math.max(0,(n.pending.get(e)??1)-1))});return n.chains.set(e,i),!0},[f,e,n]),g=(0,I.useCallback)(e=>p([...l(),{...e,body:e.body.slice(0,P),excerpt:fe(e.excerpt,e.start?de:200),id:me()}]),[l,p]),_=(0,I.useCallback)((e,t)=>p(l().map(n=>n.id===e?{...n,body:t.slice(0,P)}:n)),[l,p]),y=(0,I.useCallback)(e=>void p(l().filter(t=>t.id!==e),[e]),[l,p]),b=(0,I.useCallback)(()=>void p([],l().map(e=>e.id)),[l,p]),x=(0,I.useCallback)(async e=>{let t=l(),n=await e(t);if(t.length>0){let e=new Map(t.map(e=>[e.id,e.body])),n=l();p(n.filter(t=>e.get(t.id)!==t.body),n.filter(t=>e.get(t.id)===t.body).map(e=>e.id))}return n},[l,p]);return{ready:o!==void 0||r.isSuccess,comments:c,add:g,update:_,remove:y,clear:b,submit:x}}function X(e){return e.length===0?``:JSON.stringify(e)}function Z(e,t,n,r){let i=new Map(n.map(e=>[e.id,e])),a=new Map(t.map(e=>[e.id,e])),o=[];for(let t of e){let e=i.get(t.id),n=a.get(t.id);if(e&&!n)continue;let r=!e||e.body!==t.body;o.push(n&&!r?n:t)}let s=new Set(e.map(e=>e.id));for(let e of t)!s.has(e.id)&&!r?.has(e.id)&&o.push(e);return o.length===e.length&&o.every((t,n)=>t===e[n]||JSON.stringify(t)===JSON.stringify(e[n]))?e:o}function ve(e){let t=s(),n=b(e).continueRun,i=_(),[o,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null),[d,p]=(0,I.useState)(null),h=ie(e,o),{runners:g,canContinue:v,currentRunner:y,runner:x}=h,S=r(x,n),T=i.data?.modelsLocked===!0,D=x!==y,O=!T&&!D&&e.model?{...i.data?.defaultModels,[x]:e.model}:i.data?.defaultModels,k=T?null:l,A=C(x,S.data,[k,O?.[x]]),j=ee(k,x,O,S.data),{accounts:M,repoAccount:N}=w(),P=[...e.steps].reverse().find(e=>e.profileId)?.profileId??e.agentProfile??`default`,L=D?N:{...N,[y]:P},R=M.some(e=>e.provider===x&&e.id===d)?d:null,z=a({mutationFn:({text:t,images:n})=>v?f(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:h.runnerOverride,model:!T&&l!==null?j:void 0,agentProfile:R??void 0}):Promise.reject(Error(h.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:m.runs.all})});return{available:n,canContinue:v,reason:h.reason,providerPending:h.providerPending,pills:(0,F.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[g.length>1||g.some(e=>re(M,e))?(0,F.jsx)(ne,{runners:g,value:x,accounts:M,account:R,repoAccount:L,onPick:(e,t)=>{p(t),e!==x&&(c(e),u(null))}}):null,(0,F.jsx)(E,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:A.find(e=>e.id===j)?.label??`auto`,value:j,readOnly:T,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>u(e),options:A.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:te(x,S.data,S.isError)})]}),continueWith:(e,t)=>z.mutateAsync({text:e,images:t})}}function ye({items:e}){let{id:t}=o();return(0,F.jsxs)(`div`,{"data-slot":`review-comments`,className:`mt-1 flex flex-col gap-2 text-left`,children:[(0,F.jsxs)(`p`,{className:`text-[12px] font-medium text-muted-foreground`,children:[e.length,` `,e.length===1?`comment`:`comments`,` on the diff`]}),e.map((e,n)=>(0,F.jsxs)(`div`,{"data-slot":`review-comment`,className:`overflow-hidden rounded-lg border border-border bg-background/60`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 border-b border-border/60 px-2.5 py-1.5 text-[12px]`,children:[(0,F.jsx)(D,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),t?(0,F.jsx)(g,{to:Q(t,e),className:`min-w-0 truncate font-mono font-medium text-foreground underline-offset-2 hover:underline`,title:`Open ${e.path} on the Changes tab`,children:e.path}):(0,F.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:e.path}),(0,F.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`· `,e.label]})]}),e.excerpt===``?null:(0,F.jsx)(`pre`,{"data-slot":`review-comment-code`,className:`max-h-48 overflow-auto border-b border-border/60 bg-muted/40 px-2.5 py-1.5 font-mono text-[12px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.excerpt}),(0,F.jsx)(`p`,{"data-slot":`review-comment-body`,className:`px-2.5 py-2 break-words whitespace-pre-wrap text-foreground`,children:e.body})]},n))]})}function Q(e,t){let n=new URLSearchParams({file:t.path,side:t.side});return t.line!==void 0&&n.set(`line`,String(t.line)),t.commentId!==void 0&&n.set(`comment`,t.commentId),`/tasks/${e}/changes?${n.toString()}`}function be(e){let t=e.get(`file`);if(!t)return;let n=Number(e.get(`line`)),r=e.get(`comment`);return{path:t,side:e.get(`side`)===`old`?`old`:`new`,...Number.isInteger(n)&&n>0?{line:n}:{},...r?{commentId:r}:{}}}function $(e){return e===`running`||e===`waiting`||e===`queued`?`live`:`continue`}function xe(e,t){let n=s(),{mutateAsync:r}=c(e.id),{continueWith:i}=t;return(0,I.useCallback)(async(t,a)=>{let o=e=>e===`live`?r({text:t,images:a}):i(t,a),s=$(e.status);try{return await o(s)}catch(r){if(!(r instanceof l)||r.status!==409)throw r;let i;try{i=await n.fetchQuery({...p(e.id),staleTime:0})}catch{throw r}let c=$(i.status);if(c===s||c===`live`&&t.trim()===``&&a.length===0||c===`continue`&&x(i)===void 0)throw r;return await o(c)}},[i,n,e.id,e.status,r])}function Se({runId:e,comments:t,onRemove:n,onOpen:r}){return t.length===0?null:(0,F.jsx)(j,{delayDuration:300,children:V(t).map(t=>{let i=t.path.split(`/`).at(-1)??t.path,a=e=>e===`old`?`−`:`+`,o=`${i} ${t.start&&(t.start.side!==t.side||t.start.line!==t.line)?t.start.side===t.side?`${a(t.side)}${t.start.line}–${t.line}`:`${a(t.start.side)}${t.start.line}–${a(t.side)}${t.line}`:`${a(t.side)}${t.line}`}`,s=B(t);return(0,F.jsxs)(M,{children:[(0,F.jsx)(k,{asChild:!0,children:(0,F.jsxs)(`span`,{"data-slot":`diff-comment-chip`,className:`flex h-8 max-w-[260px] items-center overflow-hidden rounded-md border border-border bg-muted/40 text-xs text-foreground`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-full items-center border-r border-border px-2 text-muted-foreground`,children:(0,F.jsx)(D,{className:`size-3.5`})}),r?(0,F.jsx)(`button`,{type:`button`,onClick:()=>r(t),className:`min-w-0 truncate px-2 font-medium hover:underline`,"aria-label":`Show comment on ${t.path} ${s}`,children:o}):(0,F.jsx)(g,{to:Q(e,{path:t.path,side:t.side,line:t.line,commentId:t.id}),className:`min-w-0 truncate px-2 font-medium hover:underline`,"aria-label":`Comment on ${t.path} ${s}`,children:o}),(0,F.jsx)(`button`,{type:`button`,"aria-label":`Remove comment on ${i} ${s}`,onClick:()=>n(t.id),className:`flex h-full items-center px-1.5 text-soft-foreground hover:bg-muted hover:text-foreground`,children:(0,F.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`})})]})}),(0,F.jsx)(A,{side:`top`,sideOffset:6,className:`max-w-[320px] text-left`,children:(0,F.jsxs)(`div`,{"data-slot":`diff-comment-tooltip`,className:`flex flex-col gap-1`,children:[(0,F.jsxs)(`span`,{className:`font-mono text-[11px] text-contrast-foreground/80`,children:[t.path,` · `,s]}),(0,F.jsx)(`span`,{className:`line-clamp-6 break-words whitespace-pre-wrap`,children:t.body})]})})]},t.id)})})}function Ce({run:e,draft:t,diffComments:n,continueAction:r,getMentionCandidates:a,onSendingChange:o,onOpenComment:s}){let c=e.status===`running`||e.status===`waiting`,l=e.status===`queued`,u=!c&&!l&&r.available,d=u&&r.canContinue,f=xe(e,r),p=n.comments.length>0,m=i(p),_=(0,I.useMemo)(()=>Array.isArray(m.data)?m.data.map(e=>e.name):void 0,[m.data]),v=S(e),y=c&&!v.usable,b=u&&!r.canContinue,x=y||b,C=y?v.reason:r.reason;return(0,F.jsx)(T,{value:t.text,onValueChange:t.setText,images:t.images,onImagesChange:t.setImages,onSubmit:async(e,r,i)=>{if(i?.quickReply)return f(e,r);o?.(!0);try{return await t.submit(()=>p&&!ce(e,_)?(h(`Diff comments kept — /${G(e)} is a command, so they go with your next message.`),f(e,r)):n.submit(async t=>f(J(e,t),r)))}finally{o?.(!1)}},draftItems:p?(0,F.jsx)(Se,{runId:e.id,comments:n.comments,onRemove:n.remove,onOpen:s}):void 0,disabled:x||!c&&!l&&!d,disabledReason:x?C:`Session closed — no session to resume.`,footerEnd:x&&!r.providerPending?(0,F.jsx)(g,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):d?r.pills:void 0,allowEmptySubmit:d||p,sendAriaLabel:d?`Continue`:`Send`,placeholder:l?`Add to the prompt — sent when the run starts…`:d?`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…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:a})}function we({children:e,overlay:t,floating:n=!1,className:r,style:i,ref:a}){return(0,F.jsxs)(`div`,{ref:a,"data-slot":`thread-dock`,"data-floating":n||void 0,style:i,className:y(`sticky bottom-[var(--kb,0px)] z-10 bg-background px-3 pt-1 pb-2 max-md:border-t max-md:border-border md:px-6 md:pt-1.5 md:pb-4`,n&&`pointer-events-none bg-transparent max-md:border-t-0 [&_[data-slot=composer]]:shadow-lg`,r),children:[t,(0,F.jsx)(`div`,{className:y(`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-1.5 md:gap-2.5`,n&&`pointer-events-auto`),children:e})]})}export{ve as a,W as c,be as i,_e as l,we as n,pe as o,ye as r,J as s,Ce as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,Hi as i,Rn as a,_t as o}from"./toaster-Hj_czp_o.js";import{r as s}from"./button-CjSjKnkd.js";import{t as c}from"./chevron-right-DKiL3NWw.js";import{t as l}from"./run-header-i1D5Lvfs.js";import{h as u}from"./dropdown-menu-DkEK7m00.js";import{a as d,i as f,n as p,r as m,t as h}from"./file-preview-kYsqZiLU.js";import{t as g}from"./file-Df5WtpM_.js";import{t as _}from"./triangle-alert-DpH3QFz6.js";import{t as v}from"./centered-state-T0J7VmBb.js";import{U as y,i as b,r as x}from"./index-CiQrbvAq.js";var S=e(t(),1),C=n();function w({runId:e,selected:t,onSelect:n}){return(0,C.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,C.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,C.jsx)(T,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function T({runId:e,path:t,depth:n,selected:i,onSelect:a}){let o=r(e,t);return o.isPending?(0,C.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Loading…`}):o.isError?(0,C.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${24+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,C.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Empty directory`}):(0,C.jsx)(C.Fragment,{children:o.data.entries.map(r=>r.type===`dir`?(0,C.jsx)(E,{runId:e,name:r.name,path:t===``?r.name:`${t}/${r.name}`,depth:n,selected:i,onSelect:a},r.name):(0,C.jsx)(D,{name:r.name,path:t===``?r.name:`${t}/${r.name}`,size:r.size,depth:n,selected:i,onSelect:a},r.name))}):null}function E({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,l]=(0,S.useState)(!1);return(0,C.jsxs)(`li`,{children:[(0,C.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,onClick:()=>l(e=>!e),className:`flex 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,C.jsx)(c,{"aria-hidden":`true`,className:s(`size-3.5 shrink-0 transition-transform`,o&&`rotate-90`)}),(0,C.jsx)(u,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,C.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),o?(0,C.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,C.jsx)(T,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function D({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,c=m(t)?f:g;return(0,C.jsx)(`li`,{children:(0,C.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:s(`flex 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:`${24+r*14}px`},children:[(0,C.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,C.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:p(n)})]})})}function O(){let{id:e}=i(),t=o(e);return t.isPending?(0,C.jsx)(b,{tab:`files`}):t.isError?(0,C.jsx)(x,{tab:`files`,error:t.error}):(0,C.jsx)(k,{run:t.data},t.data.id)}function k({run:e}){let t=r(e.id,``),[n,i]=(0,S.useState)(null),o=y(),s=t.isError&&t.error instanceof a&&t.error.status===409;return(0,C.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col md:h-full`,children:[(0,C.jsx)(l,{run:e,tab:`files`}),t.isPending?(0,C.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`}):t.isError?(0,C.jsx)(v,{icon:s?(0,C.jsx)(d,{}):(0,C.jsx)(_,{}),tone:s?`neutral`:`danger`,heading:`h2`,title:s?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,C.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 px-4 py-4 md:flex-row md:px-6 md:py-0`,children:[(0,C.jsx)(`aside`,{"data-slot":`files-tree-pane`,className:`w-full shrink-0 md:w-60 md:overflow-y-auto md:overscroll-contain md:py-4 lg:w-72`,children:(0,C.jsx)(w,{runId:e.id,selected:n,onSelect:i})}),(0,C.jsx)(`div`,{"data-slot":`file-preview-pane`,...o?{role:`region`,"aria-label":`File preview`,tabIndex:0}:{},className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,C.jsx)(`div`,{className:`md:py-4`,children:(0,C.jsx)(h,{source:{kind:`run`,runId:e.id},path:n,className:`min-w-0`})})})]})]})}export{O as TaskFilesRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Hi as r,_t as i,r as a}from"./toaster-Hj_czp_o.js";import{t as o}from"./run-header-i1D5Lvfs.js";import{t as s}from"./external-link-DPKRidDg.js";import{t as c}from"./centered-state-T0J7VmBb.js";import{M as l,i as u,r as d}from"./index-CiQrbvAq.js";import{FloatingPanel as f,a as p,c as m,d as h,f as g,g as _,h as v,i as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,t as D,u as O}from"./workflow-graph-Y2Pr7ubb.js";var k=e(t(),1),A=n();function j({data:e}){let{node:t,state:n,childRunId:r}=e;return r?(0,A.jsx)(M,{node:t,state:n,childRunId:r}):(0,A.jsx)(D,{node:t,connectable:!1,status:n.status,loopCount:n.loopCount,iterations:n.iterations,costUsd:n.costUsd})}function M({node:e,state:t,childRunId:n}){let r=i(n).data,a=r&&r.steps.length>1?r.steps.map(e=>({id:e.id,name:e.name??e.id,status:e.status})):void 0;return(0,A.jsx)(D,{node:e,connectable:!1,status:t.status,costUsd:r?.costUsd??t.costUsd,inner:a,subtaskTo:`/tasks/${n}/graph`})}var N={live:j};function P(){let{id:e}=r(),t=i(e);return t.isPending?(0,A.jsx)(u,{tab:`changes`}):t.isError?(0,A.jsx)(d,{tab:`changes`,error:t.error}):(0,A.jsx)(x,{children:(0,A.jsx)(F,{run:t.data})})}function F({run:e}){let t=e.workflowDef,n=(0,k.useMemo)(()=>t?p(t):null,[t]),r=(0,k.useMemo)(()=>n?b(n,e):null,[n,e]),[i,a]=(0,k.useState)(null),s=n?.nodes.find(e=>e.id===i),u=(0,k.useMemo)(()=>n&&r?n.nodes.map(t=>({id:t.id,type:`live`,position:n.layout?.[t.id]??{x:0,y:0},draggable:!1,connectable:!1,data:{node:t,state:r.nodes.get(t.id)??{status:`pending`},...I(e,t.id)}})):[],[n,r]),d=(0,k.useMemo)(()=>n?C(n):new Set,[n]),x=(0,k.useMemo)(()=>n?S(n,d):new Map,[n,d]),D=(0,k.useMemo)(()=>!n||!r?[]:n.nodes.flatMap(e=>m(e).flatMap(t=>{let i=O(n,e.id,t);if(!i)return[];let a=`${e.id}.${t}->${i}`,o=r.edges.get(a)??0,s=d.has(`${e.id}.${t}->${i}`),c=(n.layout?.[i]?.x??0)<=(n.layout?.[e.id]?.x??0),l=T({tone:E(e,t),back:s,emphasis:o?`taken`:`dim`});return[{id:a,source:e.id,sourceHandle:t,target:i,type:s||c||x.has(a)?`lane`:`default`,...x.has(a)?{data:{lane:x.get(a)}}:{},label:o>1?`×${o}`:void 0,style:l,markerEnd:{type:_.ArrowClosed,color:l.stroke,width:14,height:14},labelStyle:{fill:`var(--muted-foreground)`,fontSize:10,fontWeight:600},labelBgStyle:{fill:`var(--background)`}}]})),[n,r,d,x]);return(0,A.jsxs)(`div`,{"data-route":`task-graph`,className:`flex h-full min-h-0 flex-col`,children:[(0,A.jsx)(o,{run:e,tab:`graph`}),n?(0,A.jsxs)(`div`,{className:`relative min-h-[420px] flex-1`,children:[(0,A.jsxs)(v,{nodes:u,edges:D,nodeTypes:N,edgeTypes:y,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,onNodeClick:(e,t)=>a(t.id),onPaneClick:()=>a(null),fitView:!0,fitViewOptions:{padding:.2,maxZoom:1.2},minZoom:.2,colorMode:`system`,proOptions:{hideAttribution:!0},children:[(0,A.jsx)(h,{variant:g.Dots,gap:18,size:1}),(0,A.jsx)(w,{showInteractive:!1})]}),s&&r?(0,A.jsx)(f,{side:`right`,label:`Node details`,title:s.name??s.id,onClose:()=>a(null),children:(0,A.jsx)(L,{state:r.nodes.get(s.id)??{status:`pending`},outputs:e.graphState?.outputs?.[s.id],childRunId:I(e,s.id).childRunId,loopMax:s.type===`loop`?s.max:void 0})}):null]}):(0,A.jsx)(c,{icon:(0,A.jsx)(l,{}),tone:`neutral`,title:`No workflow graph`,subtitle:`This task has no stored workflow definition to draw.`})]})}function I(e,t){let n=e.graphState?.outputs?.[t]?.runId;return typeof n==`string`&&n?{childRunId:n}:{}}function L({state:e,outputs:t,loopMax:n,childRunId:r}){let i=[[`status`,e.status===`reached`?`passed through`:e.status]];e.iterations&&i.push([`runs`,String(e.iterations)]),e.costUsd&&i.push([`cost`,`$${e.costUsd.toFixed(2)}`]),e.loopCount!==void 0&&i.push([`iterations`,`${e.loopCount}${n?` / ${n}`:``}`]);let o=Object.entries(t??{}).filter(([,e])=>e!==``);return(0,A.jsxs)(`div`,{className:`space-y-4 p-4 text-[12px]`,children:[(0,A.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:i.map(([e,t])=>(0,A.jsxs)(`div`,{className:`contents`,children:[(0,A.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{children:t})]},e))}),r?(0,A.jsxs)(a,{to:`/tasks/${r}`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[`Open the subtask `,(0,A.jsx)(s,{className:`size-3`})]}):null,(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`mb-1 text-[11px] text-muted-foreground uppercase`,children:`Outputs`}),o.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Nothing yet — outputs appear once the node has run.`}):o.map(([e,t])=>(0,A.jsxs)(`div`,{className:`mb-2`,children:[(0,A.jsx)(`code`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,A.jsx)(`pre`,{className:`mt-0.5 max-h-48 overflow-auto rounded-md bg-muted/40 p-2 text-[11px] whitespace-pre-wrap`,children:String(t)})]},e))]})]})}export{P as TaskGraphRoute};
@@ -1,9 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Bi as r,Dt as i,Gi as a,H as o,Hi as s,J as c,Ji as l,K as u,Ki as d,Ni as f,O as p,Rn as m,Sr as h,Un as g,Wi as _,Zn as v,_t as y,jn as b,k as x,kn as S,m as C,mn as w,n as T,pn as E,r as D,tr as O,ut as k,xr as A}from"./toaster-Hj_czp_o.js";import{B as j,F as M,i as N,r as P,t as F,xt as I}from"./button-CjSjKnkd.js";import{a as L,c as R,i as z,l as ee,o as te,r as ne,t as re,u as B}from"./sheet-DCdZVHFk.js";import{C as ie,I as ae,O as V,T as oe,V as se,z as ce}from"./editable-title-CJSWyCcL.js";import{d as le,m as ue,s as de}from"./reference-chip-Bx_mG9QG.js";import{M as fe}from"./composer-DZx3cwQW.js";import{r as pe,t as me}from"./trash-2-EdjdGvEo.js";import{t as he}from"./check-DAAMuI4o.js";import{t as H}from"./chevron-right-DKiL3NWw.js";import{n as ge}from"./git-merge-B7oVXcKc.js";import{i as _e,n as ve,r as ye,t as be}from"./run-header-i1D5Lvfs.js";import{m as xe}from"./dropdown-menu-DkEK7m00.js";import{n as Se,t as Ce}from"./file-text-m0tZu8sU.js";import{t as we}from"./external-link-DPKRidDg.js";import{t as Te}from"./eye-CEHQ0c-s.js";import{n as Ee}from"./triangle-alert-DpH3QFz6.js";import{n as De,r as Oe,t as ke}from"./centered-state-T0J7VmBb.js";import{t as Ae}from"./search-x-bpAfQtVY.js";import{_ as je}from"./use-now-CrM50BFB.js";import{n as Me,r as Ne,t as Pe}from"./collapsible-RD4hkew7.js";import{i as U}from"./token-metrics-C149OWmd.js";import{t as Fe}from"./textarea-Bb0_Hz53.js";import{t as Ie}from"./use-submit-shortcut-BJ10ZshV.js";import{t as W}from"./markdown-Bmfy_1Ll.js";import{t as Le}from"./thread-loading-Bo6IOu3Y.js";import{t as Re}from"./lib-BQXq3kEf.js";import{r as ze}from"./image-preview-4SVDrBvn.js";import{t as Be}from"./run-diff-GZbNs8fA.js";import{a as Ve,c as He,l as Ue,n as We,r as Ge,s as Ke,t as qe}from"./task-composer-Brx0sa7_.js";var Je=120;function Ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xe(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Je?`${t.slice(0,Je-1)}…`:t}function G(e,...t){if(Ye(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return Xe(t)}}function Ze(e){if(!Ye(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return Xe(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return Xe(e.join(` `))}}function Qe(e){if(!Ye(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)Ye(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function $e(e){return G(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function K(e,t){return t?`${e} ${t}`:e}function et(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:K(`Ran`,Ze(t)),subtitle:G(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:K(`Write`,G(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Qe(t);return{toolKind:`edit`,title:K(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:K(`Read`,G(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:K(`View image`,G(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:K(`Search`,G(t,`pattern`,`query`)),subtitle:G(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:K(`Fetch`,G(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:K(`Web search`,G(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=G(t,`subagent_type`,`subagentType`),i=G(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=G(t,`skill`,`name`,`command`);return{toolKind:`skill`,title:e?`Skill: ${e}`:`Skill`,subtitle:G(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=G(t,`server`),n=G(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:$e(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?Xe(e):`Tool`,subtitle:$e(t)}}var tt=M(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),nt=M(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),rt=M(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),it=M(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),at=M(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),ot=M(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),st=M(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),ct=M(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),q=e(t(),1);function lt(e,t,n){let[r,i]=(0,q.useState)({key:n,value:e}),a=(0,q.useRef)(e);a.current=e;let o=(0,q.useRef)(n);o.current=n;let s=(0,q.useRef)(0),c=(0,q.useRef)(void 0),l=(0,q.useRef)(!1),u=!Object.is(r.value,e);return r.key===n?u&&c.current===void 0&&Date.now()-s.current>=t&&i({key:n,value:e}):i({key:n,value:e}),(0,q.useEffect)(()=>{if(!l.current){l.current=!0;return}clearTimeout(c.current),c.current=void 0,s.current=Date.now()},[r]),(0,q.useEffect)(()=>{if(Object.is(r.value,e)||c.current!==void 0)return;let n=Math.max(0,s.current+t-Date.now());c.current=setTimeout(()=>{c.current=void 0,s.current=Date.now(),i({key:o.current,value:a.current})},n)},[r,e,t]),(0,q.useEffect)(()=>()=>clearTimeout(c.current),[]),r.value}var ut=5,dt=120,ft=200,pt=5e3,mt=15e3,ht=[];function gt(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function _t(e){let t=-1/0;for(let n of e){if(n.seq<=t)return!1;t=n.seq}return!0}function J(e){for(let t=e.length-1;t>=0;--t)if(e[t].newerCursor===void 0)return e[t]}function vt(...e){if(!e.every(_t))return gt(...e);let t=e.map(()=>0),n=[];for(;;){let r=1/0;for(let n=0;n<e.length;n+=1){let i=e[n][t[n]];i!==void 0&&i.seq<r&&(r=i.seq)}if(r===1/0)return n;let i;for(let n=0;n<e.length;n+=1){let a=e[n][t[n]];a?.seq===r&&(i=a,t[n]=t[n]+1)}i!==void 0&&n.push(i)}}function yt(e,t,n=-1/0){let r=new Set(t.map(({seq:e})=>e)),i=new Map;for(let e of t){if(e.type!==`item.updated`&&e.type!==`item.completed`)continue;let t=R(e);t!==void 0&&i.set(t,Math.max(i.get(t)??-1/0,e.seq))}return e.filter(e=>{if(r.has(e.seq)||e.seq<=n&&e.type!==`item.delta`&&e.type!==`item.updated`)return!0;if(e.type!==`item.delta`&&e.type!==`item.updated`)return!1;let t=i.get(R(e)??``);return t!==void 0&&t>e.seq}).map(({seq:e})=>e)}function bt(e,t){if(t.length===0)return e.slice();let n=e.at(-1)?.seq??-1/0,r=-1/0;for(let n of t){if(n.seq<=r)return gt(e,t);r=n.seq}return e.length===0||t[0].seq>n?[...e,...t]:vt(e,t)}function xt(e){let t=j(),n=l(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=[`run-history-tail`,t,e],o=_({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>A(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:ut,retry:1}),s=d({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>h(e,{signal:t}),retry:1}),c=o.isError&&o.data===void 0&&!o.isFetchPreviousPageError&&!o.isFetchNextPageError&&!o.isRefetchError,u=s.isError&&s.data===void 0&&!s.isRefetchError,f=o.data?.pages??[],p=(0,q.useRef)(void 0),m=`${t}\0${e??``}`,g=(0,q.useRef)({key:m,fallbackLatched:!1}),v=(0,q.useRef)(Promise.resolve()),y=(0,q.useRef)(0);g.current.key!==m&&(g.current={key:m,fallbackLatched:!1},v.current=Promise.resolve(),y.current+=1,p.current=void 0),(c||u)&&(g.current.fallbackLatched=!0);let b=g.current.fallbackLatched,x=(0,q.useCallback)(e=>{let t=v.current,n;return v.current=new Promise(e=>{n=e}),t.then(e).finally(n)},[]),S=J(f),C=f.length>0?n.getQueryData(a):void 0;S&&(!p.current||S.asOfSeq>=p.current.asOfSeq)?p.current=S:C&&(!p.current||C.asOfSeq>=p.current.asOfSeq)&&(p.current=C);let w=p.current??S??C??(f.length>0?f.at(-1):void 0),T=(0,q.useRef)(void 0),E=(0,q.useCallback)(async t=>{if(e===void 0||T.current===m)return!1;T.current=m;let i=y.current,o=new AbortController,s;try{let c=await Promise.race([A(e,void 0,{signal:o.signal}),new Promise((e,t)=>{s=setTimeout(()=>{o.abort(),t(Error(`history compaction timed out`))},mt)})]);if(g.current.key!==m||y.current!==i)return!1;let l=n.getQueryData(r),u=J(l?.pages??[]),d=n.getQueryData(a);if(Math.max(u?.asOfSeq??-1/0,d?.asOfSeq??-1/0,p.current?.asOfSeq??-1/0)>=c.asOfSeq)return!1;let f=l?(()=>{let e=[...l.pages],t=[...l.pageParams],n=u?e.indexOf(u):-1;for(n>=0?(e[n]=c,t[n]=void 0):(e.push(c),t.push(void 0));e.length>ut;)e.shift(),t.shift();return{pages:e,pageParams:t}})():{pages:[c],pageParams:[void 0]};return n.setQueryData(r,f),n.setQueryData(a,c),p.current=c,yt(t,f.pages.flatMap(e=>e.events),c.asOfSeq)}catch{return!1}finally{clearTimeout(s),o.abort(),T.current===m&&(T.current=void 0)}},[r,m,n,e,a]),D=B(w&&!b?e:void 0,w?{cursor:w.liveCursor,afterSeq:w.asOfSeq,compactWhenOver:pt,compactAt:ft,onCompact:E}:{}),O=B(b?e:void 0),k=lt(D,dt,e),M=lt(O,dt,e),N=(0,q.useRef)({runId:void 0,scope:t,events:[]});(N.current.runId!==e||N.current.scope!==t)&&(N.current={runId:e,scope:t,events:[]}),b||(N.current.events=k);let P=b?N.current.events:ht,F=(0,q.useMemo)(()=>{let e=f.map(e=>e.events);return w!==void 0&&!f.includes(w)&&e.push(w.events),gt(...e)},[w,f]);(0,q.useEffect)(()=>{let e=J(f);e&&n.setQueryData(a,e)},[f,n,e,t]);let I=(0,q.useMemo)(()=>b?vt(F,P,M):bt(F,k),[b,M,P,k,F]),L=(0,q.useMemo)(()=>{if(b)return I;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return vt(e,I.filter(({seq:e})=>e>t),k.filter(({seq:e})=>e<=t))},[s.data,b,k,I]),R=(0,q.useCallback)(async()=>{let e=m,t=y.current,i=J(n.getQueryData(r)?.pages??[]);i&&n.setQueryData(a,i);try{await x(()=>o.fetchPreviousPage())}finally{if(g.current.key!==e||y.current!==t)return;let i=p.current;if(!i)return;n.setQueryData(r,e=>{if(!e)return e;let t=J(e.pages),n=t?e.pages.indexOf(t):-1;if(n<0||e.pages[n].asOfSeq>=i.asOfSeq)return e;let r=[...e.pages];return r[n]=i,{...e,pages:r}})}},[x,o.fetchPreviousPage,r,n,a]),z=(0,q.useCallback)(async()=>{y.current+=1,v.current=Promise.resolve();let e=e=>p.current??J(e)??n.getQueryData(a),t=n.getQueryData(r);if(!e(t?.pages??[])){p.current=void 0,n.removeQueries({queryKey:a,exact:!0}),n.resetQueries({queryKey:r,exact:!0});return}if(t?.pages.length===1&&t.pages[0]===e(t.pages)&&!o.isFetchingPreviousPage)return;await n.cancelQueries({queryKey:r,exact:!0});let i=e(n.getQueryData(r)?.pages??[]);i&&(n.setQueryData(r,{pages:[i],pageParams:[void 0]}),n.setQueryData(a,i),p.current=i)},[o.isFetchingPreviousPage,r,n,a]);return{visibleEvents:I,currentEvents:L,isPending:!b&&o.isPending,contextPending:!b&&s.isPending,fallback:b,hasOlder:!b&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:R,jumpToLatest:z,retainedPages:f.length}}var Y=n();function St({run:e}){let t=l(),n=a({mutationFn:()=>g(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:C.runs.detail(e.id)}),t.invalidateQueries({queryKey:C.runs.list()}),T(`This task will not resume itself`)},onError:e=>T(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)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,Y.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,Y.jsx)(U,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Y.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Y.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,Y.jsx)(f,{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 Ct({run:e}){let t=e.status===`done`||e.status===`review`||e.status===`failed`||e.status===`cancelled`;return e.workflow!==`e2e-setup`||!t?null:(0,Y.jsx)(wt,{run:e})}function wt({run:e}){let t=!!p().data?.configFile,n=e.status===`done`||e.status===`review`,r=e.steps.find(e=>e.status===`failed`&&e.id!==`pr`),i=e.pullRequestUrl&&/^https?:\/\//.test(e.pullRequestUrl)?e.pullRequestUrl:void 0,a=(0,Y.jsx)(D,{className:`font-medium underline underline-offset-2`,to:`/settings/integrations`,children:`Settings → External integrations`});return(0,Y.jsxs)(`div`,{"data-slot":`e2e-setup-verdict`,"data-verdict":n?`works`:`not-working`,role:`status`,className:P(`mt-4 flex gap-3 rounded-lg border p-4 text-sm`,n?`border-success/40 bg-success/5`:`border-danger/40 bg-danger/5`),children:[n?(0,Y.jsx)(ge,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":!0}):(0,Y.jsx)(le,{className:`mt-0.5 size-5 shrink-0 text-danger`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`font-semibold`,children:n?`e2e works`:e.status===`cancelled`?`e2e is not set up — the setup was cancelled`:`e2e is not working yet`}),n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`The config loads and the smoke test passed in a real browser.`}),(0,Y.jsx)(`p`,{className:`mt-1`,children:t?(0,Y.jsxs)(Y.Fragment,{children:[`It is live in this project: pick the `,(0,Y.jsx)(`code`,{children:`implement-and-e2e`}),` workflow for your next task.`]}):i?(0,Y.jsxs)(Y.Fragment,{children:[`One step left: merge the `,(0,Y.jsx)(`a`,{className:`font-medium underline underline-offset-2`,href:i,target:`_blank`,rel:`noreferrer`,children:`draft PR`}),`. Then pick the `,(0,Y.jsx)(`code`,{children:`implement-and-e2e`}),` workflow for your next task.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`One step left: merge branch `,(0,Y.jsx)(`code`,{children:e.branch??`of this task`}),` (or open a draft PR from the header). Then pick the `,(0,Y.jsx)(`code`,{children:`implement-and-e2e`}),` workflow for your next task.`]})})]}):e.status===`cancelled`?(0,Y.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`Start it again from `,a,`.`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:r?(0,Y.jsxs)(Y.Fragment,{children:[`“`,r.name,`” did not pass — its output is above.`]}):`The setup stopped before it could prove e2e works — the reason is above.`}),(0,Y.jsxs)(`p`,{className:`mt-1`,children:[`Continue this task to fix it, or set it up again from `,a,`.`]})]})]})]})}var Tt=e=>e.kind===`tool`,Et=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Dt=(e,t,n)=>`${e} ${e===1?t:n}`;function Ot(e,t){let n=[];return e>0&&n.push(Dt(e,`file`,`files`)),t>0&&n.push(Dt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function kt(e){return`${e} earlier tool call${e===1?``:`s`}`}var At=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`,`Skill:`];function jt(e){for(let t of At)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t.endsWith(`:`)?t.slice(0,-1):t,detail:e.slice(t.length+1)};return{verb:e}}function Mt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(Tt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Ot(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)Tt(e)&&Et(e)&&!r.has(e.id)?o.push(e):(s(),Tt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Nt=new Map,Pt=(0,q.createContext)(null);function Ft(){return(0,q.useContext)(Pt)}function It({runId:e,children:t}){let n=(0,q.useMemo)(()=>({get:t=>Nt.get(e)?.get(t),set:(t,n)=>{let r=Nt.get(e)??new Map;r.set(t,n),Nt.set(e,r)}}),[e]);return(0,Y.jsx)(Pt.Provider,{value:n,children:t})}function Lt(e){let t=`flex w-full flex-col pb-2.5`;return e?`${t} [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`:t}function Rt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function zt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Bt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Vt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Ht(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Ut=new Map;function Wt(e,t){Ut.set(e,t)}function Gt(e){return Ut.get(e)}var Kt=new Map;function qt(e,t){Kt.set(e,t)}function Jt(e,t){let n=Kt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}var Yt=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Xt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Zt=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Qt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),$t=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function X(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function en(e){let t=X(e);return t===void 0?void 0:Yt.format(t)}function tn(e){let t=X(e);return t===void 0?void 0:Xt.format(t)}var nn=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function rn(e){let t=X(e);return t===void 0?void 0:nn(t)}function an(e,t=new Date){let n=X(e);if(n===void 0)return;let r=nn(n);return r===nn(t)?`Today`:r===nn(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Zt:Qt).format(n)}function on(e,t){let n=X(e),r=X(t);if(!(n===void 0||r===void 0))return cn(Math.round((r.getTime()-n.getTime())/1e3))}function sn(e,t){let n=X(e);if(n!==void 0)return cn(Math.floor((t-n.getTime())/1e3))}function cn(e){if(e<0)return;if(e<60)return`${e}s`;let t=Math.floor(e/60);return t<60?`${t}m ${String(e%60).padStart(2,`0`)}s`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,`0`)}m`}function ln(e=1e3){let[t,n]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function un({ts:e}){let t=en(e);return t===void 0?null:(0,Y.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:tn(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function dn({startedAt:e,completedAt:t}){let n=en(t);if(n===void 0)return null;let r=on(e,t);return(0,Y.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,Y.jsx)(`time`,{dateTime:t,title:tn(t),children:n}),r===void 0?null:(0,Y.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function fn({ts:e}){let t=an(e),n=X(e);if(t===void 0||n===void 0)return null;let r=$t.format(n);return(0,Y.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,Y.jsx)(`time`,{dateTime:rn(e),title:r,children:t}),(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}function pn({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:i,onRemove:a,editLabel:o=`Edit message`,removeLabel:s=`Remove message`,draftRunId:c,draftSurface:l}){let u=t-n.length,[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(e),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(),y=ye(c??``,l??``,{enabled:i!==void 0&&c!==void 0&&l!==void 0}),b=`${c??``} ${l??``}`,[x,S]=(0,q.useState)(b);x!==b&&(S(b),f(!1),m(e),v(void 0)),(0,q.useEffect)(()=>{d||!y.ready||!y.hasDraft||(m(y.text),v(void 0),f(!0))},[d,y.hasDraft,y.ready,y.text]);let C=e=>{m(e),y.setText(e)},w=()=>{m(e),v(void 0),f(!0)},T=async()=>{let t=p.trim();if(!t||t===e){y.clear(),f(!1);return}g(!0),v(void 0);try{await y.submit(()=>i?.(t)??Promise.resolve()),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},E=()=>{y.clear(),f(!1)},D=async()=>{g(!0),v(void 0);try{await a?.(),y.clear()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,Y.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),E()):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),T())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Y.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:E,disabled:h,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void T(),disabled:h,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,Y.jsx)(Oe,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[i||a?(0,Y.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,Y.jsx)(`button`,{type:`button`,"aria-label":o,onClick:w,disabled:h,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(st,{className:`size-3.5`})}):null,a?(0,Y.jsx)(`button`,{type:`button`,"aria-label":s,onClick:()=>void D(),disabled:h,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(me,{className:`size-3.5`})}):null]}):null,_?(0,Y.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,(0,Y.jsx)(mn,{text:e}),n.length>0?(0,Y.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>I(e.split(`/`).pop()??``)?(0,Y.jsx)(ze,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Y.jsxs)(`a`,{href:e,download:!0,"data-slot":`user-file`,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,Y.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null,r===void 0?null:(0,Y.jsx)(`span`,{className:`mt-1 flex justify-end`,children:(0,Y.jsx)(un,{ts:r})})]})}function mn({text:e}){let t=(0,q.useMemo)(()=>He(e),[e]);return t?(0,Y.jsxs)(Y.Fragment,{children:[t.lead===``?null:(0,Y.jsx)(W,{breaks:!0,children:t.lead}),(0,Y.jsx)(Ge,{items:t.items})]}):(0,Y.jsx)(W,{breaks:!0,children:e})}function hn({text:e}){return(0,Y.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,Y.jsx)(W,{children:e})})}function gn({note:e}){return(0,Y.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:P(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var _n={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`};function vn({incident:e}){let t=_n[e.provider];return(0,Y.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Y.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Y.jsx)(D,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function yn({text:e}){let t=(0,q.useId)();if(e.trim()===``)return null;let n=e.split(`
2
- `,1)[0]??``,r=n.length<e.length;return(0,Y.jsxs)(Pe,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Y.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,Y.jsx)(H,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Y.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Y.jsx)(W,{inline:!0,children:n})}),r?(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Y.jsx)(Ne,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Y.jsx)(Me,{children:(0,Y.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Y.jsx)(W,{children:e})})})]})}function bn({since:e,lastActivityAt:t}={}){let n=ln(),r=sn(e,n),i=sn(t,n),a=en(t);return(0,Y.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-1 text-[13px] text-soft-foreground`,children:[(0,Y.jsx)(Oe,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Y.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`}),r===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`working-elapsed`,title:`Started ${tn(e)}`,className:`font-mono text-xs tabular-nums`,children:r}),i!==void 0&&a!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`working-last-activity`,title:tn(t),className:`text-xs`,children:[`· last activity `,a,` (`,i,` ago)`]}):null]})}var xn={read:Ce,edit:st,delete:me,move:it,search:je,execute:xe,think:nt,fetch:se,task:pe,skill:ce,plan:at,other:ct},Sn=e=>e.split(`
3
- `).length;function Cn({text:e,streaming:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(null),a=(0,q.useRef)(!0);(0,q.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Sn(e),s=!t&&!n&&o>12;return(0,Y.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Vt(e.currentTarget)}:void 0,className:P(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,Y.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,Y.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,Y.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function wn({diffs:e}){return(0,Y.jsx)(Y.Fragment,{children:e.map((e,t)=>(0,Y.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,Y.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Tn(e.oldText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Tn(e.newText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
- `).map((e,t)=>(0,Y.jsx)(En,{text:e},t))})]},`${e.path}:${t}`))})}function Tn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
5
- `)}function En({text:e}){return(0,Y.jsx)(`span`,{className:P(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function Dn(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function On({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=Ft(),[a,o]=(0,q.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,l=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,u=l&&(a??Dn(e)),{verb:d,detail:f}=jt(e.title),p=xn[e.toolKind]??ct;return(0,Y.jsxs)(Pe,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:u,onOpenChange:s,className:P(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,Y.jsxs)(Ne,{disabled:!l,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,Y.jsx)(H,{"aria-hidden":!0,className:P(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!l&&`invisible`)}),(0,Y.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:P(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:d}),f===void 0?null:(0,Y.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:f}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,Y.jsx)(Oe,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,Y.jsx)(`span`,{"data-slot":`tool-exit`,className:P(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,Y.jsx)(Me,{children:(0,Y.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,Y.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,Y.jsx)(wn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,Y.jsx)(Cn,{text:e.output,streaming:c}):null,t.length>0?(0,Y.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function kn({group:e,scope:t}){return(0,Y.jsxs)(Pe,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,Y.jsxs)(Ne,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(H,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,Y.jsx)(Me,{children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,Y.jsx)(On,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function An({count:e,children:t}){return(0,Y.jsxs)(Pe,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,Y.jsxs)(Ne,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,Y.jsx)(H,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),kt(e)]}),(0,Y.jsx)(Me,{children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function jn({image:e}){return(0,Y.jsx)(ze,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}var Mn=120,Nn=e=>e!==`pending`&&e!==`running`,Pn=e=>e.kind===`tool`&&e.toolKind===`task`,Z=e=>Pn(e)&&e.parentItemId===void 0,Fn=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function In(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Z(e)&&t.has(e.id)))return n;return 0}function Ln(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 Rn(e){if(e.kind===`tool`)return zn(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
6
- `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return zn(n)}}}function zn(e){return e.length>Mn?`${e.slice(0,Mn-1).trimEnd()}…`:e}function Bn(e,t=!1){let n=Kn(e,e=>e.items.some(Z));if(n===-1)return[];let r=e=>!t&&!Nn(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Z);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Z)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?In(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!Fn(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>Hn(e,c.get(e.id)??[],t))}function Vn(e){let t=new Map;for(let n of e)for(let e of n.items){if(e.kind!==`tool`||e.toolKind!==`skill`||e.parentItemId!==void 0||e.status===`failed`||e.status===`declined`)continue;let n=jt(e.title).detail??e.title;t.has(n)||t.set(n,{id:e.id,name:n})}return[...t.values()]}function Hn(e,t,n){let r={id:e.id,title:jt(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=Ln(e);i!==void 0&&(r.agentType=i),n&&!Nn(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=Rn(t[e]);if(n!==void 0){r.activity=n;break}}return r}function Un(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Wn(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function Gn(e){return e.find(e=>!Nn(e.status))??e[0]}function Kn(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function qn(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Z(e));if(i!==void 0)return Hn(i,Jn(e,t),n)}}function Jn(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Z(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)Fn(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var Yn=new Map,Xn=!1;function Zn({runId:e,agents:t,onSelect:n}){let[r,i]=(0,q.useState)(()=>Yn.get(e)??Xn),a=t.every(e=>e.status!==`pending`&&e.status!==`running`),o=(0,q.useRef)(a);if((0,q.useEffect)(()=>{!o.current&&a&&i(t=>t&&(Yn.set(e,!1),!1)),o.current=a},[a,e]),t.length===0)return null;let{done:s,total:c}=Un(t),l=Gn(t);return(0,Y.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Y.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Yn.set(e,!t),!t)),"aria-expanded":r,className:P(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Y.jsx)(pe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,Y.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,s,`/`,c]}),!r&&l!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,Wn(l)]}):null,(0,Y.jsx)(ue,{"aria-hidden":!0,className:P(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Y.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,Y.jsx)(Qn,{agent:e,onSelect:n},e.id))}):null]})}function Qn({agent:e,onSelect:t}){let n=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)($n,{status:e.status,stalled:e.stalled===!0}),(0,Y.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,Y.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Wn(e)}),(0,Y.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,Y.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,Y.jsx)(`button`,{type:`button`,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,Y.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function $n({status:e,stalled:t=!1}){return t?(0,Y.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,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,Y.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,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,Y.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,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,Y.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,Y.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Y.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var er=new Map;function tr(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function nr(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function rr(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function ir({runId:e,entries:t,settled:n=!1}){let[r,i]=(0,q.useState)(()=>er.get(e)??tr());if(t.length===0)return null;let{done:a,total:o}=nr(t),s=n?void 0:rr(t),c=n&&a<o;return(0,Y.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":r?`open`:`collapsed`,"data-settled":n?`true`:void 0,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Y.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-0.5 md:h-[3px]`,style:{background:`var(--grad)`}}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(er.set(e,!t),!t)),"aria-expanded":r,className:P(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,Y.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),c?(0,Y.jsx)(`span`,{"data-slot":`plan-unfinished`,className:`shrink-0 text-soft-foreground`,children:`· left unfinished`}):null,!r&&s!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,s.activeForm??s.content]}):null,(0,Y.jsx)(ue,{"aria-hidden":!0,className:P(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Y.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,Y.jsx)(ar,{entry:e,settled:n},`${t}:${e.content}`))}):null]})}function ar({entry:e,settled:t}){let n=t&&e.status===`in_progress`?`pending`:e.status;return(0,Y.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:P(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,n===`completed`&&`text-soft-foreground line-through`,n===`in_progress`&&`font-medium`,n===`pending`&&`text-muted-foreground`,n===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,Y.jsx)(or,{status:n}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),n===`in_progress`?(0,Y.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function or({status:e}){return e===`cancelled`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,Y.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,Y.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,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,Y.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,Y.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Y.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,Y.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,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function sr({skills:e}){return e.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`skills-dock`,className:`flex min-w-0 items-center gap-2 overflow-hidden rounded-lg border border-border bg-card px-3.5 py-2 text-[13px] shadow-xs`,children:[(0,Y.jsx)(ce,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`shrink-0 font-semibold`,children:e.length===1?`Skill`:`Skills`}),(0,Y.jsxs)(`span`,{"data-slot":`skills-names`,className:`min-w-0 truncate text-muted-foreground`,children:[`· `,e.map(e=>e.name).join(` · `)]})]})}function cr(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!cr(e[n],t[n]))return!1;return!0}if(!lr(e)||!lr(t))return!1;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!cr(e[r],t[r]))return!1;return!0}function lr(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ur(){return typeof CSS>`u`||typeof CSS.supports!=`function`||CSS.supports(`overflow-anchor`,`auto`)}function dr(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,q.useRef)(null),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1),d=(0,q.useRef)(!0),f=(0,q.useRef)(null),p=(0,q.useRef)(null),m=(0,q.useRef)(null),h=(0,q.useCallback)(e=>{let t=o.current;if(!t)return;let n=m.current;n?n.scrollTo(e):t.scrollTop=e},[]),g=(0,q.useCallback)(()=>{let e=o.current;e&&h(e.scrollHeight-e.clientHeight)},[h]),_=(0,q.useCallback)(()=>{if(o.current){if(p.current!==e){p.current=e;let t=Gt(e);t&&!t.atBottom?(d.current=!1,f.current=t.top):(d.current=!0,f.current=null)}f.current===null?d.current&&g():h(f.current)}},[e,h,g]),v=(0,q.useCallback)(e=>{c(e),e&&(o.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),_())},[n,_]),y=(0,q.useCallback)(()=>{d.current&&g()},[g]),b=(0,q.useRef)(!1),x=(0,q.useRef)(!1),S=(0,q.useRef)(void 0),C=(0,q.useRef)(!1),w=(0,q.useRef)(!1),T=(0,q.useRef)(!1),E=(0,q.useRef)(void 0),D=(0,q.useRef)(0),O=(0,q.useRef)(a);O.current=a;let k=(0,q.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),A=(0,q.useCallback)(()=>{let e=o.current;if(!e||!r||b.current)return;b.current=!0;let t=e.scrollHeight,n=e.scrollTop,i=e.getBoundingClientRect().top,a=zt(i,k(e));r().finally(()=>{requestAnimationFrame(()=>{let e=o.current;if(e&&!d.current){let r=n+Math.max(0,e.scrollHeight-t),i=e.getBoundingClientRect().top,o=a===void 0?-1:O.current.indexOf(a.key),s=m.current;s&&o>=0?s.scrollToIndex(o,{align:`start`,offset:-a.offset}):h(Bt(e.scrollTop,i,a,k(e),r))}b.current=!1})})},[k,r,h]);(0,q.useEffect)(()=>()=>clearTimeout(S.current),[]);let j=(0,q.useCallback)(()=>{o.current&&(f.current=null,d.current=!0,(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{let e=o.current;e?.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`})})}))},[i]);return(0,q.useLayoutEffect)(()=>{!o.current||!s||_()},[s,_]),(0,q.useEffect)(()=>{let t=o.current,n=s;if(!t||!n)return;let r=!ur(),i=(e,t)=>{if(typeof document.elementsFromPoint==`function`){let n=document.elementsFromPoint(t.left+t.width/2,t.top+1).map(e=>e.closest(`[data-slot="thread-row"][data-row-key]`)).find(t=>t!==null&&e.contains(t));if(n){let e=n.getBoundingClientRect();return{key:n.dataset.rowKey,top:e.top,bottom:e.bottom}}return}return k(e).find(({bottom:e})=>e>t.top)},a=(e,t)=>{let n=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(t):t.replace(/["\\]/g,`\\$&`),r=e.querySelector(`[data-slot="thread-row"][data-row-key="${n}"]`);if(!r)return;let i=r.getBoundingClientRect();return{key:t,top:i.top,bottom:i.bottom}},c=()=>{!r||d.current||f.current!==null||D.current===0&&(D.current=requestAnimationFrame(()=>{D.current=0;let e=o.current;if(!e||d.current)return;let t=e.getBoundingClientRect(),n=i(e,t);E.current=n===void 0?void 0:{key:n.key,offset:n.top-t.top}}))},l=()=>{let e=E.current;if(!r||e===void 0||m.current)return;let n=t.getBoundingClientRect().top,i=a(t,e.key),o=i===void 0?t.scrollTop:t.scrollTop+(i.top-n-e.offset);Math.abs(o-t.scrollTop)>=1&&h(o)},p=0,_=null,v=!1,y=t.scrollTop,b=()=>{f.current=null,d.current=!1,p=0},O=()=>{p=Date.now()},j=e=>{if(e.deltaY<0){b();let e=!x.current;x.current=!0,clearTimeout(S.current),S.current=setTimeout(()=>{x.current=!1},180),e&&Rt(t)&&A()}else O()},M=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(b(),!e.repeat&&Rt(t)&&A()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&O()},N=()=>{v=!0,T.current=!1,y=t.scrollTop,Vt(t,80)||(b(),O())},P=()=>{v=!1},F=e=>{C.current=!1,w.current=!0,_=e.touches[0]?.clientY??null},I=()=>{w.current&&(w.current=!1,d.current&&f.current===null&&g())},L=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(_!==null&&n>_+1?(b(),!C.current&&Rt(t)&&(C.current=!0,A())):_!==null&&n<_-1&&O(),_=n)},R=()=>{v&&!T.current&&t.scrollTop<y&&Rt(t)&&(T.current=!0,A()),y=t.scrollTop;let n=Vt(t,80);n&&f.current===null&&(d.current||Date.now()-p<2e3)&&(d.current=!0),u(!n),f.current===null&&Wt(e,{top:t.scrollTop,atBottom:n}),c()};t.addEventListener(`scroll`,R,{passive:!0}),t.addEventListener(`wheel`,j,{passive:!0}),t.addEventListener(`touchstart`,F,{passive:!0}),t.addEventListener(`touchmove`,L,{passive:!0}),window.addEventListener(`touchend`,I,{passive:!0}),window.addEventListener(`touchcancel`,I,{passive:!0}),t.addEventListener(`pointerdown`,N,{passive:!0}),window.addEventListener(`pointerup`,P,{passive:!0}),t.addEventListener(`keydown`,M);let z;return typeof ResizeObserver<`u`&&(z=new ResizeObserver(()=>{let e=f.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;h(Math.min(e,n)),n>=e&&(f.current=null,c())}else d.current?w.current||g():l()}),z.observe(n)),c(),()=>{cancelAnimationFrame(D.current),D.current=0,E.current=void 0,t.removeEventListener(`scroll`,R),t.removeEventListener(`wheel`,j),t.removeEventListener(`touchstart`,F),t.removeEventListener(`touchmove`,L),window.removeEventListener(`touchend`,I),window.removeEventListener(`touchcancel`,I),t.removeEventListener(`pointerdown`,N),window.removeEventListener(`pointerup`,P),t.removeEventListener(`keydown`,M),z?.disconnect()}},[e,s,A,h,g]),{attachContent:v,scrollElRef:o,virtualizerRef:m,pillVisible:l,jumpToLatest:j,loadOlder:A,restickIfStuck:y}}function fr({runId:e,rows:t,mode:n,controls:r}){if(n===`virtual`)return(0,Y.jsx)(pr,{runId:e,rows:t,controls:r});let i=Lt(ur());return(0,Y.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,Y.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:i,children:e.node},e.key))})}function pr({runId:e,rows:t,controls:n}){let r=(0,q.useRef)(null),[i]=(0,q.useState)(()=>Jt(e,t.length)),a=(0,q.useRef)(t.length);a.current=t.length;let o=(0,q.useRef)(null),s=(0,q.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(qt(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(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,Y.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,Y.jsx)(Re,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,Y.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))})})}function mr({onJump:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,Y.jsx)(tt,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function hr(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[],ts:e.createdAt},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[],ts:t.createdAt},inDaySequence:!1,entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images,...e.userMessage.ts===void 0?{}:{ts:e.userMessage.ts}}},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.completed?.ts===void 0?{}:{completedAt:e.completed.ts},entries:e.items});return n}function gr(e,t){return[{id:`agent:${e}`,entries:t}]}function _r(e){if(e.inDaySequence!==!1)return e.userMessage?.ts??e.startedAt??e.completedAt}function vr(e,t){let n=[],r;for(let t of e){let e=_r(t),i=rn(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 Mt([...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 yr({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c,rowModels:l}){let u=(0,q.useMemo)(()=>l??vr(n,e),[l,n,e]),d=dr(`${e}:${t}`,{surface:r}),f=s??d,p=(0,q.useMemo)(()=>u.map(t=>({key:t.key,node:(0,Y.jsx)(xr,{runId:e,row:t,actions:o?.[t.key],renderAsk:a})})),[o,a,u,e]),m=c??Ht(``,p.length),h=p.length===0?i??null:(0,Y.jsx)(fr,{runId:`${e}:${t}`,rows:p,mode:m,controls:f});return(0,Y.jsx)(It,{runId:e,children:r===`panel`?(0,Y.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,Y.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:h}),f.pillVisible?(0,Y.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,Y.jsx)(mr,{onJump:f.jumpToLatest})}):null]}):h})}function br({runId:e,row:t,actions:n,renderAsk:r}){return Sr(e,t,n,r)}var xr=(0,q.memo)(br,(e,t)=>e.runId===t.runId&&e.actions===t.actions&&e.renderAsk===t.renderAsk&&cr(e.row,t.row));function Sr(e,t,n,r){switch(t.content.kind){case`user-message`:return(0,Y.jsx)(Cr,{runId:e,message:t.content.message,actions:n});case`day-separator`:return(0,Y.jsx)(fn,{ts:t.content.ts});case`turn-time`:return(0,Y.jsx)(dn,{completedAt:t.content.completedAt,...t.content.startedAt===void 0?{}:{startedAt:t.content.startedAt}});case`block`:return(0,Y.jsx)(wr,{block:t.content.block,scope:t.scope,renderAsk:r});default:return Dr(t.content)}}function Cr({runId:e,message:t,actions:n}){return(0,Y.jsx)(pn,{text:t.text,imageCount:t.imageCount,images:t.images,...t.ts===void 0?{}:{ts:t.ts},onEdit:n?.onEdit,onRemove:n?.onRemove,editLabel:n?.editLabel,removeLabel:n?.removeLabel,draftRunId:n?.draftSurface===void 0?void 0:e,draftSurface:n?.draftSurface})}var wr=(0,q.memo)(function e({block:t,scope:n,renderAsk:r}){switch(t.kind){case`entry`:return(0,Y.jsx)(Er,{entry:t.entry,scope:n,renderAsk:r});case`tool-card`:return(0,Y.jsx)(On,{item:t.item,nested:t.children,cacheKey:`${n}:${t.id}`,renderNested:(e,t)=>(0,Y.jsx)(Tr,{entries:e,scope:t,renderAsk:r})});case`context-group`:return(0,Y.jsx)(kn,{group:t,scope:n});case`streak`:return(0,Y.jsx)(An,{count:t.count,children:t.blocks.map(t=>(0,Y.jsx)(e,{block:t,scope:n,renderAsk:r},t.id))});default:return Dr(t)}},Or);function Tr({entries:e,scope:t,renderAsk:n}){return Mt([...e]).map(e=>(0,Y.jsx)(wr,{block:e,scope:t,renderAsk:n},e.id))}function Er({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,Y.jsx)(hn,{text:e.text}):(0,Y.jsx)(pn,{text:e.text});case`reasoning`:return(0,Y.jsx)(yn,{text:e.text});case`tool`:return(0,Y.jsx)(On,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,Y.jsx)(gn,{note:e});case`image`:return(0,Y.jsx)(jn,{image:e});case`ask`:return n===void 0?(0,Y.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`provider-auth-required`:return(0,Y.jsx)(vn,{incident:e});default:return Dr(e)}}function Dr(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function Or(e,t){return e.scope===t.scope&&Ar(e.block,t.block)&&(!kr(t.block)||e.renderAsk===t.renderAsk)}function kr(e){return e.kind===`entry`?e.entry.kind===`ask`:e.kind===`tool-card`?e.children.some(e=>e.kind===`ask`):e.kind!==`context-group`&&e.blocks.some(kr)}function Ar(e,t){if(e.kind!==t.kind||e.id!==t.id)return!1;switch(t.kind){case`entry`:return Mr(e.kind===`entry`?e.entry:void 0,t.entry);case`tool-card`:return e.kind===`tool-card`&&Br(e.item,t.item)&&jr(e.children,t.children);case`context-group`:return e.kind===`context-group`&&e.files===t.files&&e.searches===t.searches&&e.label===t.label&&e.tools.length===t.tools.length&&e.tools.every((e,n)=>Br(e,t.tools[n]));case`streak`:return e.kind===`streak`&&e.count===t.count&&e.blocks.length===t.blocks.length&&e.blocks.every((e,n)=>Ar(e,t.blocks[n]));default:return!1}}function jr(e,t){return e.length===t.length&&e.every((e,n)=>Mr(e,t[n]))}function Mr(e,t){if(e===void 0||e.kind!==t.kind||e.id!==t.id)return!1;switch(t.kind){case`message`:return e.kind===`message`&&Q(e,t,Nr);case`reasoning`:return e.kind===`reasoning`&&Q(e,t,Pr);case`tool`:return e.kind===`tool`&&Br(e,t);case`note`:return e.kind===`note`&&Q(e,t,Fr);case`image`:return e.kind===`image`&&Q(e,t,Ir);case`ask`:return e.kind===`ask`&&Q(e,t,Lr);case`provider-auth-required`:return e.kind===`provider-auth-required`&&Q(e,t,Rr);default:return!1}}var Nr={kind:!0,id:!0,role:!0,text:!0,phase:!0,parentItemId:!0},Pr={kind:!0,id:!0,text:!0,parentItemId:!0},Fr={kind:!0,id:!0,text:!0,tone:!0},Ir={kind:!0,id:!0,url:!0,name:!0},Lr={kind:!0,id:!0,questions:!0,resolved:!0,answer:!0,fromWorkflow:!0},Rr={kind:!0,id:!0,provider:!0,authFailureId:!0},zr={kind:!0,id:!0,name:!0,toolKind:!0,title:!0,status:!0,input:!0,output:!0,error:!0,diffs:!0,locations:!0,exitCode:!0,parentItemId:!0};function Q(e,t,n){return Object.keys(n).every(n=>e[n]===t[n])}function Br(e,t){return Q(e,t,zr)}function Vr({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,Y.jsx)(re,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,Y.jsx)(ne,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,Y.jsx)(Hr,{runId:e,renderAsk:t,agent:n,entries:r})})})}function Hr({runId:e,renderAsk:t,agent:n,entries:r}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(L,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,Y.jsxs)(te,{className:`flex min-w-0 items-center gap-2 text-[15px]`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,Y.jsxs)(z,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(Ur,{status:n.status}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,Y.jsx)(yr,{runId:e,viewId:`agent:${n.id}`,sections:gr(n.id,r),mode:`panel`,renderAsk:t,empty:(0,Y.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 Ur({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,Y.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:P(`rounded-full px-2 py-0.5 text-[10.5px] 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 Wr({run:e,diffComments:t}){return(0,Y.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,Y.jsx)(Te,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,Y.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,Y.jsx)(Be,{runId:e.id}),(0,Y.jsx)(Gr,{run:e,diffComments:t})]})}function Gr({run:e,diffComments:t}){let n=l(),r=(0,q.useRef)(null),i=ye(e.id,`review-notes`),o=i.text,s=i.setText,[c,u]=(0,q.useState)(null),d=ve(e.id),f=_e(e),p=()=>n.invalidateQueries({queryKey:C.runs.all}),h=a({mutationFn:async n=>{if(!f.canContinue)return null;let r=async t=>{let r=`Review feedback:\n${Ke(n,t)}`;if(r.length>1e5)throw Error(`Too long with the diff comments attached — shorten the notes or remove some comments.`);return v(e.id,{text:r,runner:f.runnerOverride})};return i.submit(()=>t?t.submit(r):r([]))},onSuccess:e=>{e!==null&&p()},onError:e=>T(e.message,{tone:`danger`})}),g=a({mutationFn:()=>O(e.id),onSuccess:e=>{T(`Draft PR created — ${e.url}`),p()},onError:e=>{e instanceof m&&e.manual!==void 0&&u(e.manual),T(e.message,{tone:`danger`})}}),_=t?.comments.length??0,y=()=>{let e=o.trim();if(e.length===0&&_===0){T(`Write what to change first.`),r.current?.focus();return}h.mutate(e)};return(0,Y.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(Fe,{ref:r,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{Ie({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},className:`min-h-[52px] text-[13px]`}),_>0?(0,Y.jsxs)(`p`,{"data-slot":`review-diff-comments`,className:`text-xs text-muted-foreground`,children:[`+ `,_,` `,_===1?`comment`:`comments`,` on the diff — sent back with these notes.`]}):null,f.canContinue?null:(0,Y.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:f.reason}),f.providerPending?null:(0,Y.jsx)(D,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(F,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:f.reason??`Send the notes back into the agent's session`,"aria-describedby":f.canContinue?void 0:`review-provider-guidance`,disabled:h.isPending||!f.canContinue,onClick:y,children:[(0,Y.jsx)(rt,{"aria-hidden":`true`}),`Send back`]}),N(e.pullRequestUrl)?(0,Y.jsx)(F,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,Y.jsx)(we,{"aria-hidden":`true`}),`PR ↗`]})}):(0,Y.jsxs)(F,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:g.isPending,onClick:()=>g.mutate(),children:[(0,Y.jsx)(Ee,{"aria-hidden":`true`}),`Draft PR`]}),(0,Y.jsxs)(F,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:oe(`review`),disabled:d.isPending,onClick:()=>d.mutate(),children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),`Accept`]})]}),c===null?null:(0,Y.jsx)(Kr,{command:c})]})}function Kr({command:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>T(`Command copied to clipboard.`)).catch(()=>T(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(Se,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function qr(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Jr=1500;function Yr({status:e}){let t=(0,q.useRef)(e),[n,r]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||qr())return;r(!0);let i=setTimeout(()=>r(!1),Jr);return()=>clearTimeout(i)},[e]),n?(0,Y.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,Y.jsx)(De,{}),(0,Y.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,Y.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}var Xr=new Map,Zr=(e,t)=>JSON.stringify([e,t.id,t.questions.map(e=>[e.header,e.question,e.options.map(e=>e.label)])]);function Qr(e,t){return Xr.get(Zr(e,t))??{}}function $r(e,t,n){Xr.set(Zr(e,t),n)}function ei(e,t){Xr.delete(Zr(e,t))}function ti(e,t){return`${e.header}: ${t.join(`, `)}`}function ni({ask:e,run:t}){return(0,q.useEffect)(()=>{e.resolved&&ei(t.id,e)},[e,t.id]),e.resolved?(0,Y.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,Y.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,Y.jsx)(ri,{ask:e,run:t})}function ri({ask:e,run:t}){let n=ie(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,q.useState)(()=>Qr(t.id,e)),c=(n,r)=>s(i=>{let a={...i,[n]:r};return $r(t.id,e,a),a}),l=e=>(o[e]?.length??0)>0,u=i.every((e,t)=>l(t)),d=i.some((e,t)=>l(t))?i.filter((e,t)=>!l(t)).map(e=>e.header):[],f=()=>void n.send(i.map((e,t)=>ti(e,o[t]??[])).join(`
7
- `)),p=n.mode===`resume`;return(0,Y.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,Y.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:e.fromWorkflow?`The workflow is asking`:`The agent is asking`})}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,Y.jsx)(ii,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(ti(e,i)):c(t,i))}},e.id??t))}),a?p?(0,Y.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,Y.jsx)(F,{size:`sm`,disabled:n.isPending||r||!u,onClick:f,children:p?`Send answer & reopen`:`Send answer`}),(0,Y.jsx)(`span`,{"data-slot":p?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:p?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),!a&&d.length>0?(0,Y.jsxs)(`p`,{"data-slot":`ask-unanswered`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:[`unanswered: `,d.join(`, `)]}):null,n.blockedBy===`provider`?(0,Y.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:n.reason}),(0,Y.jsx)(D,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,Y.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,Y.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function ii({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,Y.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,Y.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,Y.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,Y.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,Y.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:P(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,Y.jsx)(`span`,{"aria-hidden":!0,className:P(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,Y.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var ai=2e3;function oi(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{lastEnd:t,lastStart:n}}function si(e){let{lastEnd:t,lastStart:n}=oi(e);return t>n?t:0}function ci(e){let{lastEnd:t,lastStart:n}=oi(e);return n>t?n:0}function li(e,t){let n=l(),r=(0,q.useMemo)(()=>si(t),[t]),i=(0,q.useMemo)(()=>ci(t),[t]),a=e?.id,o=e?.status;(0,q.useEffect)(()=>{if(a===void 0||o===void 0||o===`queued`||!(o===`running`||o===`waiting`?r>0:i>0))return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:C.runs.detail(a)}),n.invalidateQueries({queryKey:C.runs.list()})},ai);return()=>clearTimeout(e)},[r,i,a,o,n])}function ui(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function di(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function fi(e,t,n=!1){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return n?{state:`closed`,tone:`dim`,label:`Session closed — waiting for your answer, which reopens it`}:{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function pi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function mi(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function hi(e){return e===`claude`||e===`codex`||e===`junie`||e===`opencode`||e===`cursor`||e===`pi`||e===`copilot`?e:void 0}var gi=e=>pi(e)&&typeof e.header==`string`&&Array.isArray(e.options);function _i(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``)),n.includes(`CEZ:`)?n.split(`
8
- `).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
9
- `):n}function vi(e){let t=e=>_i(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function yi(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var bi=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,xi=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Si(e){if(!pi(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!pi(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:xi.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function Ci(e,t={}){let n=[],r=new Map,i,a=0,o,s,c=e=>{a+=1;let t={id:e===void 0?`turn-fallback-${a}`:`turn-seq-${e}`,entries:[],v2Items:!1};return n.push(t),t},l=()=>n.at(-1)??c(),u=(e,t)=>ee(e.stepId,t),d=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})};for(let t of e)switch(s=mi(t.ts)??s,t.type){case`user-message`:{let e=$(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=c(t.seq),r=mi(t.ts);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...r===void 0?{}:{ts:r}},r!==void 0&&(n.startedAt=r);break}case`turn.started`:{let e=$(t.turnId),r=n.at(-1),i=r&&r.turnId===void 0&&!r.v2Items?r:c(t.seq);i.turnId=e;let a=mi(t.ts);i.startedAt===void 0&&a!==void 0&&(i.startedAt=a);break}case`turn.completed`:{let e=$(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);if(i){let e=mi(t.ts);i.completed={stopReason:$(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...e===void 0?{}:{ts:e}}}break}case`item.started`:case`item.updated`:case`item.completed`:{if(!pi(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=u(t,i.id);d(r.get(a)?.turn??l(),i,a);break}case`item.delta`:{let e=$(t.itemId)??``,n=r.get(u(t,e)),i=$(t.delta)??``;if(!n||i===``||!bi(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=l(),n=$(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=l();if(e.v2Items)break;let n=$(t.tool)??`Tool`;if(wi.has(n))break;let i=et(n,t.input);if(i.toolKind===`plan`){let n=Si(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:$(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get($(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=yi(t.result);break}case`note`:case`lifecycle`:{let e=$(t.message)??``;if(e===``)break;let n=t.tone===`danger`?`danger`:`dim`;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:n}});break}case`error`:{let e=$(t.message)??``;if(e===``)break;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=$(t.message)??``;if(e===``)break;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=$(t.error)?` — ${$(t.error)}`:``;l().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${$(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=$(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:$(t.text)??``,exitCode:n};l().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=hi(t.provider),n=$(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;l().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=$(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=$(t.name);r!==void 0&&(n.name=r),l().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(l().planEntries=t.entries);break;case`session.ended`:i={reason:$(t.reason)??`end_turn`,...$(t.message)===void 0?{}:{message:$(t.message)}};break;case`ask.requested`:{let e=$(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions,r=n.every(gi)?n:n.filter(gi);if(r.length===0)break;let i={kind:`ask`,id:e,questions:r,resolved:!1,...t.source===`workflow`?{fromWorkflow:!0}:{}};l().entries.push({origin:`meta`,entry:i}),o=i;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add(_i(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has(_i(e.entry.text,!0).trim()))),vi(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:_i(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i},...s===void 0?{}:{lastEventAt:s}}}var wi=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function Ti(){let{id:e}=s(),t=y(e),n=xt(e),r=t.data?.status,i=(0,q.useMemo)(()=>Ci(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,q.useMemo)(()=>Ci(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),c=(0,q.useRef)(void 0),l=(0,q.useCallback)(e=>{c.current=e},[]),{mutate:u}=o();if((0,q.useEffect)(()=>{t.data&&c.current!==t.data.id&&ae(t.data)&&u(t.data.id)},[u,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),li(t.data,n.visibleEvents),t.isPending)return(0,Y.jsx)(Le,{});if(t.isError){let e=t.error instanceof m&&t.error.status===404;return(0,Y.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(ke,{icon:e?(0,Y.jsx)(Ae,{}):(0,Y.jsx)(ot,{}),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,Y.jsx)(F,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(D,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,Y.jsx)(Le,{}):(0,Y.jsx)(Ei,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:l})}function Ei({run:e,thread:t,currentThread:n=t,history:i,onMarkedUnread:a}){let o=fi(e.status,e.error,b(e)),s=(0,q.useCallback)(()=>a?.(e.id),[a,e.id]),l=ui(n),d=S(e),f=l!==void 0&&l.length>0?nr(l):void 0,p=e.status===`running`||e.status===`waiting`,m=e.status===`queued`,h=Ve(e),g=!p&&!m&&h.available&&h.canContinue,_=!p&&e.status!==`queued`,v=(0,q.useMemo)(()=>Bn(n.turns,_),[n.turns,_]),y=(0,q.useMemo)(()=>Vn(n.turns),[n.turns]),[C,T]=(0,q.useState)(void 0),[D,O]=(0,q.useState)(e.id);D!==e.id&&(O(e.id),T(void 0));let A=(0,q.useMemo)(()=>C===void 0?void 0:qn(n.turns,C,_),[n.turns,C,_]),j=(0,q.useMemo)(()=>C===void 0?[]:Jn(n.turns,C),[n.turns,C]),M=ye(e.id,`composer`),F=Ue(e.id),{mutateAsync:I}=u(e.id),{mutateAsync:L}=x(e.id),{mutateAsync:R}=k(e.id),z=(0,q.useMemo)(()=>m?{onEditTask:async e=>{await I({task:e})},onEditMessage:(e,t)=>L({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>R(e).then(()=>void 0)}:void 0,[m,I,L,R]),ee=(0,q.useMemo)(()=>hr(e,t),[e,t]),te=(0,q.useMemo)(()=>vr(ee,e.id),[ee,e.id]),ne=(0,q.useCallback)(t=>(0,Y.jsx)(ni,{ask:t,run:e}),[e]),re=(0,q.useMemo)(()=>{if(z===void 0)return;let t={task:{onEdit:z.onEditTask,editLabel:`Edit the prompt`,draftSurface:`task-prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>z.onEditMessage(n.id,e),onRemove:()=>z.onRemoveMessage(n.id),draftSurface:`message:${n.id}`};return t},[z,e.queuedMessages]),B=E(e,c()),{search:ie}=r(),ae=Ht(ie,te.length),V=dr(`${e.id}:main`,{onLoadOlder:i?.hasOlder?i.loadOlder:void 0,onJumpToLatest:i?.jumpToLatest,rowKeys:te.map(({key:e})=>e)});return de(V.restickIfStuck),(0,Y.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,Y.jsx)(be,{run:e,planTally:f,onMarkedUnread:s,continuationEngine:g?h.pills:void 0}),(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-2.5 px-3 py-3 md:gap-3.5 md:px-6 md:py-5`,children:[i?(0,Y.jsx)(Di,{hasOlder:i.hasOlder,loading:i.isFetchingOlder,error:i.olderError,fallback:i.fallback,retainedPages:i.retainedPages,onLoad:V.loadOlder}):null,(0,Y.jsx)(yr,{runId:e.id,viewId:`main`,sections:ee,mode:`document`,renderAsk:ne,messageActions:re,scrollControls:V,renderMode:ae,rowModels:te}),t.turns.length===0?e.status===`queued`?(0,Y.jsx)(ki,{run:e}):(0,Y.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,Y.jsx)(bn,{since:Oi(e,n),lastActivityAt:n.lastEventAt}):null,(0,Y.jsx)(Ct,{run:e}),o&&o.state===`closed`?(0,Y.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":o.state,className:P(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,o.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[o.label,N(w(e))?(0,Y.jsx)(`a`,{"data-slot":`pr-link`,href:w(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,N(B)?(0,Y.jsx)(`a`,{"data-slot":`issue-link`,href:B,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,Y.jsx)(Wr,{run:e,diffComments:F}):null]}),(0,Y.jsx)(Yr,{status:e.status}),(0,Y.jsx)(Vr,{runId:e.id,renderAsk:ne,agent:A,entries:j,onClose:()=>T(void 0)}),(0,Y.jsxs)(We,{overlay:V.pillVisible?(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,Y.jsx)(mr,{onJump:V.jumpToLatest})}):null,children:[(0,Y.jsx)(Zn,{runId:e.id,agents:v,onSelect:T},`agents:${e.id}`),(0,Y.jsx)(sr,{skills:y}),l!==void 0&&l.length>0?(0,Y.jsx)(ir,{runId:e.id,entries:l,settled:_},e.id):null,(0,Y.jsx)(St,{run:e}),d?(0,Y.jsxs)(`div`,{"data-slot":`budget-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(U,{tone:`pending`,pulse:!0}),`Budget reached — spent $`,d.spent.toFixed(2),` of $`,d.ceiling.toFixed(2),`; send a message to continue.`]}):e.status===`waiting`?(0,Y.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(U,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,m?(0,Y.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(U,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,Y.jsx)(qe,{run:e,draft:M,diffComments:F,continueAction:h,getMentionCandidates:()=>di(t)})]})]})}function Di({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,Y.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,Y.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,Y.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,Y.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,Y.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Oi(e,t){let n=t.turns.at(-1);return n===void 0?e.startedAt:n.completed===void 0?n.startedAt??e.startedAt:n.completed.ts??e.startedAt}function ki({run:e}){let t=V(i().data??[],e.id);return(0,Y.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,Y.jsx)(U,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,Y.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{Ti as TaskThreadRoute};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n}from"./button-CjSjKnkd.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`textarea`,{"data-slot":`textarea`,className:n(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{i as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{r as t,t as n}from"./centered-state-T0J7VmBb.js";var r=e();function i(){return(0,r.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,r.jsx)(n,{icon:(0,r.jsx)(t,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{i as t};