@open-mercato/cezar 0.16.0 → 0.16.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 (109) hide show
  1. package/dist/contract/agent-profiles.d.ts +2 -2
  2. package/dist/contract/index.js +3 -0
  3. package/dist/contract/projects.d.ts +4 -0
  4. package/dist/core/backend-detect.js +10 -0
  5. package/dist/core/backend-detect.js.map +1 -1
  6. package/dist/core/codex-app-server-runner.d.ts +3 -0
  7. package/dist/core/codex-app-server-runner.js +46 -4
  8. package/dist/core/codex-app-server-runner.js.map +1 -1
  9. package/dist/core/cursor-bin.d.ts +7 -0
  10. package/dist/core/cursor-bin.js +11 -0
  11. package/dist/core/cursor-bin.js.map +1 -1
  12. package/dist/core/provider-auth.d.ts +25 -7
  13. package/dist/core/provider-auth.js +141 -17
  14. package/dist/core/provider-auth.js.map +1 -1
  15. package/dist/core/usage-limit.js +51 -6
  16. package/dist/core/usage-limit.js.map +1 -1
  17. package/dist/runs/agent-error-telemetry.d.ts +3 -2
  18. package/dist/runs/agent-error-telemetry.js +24 -3
  19. package/dist/runs/agent-error-telemetry.js.map +1 -1
  20. package/dist/self-update/checkouts.js +8 -4
  21. package/dist/self-update/checkouts.js.map +1 -1
  22. package/dist/server/provider-auth-runtime.js +6 -3
  23. package/dist/server/provider-auth-runtime.js.map +1 -1
  24. package/dist/server/server.d.ts +10 -0
  25. package/dist/server/server.js +12 -3
  26. package/dist/server/server.js.map +1 -1
  27. package/dist/server/terminal/detected-urls.js +6 -1
  28. package/dist/server/terminal/detected-urls.js.map +1 -1
  29. package/dist/workspace/projects.d.ts +2 -0
  30. package/dist/workspace/projects.js.map +1 -1
  31. package/package.json +3 -3
  32. package/web/dist/assets/{agent-task-pickers-DXaIqpJo.js → agent-task-pickers-B5I-IyLy.js} +1 -1
  33. package/web/dist/assets/{alert-dialog-BRafiUQO.js → alert-dialog-DvPnvVvK.js} +1 -1
  34. package/web/dist/assets/arrow-left-BELOeFyX.js +1 -0
  35. package/web/dist/assets/{automation-format-DeGsIrRc.js → automation-format-BL4n19a2.js} +1 -1
  36. package/web/dist/assets/{automations-route-CwLG2JNr.js → automations-route-BXxP0xWu.js} +1 -1
  37. package/web/dist/assets/{button-ZPJ84lSe.js → button-Clwd6u4_.js} +1 -1
  38. package/web/dist/assets/{centered-state-DPvWqO6I.js → centered-state-nM7v9xtl.js} +1 -1
  39. package/web/dist/assets/check-Dt8U0Zvm.js +1 -0
  40. package/web/dist/assets/chevron-left-Df5IsPem.js +1 -0
  41. package/web/dist/assets/chevron-right-VbYrJ_st.js +1 -0
  42. package/web/dist/assets/circle-check-DnEaQ9Rj.js +1 -0
  43. package/web/dist/assets/{collapsible-D5nsq_lY.js → collapsible-Bdyuw-he.js} +1 -1
  44. package/web/dist/assets/{commit-list-Cj_rtptn.js → commit-list-xMdmPYbz.js} +1 -1
  45. package/web/dist/assets/{compare-variants-DI8e5hXy.js → compare-variants-BWaSra3R.js} +1 -1
  46. package/web/dist/assets/{dashboard-Bq8Zgcct.js → dashboard-i4GP_SB1.js} +1 -1
  47. package/web/dist/assets/{diff-Dzk_1Vj_.js → diff-CJKocK17.js} +2 -2
  48. package/web/dist/assets/{diff-stat-CG6Qr4ac.js → diff-stat-CiWUpWY0.js} +1 -1
  49. package/web/dist/assets/{diff-view-CnRMn9fw.js → diff-view-DqWj0yYe.js} +1 -1
  50. package/web/dist/assets/{download-CAIBRPES.js → download-DOJ8Dqfh.js} +1 -1
  51. package/web/dist/assets/{file-BuJHbBa7.js → file-1a6_DhLG.js} +1 -1
  52. package/web/dist/assets/{file-preview-Dy3TYcU4.js → file-preview-iucr8WDo.js} +1 -1
  53. package/web/dist/assets/{file-text-DYR0Kxgo.js → file-text-DmMQx3hx.js} +1 -1
  54. package/web/dist/assets/{git-pull-request-draft-tzNd17hB.js → git-pull-request-draft-Cn24ayXz.js} +1 -1
  55. package/web/dist/assets/git-tab-loading-BfC2ir8N.js +1 -0
  56. package/web/dist/assets/{git-toolbar-Dc6kAzPv.js → git-toolbar-DU5Ca6RI.js} +1 -1
  57. package/web/dist/assets/{github-k0H4K2Xv.js → github-uQ7k7SEK.js} +1 -1
  58. package/web/dist/assets/{host-usage-BmL2kzAM.js → host-usage-DjDYDU0A.js} +1 -1
  59. package/web/dist/assets/{icon-tooltip-BEOrU9g6.js → icon-tooltip-YXzUubMO.js} +1 -1
  60. package/web/dist/assets/{index-B7LeGGi2.js → index-Cse8uyXO.js} +4 -4
  61. package/web/dist/assets/{input-NF_gJ6fV.js → input-DIWTlsx6.js} +1 -1
  62. package/web/dist/assets/{layout-cards-Cx4pRGy3.js → layout-cards-Sur4EWtx.js} +1 -1
  63. package/web/dist/assets/loader-circle-D-ter0qP.js +1 -0
  64. package/web/dist/assets/{markdown-D27e_KDW.js → markdown-BzqT8I8y.js} +1 -1
  65. package/web/dist/assets/{markdown-DUNEzJJg.js → markdown-Rbaca31B.js} +1 -1
  66. package/web/dist/assets/{message-square-DHEW7I0Y.js → message-square-EWpWB_Gr.js} +1 -1
  67. package/web/dist/assets/plus-CBVm02wz.js +1 -0
  68. package/web/dist/assets/{project-router-CIOAbq2D.js → project-router-DZsR9P9C.js} +1 -1
  69. package/web/dist/assets/{queries-B--Cyn_0.js → queries-CI0EmEcH.js} +1 -1
  70. package/web/dist/assets/{reference-chip-C0KB59wJ.js → reference-chip-DnemrSPW.js} +1 -1
  71. package/web/dist/assets/{repo-git-BlEiXMbR.js → repo-git-CxAx2JBB.js} +1 -1
  72. package/web/dist/assets/{run-diff-C_AD_Pms.js → run-diff-BPZ85gAE.js} +1 -1
  73. package/web/dist/assets/{save-Ct323V7q.js → save-B8DEQI2V.js} +1 -1
  74. package/web/dist/assets/{scroll-within-DVYNEANz.js → scroll-within-Cm6fjjNd.js} +1 -1
  75. package/web/dist/assets/{search-x-7tkSEIRx.js → search-x-CuinYQnl.js} +1 -1
  76. package/web/dist/assets/{settings-2-CmkgM6rX.js → settings-2-COky68xN.js} +1 -1
  77. package/web/dist/assets/{skills-DKqFJCnx.js → skills-B1z9gRg4.js} +1 -1
  78. package/web/dist/assets/{square-Du4NO0cr.js → square-8OFxLPoA.js} +1 -1
  79. package/web/dist/assets/{tabs-BhcbXPq1.js → tabs-BUk8rSoE.js} +1 -1
  80. package/web/dist/assets/{tag-DczwHOyX.js → tag-yruQH0i-.js} +1 -1
  81. package/web/dist/assets/{task-commits-DtSkB1UU.js → task-commits-W1ZZiEt4.js} +1 -1
  82. package/web/dist/assets/{task-graph-DalcExDj.js → task-graph-fkOtF8MX.js} +1 -1
  83. package/web/dist/assets/{task-notes-BHYduZ1z.js → task-notes-lmvd1UM7.js} +1 -1
  84. package/web/dist/assets/{task-workspace-LhAGqT6q.js → task-workspace-DA3mFwL9.js} +3 -3
  85. package/web/dist/assets/{terminal-tordSBUt.js → terminal-F3ZJ5fI8.js} +1 -1
  86. package/web/dist/assets/{terminal-drawer-Cvbqz2QG.js → terminal-drawer-DAkquqSe.js} +2 -2
  87. package/web/dist/assets/{textarea-Dy9f469S.js → textarea-ewNKsXDa.js} +1 -1
  88. package/web/dist/assets/{token-metrics-edH1Iifj.js → token-metrics-Dk2ZNHb_.js} +1 -1
  89. package/web/dist/assets/{tooltip-tycRJnh-.js → tooltip-B628Gs7C.js} +1 -1
  90. package/web/dist/assets/{tracker-BNqQ5hFE.js → tracker-wxG0l2wk.js} +1 -1
  91. package/web/dist/assets/{triangle-alert-BDB8QKSV.js → triangle-alert-BqI_9MkV.js} +1 -1
  92. package/web/dist/assets/{upload-H7_s70Ro.js → upload-J0hBTVF7.js} +1 -1
  93. package/web/dist/assets/{use-automations-7Eect_3d.js → use-automations-v77gHYDG.js} +1 -1
  94. package/web/dist/assets/{use-now-DUGH_55J.js → use-now-pBdvhv13.js} +1 -1
  95. package/web/dist/assets/{use-submit-shortcut-D4G7Y1CV.js → use-submit-shortcut-hAaAH4HY.js} +1 -1
  96. package/web/dist/assets/{workflow-graph-4GB6HfLn.js → workflow-graph-Bo72pTbt.js} +1 -1
  97. package/web/dist/assets/worktree-lifecycle-operation-DOTiqQFx.js +18 -0
  98. package/web/dist/assets/x-DMIsmLBt.js +1 -0
  99. package/web/dist/index.html +37 -37
  100. package/web/dist/assets/arrow-left-BfLRAgF_.js +0 -1
  101. package/web/dist/assets/check-Blje0ysd.js +0 -1
  102. package/web/dist/assets/chevron-left-CwNUPSrV.js +0 -1
  103. package/web/dist/assets/chevron-right-dAzuginM.js +0 -1
  104. package/web/dist/assets/circle-check-B_-oU6Lf.js +0 -1
  105. package/web/dist/assets/git-tab-loading-BL6wGQi_.js +0 -1
  106. package/web/dist/assets/loader-circle-i7B5PoZa.js +0 -1
  107. package/web/dist/assets/plus-CUeDPNAL.js +0 -1
  108. package/web/dist/assets/worktree-lifecycle-operation-C6S6Hgiq.js +0 -18
  109. package/web/dist/assets/x-PavsP4k3.js +0 -1
@@ -0,0 +1,18 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Nt as r,Qt as i,Sa as a,Ut as o,Yi as s,br as c,it as l,r as ee,s as te,u,wr as d,xi as f}from"./queries-CI0EmEcH.js";import{F as p,_t as m,gt as ne,r as h,t as g}from"./button-Clwd6u4_.js";import{f as _,t as v}from"./project-router-DZsR9P9C.js";import{D as re,E as ie,T as y,a as ae,i as oe,r as se,w as b}from"./reference-chip-DnemrSPW.js";import{h as ce,l as le,m as ue,t as x}from"./use-now-pBdvhv13.js";import{an as de,d as fe,f as pe,h as me,ln as he,m as ge,on as _e,p as ve,un as ye,zt as S}from"./git-tab-loading-BfC2ir8N.js";import{n as be}from"./file-1a6_DhLG.js";import{t as C}from"./check-Dt8U0Zvm.js";import{t as xe}from"./icon-tooltip-YXzUubMO.js";import{t as Se}from"./loader-circle-D-ter0qP.js";import{t as Ce}from"./use-submit-shortcut-hAaAH4HY.js";import{t as we}from"./square-8OFxLPoA.js";import{t as Te}from"./x-DMIsmLBt.js";import{a as w,c as Ee,i as De,n as T,o as E,r as Oe,s as D,t as O}from"./alert-dialog-DvPnvVvK.js";import{t as ke}from"./centered-state-nM7v9xtl.js";var k=p(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),A=p(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Ae=p(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),je=p(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),j=e(t(),1),Me=new Set([`ai`,`cezar`,`agents`,`team`]);function M(e){return Me.has(e.source)}function N(e){return[...e].sort((e,t)=>Number(!M(e))-Number(!M(t)))}var Ne=5;function Pe(e,t,{mostUsedLimit:n=Ne}={}){let r=e.map((e,n)=>({skill:e,index:n,count:F(t,e.name)})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count||Number(!M(e.skill))-Number(!M(t.skill))||e.index-t.index).slice(0,n).map(e=>e.skill),i=new Set(r),a=e.filter(e=>!i.has(e));return{mostUsed:r,project:a.filter(M),global:a.filter(e=>!M(e))}}function P(e,t){let n=Pe(e,t);return[...n.mostUsed,...n.project,...n.global]}function F(e,t){if(!e||!Object.hasOwn(e,t))return 0;let n=e[t];return typeof n==`number`?n:0}function Fe(e,t){return{...e,[t]:F(e,t)+1}}function Ie(e,t){if(t===``)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e of r){if(i=n.indexOf(e,i),i===-1)return!1;i+=1}return!0}function I(e,t){let n=[];for(let r of e)for(let e of r.steps??[])e.skill===t&&n.push(`${r.name} › ${e.name??e.id}`);return n}var L=/[\s\-/_.]/;function R(e,t){let n=0;for(let r=e.indexOf(t);r!==-1;r=e.indexOf(t,r+1)){let i=1,a=e[r-1];if(r===0||a!==void 0&&L.test(a)){let n=e[r+t.length];i=n===void 0||L.test(n)?3:2}if(i>n&&(n=i),n===3)break}return n}function z(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=[e,...n??[]].join(` `).toLowerCase(),a=0;for(let e of r){let t=R(i,e);if(t===0)return 0;a+=t}return a/(r.length*3)}function Le(e,t){if(t===``)return 1;let n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 6;if(n.startsWith(r))return 5;let i=n.indexOf(r);if(i>0){let e=n[i-1];return e!==void 0&&L.test(e)?4:3}return+!!Ie(n,r)}function B(e,t){let n=e.split(`-`).filter(Boolean);return t?[...n,t]:n}var Re=10;function V(e,t,n){let r=n.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=0;for(let n of r){let r=Le(e,n),a=t?Le(t,n):0;if(r===0&&a===0)return 0;i+=r>0?r+Re:a}return i}var H=.5;function U(e,t,n){return t.trim()===``?[...e]:e.map((e,r)=>{let i=V(e.name,e.description,t),a=F(n,e.name),o=Math.min(a,Ne)*H;return{item:e,index:r,count:a,score:i>0?i+o:0}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||t.count-e.count||e.index-t.index).map(e=>e.item)}function W(e,t,n){return U(e,t,n)}function ze(e,t){return U(e,t)}function Be(e,t,n){return U(P(e,n),t,n)}function G(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function K(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Ve(e,t,{inEditable:n=!1}={}){if(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat)return!1;if(G(e.target)&&!K(e.target)){if(!n)return!1;let t=S();if(e.target instanceof HTMLElement&&e.target.closest(`.xterm`))return t&&e.metaKey;if(t?!e.metaKey:!e.ctrlKey)return!1}return!0}function He(e,t,n={}){let r=j.useRef(t);j.useLayoutEffect(()=>{r.current=t});let i=n.inEditable===!0;j.useEffect(()=>{let t=t=>{Ve(t,e,{inEditable:i})&&(t.preventDefault(),r.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,i])}function q(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||G(e.target))}function Ue(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function We(e,t){let n=j.useRef(t);j.useLayoutEffect(()=>{n.current=t}),j.useEffect(()=>{let t=t=>{q(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var J=`cezar:recent-tasks:v1`,Y=null;function Ge(){if(Y)return Y;try{let e=JSON.parse(window.localStorage.getItem(J)??`[]`);Y=Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{Y=[]}return Y}function Ke(){return Ge()}function qe(e){let t=[e,...Ge().filter(t=>t!==e)].slice(0,30);Y=t;try{window.localStorage.setItem(J,JSON.stringify(t))}catch{}}function Je(e,t,n){let r=new Map(n.map((e,t)=>[e,t])),i=e.filter(e=>r.has(t(e)));return i.sort((e,n)=>r.get(t(e))-r.get(t(n))),[...i,...e.filter(e=>!r.has(t(e)))]}var X=null,Z=null;function Ye(e){X=e}function Xe(e){X===e&&(X=null)}function Ze(e){return e!==void 0&&X?.runId===e?X:null}function Qe(e,t){Z={runId:e,path:t}}function $e(e){if(Z?.runId!==e)return null;let{path:t}=Z;return Z=null,t}var et=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],tt={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,junie:`Junie`,copilot:`GitHub Copilot CLI`};function nt(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of et){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function rt(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return et.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:tt[e],authFailureId:r.authFailureId}]})}function it(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function at(){let e=u(),t=l(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),r=t.data?.info?.root;return{accounts:n,repoAccount:ot(r?e.data?.selections?.[r]:void 0,e.data?.defaults)}}function ot(e,t){let n={};for(let r of[t,e])for(let[e,t]of Object.entries(r??{}))t&&(n[e]=t);return Object.keys(n).length>0?n:void 0}function st(e,t){return`${tt[e]} account "${t.replace(/"/g,``)}" is not signed in. Sign it in under Settings → Agent accounts, or choose another account for this task.`}function ct(e,t){let n=a(),r=u().data?.profiles.find(n=>n.provider===e&&n.id===t&&!n.isDefault),o=r?ne(r):``,s=r?.status,c=te(o,r!==void 0&&s?.status!==`connected`).data?.status??(s?.status===`connected`?s:void 0),l=t=>r&&t!==void 0&&t!==`connected`?st(e,r.label||r.id):null;return{blocked:l(c?.status),verify:async()=>{if(!r)return null;try{let e=await d(o,{refresh:!0});return n.setQueryData(i.agentAccountStatus(o),e),l(e.status.status)}catch{return null}}}}function lt(e,t){return e.filter(e=>e.provider===t).length>1}var ut=80,dt=m,ft=50,pt=200,mt=50,ht=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`},{id:`review-open-prs`,label:`Review open PRs`,text:'Check this repository\'s open pull requests that still need a review (use `gh pr list --state open --json number,title,headRefName,isDraft,reviewDecision` and skip drafts and PRs already approved). For each one, dispatch a separate review task with `cez task create --kind review --review-of <headRefName> --title "Review PR #<number>" "Review pull request #<number> (<title>) on branch <headRefName>: read the diff, run the tests, and report a verdict with findings."`, at most 4 at a time. Then end your turn with CEZ:MONITORING and, when their reports arrive, summarise every verdict in one message. If `cez task create` is refused or unavailable, stop and report that dispatch is disabled on this cockpit — do not review the PRs yourself and do not use sub-agents instead.'},{id:`create-automation`,label:`Create an automation`,skills:[`create-cezar-automation`],text:`Create an automation for this repository.
2
+ Trigger: <when — e.g. every new pull request; every issue labelled \`needs-agent\`; every day at 04:00; weekdays at 07:30; every 6 hours>.
3
+ Task for each run: <what the launched task must do — e.g. review the diff, run the tests and post findings as a review comment>.
4
+ Leave it paused and, for a GitHub trigger, preview its matches so I can check the filter before enabling it.`}],gt=new Set([`review-open-prs`]),_t=new Set([`create-automation`]);function vt(e,t){return e.filter(e=>(t?.dispatch===!0||!gt.has(e.id))&&(t?.automations===!0||!_t.has(e.id)))}function yt(e){return!!e&&typeof e==`object`}function bt(e){if(e===void 0||!Array.isArray(e))return ht.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!yt(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=xt(r.skills);if(n.push({id:e,label:i.slice(0,ut),text:a.slice(0,dt),...o.length>0?{skills:o}:{}}),n.length>=ft)break}return n}function xt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,pt)),t.size>=mt))break}return[...t]}function St(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Ct(e,t){return St(e,t).map(e=>e.text).join(`
5
+
6
+ `)}function wt(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function Tt(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Et(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
7
+
8
+ `)?``:i.endsWith(`
9
+ `)?`
10
+ `:`
11
+
12
+ `);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
13
+
14
+ `)?``:s.startsWith(`
15
+ `)?`
16
+ `:`
17
+
18
+ `),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}var Q=new Map;function Dt(e){let t=Q.get(e.data);return t||(t=s(me(e)).then(e=>typeof e?.uploadId==`string`?e.uploadId:null,e=>(de(e),null)),Q.set(e.data,t),t.then(n=>{n===null&&Q.get(e.data)===t&&Q.delete(e.data)})),t}async function Ot(e){let t=await Dt(e);return t===null?me(e):{uploadId:t,...e.originalName?{name:e.originalName}:{}}}function kt(e){for(let t of e){let e=Q.get(t.data);e&&(Q.delete(t.data),e.then(e=>e===null?void 0:c(e)).catch(()=>{}))}}function At(e){for(let t of e)Q.delete(t.data)}function jt(e){return e instanceof Error&&e.message.includes(`attachment upload expired — attach the file again`)}async function Mt(e,t){if(e.length===0)return t([]);try{return await t(await Promise.all(e.map(Ot)))}catch(n){if(!jt(n))throw n;At(e);try{let n=await t(await Promise.all(e.map(Ot)));return he(`recovered`),n}catch(e){throw he(`failed`),e}}}var Nt=new Set([`/`,`@`]);function Pt(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(Nt.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Ft(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function It(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Lt(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}var Rt=`Dictation needs https or localhost`,zt=`Dictation is not available in this browser`,Bt=`Dictation needs a newer Cezar app — update it to use the microphone`;function Vt(){let e=window.__CEZ_DESKTOP__;return e?.platform!==`macos`&&document.documentElement.dataset.cezDesktop!==`macos`?null:{microphone:e?.microphone===!0}}function Ht(){return window.isSecureContext===!1?Rt:Wt?zt:Vt()?.microphone===!1?Bt:null}function Ut(e){switch(e){case`aborted`:return null;case`no-speech`:return{message:`Dictation heard nothing — try again`,failure:null};case`not-allowed`:return{message:Vt()?`Dictation needs microphone access — allow Cezar in System Settings → Privacy & Security → Microphone and Speech Recognition`:`Dictation needs microphone access — allow it for this site in the browser settings`,failure:e};case`service-not-allowed`:return{message:zt,failure:e};case`audio-capture`:return{message:`Dictation failed — no microphone was found`,failure:e};case`network`:return{message:`Dictation failed — the speech service could not be reached`,failure:e};default:return{message:`Dictation failed${e?` — ${e}`:``}`,failure:e||`unknown`}}}var Wt=!1;function Gt(e){let[t,n]=j.useState(null),r=j.useRef(null),i=j.useRef(``),[a]=j.useState(()=>It()!==void 0),[o,s]=j.useState(Ht),c=j.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return j.useEffect(()=>c,[c]),{supported:a,unavailable:o,recording:t,start:j.useCallback(()=>{if(r.current||o)return;let t=It();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let o=Date.now();a.onresult=e=>{let t=Lt(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:o})},a.onerror=t=>{c(),t.error===`service-not-allowed`&&(Wt=!0,s(zt));let n=Ut(t.error);n&&e(n)},a.start(),r.current=a,n({transcript:``,startedAt:o})}catch{e({message:`Dictation failed — the microphone could not be started`,failure:`start-threw`}),c()}},[e,c,o]),cancel:j.useCallback(()=>c(),[c]),finish:j.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function Kt(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var $=n(),qt={KeyA:`Yes, approved.`,KeyC:`Continue.`};function Jt({onSubmit:e,value:t,onValueChange:n,images:i,onImagesChange:s,autoFocus:c=!1,draftItems:l,footerStart:te,footerEnd:u,sendAriaLabel:d=`Send`,stop:p,disabled:m=!1,disabledReason:ne=`Session closed — Continue to reopen.`,allowEmptySubmit:v=!1,placeholder:re=`Reply — / for skills, @ for files…`,ariaLabel:ie=`Reply to the agent`,autocompleteSkills:y=!0,quickReplies:b=!1,getMentionCandidates:x,ref:de}){let[me,he]=(0,j.useState)(``),S=t??me,C=(0,j.useRef)(S);C.current=S;let Se=(0,j.useRef)(n);Se.current=n;let w=(0,j.useCallback)(e=>{let t=typeof e==`function`?e(C.current):e;he(t),Se.current?.(t)},[]),[Ee,De]=(0,j.useState)([]),T=i??Ee,E=(0,j.useRef)(T);E.current=T;let Oe=(0,j.useRef)(s);Oe.current=s;let D=(0,j.useCallback)((e,t=`edit`)=>{let n=typeof e==`function`?e(E.current):e;E.current=n,De(n),Oe.current?.(n,t)},[]),[O,ke]=(0,j.useState)(!1),[k,A]=(0,j.useState)(null),[Me,N]=(0,j.useState)(``),[Ne,Pe]=(0,j.useState)(!1),P=(0,j.useRef)(null),F=(0,j.useRef)(null),I=(0,j.useRef)(null),L=(0,j.useRef)(new Map),R=r(y&&Ne),z=o(),Le=a(),B=Gt(({message:e,failure:t})=>{t&&_e(t),_(e,t?{tone:`danger`,reported:!0}:{})});(0,j.useEffect)(()=>{c&&P.current?.focus()},[]),(0,j.useImperativeHandle)(de,()=>({insertAtCaret:e=>{let t=P.current,n=Et(C.current,t?.selectionStart??C.current.length,e);w(n.text),I.current=n.caret,t?.focus()}}),[w]);let Re=(0,j.useCallback)(()=>{let e=P.current;if(!e||m){A(null);return}let t=Pt(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!y||t?.trigger===`@`&&x===void 0)return A(null);t?.trigger===`/`&&Pe(!0),A(t)},[y,m,x]),V=(0,j.useMemo)(()=>k===null?[]:k.trigger===`/`?Be(R.data??[],k.query,z.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:M(e)})):(x?.()??[]).filter(e=>Ie(e,k.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[x,R.data,k,z.data?.skillUsage]),H=V.some(e=>e.value===Me)?Me:V[0]?.value,U=k!==null,W=(0,j.useCallback)(()=>A(null),[]),ze=e=>{let t=P.current;if(!t||k===null)return;let n=t.selectionStart??t.value.length,r=Ft(t.value,k,n,e.insert);k.trigger===`/`&&z.data!==void 0&&f({skillUsage:Fe(z.data.skillUsage,e.insert)}).then(()=>Le.invalidateQueries({queryKey:ee.uiState})).catch(()=>{}),w(r.text),I.current=r.caret,A(null),t.focus()};(0,j.useEffect)(()=>{!U||H==null||L.current.get(H)?.scrollIntoView({block:`nearest`})},[H,U]),(0,j.useLayoutEffect)(()=>{let e=I.current,t=P.current;e!==null&&t&&(t.setSelectionRange(e,e),I.current=null)},[S]),(0,j.useLayoutEffect)(()=>{let e=P.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[S]);let K=(0,j.useCallback)((e,t=`file`)=>{if(m)return;let n=ge(e,E.current.length,pe(E.current));for(let e of n.rejected)_(e,{tone:`danger`});for(let e of n.accepted)ve(e,t).then(e=>{let t=fe(E.current,e);t&&(Dt(e),D(t))})},[m]),Ve=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),K(t,`clipboard`))},He=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),K(t))},q=(0,j.useCallback)(async(t,n,r,i)=>{let a=t.trim();if(!(m||O)&&!(a===``&&n.length===0&&!v)){ke(!0);try{await Mt(n,t=>i?e(a,t,i):e(a,t)),kt(n),ye(n.length)}catch(e){if(_(e instanceof Error?e.message:String(e),{tone:`danger`}),r){w(e=>e===``?t:`${t}\n${e}`);let e=[],r=E.current.reduce((t,n)=>{let r=fe(t,n);return r||e.push(n),r??t},n);for(let t of e)_(`“${t.name}” removed — the restored message fills the attachment limit`,{tone:`danger`});D(r)}}finally{ke(!1)}}},[v,O,m,e]),Ue=(0,j.useCallback)(()=>{if(S.trim()===``&&T.length===0&&!v)return;let e=S,t=T;w(``),D([],`submit`),A(null),q(e,t,!0)},[v,T,q,S]),We=e=>{if(U){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),V.length===0)return;let t=V.findIndex(e=>e.value===H),n=e.key===`ArrowDown`?1:-1,r=V[(t+n+V.length)%V.length];N(r.value);return}if(e.key===`Escape`){e.preventDefault(),W();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=V.find(e=>e.value===H);if(t){e.preventDefault(),ze(t);return}W()}}if(e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){e.currentTarget.blur();return}Ce({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Ue())};(0,j.useEffect)(()=>{if(!b||m)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||G(e.target))return;let t=qt[e.code];t!==void 0&&(e.preventDefault(),q(t,[],!1,{quickReply:!0}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,b,q]);let J=e=>{let t=B.finish();if(t===``)return;let n=S.trim()===``?t:`${S.replace(/\s*$/,``)} ${t}`;if(e){w(``),D([],`submit`),q(n,T,!0);return}w(n),I.current=n.length,P.current?.focus()},Y=B.recording;return(0,$.jsxs)(se,{open:U,onOpenChange:e=>e?void 0:W(),children:[(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsxs)(`div`,{ref:F,"data-slot":`composer`,"data-disabled":m||void 0,onDrop:He,onDragOver:e=>e.preventDefault(),className:h(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,m&&`opacity-80`),children:[T.length>0||l?(0,$.jsxs)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap items-center gap-2 px-4 pt-3`,children:[l,T.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:h(`group relative overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{kt([e]),D(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,$.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,$.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,$.jsx)(Te,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))]}):null,(0,$.jsx)(`textarea`,{ref:P,rows:1,value:S,disabled:m,"aria-label":ie,placeholder:m?ne:re,className:`block max-h-[220px] min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,onChange:e=>{w(e.target.value),Re()},onKeyDown:We,onSelect:Re,onPaste:Ve}),Y?(0,$.jsx)(Xt,{transcript:Y.transcript,startedAt:Y.startedAt,onCancel:B.cancel,onInsert:()=>J(!1),onInsertAndSend:()=>J(!0)}):(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[(0,$.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,$.jsx)(Yt,{disabled:m,onFiles:K}),te]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[B.supported&&B.unavailable?(0,$.jsx)(xe,{label:B.unavailable,side:`top`,children:(0,$.jsxs)(g,{type:`button`,variant:`ghost`,size:`sm`,"aria-disabled":`true`,"aria-label":`Start dictation`,className:`h-8 cursor-not-allowed gap-1.5 px-2.5 text-xs font-medium text-muted-foreground opacity-50 hover:bg-transparent`,children:[(0,$.jsx)(Ae,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]})}):B.supported?(0,$.jsxs)(g,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:B.start,children:[(0,$.jsx)(Ae,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,u?(0,$.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:u}):null,p?(0,$.jsx)(xe,{label:p.label,side:`top`,children:(0,$.jsx)(g,{type:`button`,size:`icon-sm`,variant:`contrast`,"data-slot":`composer-stop`,"aria-label":p.label,disabled:p.pending,className:`size-8`,onClick:p.onStop,children:(0,$.jsx)(we,{"aria-hidden":`true`,className:`size-3 fill-current`})})}):null,!p||S.trim()!==``||T.length>0||v?(0,$.jsx)(g,{type:`button`,size:`icon-sm`,"aria-label":d,disabled:m||O||S.trim()===``&&T.length===0&&!v,className:`size-8`,onClick:Ue,children:(0,$.jsx)(be,{"aria-hidden":`true`})}):null]})]})]})}),(0,$.jsx)(ae,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},children:(0,$.jsx)(le,{shouldFilter:!1,value:H??``,onValueChange:N,children:(0,$.jsx)(ce,{"data-slot":`composer-menu`,"data-trigger":k?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:V.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:k?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:R.isPending?`Loading skills…`:`No matching skills.`}):V.map(e=>(0,$.jsxs)(ue,{ref:t=>{t?L.current.set(e.value,t):L.current.delete(e.value)},value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>ze(e),children:[(0,$.jsx)(`span`,{className:h(`shrink-0 truncate`,e.emphasized&&`font-semibold`,k?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Yt({disabled:e,onFiles:t}){let n=(0,j.useRef)(null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach images or files (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,$.jsx)(je,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,$.jsx)(`input`,{ref:n,type:`file`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Xt({transcript:e,startedAt:t,onCancel:n,onInsert:r,onInsertAndSend:i}){let a=x(1e3);return(0,$.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:Kt(t,a)}),(0,$.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,$.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,$.jsx)(Te,{"aria-hidden":`true`})}),(0,$.jsx)(g,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:r,children:(0,$.jsx)(C,{"aria-hidden":`true`})}),(0,$.jsx)(g,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:i,children:(0,$.jsx)(be,{"aria-hidden":`true`})})]})}function Zt(){return(0,$.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(ke,{icon:(0,$.jsx)(Se,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}var Qt={retry:`Retry`,"start-anyway":`Start task anyway`,"cancel-task":`Cancel task`,"keep-worktree":`Keep worktree`,"force-delete":`Force delete`,stop:`Stop scripts`},$t=new Set([`start-anyway`,`cancel-task`,`keep-worktree`,`force-delete`]);function en(e,t){switch(e){case`force-delete`:return`Skip remaining cleanup commands and ${t.intent===`delete-task`?`delete this task and its worktree`:`remove this worktree`}? Containers, volumes, and other resources may remain. ${t.intent===`reclaim`?`The task branch is kept.`:`The managed task branch is removed.`}`;case`start-anyway`:return`Start the task with an incomplete environment? Remaining setup commands will be skipped.`;case`cancel-task`:return`Cancel this task? The worktree and resources already created are kept; cleanup remains explicit.`;case`keep-worktree`:return`Keep this worktree and suppress automatic cleanup for this generation? Some resources may already have been stopped.`;default:return``}}function tn(e){return e.state===`completed`?e.phase===`setup`?`Worktree ready`:`Worktree cleanup complete`:e.state===`bypassed`?`Setup bypassed`:e.state===`kept`?`Worktree kept — automatic cleanup suppressed`:e.state===`cancelled`?`Task cancelled — worktree retained`:e.state===`needs_attention`||e.state===`interrupted`?e.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`:e.state===`committing`?e.phase===`setup`?`Finishing worktree preparation`:`Removing worktree`:e.phase===`setup`?`Preparing worktree`:`Cleaning up worktree`}function nn({operationId:e,worktreePath:t,taskTitle:n}){let r=y(e),i=b(e),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(!1),l=ie(e,s),ee=(0,j.useRef)(null),[te,u]=(0,j.useState)(Date.now()),d=r.data?.operation.state===`running`;if((0,j.useEffect)(()=>{if(!d)return;let e=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(e)},[d]),r.isPending)return(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading worktree operation…`});if(r.isError)return(0,$.jsxs)(`p`,{role:`alert`,className:`text-xs text-danger`,children:[`Worktree operation could not load: `,r.error.message]});let f=r.data.operation,p=async e=>{o(null);try{await i.mutateAsync({action:e,requestId:crypto.randomUUID(),expectedRevision:f.revision}),ee.current?.focus()}catch{}},m=[...new Map((l.data?.pages.flatMap(e=>e.items)??[]).map(e=>[e.seq,e])).values()].sort((e,t)=>e.seq-t.seq),ne=[`queued`,`running`,`committing`].includes(f.state),h=[`completed`,`bypassed`,`cancelled`,`kept`].includes(f.state);return(0,$.jsxs)(`section`,{"data-slot":`worktree-lifecycle-operation`,className:`rounded-lg border border-border bg-card p-3 text-sm`,children:[(0,$.jsx)(`h2`,{ref:ee,tabIndex:-1,className:`font-medium outline-none`,"aria-live":`polite`,children:tn(f)}),n?(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:n}):null,t?(0,$.jsx)(`p`,{className:`mt-1 break-all font-mono text-[11px] text-muted-foreground`,children:t}):null,f.phase===`setup`&&ne?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`The agent starts after worktree preparation finishes.`}):null,f.error?h?(0,$.jsxs)(`details`,{className:`mt-2 break-words text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`Previous operation error`}),(0,$.jsx)(`p`,{className:`mt-1`,children:f.error})]}):(0,$.jsxs)(`p`,{role:`alert`,className:`mt-2 break-words text-xs text-danger`,children:[f.failureStage===`commit`?`Scripts completed, but the worktree transition failed. `:``,f.error]}):null,(0,$.jsx)(`ol`,{className:`mt-3 space-y-2`,children:f.entries.map(e=>{let t=[...f.history].reverse().find(t=>t.entryId===e.entryId&&t.commandPreview===e.commandPreview),n=t?Math.max(0,Math.round(((t.finishedAt?Date.parse(t.finishedAt):te)-Date.parse(t.startedAt))/1e3)):void 0;return(0,$.jsxs)(`li`,{className:`rounded border border-border px-2 py-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-1 text-xs`,children:[(0,$.jsx)(`span`,{className:`break-words font-medium`,children:e.label}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.state.replaceAll(`-`,` `),e.attempt?` · attempt ${e.attempt}`:``,n===void 0?``:` · ${n}s`]})]}),(0,$.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all text-[11px] text-muted-foreground`,children:e.commandPreview})]},e.entryId)})}),f.history.length?(0,$.jsxs)(`details`,{className:`mt-3 text-xs`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:[`Attempt history (`,f.history.length,`)`]}),(0,$.jsx)(`ol`,{className:`mt-2 space-y-2`,children:f.history.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`span`,{children:[e.label,` · attempt `,e.attempt,` · `,e.state]}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-[11px] text-muted-foreground`,children:e.commandPreview}),e.reason?(0,$.jsx)(`p`,{className:`text-danger`,children:e.reason}):null]},e.id))})]}):null,f.allowedActions.includes(`retry`)?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Retry loads current saved scripts. Unchanged completed commands stay completed; edited commands run again.`}):null,(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[f.allowedActions.map(e=>(0,$.jsx)(g,{size:`sm`,variant:e===`force-delete`||e===`cancel-task`?`danger-ghost`:`outline`,disabled:i.isPending,onClick:()=>$t.has(e)?o(e):void p(e),children:Qt[e]},e)),(0,$.jsx)(g,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,$.jsx)(v,{to:`/settings/worktrees?operation=${encodeURIComponent(e)}`,children:`Edit scripts`})}),(0,$.jsx)(g,{size:`sm`,variant:`ghost`,"aria-expanded":s,onClick:()=>c(e=>!e),children:s?`Hide output`:`Show output`})]}),i.isError?(0,$.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:i.error.message}):null,s?(0,$.jsxs)(`div`,{className:`mt-3`,children:[l.isPending?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading output…`}):null,l.isError?(0,$.jsxs)(`p`,{role:`alert`,className:`text-xs text-danger`,children:[`Output could not load: `,l.error.message]}):null,l.data?.pages.some(e=>e.truncated)?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Some earlier output was truncated.`}):null,(0,$.jsx)(`pre`,{"aria-label":`Script output`,className:`max-h-64 overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-[11px]`,children:m.map(e=>e.text).join(``)||`No output recorded.`}),l.hasNextPage?(0,$.jsx)(g,{size:`sm`,variant:`ghost`,disabled:l.isFetchingNextPage,onClick:()=>void l.fetchNextPage(),children:`Load more output`}):null]}):null,(0,$.jsx)(O,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,$.jsxs)(De,{children:[(0,$.jsxs)(D,{children:[(0,$.jsx)(Ee,{children:a?Qt[a]:`Confirm action`}),(0,$.jsxs)(w,{children:[a?en(a,f):``,(0,$.jsx)(`span`,{className:`mt-2 block break-all font-medium`,children:n??t??`Worktree operation ${e}`})]})]}),(0,$.jsxs)(E,{children:[(0,$.jsx)(Oe,{children:`Go back`}),(0,$.jsx)(T,{onClick:()=>{a&&p(a)},children:a?Qt[a]:`Continue`})]})]})})]})}function rn({worktreeId:e,operationId:t,worktreePath:n,taskTitle:r}){let i=re(e,!t),a=t??[...i.data?.worktree.history??[]].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]?.id;return a?(0,$.jsx)(nn,{operationId:a,worktreePath:n,taskTitle:r}):null}export{We as A,ze as B,Xe as C,Ue as D,qe as E,N as F,k as G,I as H,P as I,Pe as L,Be as M,M as N,G as O,z as P,V as R,Ze as S,Ke as T,je as U,B as V,A as W,nt as _,ht as a,Qe as b,vt as c,bt as d,wt as f,it as g,ct as h,Jt as i,Fe as j,He as k,Et as l,at as m,rn as n,dt as o,lt as p,Zt as r,Ct as s,nn as t,Tt as u,rt as v,Je as w,$e as x,Ye as y,W as z};
@@ -0,0 +1 @@
1
+ import{F as e}from"./button-Clwd6u4_.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
@@ -43,49 +43,49 @@
43
43
  }
44
44
  })()
45
45
  </script>
46
- <script type="module" crossorigin src="/assets/index-B7LeGGi2.js"></script>
46
+ <script type="module" crossorigin src="/assets/index-Cse8uyXO.js"></script>
47
47
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
48
48
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
49
49
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
50
- <link rel="modulepreload" crossorigin href="/assets/button-ZPJ84lSe.js">
51
- <link rel="modulepreload" crossorigin href="/assets/queries-B--Cyn_0.js">
52
- <link rel="modulepreload" crossorigin href="/assets/project-router-CIOAbq2D.js">
53
- <link rel="modulepreload" crossorigin href="/assets/tooltip-tycRJnh-.js">
54
- <link rel="modulepreload" crossorigin href="/assets/circle-check-B_-oU6Lf.js">
55
- <link rel="modulepreload" crossorigin href="/assets/triangle-alert-BDB8QKSV.js">
56
- <link rel="modulepreload" crossorigin href="/assets/git-pull-request-draft-tzNd17hB.js">
57
- <link rel="modulepreload" crossorigin href="/assets/x-PavsP4k3.js">
58
- <link rel="modulepreload" crossorigin href="/assets/token-metrics-edH1Iifj.js">
59
- <link rel="modulepreload" crossorigin href="/assets/reference-chip-C0KB59wJ.js">
60
- <link rel="modulepreload" crossorigin href="/assets/use-now-DUGH_55J.js">
61
- <link rel="modulepreload" crossorigin href="/assets/check-Blje0ysd.js">
62
- <link rel="modulepreload" crossorigin href="/assets/use-automations-7Eect_3d.js">
50
+ <link rel="modulepreload" crossorigin href="/assets/button-Clwd6u4_.js">
51
+ <link rel="modulepreload" crossorigin href="/assets/queries-CI0EmEcH.js">
52
+ <link rel="modulepreload" crossorigin href="/assets/project-router-DZsR9P9C.js">
53
+ <link rel="modulepreload" crossorigin href="/assets/tooltip-B628Gs7C.js">
54
+ <link rel="modulepreload" crossorigin href="/assets/circle-check-DnEaQ9Rj.js">
55
+ <link rel="modulepreload" crossorigin href="/assets/triangle-alert-BqI_9MkV.js">
56
+ <link rel="modulepreload" crossorigin href="/assets/git-pull-request-draft-Cn24ayXz.js">
57
+ <link rel="modulepreload" crossorigin href="/assets/x-DMIsmLBt.js">
58
+ <link rel="modulepreload" crossorigin href="/assets/token-metrics-Dk2ZNHb_.js">
59
+ <link rel="modulepreload" crossorigin href="/assets/reference-chip-DnemrSPW.js">
60
+ <link rel="modulepreload" crossorigin href="/assets/use-now-pBdvhv13.js">
61
+ <link rel="modulepreload" crossorigin href="/assets/check-Dt8U0Zvm.js">
62
+ <link rel="modulepreload" crossorigin href="/assets/use-automations-v77gHYDG.js">
63
63
  <link rel="modulepreload" crossorigin href="/assets/use-desktop-BNN3U2y9.js">
64
- <link rel="modulepreload" crossorigin href="/assets/host-usage-BmL2kzAM.js">
65
- <link rel="modulepreload" crossorigin href="/assets/textarea-Dy9f469S.js">
66
- <link rel="modulepreload" crossorigin href="/assets/icon-tooltip-BEOrU9g6.js">
67
- <link rel="modulepreload" crossorigin href="/assets/terminal-tordSBUt.js">
68
- <link rel="modulepreload" crossorigin href="/assets/upload-H7_s70Ro.js">
69
- <link rel="modulepreload" crossorigin href="/assets/loader-circle-i7B5PoZa.js">
70
- <link rel="modulepreload" crossorigin href="/assets/diff-stat-CG6Qr4ac.js">
71
- <link rel="modulepreload" crossorigin href="/assets/git-toolbar-Dc6kAzPv.js">
72
- <link rel="modulepreload" crossorigin href="/assets/use-submit-shortcut-D4G7Y1CV.js">
73
- <link rel="modulepreload" crossorigin href="/assets/search-x-7tkSEIRx.js">
74
- <link rel="modulepreload" crossorigin href="/assets/collapsible-D5nsq_lY.js">
75
- <link rel="modulepreload" crossorigin href="/assets/alert-dialog-BRafiUQO.js">
76
- <link rel="modulepreload" crossorigin href="/assets/centered-state-DPvWqO6I.js">
77
- <link rel="modulepreload" crossorigin href="/assets/git-tab-loading-BL6wGQi_.js">
78
- <link rel="modulepreload" crossorigin href="/assets/arrow-left-BfLRAgF_.js">
79
- <link rel="modulepreload" crossorigin href="/assets/file-BuJHbBa7.js">
80
- <link rel="modulepreload" crossorigin href="/assets/square-Du4NO0cr.js">
81
- <link rel="modulepreload" crossorigin href="/assets/worktree-lifecycle-operation-C6S6Hgiq.js">
82
- <link rel="modulepreload" crossorigin href="/assets/chevron-right-dAzuginM.js">
83
- <link rel="modulepreload" crossorigin href="/assets/plus-CUeDPNAL.js">
84
- <link rel="modulepreload" crossorigin href="/assets/tabs-BhcbXPq1.js">
85
- <link rel="modulepreload" crossorigin href="/assets/input-NF_gJ6fV.js">
64
+ <link rel="modulepreload" crossorigin href="/assets/host-usage-DjDYDU0A.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/textarea-ewNKsXDa.js">
66
+ <link rel="modulepreload" crossorigin href="/assets/icon-tooltip-YXzUubMO.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/terminal-F3ZJ5fI8.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/upload-J0hBTVF7.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/loader-circle-D-ter0qP.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/diff-stat-CiWUpWY0.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/git-toolbar-DU5Ca6RI.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/use-submit-shortcut-hAaAH4HY.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/search-x-CuinYQnl.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/collapsible-Bdyuw-he.js">
75
+ <link rel="modulepreload" crossorigin href="/assets/alert-dialog-DvPnvVvK.js">
76
+ <link rel="modulepreload" crossorigin href="/assets/centered-state-nM7v9xtl.js">
77
+ <link rel="modulepreload" crossorigin href="/assets/git-tab-loading-BfC2ir8N.js">
78
+ <link rel="modulepreload" crossorigin href="/assets/arrow-left-BELOeFyX.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/file-1a6_DhLG.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/square-8OFxLPoA.js">
81
+ <link rel="modulepreload" crossorigin href="/assets/worktree-lifecycle-operation-DOTiqQFx.js">
82
+ <link rel="modulepreload" crossorigin href="/assets/chevron-right-VbYrJ_st.js">
83
+ <link rel="modulepreload" crossorigin href="/assets/plus-CBVm02wz.js">
84
+ <link rel="modulepreload" crossorigin href="/assets/tabs-BUk8rSoE.js">
85
+ <link rel="modulepreload" crossorigin href="/assets/input-DIWTlsx6.js">
86
86
  <link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
87
87
  <link rel="modulepreload" crossorigin href="/assets/chunk-BO2N2NFS-MDrqQfMl.js">
88
- <link rel="modulepreload" crossorigin href="/assets/markdown-DUNEzJJg.js">
88
+ <link rel="modulepreload" crossorigin href="/assets/markdown-Rbaca31B.js">
89
89
  <link rel="stylesheet" crossorigin href="/assets/index-BCATUrmu.css">
90
90
  </head>
91
91
  <body>
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);export{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{B as r,Ci as i,Cr as a,Ct as o,En as s,F as c,Fn as l,G as u,H as d,I as f,In as p,K as m,Ln as h,Lr as g,On as _,Or as v,Qt as y,R as b,Sa as x,V as S,Xt as C,Y as w,Yn as T,Zi as E,Zn as D,_ as O,_t as ee,ci as k,cr as A,dn as te,gi as ne,gn as re,h as ie,ha as ae,it as oe,j as se,jt as ce,la as le,ln as ue,ma as de,mi as fe,mn as pe,mr as me,oa as he,pn as ge,r as j,rr as _e,sa as ve,si as ye,sn as be,tr as xe,u as Se,un as Ce,vi as we,vn as Te,vr as Ee,wt as De,ya as M,yr as Oe,yt as ke,z as Ae}from"./queries-B--Cyn_0.js";import{At as je,F as N,J as Me,K as Ne,Mt as Pe,Ot as Fe,St as Ie,Ut as Le,bt as Re,i as ze,kt as Be,q as Ve,r as P,t as F}from"./button-ZPJ84lSe.js";import{c as He,d as Ue,f as I,t as We,x as Ge}from"./project-router-CIOAbq2D.js";import{C as Ke,_ as qe,a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,m as et,n as tt,o as nt,p as rt,r as it,t as at,u as ot,v as st,y as ct}from"./reference-chip-C0KB59wJ.js";import{a as lt,i as ut,n as dt,r as ft,t as pt}from"./textarea-Dy9f469S.js";import{t as mt}from"./check-Blje0ysd.js";import{f as ht,i as gt,n as _t,r as vt,t as yt}from"./tooltip-tycRJnh-.js";import{t as bt}from"./circle-check-B_-oU6Lf.js";import{a as xt,c as St,g as Ct,i as L,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./icon-tooltip-BEOrU9g6.js";import{n as At,t as jt}from"./terminal-tordSBUt.js";import{c as R,f as Mt,i as Nt,n as Pt,p as Ft,r as It}from"./git-toolbar-Dc6kAzPv.js";import{n as Lt}from"./upload-H7_s70Ro.js";import{t as Rt}from"./triangle-alert-BDB8QKSV.js";import{t as zt}from"./loader-circle-i7B5PoZa.js";import{r as Bt,t as Vt}from"./use-submit-shortcut-D4G7Y1CV.js";import{t as Ht}from"./search-x-7tkSEIRx.js";import{i as Ut,n as Wt,o as Gt,r as Kt,t as qt}from"./collapsible-D5nsq_lY.js";import{a as Jt,c as Yt,i as Xt,n as Zt,o as Qt,r as $t,s as en,t as tn}from"./alert-dialog-BRafiUQO.js";import{i as nn,t as rn}from"./token-metrics-edH1Iifj.js";import{t as an}from"./diff-stat-CG6Qr4ac.js";import{t as on}from"./centered-state-DPvWqO6I.js";var sn=N(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),cn=N(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),ln=N(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),un=N(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),dn=N(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),fn=N(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),pn=N(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),mn=N(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),hn=N(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),gn=N(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),_n=N(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),vn=N(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),yn=N(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),bn=N(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),xn=N(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),Sn=N(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),Cn=N(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),wn=N(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Tn=N(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),En=N(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Dn=N(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),On=N(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),kn=N(`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`}]]),An=N(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),jn=N(`notebook-text`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),Mn=N(`panel-bottom`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),Nn=N(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Pn=N(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Fn=N(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),In=N(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Ln=N(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Rn=N(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),zn=N(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),Bn=N(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),Vn=N(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),z=e(t(),1),B=n(),Hn=`cez:stale-build-reload-at`,Un=6e4,Wn=!1;function Gn(e=Kn(),t=()=>window.location.reload(),n=Date.now()){if(Wn)return!0;if(!e)return!1;try{let t=Number(e.getItem(Hn));if(Number.isFinite(t)&&t>0&&n-t<Un)return!1;e.setItem(Hn,String(n))}catch{return!1}return Wn=!0,t(),!0}function Kn(){try{return window.sessionStorage}catch{return null}}function V(e,t){try{fetch(e,{method:`POST`,headers:{"content-type":`application/json`,[ve]:le()},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function qn(e){V(`/api/v1/telemetry/event`,{event:`message_sent`,label:e})}function Jn(e){V(`/api/v1/telemetry/event`,{event:`diff_comment_added`,label:e})}function Yn(e){e<1||V(`/api/v1/telemetry/event`,{event:`attachments_sent`,label:Ve(e)})}function Xn(e){V(`/api/v1/telemetry/event`,{event:`attachments_restaged`,label:e})}function Zn(e){V(`/api/v1/telemetry/event`,{event:`add_project_opened`,label:e})}function Qn(e){V(`/api/v1/telemetry/event`,{event:`skills_update_apply_dropped`,label:e})}function $n(e){V(`/api/v1/telemetry/event`,{event:`palette_opened`,label:e})}function er(e){V(`/api/v1/telemetry/event`,{event:`task_switched`,label:e})}function tr(e){for(let t of e)V(`/api/v1/telemetry/event`,{event:`palette_mode_used`,label:t})}function nr(e){V(`/api/v1/telemetry/event`,{event:`palette_dismissed`,label:e})}function rr(e){let t=Me(e);t&&V(`/api/v1/telemetry/event`,{event:`shortcut_rebound`,label:t})}function ir(e,t){let n=e.trim().toLowerCase();if(n===``)return[];let r=t?[t]:[];return t===`files`?r:(/^(?:(?:pr|issue)\s*)?#?\d{1,7}$/.test(n)&&r.push(`pr_number`),/\bauto/.test(n)&&r.push(`automation`),r)}function ar(e,t=6e4){let n=new Map,r,i=()=>{clearTimeout(r),r=void 0;for(let[t,r]of n){let[n,i]=t.split(`\0`);for(let t=r;t>0;t-=1e3)e(n,i,Math.min(t,1e3))}n.clear()};return{add:(e,a)=>{let o=`${e}\u0000${a}`;n.set(o,(n.get(o)??0)+1),r??=setTimeout(i,t)},flush:i}}var or=ar((e,t,n)=>V(`/api/v1/telemetry/event`,{event:e,label:t,value:n}));typeof window<`u`&&(window.addEventListener(`pagehide`,or.flush),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&or.flush()}));function sr(e,t){let n=Me(e);n&&or.add(t===`palette`?`task_command_run`:`task_shortcut_used`,n)}function cr(e){return e.startsWith(`/p/`)||e===`/tasks`||e===`/dashboard`||e.startsWith(`/settings/global/`)}function lr(e){V(`/api/v1/telemetry/page`,{route:e})}var ur=new Set(Ne);function dr(e){return`/${e.split(`/`).filter(Boolean).map(e=>ur.has(e)?e:`:param`).join(`/`)}`}function fr(e){return/Firefox\//.test(e)?`gecko`:/Chrom(e|ium)\/|Edg\//.test(e)?`chromium`:/AppleWebKit\//.test(e)?`webkit`:`other`}function pr(e){return/iPhone|iPad|iPod/.test(e)?`ios`:/Android/.test(e)?`android`:/Mac OS X|Macintosh/.test(e)?`macos`:/Windows/.test(e)?`windows`:/Linux/.test(e)?`linux`:`other`}function mr(){try{let e=new URL(import.meta.url).pathname.split(`/`).pop()??``;return/^[\w.-]+\.js$/.test(e)?e:null}catch{return null}}var H={route:dr(typeof window>`u`?`/`:window.location.pathname),previousRoute:null,routeEnteredAt:0,navigations:0,errors:0,serverVersion:null,latestVersion:null};function hr(){return`__CEZ_DESKTOP__`in window||document.documentElement.dataset.cezDesktop||`__TAURI_INTERNALS__`in window?`desktop`:`browser`}function gr(e={}){let t=navigator.userAgent,n=performance.now();return{...e,"page.route":H.route,"page.previous_route":H.previousRoute,"page.time_on_route_s":Math.round((n-H.routeEnteredAt)/1e3),"session.age_s":Math.round(n/1e3),"session.navigations":H.navigations,"session.errors":H.errors,"client.surface":hr(),"client.engine":fr(t),"client.os":pr(t),"client.online":navigator.onLine,"client.visibility":document.visibilityState,"client.viewport_w":window.innerWidth,"build.entry":mr(),"build.server_version_at_load":H.serverVersion,"build.update_available":H.latestVersion!==null&&H.latestVersion!==H.serverVersion}}var _r=[/^ResizeObserver loop (limit exceeded|completed with undelivered notifications)/];function vr(e){return _r.some(t=>t.test(e))}function yr(e){return e&&(e.split(/[?#]/)[0]?.split(`/`).pop()??``)||null}var br=new WeakSet,xr={error:0,toast:0,staging:0};function Sr(e){return e.name===`ApiError`&&e.status===0?Er(e.cause):{}}function U(e,t,n={}){if(typeof e==`object`&&e){if(br.has(e))return;br.add(e)}H.errors+=1;let r=Date.now(),i=t===`toast`?`toast`:t===`attachment-staging`?`staging`:`error`;if(r-xr[i]<1e4)return;xr[i]=r;let a=e instanceof Error,o=a?e:Error(String(e));V(`/api/v1/telemetry/error`,{type:(n.type??(o.name||`Error`)).slice(0,128),message:(o.message||`unknown error`).slice(0,2048),stack:a?o.stack?.split(window.location.origin).join(``).slice(0,16384):void 0,handler:t,code:n.code,fingerprint:n.fingerprint,context:gr({...Sr(o),...n.context})})}var Cr=new Set(`api.v1.agent-profiles.apply.archive.archive-finished.association.auto-resume.automation-checks.automation-log.automation-options.automation-templates.branch.branding-logo.cancel.candidates.channel.check.checkout.checks.comments.commit.config.connect.connection.consent.continue.details.diff.dispatch.drafts.enable.events.feed.finish.groups.handoff.health.host-usage.images.importable.launch-key.merge-state.messages.models.nodes.open.open-in.open-in-cli.open-targets.parse.pause.pick.pin.plan.pr.providers.push.queued-messages.read.read-all.reclaim.refresh.remove-worktree.repo.report.retry.run.runs.runs-index.search.self-update.setup.skills-update.star-count.status.telemetry.todos.tree.ui-state.unread.validate.watch.workspace.ws`.split(`.`));function wr(e){let t=e.split(`/`).filter(Boolean);return`/${t.map((e,n)=>t[n-1]===`p`||!(Cr.has(e)||ur.has(e))?`:param`:e).join(`/`)}`.slice(0,256)}function Tr(e,t=Date.now()){return e?{type:`ApiError`,context:{"request.method":e.method,"request.route":wr(e.path),"request.status":e.status,"request.age_ms":t-e.at,...e.provider?{"request.provider":e.provider}:{},...Er(e.cause)}}:{type:`ErrorToast`,context:{}}}function Er(e){if(typeof e!=`object`||!e)return{};let{name:t,message:n}=e;return{"request.cause_name":typeof t==`string`&&/^[A-Za-z]\w{0,63}$/.test(t)?t:`other`,"request.cause_message":typeof n==`string`?Ar(n).slice(0,256):``}}var Dr=[],Or=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),kr=/(?<![\w./-])[\w-][\w.-]*\.(?:png|jpe?g|gif|webp|bmp|heic|svg|pdf|txt|md|markdown|log|html?|csv|tsv|json|ya?ml|zip)(?![\w.-])/gi;function Ar(e,t=Dr){let n=e.replace(/“[^”]*”|‘[^’]*’|"[^"]*"|`[^`]*`|(?<!\w)'[^'\n]+'(?!\w)/g,`<value>`).replace(/[^\s()[\]{}<>,;]+@[^\s()[\]{}<>,;]+\.\w+/g,`<email>`).replace(kr,`<file>`).replace(/[^\s()[\]{}<>,;]*\/[^\s()[\]{}<>,;]*/g,e=>{if(!/^(https?:\/\/[^/\s]+)?\/api\//.test(e))return`<path>`;try{return wr(new URL(e,`http://localhost`).pathname)}catch{return`<path>`}});for(let e of[...new Set(t)].filter(e=>e.length>=3).sort((e,t)=>t.length-e.length))n=n.replace(RegExp(`(?<![\\w-])${Or(e)}(?![\\w-])`,`gi`),`<project>`);return n.replace(/:\s+\S.*$/s,`: <detail>`)}function jr(e){let{type:t,context:n}=Tr(he());U(Ar(e),`toast`,{type:t,context:n})}function Mr(e){let t=e?.status;U(e,`attachment-staging`,{code:`attachment_stage_failed`,context:{"request.route":`/api/v1/workspace/uploads`,...typeof t==`number`?{"request.status":t}:{}}})}function Nr(e){U(Error(`Dictation failed`),`toast`,{type:`DictationError`,code:`dictation_failed`,fingerprint:`cockpit:dictation_failed`,context:{"dictation.error":/^[a-z][a-z-]{0,63}$/.test(e)?e:`other`,"dictation.secure_context":window.isSecureContext!==!1}})}function Pr(e,t){return(0,z.lazy)(()=>t().catch(t=>{if(Gn())return new Promise(()=>{});throw U(t,`lazy-route`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`,context:{"chunk.route":e}}),t}))}var Fr=!1;function Ir(){let{pathname:e}=Ge(),t=se(),n=u();return(0,z.useEffect)(()=>{Dr=(n.data?.projects??[]).flatMap(e=>[e.name,e.id])},[n.data]),(0,z.useEffect)(()=>{t.data&&H.serverVersion===null&&(H.serverVersion=t.data.version),H.latestVersion=t.data?.latestVersion??H.latestVersion},[t.data]),(0,z.useEffect)(()=>{Fr||(Fr=!0,window.addEventListener(`error`,e=>{vr(e.message??``)||U(e.error??e.message,`window.error`,{context:{"error.source_file":yr(e.filename),"error.line":e.lineno||null,"error.col":e.colno||null}})}),window.addEventListener(`unhandledrejection`,e=>U(e.reason,`unhandledrejection`)),window.addEventListener(`vite:preloadError`,e=>{Gn()||U(e.payload,`vite:preloadError`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`})}),Ue(jr))},[]),(0,z.useEffect)(()=>{if(!cr(e))return;let t=dr(e);(t!==H.route||H.navigations===0)&&(H.navigations>0&&(H.previousRoute=H.route),H.route=t,H.routeEnteredAt=performance.now(),H.navigations+=1,lr(t))},[e]),null}var Lr={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`};function Rr(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function zr(e){return e.runner??`claude`}function Br(e,t){let n=de(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${Lr[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${Lr[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function Vr(e,t){return Br(Rr(e),t)}function Hr(e,t){return Br(zr(e),t)}function Ur(e){let t=m(),n=Rr(e);return t.isSuccess&&t.data?Vr(e,t.data):{provider:n,usable:!0}}function Wr(e){let t=m(),n=zr(e);return t.isSuccess&&t.data?Hr(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var Gr={folder:Mt,terminal:Rn,vscode:mn,cursor:An,zed:Vn,windsurf:Bn,sublime:xn,idea:vn,pycharm:Tn,webstorm:Cn,goland:Fn,rubymine:Sn,phpstorm:ln,clion:_n,rider:cn,"android-studio":In,xcode:wn,warp:Pn,claude:lt,codex:Ln,junie:lt,opencode:lt,pi:lt,copilot:lt};function Kr(e){return e.icon&&Gr[e.icon]||At}var qr=RegExp(`^cli:(${Le.options.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})$`);function Jr(e){let t=qr.exec(e);return t?t[1]:void 0}function Yr({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,B.jsxs)(wt,{children:[(0,B.jsx)(kt,{asChild:!0,children:(0,B.jsxs)(F,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,B.jsx)(At,{"aria-hidden":`true`}),n]})}),(0,B.jsxs)(Et,{align:`end`,children:[o,o&&e.length>0?(0,B.jsx)(St,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=Kr(e);return(0,B.jsxs)(L,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,B.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}var Xr=[`done`,`failed`,`cancelled`],Zr=[`done`,`failed`];function Qr(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function $r(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function ei(e){return Xr.includes(e)}function ti(e){return e.archived||Qr(e)||$r(e)||!Zr.includes(e.status)?!1:e.finishedAt!==void 0}function ni(e){let t=e.finishedAt;return t===void 0||!ti(e)?!1:e.seenAt===void 0||e.seenAt<t}function ri(e){return Qr(e)||$r(e)?!1:ei(e.status)&&!ni(e)}function ii(e){return e.reduce((e,t)=>ni(t)?e+1:e,0)}function W(e){return e===`running`||e===`queued`||e===`waiting`}function ai(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var oi=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/,si={claude:`claude --resume`,codex:`codex resume`,opencode:`opencode --session`,cursor:`agent --resume`,junie:`junie --resume`,pi:`pi --session`,copilot:`copilot --resume`};function ci(e,t){if(oi.test(t))return e===`junie`?`${si.junie} --session-id=${t}`:`${si[e??`claude`]} ${t}`}function li(e){if(W(e.status)||e.worktreeLifecycle?.activeOperationId)return;let t=ai(e);if(t===void 0)return;let n=ci(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function ui(e,t){let n=Jr(t);return!n||W(e.status)||e.worktreeLifecycle?.activeOperationId?!1:n===(e.runner??`claude`)&&ai(e)!==void 0}function di(e){let t=W(e.status),n=ai(e)!==void 0,r=!!e.worktreeLifecycle?.activeOperationId;return{finish:!r&&(e.status===`waiting`||e.status===`review`),continueRun:!r&&!t&&n,terminal:!r&&!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:ti(e)&&!ni(e),markRead:ti(e)&&ni(e),cancel:!r&&t,deleteRun:!r&&!t}}function fi(e){return e?`Resolve conflicts in PR ${e}`:`Resolve conflicts`}function pi(e){return e?`Fix failing checks in PR ${e}`:`Fix failing checks`}function mi(e){return e?`Commit and push`:`Commit`}function hi(){return`Push`}function gi(e){let t=e?.replace(/^origin\//,``);return t&&!/^[0-9a-f]{7,40}$/i.test(t)?t:void 0}function _i(e,t){let n=gi(t);return`${e?`Create draft PR`:`Create PR`}${n?` against ${n}`:``}`}function vi(e){let t=gi(e);return t?`Update branch from ${t}`:`Update branch`}function yi(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function bi(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var xi=[50,100,200,400,800,1e3,1e3,1e3,1e3],Si=e=>new Promise(t=>setTimeout(t,e));function Ci(e){return e instanceof T&&e.status===409&&e.message===`run is still active`}async function wi(e,t=Si){for(let n=0;;n+=1)try{return await e()}catch(e){let r=xi[n];if(!Ci(e)||r===void 0)throw e;await t(r)}}function Ti(e){return W(e.status)?`live`:di(e).continueRun?`resume`:`unavailable`}function Ei(e,t,n=`ask_answer`){let r=ce(e.id,t),i=O(e.id,t),a=Ur(e),o=Wr(e),[s,c]=(0,z.useState)(void 0),[l,u]=(0,z.useState)(!1),d=(0,z.useRef)(!1),f=Ti(e),p=f===`resume`?!o.usable:f===`live`&&!a.usable,m=f===`unavailable`?`no-session`:p?`provider`:void 0,h=m===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:m===`provider`?f===`resume`?o.reason:a.reason:void 0,g=e=>o.usable?i.mutateAsync({text:e}).then(e=>(qn(n),e)):Promise.reject(Error(o.reason??`The run provider is unavailable.`));return{mode:f,blockedBy:m,reason:h,isPending:l||r.isPending||i.isPending,error:s,send:async t=>{if(m||d.current)return h;d.current=!0,u(!0),c(void 0);try{if(f===`resume`){await wi(()=>g(t));return}try{await r.mutateAsync({text:t}),qn(n)}catch(n){if(n instanceof T&&n.status===409&&ai(e)!==void 0){await wi(()=>g(t));return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return c(t),t}finally{d.current=!1,u(!1)}}}}function Di({run:e,projectId:t,prNumber:n}){let r=Ei(e,t),i=tt(),[a,o]=(0,z.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(fi(n));t?I(t,{tone:`danger`}):(I(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(F,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,B.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function Oi({projectId:e,runId:t,prNumber:n}){let r=d(e,t);return r.data?(0,B.jsx)(Di,{run:r.data,projectId:e,prNumber:n}):(0,B.jsx)(F,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function ki({run:e,reference:t,className:n,compact:r=!1,projectId:i}){let a=Xe(),{lookup:o}=a,s=i??a.projectId,c=t.kind===`PR`?re(e).filter(e=>e.kind===`PR`&&(e.number!==t.number||!!e.url&&!!t.url&&e.url!==t.url)):[];return(0,B.jsx)(B.Fragment,{children:(t.number===void 0?[t,...c]:te([{...t,number:t.number},...c],e=>s?o({projectId:s,kind:e.kind,number:e.number}).status:void 0)).map((t,a)=>(0,B.jsx)(z.Fragment,{children:(0,B.jsx)(at,{reference:t,taskTitle:_(e),projectId:i,conflictAction:i===void 0?(0,B.jsx)(Di,{run:e,prNumber:t.number}):(0,B.jsx)(Oi,{projectId:i,runId:e.id,prNumber:t.number}),className:n,compact:r})},`${t.kind}-${t.number??`unknown`}-${t.url??a}`))})}function G(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)}var Ai={Slash:`/`,Backslash:`\\`,Period:`.`,Comma:`,`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Minus:`-`,Equal:`=`,Backquote:"`",Enter:`Enter`,Space:`Space`,Backspace:`Backspace`,Delete:`Delete`,Tab:`Tab`,Escape:`Escape`,ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`};function ji(e){let t=e.code??``;if(/^Key[A-Z]$/.test(t))return t.slice(3);if(/^Digit[0-9]$/.test(t))return t.slice(5);if(/^Numpad[0-9]$/.test(t))return t.slice(6);if(/^F([1-9]|1[0-2])$/.test(t))return t;if(t in Ai)return Ai[t];let n=e.key??``;return n.length===1&&n!==` `?n.toUpperCase():null}function Mi(e,t=G()){if([`Meta`,`Control`,`Alt`,`Shift`,`OS`,`AltGraph`].includes(e.key)||!t&&e.getModifierState?.(`AltGraph`))return null;let n=ji(e);if(!n)return null;let r=[];return(t?e.metaKey:e.ctrlKey)&&r.push(`Mod`),t&&e.ctrlKey&&r.push(`Ctrl`),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),r.push(n),r.join(`+`)}function Ni(e,t=G()){let n=e.split(`+`),r=n.at(-1)||`+`,i=n.slice(0,-1);if(t){let e={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Mod:`⌘`};return[`Ctrl`,`Alt`,`Shift`,`Mod`].filter(e=>i.includes(e)).map(t=>e[t]).join(``)+r}let a={Mod:`Ctrl`,Alt:`Alt`,Shift:`Shift`};return[...i.map(e=>a[e]??e),r].join(`+`)}function Pi(e=document){return e.querySelector(`[role="dialog"], [role="alertdialog"], [role="menu"]`)!==null}function Fi(e,t=G()){if(!e)return;let n=/^Mod\+([1-9])$/.exec(e);return n?n[1]:Ni(e,t)}var Ii=new Set([`Mod+K`,`Mod+P`,`Mod+N`,`Mod+Enter`,"Mod+Shift+`",`Mod+A`,`Mod+C`,`Mod+V`,`Mod+X`,`Mod+Z`,`Mod+Shift+Z`,`Mod+F`,`Mod+L`,`Mod+R`,`Mod+T`,`Mod+W`,`Mod+Q`,`Mod+Shift+T`,`Mod+Shift+N`,`Mod+Shift+W`]);function Li(e,t=G()){if(!(t||[`Control`,`Alt`,`AltGraph`].includes(e.key))&&(e.getModifierState?.(`AltGraph`)||e.ctrlKey&&e.altKey))return`Ctrl+Alt — types characters on many layouts`}function Ri(e,t=G()){let n=e.split(`+`).slice(0,-1);if(!n.some(e=>e===`Mod`||e===`Ctrl`||e===`Alt`))return`Use ⌘/Ctrl, ⌃ or ⌥ with the key`;if(!t&&n.includes(`Mod`)&&n.includes(`Alt`))return`Ctrl+Alt types characters on many layouts`;if(Ii.has(e))return`That shortcut is taken by the browser or cezar`}var zi={...Object.fromEntries(Array.from({length:9},(e,t)=>[`tab:${t+1}`,`Mod+${t+1}`])),"terminal-column":`Mod+/`},Bi=200;function Vi(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(Object.keys(t).length>=Bi)break;n.length<1||n.length>120||(r===null||typeof r==`string`&&r.length>=1&&r.length<=40)&&(t[n]=r)}return t}function Hi(e={}){let t=new Map;for(let[n,r]of Object.entries(zi))n in e||t.set(n,r);for(let[n,r]of Object.entries(e))r&&t.set(n,r);let n=new Map;for(let[r,i]of t){let t=n.get(i);(t===void 0||r in e&&!(t in e))&&n.set(i,r)}return new Map([...t].filter(([e,t])=>n.get(t)===e))}function Ui(e,t,n){let r={...e};if(n)for(let[i,a]of Hi(e))i!==t&&a===n&&(zi[i]?r[i]=null:delete r[i]);return n===(zi[t]??null)?delete r[t]:r[t]=n,r}function Wi(e,t){return Ui(e,t,zi[t]??null)}var Gi=[{id:`reply`,label:`Write to the agent`,group:`Actions`},{id:`toggle-read`,label:`Mark read / unread`,group:`Actions`},{id:`pin`,label:`Pin / Unpin`,group:`Actions`},{id:`archive`,label:`Archive / Unarchive`,group:`Actions`},{id:`rename`,label:`Rename`,group:`Actions`},{id:`end-session`,label:`End session`,group:`Actions`},{id:`accept`,label:`Accept changes without a PR`,group:`Actions`},{id:`stop`,label:`Stop`,group:`Actions`},{id:`delete`,label:`Delete`,group:`Actions`},{id:`git:commit`,label:`Commit`,group:`Git`},{id:`git:commit-push`,label:`Commit and push`,group:`Git`},{id:`git:push`,label:`Push`,group:`Git`},{id:`git:create-pr`,label:`Create PR`,group:`Git`},{id:`git:create-draft-pr`,label:`Create draft PR`,group:`Git`},{id:`git:update-branch`,label:`Update branch`,group:`Git`},{id:`git:resolve-conflicts`,label:`Resolve conflicts`,group:`Git`},{id:`git:fix-checks`,label:`Fix errors`,group:`Git`},{id:`open-pr`,label:`Open pull request`,group:`Git`},...Array.from({length:9},(e,t)=>({id:`tab:${t+1}`,label:`Tab ${t+1}`,group:`Go to view`})),{id:`view:session`,label:`Chat`,group:`Go to view`},{id:`view:changes`,label:`Changes`,group:`Go to view`},{id:`view:commits`,label:`Commits`,group:`Go to view`},{id:`view:files`,label:`Files`,group:`Go to view`},{id:`view:graph`,label:`Graph`,group:`Go to view`},{id:`view:notes`,label:`Notes`,group:`Go to view`},{id:`view:browser`,label:`Preview`,group:`Go to view`},{id:`view:terminal`,label:`Terminal`,group:`Go to view`},{id:`full-view`,label:`Full view`,group:`Layout`},{id:`split`,label:`Split view`,group:`Layout`},{id:`terminal`,label:`Show / hide terminal`,group:`Layout`},{id:`terminal-column`,label:`Terminal in a column`,group:`Layout`},{id:`open:terminal-resume`,label:`Terminal (resume session)`,group:`Open in`},{id:`copy:link`,label:`Copy task link`,group:`Copy`},{id:`copy:branch`,label:`Copy branch name`,group:`Copy`},{id:`copy:path`,label:`Copy worktree path`,group:`Copy`},{id:`copy:resume`,label:`Copy resume command`,group:`Copy`},{id:`copy:pr`,label:`Copy pull request link`,group:`Copy`},{id:`copy:id`,label:`Copy task id`,group:`Copy`}];function Ki(){let e=x(),t=C(),n=z.useRef(0),r=z.useRef(Promise.resolve()),a=t.data?.keybindings,o=z.useMemo(()=>Vi(a),[a]),s=z.useMemo(()=>Hi(o),[o]),c=z.useCallback(t=>{let a=e.getQueryData(y.uiState);if(a===void 0)return;let o=t(Vi(a.keybindings));e.setQueryData(y.uiState,{...a,keybindings:o});let s=++n.current,c=r.current.then(async()=>{let t=await i({keybindings:o},{keepalive:!0});s===n.current&&e.setQueryData(y.uiState,t)});r.current=c.catch(t=>{I(t instanceof Error?t.message:String(t),{tone:`danger`}),s===n.current&&e.invalidateQueries({queryKey:y.uiState})})},[e]);return{overrides:o,bindings:s,ready:t.data!==void 0,assign:z.useCallback((e,t)=>{c(n=>Ui(n,e,t)),rr(e)},[c]),reset:z.useCallback(e=>c(t=>Wi(t,e)),[c]),resetAll:z.useCallback(()=>c(()=>({})),[c])}}var qi=e=>e===`running`||e===`queued`||e===`waiting`,Ji=`no worktree — this task ran directly in the repo working tree`,Yi=e=>e.agentBlocked!==void 0;function Xi(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?Yi(e)&&e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.uncommitted===void 0?t(`Commit unavailable — changes are still loading`):e.uncommitted===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${Ji}`)}function Zi(e){let t=Xi(e);return Qi({...e,unpushed:void 0,status:`done`}).enabled?{...t,id:`commit-push`,label:`Commit and push`,...t.reason?{reason:t.reason.replace(/^Commit unavailable/,`Commit and push unavailable`)}:{}}:t}function Qi(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):Yi(e)&&e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):e.unpushed===0?t(`Push unavailable — the remote already has every commit`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${Ji}`)}function $i(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${Ji}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?Yi(e)&&e.status===`waiting`?t(`Create PR unavailable — the session is still open; end the session to open a PR`):Yi(e)&&qi(e.status)?t(`Create PR unavailable — the agent is still working; wait for it to finish`):{id:`create-pr`,label:`Create PR`,enabled:!0,alternatives:[{id:`create-draft-pr`,label:`Create draft PR`,enabled:!0}]}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function ea(e){if(!e.hasWorktree||e.prStatus===`merged`||e.prStatus===`closed`)return null;let t=e.behind!==void 0&&e.behind!==null&&e.behind>0&&!e.agentBlocked?ta(e,`update-branch`,`Update branch`):null;if(!e.prUrl&&e.forge!==null){if(e.uncommitted===0&&e.ahead===0)return null;let n=$i(e);return n.enabled?t?{...n,alternatives:[...n.alternatives??[],t]}:n:t??n}if(e.uncommitted===void 0)return null;let n=e.uncommitted>0;return e.prUrl?n?Zi(e):e.unpushed!==void 0&&e.unpushed!==null&&e.unpushed>0?Qi(e):e.prConflicting===!0?ta(e,`resolve-conflicts`,`Resolve conflicts`):t||(e.prStatus===`checks-failing`?ta(e,`fix-checks`,`Fix errors`):null):n?Zi(e):e.unpushed===0?t:Qi(e)}function ta(e,t,n){return e.agentBlocked?{id:t,label:n,enabled:!1,reason:`${n} unavailable — ${e.agentBlocked}`}:{id:t,label:n,enabled:!0}}function na({run:e,open:t,onOpenChange:n,andPush:r=!1,onCommitted:i}){let a=x(),[o,s]=(0,z.useState)(``),c=_(e),l=(0,z.useRef)(c);l.current=c,(0,z.useEffect)(()=>{t&&s(l.current)},[t]);let u=M({mutationFn:t=>A(e.id,t),onSuccess:t=>{I(`Committed ${t.sha.slice(0,7)}${r?` — pushing…`:``}`),i?.(),n(!1),a.invalidateQueries({queryKey:j.runs.changes(e.id)}),a.invalidateQueries({queryKey:j.runs.gitStatus(e.id)}),a.invalidateQueries({queryKey:j.runs.all})},onError:e=>I(e.message,{tone:`danger`})}),d=()=>{let e=o.trim();e.length===0||u.isPending||u.mutate(e)};return(0,B.jsx)(Ze,{open:t,onOpenChange:n,children:(0,B.jsxs)(rt,{"data-slot":`commit-dialog`,children:[(0,B.jsxs)(Qe,{children:[(0,B.jsx)(qe,{children:r?`Commit and push`:`Commit changes`}),(0,B.jsxs)(et,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,B.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,r?`, then pushes it`:``,`.`]})]}),(0,B.jsx)(pt,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{Vt({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(),d())}}),(0,B.jsxs)($e,{children:[(0,B.jsx)(F,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,B.jsx)(F,{"data-slot":`commit-confirm`,disabled:o.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:r?`Commit and push`:`Commit`})]})]})})}var ra=3e4,ia=3e3,aa=e=>e===`create-pr`||e===`create-draft-pr`,K=new Map,oa=new Set,sa=e=>(oa.add(e),()=>oa.delete(e));function q(e,t){t?K.set(e,t):K.delete(e);for(let e of oa)e()}function ca(e,t){return K.get(e)===t?(q(e,null),!0):!1}function la(e){let t=ue(e),n=t?.url??(t?.number===void 0?void 0:`#${t.number}`),r=t?.number,i=ot(`PR`,r),a=i.status,o=a===`merged`||a===`closed`,s=se(),c=oe(),l=ke(e.id,!!e.worktreePath&&!o,W(e.status)),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),m=Ei(e,void 0,`git_step`),h=x(),g=()=>h.invalidateQueries({queryKey:j.runs.all}),_=(0,z.useSyncExternalStore)(sa,()=>K.get(e.id)??null),v=e.status===`running`||e.status===`queued`,y=(0,z.useRef)(n);y.current=n;let b=e=>{aa(e.id)&&!y.current&&S()};(0,z.useEffect)(()=>{if(!_||_.phase!==`handedOff`)return;if(_.afterCurrentTurn){v||q(e.id,{..._,afterCurrentTurn:!1,sentAt:Date.now(),graceMs:ia});return}if(v){_.sawTurn||q(e.id,{..._,sawTurn:!0});return}if(_.sawTurn){ca(e.id,_)&&b(_);return}let t=()=>{ca(e.id,_)&&b(_)},n=_.graceMs-(Date.now()-_.sentAt);if(n<=0){t();return}let r=setTimeout(t,n);return()=>clearTimeout(r)},[v,_]);let S=async()=>{try{(await D(e.id)).found&&g()}catch{}},C=async(t,n)=>{if(K.has(e.id)||m.blockedBy)return;if(m.isPending){I(`Another message to the task is still being delivered — try again in a moment`);return}let r={id:t,phase:`sending`,sawTurn:!1,sentAt:Date.now(),afterCurrentTurn:v,graceMs:ra};q(e.id,r);let i=await m.send(n());K.get(e.id)===r&&(i?(q(e.id,null),I(i,{tone:`danger`})):q(e.id,{...r,phase:`handedOff`,sentAt:Date.now()}))},w=e=>I(e.message,{tone:`danger`}),E=M({mutationFn:()=>ne(e.id),onSuccess:t=>{I(t.upstreamSet?`Pushed ${t.branch} to ${t.remote} (upstream set)`:`Pushed ${t.branch} to ${t.remote}`),h.invalidateQueries({queryKey:j.runs.gitStatus(e.id)})},onError:w}),O=M({mutationFn:t=>me(e.id,{draft:t}),onSuccess:(e,t)=>{I(`${t?`Draft PR`:`PR`} created — ${e.url}`),g()},onError:w}),ee=l.isError&&l.error instanceof T&&l.error.status===409,k=ea({status:e.status,hasWorktree:!ee,branch:e.branch,uncommitted:l.data?.uncommitted,unpushed:l.data?.unpushed,behind:l.data?.behind,ahead:l.data?.ahead,remote:c.data?.info?.remote,forge:s.data?.forge??null,prUrl:n,prStatus:a,prConflicting:i.conflicting,agentBlocked:m.blockedBy?m.reason??`the agent cannot be reached`:void 0}),A=_?.id??(E.isPending?`push`:O.isPending?O.variables?`create-draft-pr`:`create-pr`:null);return{action:e.worktreePath?k:null,pending:A,byAgent:!m.blockedBy,onAction:t=>{let n=!!m.blockedBy;switch(t){case`commit`:case`commit-push`:if(!n){let e=t===`commit-push`;C(t,()=>mi(e));break}p(t===`commit-push`),d(!0);break;case`push`:n?E.isPending||E.mutate():C(t,hi);break;case`create-pr`:case`create-draft-pr`:{let r=t===`create-draft-pr`;n?O.isPending||O.mutate(r):C(t,()=>_i(r,e.baseBranch));break}case`update-branch`:C(t,()=>vi(e.baseBranch));break;case`resolve-conflicts`:C(t,()=>fi(r));break;case`fix-checks`:C(t,()=>pi(r));break}},commitOpen:u,dialogs:(0,B.jsx)(na,{run:e,open:u,onOpenChange:d,andPush:f,onCommitted:f?()=>E.mutate():void 0})}}function ua(e,t){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(``),o=(0,z.useRef)(!1),[s,c]=(0,z.useState)(!0),l=e=>{a(e),c(!0)},u=e=>{a(e),c(!1),o.current=!1,r(!0)};return{editing:n,draft:i,setDraft:l,begin:()=>{u(e),c(!0)},beginWith:u,commitOnBlur:s,commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function da({editor:e,className:t}){return(0,B.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:()=>{e.commitOnBlur&&e.commit()},onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:P(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}var fa=`text-violet fill-violet/25`;function pa({pinned:e,onToggle:t,className:n}){return(0,B.jsx)(Ot,{label:e?`Unpin from the top of the list`:`Pin to the top of the list`,children:(0,B.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,onClick:n=>{n.stopPropagation(),t(!e)},className:P(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,e&&`text-violet hover:text-violet [&_svg]:fill-violet/25`,n),children:(0,B.jsx)(Nn,{className:`size-3`,"aria-hidden":`true`})})})}var ma=220;function ha({references:e,taskTitle:t,hidden:n,projectId:r}){let[i,a]=z.useState(!1),o=z.useRef(!1),s=z.useRef(void 0);z.useEffect(()=>()=>clearTimeout(s.current),[]);let c=e=>e.pointerType!==`touch`,l=()=>clearTimeout(s.current),u=e=>{c(e)&&(l(),o.current=!0,a(!0))},d=e=>{c(e)&&(l(),s.current=setTimeout(()=>a(!1),ma))};return(0,B.jsxs)(it,{open:i,onOpenChange:a,children:[(0,B.jsx)(nt,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:u,onPointerLeave:d,onPointerDown:()=>{o.current=!1},onClick:()=>{o.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,B.jsxs)(Je,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:u,onPointerLeave:d,onOpenAutoFocus:e=>{o.current&&e.preventDefault()},onCloseAutoFocus:e=>{o.current&&e.preventDefault()},children:[(0,B.jsx)(`p`,{className:`px-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`References`}),(0,B.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,B.jsx)(at,{reference:e,taskTitle:t,projectId:r},`${e.kind}#${e.number??``}#${e.url??``}`))})]})]})}var ga=[`session`,`changes`,`commits`,`files`,`browser`,`graph`,`terminal`],_a=[`session`,`changes`,`commits`,`files`,`graph`,`browser`,`terminal`],va={session:`chat`,changes:`changes`,commits:`commits`,files:`files`,browser:`preview`,graph:`graph`,terminal:`terminal`},ya={session:`Chat`,changes:`Changes`,commits:`Commits`,files:`Files`,browser:`Preview`,graph:`Graph`,terminal:`Terminal`},ba={Czat:`Chat`,Zmiany:`Changes`,Commity:`Commits`,Pliki:`Files`,Code:`Files`,Przeglądarka:`Preview`,Browser:`Preview`,Graf:`Graph`};function xa(e){let t=/^(.+?)( \d+)?$/.exec(e);if(!t)return e;let[,n=e,r=``]=t;if(n===`Układ`)return`Layout${r}`;let i=ba[n];return i?`${i}${r}`:e}var Sa={files:[`Code`],browser:[`Browser`]};function Ca(e,t){return e===ya[t]||(Sa[t]?.includes(e)??!1)}function wa(e){return ya[e]}function Ta(e){return typeof e==`string`&&ga.includes(e)}function Ea(){return{tabs:[``],active:0}}function Da(e){if(typeof e!=`object`||!e)return Ea();let t=e;if(!Array.isArray(t.tabs))return Ea();let n=t.tabs.filter(e=>typeof e==`string`).slice(0,Oa).map(e=>e.length>ka?``:e);return n.length===0?Ea():{tabs:n,active:typeof t.active==`number`&&Number.isFinite(t.active)?Math.min(n.length-1,Math.max(0,Math.trunc(t.active))):0}}var Oa=12,ka=Ie,Aa=50,ja=80,Ma=3;function Na(e){return Math.min(12,e/2)}var Pa=ya.session;function Fa(){return{layouts:ga.filter(e=>e!==`terminal`).map(e=>({name:ya[e],columns:[{view:e,width:100}]})),active:Pa}}function Ia(e){let t=e.length;if(t===0)return[];let n=Math.min(12,100/t),r=e.map(e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)&&t>0?t:n}),i=r.reduce((e,t)=>e+t,0);if(!Number.isFinite(i)||i<=0)return La(t);let a=r.map(e=>e/i*100);for(let e=0;e<t;e+=1){let e=a.reduce((e,t)=>e+Math.max(0,n-t),0);if(e<=0)break;let r=a.reduce((e,t)=>e+Math.max(0,t-n),0);if(r<=0){a=a.map(()=>100/t);break}let i=Math.min(e,r)/r;a=a.map(e=>e<n?n:e-(e-n)*i)}let o=a.map(e=>J(e)),s=J(100-o.reduce((e,t)=>e+t,0));if(s!==0){let e=0;for(let t=1;t<o.length;t+=1)(o[t]??0)>(o[e]??0)&&(e=t);o[e]=J((o[e]??0)+s)}return o}function La(e){if(e===0)return[];let t=J(100/e),n=Array.from({length:e},()=>t);return n[e-1]=J(100-t*(e-1)),n}function J(e){return Math.round(e*100)/100}function Ra(e){let t=La(e.length);return e.map((e,n)=>({...e,width:t[n]??0}))}function za(e){if(typeof e!=`object`||!e)return Fa();let t=e;if(!Array.isArray(t.layouts))return Fa();let n=[];for(let e of t.layouts){if(n.length>=Aa)break;let t=Ba(e,n);t&&n.push(t)}return n.length===0?Fa():{layouts:n,active:typeof t.active==`string`&&n.some(e=>e.name===t.active)?t.active:Va(n)}}function Ba(e,t){if(typeof e!=`object`||!e)return null;let n=e;if(typeof n.name!=`string`||n.name.trim()===``||!Array.isArray(n.columns))return null;let r=[],i=[],a=[];for(let e of n.columns){if(r.length>=Ma)break;if(typeof e!=`object`||!e)continue;let t=e;Ta(t.view)&&(r.push(t.view),i.push(typeof t.width==`number`?t.width:NaN),a.push(t.view===`browser`?Da(t.browser):void 0))}if(n.columns.length>0&&r.length===0)return null;let o=Ha(n.name.trim(),t),s=Ia(i);return{name:o,columns:r.map((e,t)=>({view:e,width:s[t]??0,...a[t]?{browser:a[t]}:{}}))}}function Va(e){return(e.find(e=>e.name===Pa)??e[0])?.name??Pa}function Ha(e,t,n){let r=e=>t.some(t=>t.name===e&&t.name!==n),i=t=>`${e.slice(0,ja-t.length).trimEnd()}${t}`,a=i(``);if(!r(a))return a;for(let e=2;e<1e3;e+=1){let t=i(` ${e}`);if(!r(t))return t}return i(` ${t.length+1}`)}function Y(e,t=e.active){return e.layouts.find(e=>e.name===t)}function X(e){return Y(e,e.active)}function Z(e,t,n){return{...e,layouts:e.layouts.map(e=>e.name===t?n:e),active:e.active===t?n.name:e.active}}function Ua(e){return Ha(`Layout ${e.length+1}`,e)}function Wa(e,t,n){if(e.layouts.length>=Aa)return e;let r=n===void 0?Ua(e.layouts):Ha(n,e.layouts),i=t===void 0?[]:[{...Q(t),width:100}];return{layouts:[...e.layouts,{name:r,columns:i}],active:r}}function Ga(e,t){let n=e.layouts.findIndex(e=>e.name===t);if(n===-1)return e;let r=e.layouts.filter(e=>e.name!==t);if(r.length===0)return{layouts:[],active:``};let i=r[Math.min(n,r.length-1)];return{layouts:r,active:e.active===t?i.name:e.active}}function Ka(e,t){return e.layouts.some(e=>e.name===t)?{...e,active:t}:e}function qa(e,t,n){let r=Y(e,t);if(!r)return e;let i=n.trim();return i===``||i===t?e:Z(e,t,{...r,name:Ha(i,e.layouts,t)})}function Ja(e,t,n){let r=Y(e,t);return!r||r.columns.length>=Ma?e:Z(e,t,{...r,columns:Ra([...r.columns,Q(n)])})}function Q(e){return e===`browser`?{view:e,width:0,browser:Ea()}:{view:e,width:0}}function Ya(e,t,n,r){let i=Y(e,t),a=i?.columns[n];if(!i||!a||a.view!==`browser`)return e;let o=Da(r);return Z(e,t,{...i,columns:i.columns.map((e,t)=>t===n?{...e,browser:o}:e)})}function Xa(e,t){let n=X(e);if(!n||t.length>ka)return null;let r=e,i=n.name,a=n.columns.findIndex(e=>e.view===`browser`);if(a<0&&to(n)!==null){let t=ro(e,`browser`);if(!t)return null;({state:r,name:i,index:a}=t)}else if(a<0){if(r=Ja(e,i,`browser`),r===e)return null;a=n.columns.length}let o=(Y(r,i)?.columns[a]?.browser??Ea()).tabs.filter(e=>e!==``);return o.length>=Oa?null:Ya(r,i,a,{tabs:[...o,t],active:o.length})}function Za(e,t,n){let r=Y(e,t);if(!r||n<0||n>=r.columns.length)return e;let i=r.columns.filter((e,t)=>t!==n);return Z(e,t,{...r,columns:Ra(i)})}function Qa(e,t,n,r){let i=Y(e,t);return!i||n<0||n>=i.columns.length||i.columns[n]?.view===r?e:Z(e,t,{...i,columns:i.columns.map((e,t)=>t===n?{...Q(r),width:e.width}:e)})}function $a(e,t,n,r){let i=Y(e,t);if(!i||n<0||n+1>=i.columns.length||!Number.isFinite(r)||r===0)return e;let a=i.columns[n],o=i.columns[n+1];if(!a||!o)return e;let s=a.width+o.width,c=Na(s),l=J(Math.min(s-c,Math.max(c,a.width+r)));return l===a.width?e:Z(e,t,{...i,columns:i.columns.map((e,t)=>t===n?{...e,width:l}:t===n+1?{...e,width:J(s-l)}:e)})}function eo(e,t,n,r){let i=Y(e,t);if(!i)return e;let a=i.columns.length;if(n<0||n>=a||r<0||r>=a||n===r)return e;let o=[...i.columns],[s]=o.splice(n,1);return s?(o.splice(r,0,s),Z(e,t,{...i,columns:Ra(o)})):e}function to(e){let t=e.columns.length===1?e.columns[0]?.view:void 0;return t!==void 0&&Ca(e.name,t)?t:null}function no(e,t){let n=e.layouts.find(e=>Ca(e.name,t)&&e.columns.length===1&&e.columns[0]?.view===t);if(n)return Ka(e,n.name);let r=X(e);return r&&r.columns.length===1&&r.columns[0]?.view===t?e:Wa(e,t,wa(t))}function ro(e,t){let n=X(e);if(n){let r=n.columns.findIndex(e=>e.view===t);if(r>=0)return{state:e,name:n.name,index:r};if(to(n)===null&&n.columns.length>0&&n.columns.length<Ma)return{state:Ja(e,n.name,t),name:n.name,index:n.columns.length}}let r=so(e,[Q(n?.columns[0]?.view??`session`),Q(t)]);return r?{state:r,name:ao,index:1}:null}function io(e,t,n,r){let i=X(e),a=i?.columns.map(e=>({...e}))??[],o=a.findIndex(e=>e.view===t),s=o>=0?a[o]:Q(t),c;if(r===`replace`){if(n<0||n>=a.length)return e;c=[...a],o>=0&&(c[o]=a[n]),c[n]=s}else c=o>=0?a.filter((e,t)=>t!==o):[...a],c.splice(Math.max(0,Math.min(o>=0&&o<n?n-1:n,c.length)),0,s);return c.length>Ma?e:i&&to(i)===null?Z(e,i.name,{...i,columns:Ra(c)}):c.length===1?no(e,c[0].view):so(e,c)??e}var ao=`Custom`;function oo(e){let t=e.trim();return t===`Custom`||ga.some(e=>Ca(t,e))}function so(e,t){let n={name:ao,columns:Ra(t)};return Y(e,`Custom`)?{...Z(e,ao,n),active:ao}:e.layouts.length>=Aa?null:{layouts:[...e.layouts,n],active:ao}}function co(e,t){let n=X(e),r=t.trim().slice(0,ja);return!n||n.columns.length===0||r===``||oo(r)?null:{name:r,columns:n.columns.map(({view:e,width:t})=>({view:e,width:t}))}}function lo(e,t){if(oo(t.name))return e;let n=Y(e,t.name),r=t.columns.map(e=>e.view).join(`|`);if(n&&n.columns.map(e=>e.view).join(`|`)===r)return Ka(e,t.name);let i=Ia(t.columns.map(e=>e.width)),a={name:t.name,columns:t.columns.slice(0,Ma).map((e,t)=>({...Q(e.view),width:i[t]??0}))};return n?{...Z(e,t.name,a),active:t.name}:e.layouts.length>=Aa?e:{layouts:[...e.layouts,a],active:t.name}}function uo(e,t){let n=X(e),r=t.trim().slice(0,ja);if(!n||r===``||oo(r)||n.name===r)return e;let i=e.layouts.filter(e=>e.name!==r);if(to(n)!==null){let e={name:r,columns:n.columns.map(e=>({...e}))};return{layouts:[...i,e],active:r}}return{layouts:i.map(e=>e===n?{...e,name:r}:e),active:r}}function fo(e=!0,t=()=>!0){let[n,r]=z.useState(!1),i=z.useRef(t);return i.current=t,z.useEffect(()=>{if(!e)return;let t=G(),n=t?`Meta`:`Control`,a=new Set([`Shift`,`Alt`,`AltGraph`,t?`Control`:`Meta`]),o=e=>t?e.metaKey:e.ctrlKey,s=e=>!e.shiftKey&&!e.altKey&&!(t?e.ctrlKey:e.metaKey),c,l=!1,u,d=()=>{clearTimeout(u),clearTimeout(c),c=void 0,l&&r(!1),l=!1},f=()=>{c=void 0,i.current()&&(l=!0,r(!0))},p=e=>{if(e.key===n){!e.repeat&&c===void 0&&!l&&s(e)&&(c=setTimeout(f,350));return}if(!(c===void 0&&!l)){if(!o(e)||a.has(e.key)||!s(e))return d();if(!l){clearTimeout(c),c=void 0;return}clearTimeout(u),u=setTimeout(()=>{i.current()||d()},0)}},m=e=>{(e.key===n||(c!==void 0||l)&&!o(e))&&d()},h=e=>{(c!==void 0||l)&&!o(e)&&d()},g=()=>{document.visibilityState!==`visible`&&d()};return window.addEventListener(`keydown`,p),window.addEventListener(`keyup`,m),window.addEventListener(`pointermove`,h),window.addEventListener(`pointerdown`,h),window.addEventListener(`blur`,d),document.addEventListener(`visibilitychange`,g),()=>{d(),window.removeEventListener(`keydown`,p),window.removeEventListener(`keyup`,m),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerdown`,h),window.removeEventListener(`blur`,d),document.removeEventListener(`visibilitychange`,g)}},[e]),n}function po(e){let t=e.findIndex(e=>e===`browser`||e===`terminal`);return t<0?[...e,`notes`]:[...e.slice(0,t),`notes`,...e.slice(t)]}function mo(e){return po(e).map(e=>e===`notes`?{id:`view:notes`,label:`Notes`}:{id:`view:${e}`,label:wa(e)})}function ho(e){let{bindings:t}=Ki(),n=fo(!0,go),r=e.map(e=>e.id).join(`|`);return{hints:z.useMemo(()=>{let n=new Map;return e.forEach((e,r)=>{let i=Fi(t.get(`tab:${r+1}`)??t.get(e.id));i&&n.set(e.id,i)}),n},[t,r]),show:n}}var go=()=>!Pi()&&(G()||!(document.activeElement instanceof HTMLElement&&document.activeElement.closest(`.xterm`))),_o=(0,z.createContext)(ga);function vo(e){let t=(0,z.useContext)(_o);return e.filter(e=>t.includes(e))}var yo={session:kn,changes:Ft,commits:Lt,files:pn,browser:Cn,graph:dt,terminal:jt};function bo({onPick:e,disabled:t,purpose:n=`set`}){return(0,B.jsx)(B.Fragment,{children:vo(ga).map(r=>{let i=yo[r];return(0,B.jsxs)(L,{"data-view":r,"data-view-action":n,disabled:r===t,onSelect:()=>e(r),children:[(0,B.jsx)(i,{"aria-hidden":`true`}),wa(r)]},r)})})}var xo=[`session`,`graph`,`changes`,`commits`,`files`,`browser`,`terminal`],So={session:`The conversation with the agent`,graph:`The workflow, live, step by step`,changes:`What this task changed, as a diff`,commits:`The commits on the task branch`,files:`The worktree, file by file`,browser:`The task's app, with Design Mode`,terminal:`A shell in the task worktree`};function Co({onPick:e,scope:t=`layout`}){let n=vo(xo);return(0,B.jsx)(`div`,{"data-slot":`view-tiles-stage`,className:`@container flex min-h-0 flex-1 justify-center overflow-y-auto p-4 @md:p-6`,children:(0,B.jsxs)(`div`,{className:`my-auto flex w-full max-w-2xl flex-col gap-5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1 text-center`,children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:t===`layout`?`What should this layout show?`:`What should this window show?`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`layout`?`Pick a view to start. You can split it into more windows afterwards.`:`Pick a view for the new window.`})]}),(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-2.5 @[15rem]:grid-cols-2 @lg:grid-cols-3 @lg:gap-3`,children:n.map(t=>{let n=yo[t];return(0,B.jsxs)(F,{type:`button`,variant:`outline`,"data-view":t,"data-view-action":`create`,onClick:()=>e(t),className:`group/tile h-auto flex-col items-start justify-start gap-2.5 rounded-xl p-3 text-left whitespace-normal @lg:gap-3 @lg:p-4`,children:[(0,B.jsx)(`span`,{className:`flex size-9 items-center justify-center rounded-lg bg-muted text-muted-foreground transition-colors group-hover/tile:bg-primary group-hover/tile:text-primary-foreground`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`size-[18px]`})}),(0,B.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:wa(t)}),(0,B.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:So[t]})]})]},t)})})]})})}var wo=[{id:`actions`,heading:`Actions`},{id:`git`,heading:`Git`},{id:`views`,heading:`Go to view`},{id:`layout`,heading:`Layout`},{id:`open`,heading:`Open in`},{id:`copy`,heading:`Copy`}],$=e=>(0,B.jsx)(e,{"aria-hidden":`true`});function To(e,t){let n=[...Eo(e,t),...Do(e,t),...Oo(e,t),...jo(e),...Mo(e,t),...No(e,t)],r=mo(ko(e.run,e.workspace,e.terminalAvailable));return[...n,...Ao(r,n)]}function Eo({run:e,workspace:t},n){let r=di(e),i=W(e.status)?`Stop the task first`:void 0,a=e.worktreeLifecycle?.activeOperationId?`Resolve the worktree operation first`:void 0,o=[];return t?.focusComposer&&o.push({id:`reply`,group:`actions`,label:`Write to the agent`,icon:$(zn),keywords:[`composer`,`reply`,`message`,`focus`],shortcut:`/`,perform:t.focusComposer}),(r.markRead||r.markUnread)&&o.push({id:`toggle-read`,group:`actions`,label:r.markRead?`Mark read`:`Mark unread`,icon:$(Dn),keywords:[`unread`,`read`,`seen`],pressed:r.markRead,perform:r.markRead?n.markRead:n.markUnread}),o.push({id:`pin`,group:`actions`,label:e.pinned?`Unpin`:`Pin`,icon:$(Nn),pressed:!!e.pinned,...r.pin?{}:{unavailable:`Archived tasks can’t be pinned`},perform:n.pin},{id:`archive`,group:`actions`,label:e.archived?`Unarchive`:`Archive`,icon:$(sn),pressed:!!e.archived,...i?{unavailable:i}:{},perform:n.archive},{id:`rename`,group:`actions`,label:`Rename…`,icon:$(Bt),keywords:[`title`],perform:n.rename}),r.finish&&e.status===`waiting`&&o.push({id:`end-session`,group:`actions`,label:`End session`,icon:$(mt),keywords:[`finish`,`close`,`done`],perform:n.finish}),r.finish&&e.status===`review`&&o.push({id:`accept`,group:`actions`,label:`Accept changes without a PR`,icon:$(mt),keywords:[`finish`,`review`,`done`],perform:n.finish}),r.cancel&&o.push({id:`stop`,group:`actions`,label:`Stop…`,icon:$(fn),keywords:[`cancel`,`kill`],danger:!0,perform:n.confirmStop}),o.push({id:`delete`,group:`actions`,label:`Delete…`,icon:$(ft),keywords:[`remove`,`worktree`,`branch`],danger:!0,...i||a?{unavailable:i??a}:{},perform:n.confirmDelete}),o}function Do({git:e,gitPending:t,prUrl:n},r){let i=e?[e,...e.alternatives??[]].map(n=>{let i=t?n.id===e.id:!1;return{id:`git:${n.id}`,group:`git`,label:i&&t?It[t]:n.label,icon:i?(0,B.jsx)(zt,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):Pt[n.id],keywords:[`git`],...t?{unavailable:`Already in progress`}:n.enabled?{}:{unavailable:n.reason??`Not available right now`},perform:()=>r.gitAction(n.id)}}):[];return n&&/^https?:\/\//.test(n)&&i.push({id:`open-pr`,group:`git`,label:`Open pull request`,icon:$(At),keywords:[`pr`,`github`],perform:()=>r.openUrl(n)}),i}function Oo({run:e,workspace:t,terminalAvailable:n},r){let i=`/tasks/${e.id}`,a=ko(e,t,n),o=po(a),s=e=>{let n=o.indexOf(e);return t&&n<9?{shortcut:String(n+1)}:{}},c=a.map(e=>{let n=yo[e];return{id:`view:${e}`,group:`views`,label:wa(e),icon:(0,B.jsx)(n,{"aria-hidden":`true`}),keywords:[`view`,`go`,`tab`,e],...s(e),pressed:t?.activeView===e,perform:t?()=>t.openView(e):()=>r.navigate(`${i}/${va[e]}`),...t?{performBeside:()=>t.openViewBeside(e)}:{}}});return c.push({id:`view:notes`,group:`views`,label:`Notes`,icon:$(jn),keywords:[`view`,`handoff`],...s(`notes`),perform:()=>r.navigate(`${i}/notes`)}),c}function ko(e,t,n){return t?.views??_a.filter(t=>(t!==`graph`||!!e.workflowDef)&&(t!==`terminal`||n))}function Ao(e,t){return e.slice(0,9).flatMap((e,n)=>{let r=t.find(t=>t.id===e.id);return r?[{id:`tab:${n+1}`,group:`views`,label:`Tab ${n+1}: ${e.label}`,icon:$(ut),hidden:!0,perform:r.perform}]:[]})}function jo({workspace:e}){if(!e)return[];let t=e.layouts.map(t=>({id:`layout:${t.name}`,group:`layout`,label:t.label,icon:$(ut),keywords:[`layout`,`switch`],pressed:t.active,perform:()=>e.selectLayout(t.name)}));t.push({id:`full-view`,group:`layout`,label:e.maximized?`Exit full view`:`Full view`,icon:$(On),keywords:[`maximize`,`zen`,`focus`],shortcut:`F`,pressed:e.maximized,perform:e.toggleMaximized}),e.splitView&&t.push({id:`split`,group:`layout`,label:`Split view`,icon:$(hn),keywords:[`column`,`side`],shortcut:`\\`,perform:e.splitView});let n=e.terminal;return n.allowed&&(t.push({id:`terminal`,group:`layout`,label:n.open?`Hide terminal`:`Show terminal`,icon:$(Mn),keywords:[`shell`,`drawer`],shortcut:"`",pressed:n.open||n.inColumn,...n.inColumn?{unavailable:`The terminal is open in a column of this layout`}:{},perform:n.toggle}),n.inColumn||t.push({id:`terminal-column`,group:`layout`,label:`Terminal in a column`,icon:$(jt),keywords:[`shell`,`split`],perform:n.openInColumn})),t}function Mo({canResume:e,openChoices:t},n){let r=[];e&&r.push({id:`open:terminal-resume`,group:`open`,label:`Terminal (resume session)`,icon:$(Rn),keywords:[`open`,`cli`,`resume`],perform:n.resumeInTerminal});for(let e of t){let t=Kr(e.target);r.push({id:`open:${e.target.id}`,group:`open`,label:`${e.target.label}${e.suffix??``}`,icon:(0,B.jsx)(t,{"aria-hidden":`true`}),keywords:[`open`,`in`],perform:()=>n.openIn(e.target.id)})}return r}function No({run:e,prUrl:t,taskUrl:n},r){let i=(e,t,n,i,a=gn)=>n?[{id:`copy:${e}`,group:`copy`,label:t,icon:$(a),keywords:[`copy`],perform:()=>r.copy(n,i)}]:[];return[...i(`link`,`Copy task link`,n,`Task link`,En),...i(`branch`,`Copy branch name`,e.branch,`Branch name`),...i(`path`,`Copy worktree path`,e.worktreePath,`Worktree path`),...i(`resume`,`Copy resume command`,li(e),`Resume command`),...i(`pr`,`Copy pull request link`,t,`Pull request link`,En),...i(`id`,`Copy task id`,e.id,`Task id`)]}function Po({run:e,confirming:t,lifecycleDelete:n=!1,onOpenChange:r,onConfirm:i}){return(0,B.jsx)(tn,{open:t!==null,onOpenChange:r,children:(0,B.jsxs)(Xt,{children:[(0,B.jsxs)(en,{children:[(0,B.jsx)(Yt,{children:t===`delete`?`Delete this task?`:`Stop this task?`}),(0,B.jsx)(Jt,{children:t===`delete`?(0,B.jsxs)(B.Fragment,{children:[n?`Cleanup runs before the task, transcript, worktree, and branch are removed. If cleanup needs attention, the task and worktree are retained for your decision.`:`This removes the run, its transcript, its worktree and its branch. There is no undo.`,(0,B.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:_(e),children:_(e)})]}):e.status===`queued`?`The task leaves the queue before it starts and completes as cancelled.`:`The agent is stopped and the run completes as cancelled. The worktree stays.`})]}),(0,B.jsxs)(Qt,{children:[(0,B.jsx)($t,{children:`Keep it`}),(0,B.jsx)(Zt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t&&i(t),r(!1)},children:t===`delete`?`Delete`:`Stop the run`})]})]})})}function Fo(e){let t=x(),[n,r]=(0,z.useState)(null),i=()=>t.invalidateQueries({queryKey:j.runs.all}),a=M({mutationFn:()=>_e(e.id),onSuccess:i,onError:e=>{e instanceof T&&e.status===409&&i(),I(e.message,{tone:`danger`})}});return{request:()=>r(`cancel`),pending:a.isPending,dialog:(0,B.jsx)(Po,{run:e,confirming:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>a.mutate()})}}var Io=`quick-task`;function Lo(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var Ro=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`junie`,label:`junie`,desc:`JetBrains Junie CLI`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`cursor`,label:`cursor`,desc:`Cursor Agent CLI`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`copilot`,label:`copilot`,desc:`GitHub Copilot CLI (ACP)`}],zo={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],junie:[{id:``,label:`auto`,desc:`Use your Junie default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`},{id:`anthropic/claude-opus-4-8`,label:`claude-opus-4.8`,desc:`via Anthropic`},{id:`anthropic/claude-sonnet-5`,label:`claude-sonnet-5`,desc:`via Anthropic`},{id:`openai/gpt-5.1`,label:`gpt-5.1`,desc:`via OpenAI`}],copilot:[{id:``,label:`auto`,desc:`Let Copilot pick the model`}]},Bo={claude:/^claude[-.]/,codex:/^gpt[-.]/},Vo=[`opencode`,`pi`];function Ho(e,t){return!e||zo[t].some(t=>t.id===e)||Bo[t]?.test(e)?!1:Object.entries(zo).some(([n,r])=>n!==t&&!Vo.includes(n)&&r.some(t=>t.id!==``&&t.id===e))||Object.entries(Bo).some(([n,r])=>n!==t&&r.test(e))}function Uo(e,t,n=[]){let r=zo[e]??zo.claude,i=Re(e)?t?.models??[]:[],a=i.length>0?[Wo(r)]:[...r],o=new Set(a.map(e=>e.id));for(let e of i)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||Ho(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}function Wo(e){return e.find(e=>e.id===``)??{id:``,label:`auto`,desc:``}}var Go={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,junie:`Junie`,cursor:`Cursor`};function Ko(e,t,n=!1){if(!Re(e))return;let r=Go[e];if(t?.stale)return`Using cached ${r} model list`;if(n||t?.source===`unavailable`)return`Latest ${r} models unavailable`}function qo(e){let t=Ro.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Jo(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Yo(e,t,n=!1){return!n&&e===t?void 0:e}function Xo(e,t,n,r){let i=Uo(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function Zo(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function Qo(e,t,n){return e&&Zo(e,t,n)?e:null}function $o(e){let{task:t,source:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,agentProfile:c,variants:l,images:u,worktree:d,newBranch:f,branch:p,autonomous:m,generateFollowups:h,todoId:g,dispatch:_}=e,v=d===!1&&l<=1&&!_;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,runner:Yo(a,s,o),agentProfile:c||void 0,variants:l>1?l:void 0,images:u.length>0?[...u]:void 0,worktree:d===!1&&l<=1?!1:void 0,...v&&f?{newBranch:!0,...p?.trim()?{branch:p.trim()}:{}}:{},autonomous:m===!0||void 0,generateFollowups:h!==!1&&void 0,todoId:g||void 0,dispatch:_??void 0}}function es(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var ts=`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-55`,ns=(0,B.jsx)(ht,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`});function rs({active:e=!1,skill:t=!1,dashed:n=!1,chevron:r=!1,icon:i,className:a,children:o,type:s=`button`,...c}){return(0,B.jsxs)(`button`,{type:s,"data-slot":`chip`,"data-active":e?`true`:void 0,"data-skill":t?`true`:void 0,className:P(ts,e&&`border-foreground font-semibold text-foreground`,t&&`border-violet font-mono font-semibold text-foreground`,n&&`border-dashed`,a),...c,children:[i,o,r?ns:null]})}function is({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:s=!1,hint:c,disabledHint:l,status:u,searchPlaceholder:d}){let[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(``),g=(0,z.useRef)(null),_=(0,z.useRef)(null),v=d?i.filter(e=>e.label.toLowerCase().includes(m.trim().toLowerCase())):i;if((0,z.useEffect)(()=>{if(!f||!d)return;let e=window.setTimeout(()=>g.current?.focus());return()=>window.clearTimeout(e)},[f,d]),s)return(0,B.jsx)(`span`,{"data-slot":e,"aria-label":t,title:l??c,className:`${ts} cursor-default hover:bg-card hover:text-muted-foreground`,children:n});let y=(0,B.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?l:c,className:ts,children:[n,ns]});return o?(0,B.jsx)(`span`,{title:l,className:`inline-flex`,children:y}):(0,B.jsxs)(wt,{open:f,onOpenChange:e=>{p(e),e||h(``)},children:[(0,B.jsx)(kt,{asChild:!0,children:y}),(0,B.jsxs)(Et,{ref:_,align:`start`,"data-testid":`${e}-menu`,children:[d?(0,B.jsxs)(`div`,{className:`mb-1 flex h-9 items-center gap-2 border-b border-border px-2`,children:[(0,B.jsx)(st,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,B.jsx)(`input`,{ref:g,type:`search`,"aria-label":d,placeholder:d,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=_.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-full min-w-48 bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}):null,(0,B.jsx)(Tt,{value:r,onValueChange:a,children:v.map(e=>(0,B.jsx)(Dt,{value:e.value,className:`gap-2.5`,children:(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,B.jsx)(`span`,{className:`max-w-[calc(100vw-3rem)] whitespace-normal break-words text-[11.5px] text-muted-foreground md:max-w-96`,children:e.desc}):null]})},e.value))}),d&&v.length===0?(0,B.jsx)(`p`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No branches found.`}):null,u?(0,B.jsx)(L,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:u}):null]})]})}var as=(e,t)=>t===null?e:`${e}:${t}`;function os({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o}){let s=Ro.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:as(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:as(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),c=a??o?.[t]??`default`,l=s.some(e=>e.value===as(t,c))?as(t,c):as(t,null);return(0,B.jsx)(is,{slot:`runner-pill`,ariaLabel:`Runner`,label:s.find(e=>e.value===l)?.label??t,value:l,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:s})}function ss(e){let t=ie(),n=Se(),r=e.runner??t.data?.defaultRunner??`claude`,i=e.model??`auto`,a=[...e.steps].reverse().find(e=>e.profileId)?.profileId,o=a===void 0?void 0:a==="default"?`default`:n.data?.profiles.find(e=>e.id===a)?.label??`${a} (removed)`;return{runner:r,account:o,model:i,identity:e.modelIdentity&&e.modelIdentity!==i?e.modelIdentity:void 0,summary:[r,o,i].filter(Boolean).join(` · `)}}function cs({run:e}){let t=ss(e),n=o(t.runner),r=Uo(t.runner,n.data,[e.model]).find(e=>e.id===t.model)?.label??t.model,i=`The session’s engine — pick another when you continue it`;return(0,B.jsxs)(`div`,{"data-slot":`run-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,B.jsx)(is,{slot:`run-engine-runner`,ariaLabel:`Agent`,label:t.account&&t.account!=="default"?`${t.runner} · ${t.account}`:t.runner,value:t.runner,options:[],onPick:()=>{},readOnly:!0,hint:i}),(0,B.jsx)(is,{slot:`run-engine-model`,ariaLabel:`Model`,label:r,value:t.model,options:[],onPick:()=>{},readOnly:!0,hint:t.identity?`${i} (served as ${t.identity})`:i})]})}function ls(e){switch(e){case`done`:return`done`;case`running`:case`waiting`:case`review`:return`active`;case`failed`:case`cancelled`:return`failed`;case`pending`:case`skipped`:return`pending`}}function us(e){if(e.length===0)return 0;let t=new Set([`done`,`failed`,`cancelled`,`skipped`]),n=new Set([`running`,`waiting`,`review`]),r=0;for(let i of e)t.has(i.status)?r+=1:n.has(i.status)&&(r+=.5);return r/e.length}function ds({steps:e}){if(e.length===0)return null;let t=us(e)*100;return(0,B.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,B.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":ls(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,B.jsx)(fs,{visual:ls(t.status)}),(0,B.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,B.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,B.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-[11.5px] text-soft-foreground tabular-nums`,children:[t.kind,` · step `,n+1,` of `,e.length]})]},t.id)),(0,B.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function fs({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,B.jsx)(bt,{"aria-hidden":!0,className:P(t,`text-success`)});case`active`:return(0,B.jsx)(zt,{role:`status`,"aria-label":`Step running`,className:P(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,B.jsx)(ct,{"aria-hidden":!0,className:P(t,`text-danger`)});case`pending`:return(0,B.jsx)(Ct,{"aria-hidden":!0,className:P(t,`text-soft-foreground`)})}}function ps(e){let t=e.findIndex(e=>ls(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>ls(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function ms({visual:e}){return(0,B.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:P(`size-1.5 rounded-full`,e===`done`?`bg-success`:e===`failed`?`bg-danger`:e===`active`?`bg-pending`:`bg-soft-foreground`,e===`active`&&`animate-pulse motion-reduce:animate-none`)})}var hs=new Map;function gs({runId:e,steps:t}){let[n,r]=(0,z.useState)(()=>hs.get(e)??!1);if(t.length===0)return null;let i=t=>{hs.set(e,t),r(t)},a=ps(t),o=t[a],s=us(t)*100;return(0,B.jsxs)(qt,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,B.jsxs)(Kt,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group -my-2 flex min-h-11 w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground md:my-0 md:min-h-[30px] md:gap-2.5`,children:[(0,B.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,B.jsx)(ms,{visual:ls(e.status)},e.id))}),(0,B.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,B.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,B.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,B.jsx)(ht,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,B.jsx)(Wt,{children:(0,B.jsx)(`div`,{className:`pt-2`,children:(0,B.jsx)(ds,{steps:t})})})]})}var _s=20;function vs(e){return e.reduce((e,t)=>Pe(t.mediaType)?e+Math.floor(t.data.length*3/4):e,0)}function ys(e,t){return e.length>=_s||vs(e)+vs([t])>20971520?null:[...e,t]}var bs={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`},xs=new Set(`html.htm.xml.css.scss.less.csv.tsv.json.jsonl.ndjson.yaml.yml.toml.ini.env.conf.cfg.sql.graphql.gql.diff.patch.js.mjs.cjs.jsx.ts.mts.cts.tsx.vue.svelte.astro.php.py.rb.go.rs.java.kt.swift.c.h.cc.cpp.hpp.cs.sh.bash.zsh.ps1.bat.lua.pl.r.dart.scala.ex.exs.erl.hs.twig.rst.adoc.tex.srt.vtt`.split(`.`)),Ss=new Set([`application/json`,`application/xml`,`application/javascript`,`application/x-yaml`,`application/yaml`,`application/sql`,`application/x-sh`]);function Cs(e){if(je(e.type)&&e.type!==`application/octet-stream`)return e.type;let t=e.name.includes(`.`)?e.name.split(`.`).pop()?.toLowerCase()??``:``;return bs[t]||(xs.has(t)||e.type.startsWith(`text/`)||Ss.has(e.type)?`text/plain`:Fe)}function ws(e,t){return t?`pasted image`:`pasted.${Be(e)}`}async function Ts(e,t=`file`){let n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e<n.length;e+=32768)r+=String.fromCharCode(...n.subarray(e,e+32768));let i=btoa(r),a=Cs(e),o=Pe(a),s=t===`clipboard`&&o?void 0:e.name;return{mediaType:a,data:i,...o?{preview:`data:${a};base64,${i}`}:{},name:s||ws(a,o),...s?{originalName:s}:{},isImage:o}}function Es({mediaType:e,data:t,originalName:n}){return{mediaType:e,data:t,...n?{name:n}:{}}}function Ds(e,t,n=0){let r=[],i=[],a=t,o=n;for(let t of e){let e=t.name?`“${t.name}”`:`attachment`;if(t.size>5242880){i.push(`${e} is too large (max 5 MB)`);continue}if(a>=_s){i.push(`${e} skipped — max ${_s} attachments per message`);continue}let n=Pe(Cs(t));if(n&&o+t.size>20971520){i.push(`${e} skipped — max 20 MB of images per message`);continue}r.push(t),a+=1,n&&(o+=t.size)}return{accepted:r,rejected:i}}function Os(e){let t=[];for(let n of e)n.id!==void 0&&t.push({id:n.id,mediaType:n.mediaType,name:n.name,bytes:0});return t}function ks(e,t,{enabled:n=!0}={}){let r=x(),i=n&&e!==``&&t!==``,a=ee(i?e:void 0),o=a.data?.surfaces?.[t],[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)([]),d=`${e} ${t}`,[f,p]=(0,z.useState)(d),m=(0,z.useRef)(!1),h=(0,z.useRef)(void 0),_=(0,z.useRef)(!1),v=(0,z.useRef)(null),y=(0,z.useRef)(Promise.resolve()),b=(0,z.useRef)({runId:e,surface:t,text:s,images:l});b.current.text=s,b.current.images=l;let S=(0,z.useRef)([]);if(f!==d){if(p(d),v.current!==null){clearTimeout(v.current),v.current=null;let e=b.current;S.current=[...S.current.filter(t=>t.runId!==e.runId||t.surface!==e.surface),{runId:e.runId,surface:e.surface,text:e.text,images:e.images.map(e=>e.id).filter(e=>e!==void 0)}]}c(``),u([]),m.current=!1,_.current=!1,b.current={runId:e,surface:t,text:``,images:[]}}let C=(0,z.useCallback)((e,t,n)=>{r.setQueryData(j.runs.drafts(e),e=>{let r={...e?.surfaces??{}};return n===null||n.text===``&&n.images.length===0?delete r[t]:r[t]={...n,updatedAt:new Date().toISOString()},{surfaces:r}})},[r]),w=(0,z.useRef)(C);w.current=C;let T=(0,z.useRef)(i);T.current=i;let E=(0,z.useCallback)((e,t,n,r)=>{T.current&&(y.current=y.current.catch(()=>{}).then(()=>we(e,t,n,r?{keepalive:!0}:void 0)).then(n=>w.current(e,t,n)).catch(()=>{}))},[]),D=(0,z.useCallback)(()=>{v.current!==null&&(clearTimeout(v.current),v.current=null)},[]),O=(0,z.useCallback)(e=>{D();let t=b.current;E(t.runId,t.surface,{text:t.text,images:t.images.map(e=>e.id).filter(e=>e!==void 0)},e)},[D,E]),k=(0,z.useCallback)(()=>{D(),v.current=setTimeout(()=>{v.current=null,!_.current&&O()},500)},[D,O]),A=(0,z.useCallback)((n,r)=>{m.current=!0,T.current&&(C(e,t,{text:n,images:Os(r)}),k())},[C,e,k,t]),te=(0,z.useCallback)(e=>{c(e),b.current={...b.current,text:e},A(e,b.current.images)},[A]),ne=(0,z.useCallback)((n,r=`edit`)=>{let i=b.current.images.map(e=>e.id).filter(e=>e!==void 0&&!n.some(t=>t.id===e));if(u(n),b.current={...b.current,images:n},A(b.current.text,n),r!==`submit`&&T.current)for(let n of i)Oe(e,t,n).catch(()=>{});let a=e,o=t;for(let e of n)e.id!==void 0||!T.current||fe(a,o,{mediaType:e.mediaType,data:e.data,name:e.name}).then(t=>{b.current.runId!==a||b.current.surface!==o||(u(n=>{let r=n.map(n=>n===e?{...n,id:t.id}:n);return b.current={...b.current,images:r},r}),A(b.current.text,b.current.images))}).catch(()=>{})},[A,e,t]),re=(0,z.useCallback)(()=>{D(),_.current=!1,c(``),u([]),b.current={...b.current,text:``,images:[]},m.current=!1,h.current=d,C(e,t,null),E(e,t,{text:``,images:[]})},[C,D,d,e,t,E]),ie=(0,z.useCallback)(async e=>{_.current=!0,D();try{let t=await e();return _.current=!1,re(),t}catch(e){throw _.current=!1,k(),e}},[D,re,k]);return(0,z.useEffect)(()=>{if(S.current.length===0)return;let e=S.current;S.current=[];for(let t of e)E(t.runId,t.surface,{text:t.text,images:t.images})}),(0,z.useEffect)(()=>{if(h.current===d||o===void 0||(h.current=d,m.current))return;let n=typeof o.text==`string`?o.text:``,r=Array.isArray(o.images)?o.images:[];if(c(n),b.current={...b.current,text:n},r.length===0)return;let i=!0;return Promise.all(r.slice(0,_s).map(async n=>{try{let r=await g(e,t,n.id),i=Pe(r.mediaType),a=r.name!==``&&r.name!==ws(r.mediaType,i);return{id:r.id,mediaType:r.mediaType,data:r.data,name:r.name||ws(r.mediaType,i),...a?{originalName:r.name}:{},...i?{preview:`data:${r.mediaType};base64,${r.data}`}:{},isImage:i}}catch{return null}})).then(e=>{let t=e.filter(e=>e!==null);!i||t.length===0||m.current||(u(t),b.current={...b.current,images:t})}),()=>{i=!1}},[o,d,e,t]),(0,z.useEffect)(()=>{let e=()=>{v.current===null||_.current||O(!0)},t=()=>{document.visibilityState===`hidden`&&e()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,e),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,e)}},[O]),(0,z.useEffect)(()=>()=>{v.current!==null&&O()},[O]),{ready:!i||a.isSuccess||a.isError,hasDraft:s!==``||l.length>0,text:s,setText:te,images:l,setImages:ne,submit:ie,clear:re}}function As(e){let t=x();return M({mutationFn:()=>a(e),onSuccess:()=>t.invalidateQueries({queryKey:j.runs.all}),onError:e=>I(e.message,{tone:`danger`})})}function js(e){let t=se().data?.capabilities?.localHandoff;return di(e).terminal&&t!==!1}function Ms(e,{onMarkedUnread:t,surface:n=`task_view`,onScreen:i=!0}={}){let a=x(),o=He(),[s,l]=(0,z.useState)(null),u=ie().data?.worktreeLifecycle,d=!!e.worktreeLifecycle||!!e.worktreePath&&!!((u?.afterCreate.length??0)+(u?.beforeRemove.length??0)),p=()=>a.invalidateQueries({queryKey:j.runs.all}),m=e=>{e instanceof T&&e.status===409&&p(),I(e.message,{tone:`danger`})},h=As(e.id),g=M({mutationFn:t=>xe(e.id,!e.archived,t??n),onSuccess:p,onError:m}),_=r(n),y={isPending:_.isPending,mutate:t=>_.mutate({id:e.id,pinned:!e.pinned,surface:t},{onError:m})},b=f(),S={isPending:b.isPending,mutate:()=>{t?.(),b.mutate(e.id,{onError:m})}},C=c();return{finish:h,archive:g,pin:y,markUnread:S,markRead:{isPending:C.isPending,mutate:()=>C.mutate(e.id,{onError:m})},cancel:M({mutationFn:()=>_e(e.id),onSuccess:p,onError:m}),delete:M({mutationFn:async()=>{let t=(e.worktreePath&&!e.worktreeLifecycle?await v():void 0)?.worktreeLifecycle;return e.worktreeLifecycle||e.worktreePath&&(t?.afterCreate.length??0)+(t?.beforeRemove.length??0)>0?{kind:`lifecycle`,operation:(await E({requestId:crypto.randomUUID(),runId:e.id,intent:`delete-task`})).operation}:(await Ee(e.id),{kind:`deleted`})},onSuccess:t=>{if(p(),t.kind===`lifecycle`){let n=t.operation;a.setQueryData(Ke.operation(n.id),{operation:n}),a.setQueryData(j.runs.detail(e.id),e=>e&&{...e,worktreeLifecycle:{worktreeId:n.worktreeId,generation:n.generation,activeOperationId:n.id,phase:n.phase,state:n.state,needsAttention:n.state===`needs_attention`||n.state===`interrupted`}}),a.invalidateQueries({queryKey:Ke.all()}),I(`Cleanup requested. The task is kept until cleanup completes.`),i&&o(`/tasks/${e.id}`);return}i&&o(`/`)},onError:m}),lifecycleDelete:d,terminal:M({mutationFn:()=>k(e.id),onError:e=>{if(e instanceof T&&e.command){Ns(e.command,`No terminal found — command copied to clipboard.`);return}m(e)}}),confirming:s,setConfirming:l}}async function Ns(e,t){try{await navigator.clipboard.writeText(e),I(t)}catch{I(`Run manually: ${e}`)}}function Ps(e,t){let n=b(),r=m(),i=M({mutationFn:t=>ye(e.id,t),onError:e=>I(e.message,{tone:`danger`})}),a=ae(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`),s=t&&o(e.runner);return{choices:e.worktreePath?(n.data?.targets??[]).filter(t=>{let n=Jr(t.id);return n===void 0||!e.worktreeLifecycle?.activeOperationId&&o(n)}).map(t=>({target:t,...ui(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],canResumeHere:s,open:e=>i.mutate(e)}}var Fs=new Map,Is=Object.values({run:(e,t)=>e.run===t.run,tab:(e,t)=>e.tab===t.tab,onMarkedUnread:(e,t)=>e.onMarkedUnread===t.onMarkedUnread,continuationEngine:(e,t)=>e.continuationEngine===t.continuationEngine,tabs:(e,t)=>e.tabs===t.tabs,headerActions:(e,t)=>e.headerActions===t.headerActions,wide:(e,t)=>e.wide===t.wide,planTally:(e,t)=>e.planTally?.done===t.planTally?.done&&e.planTally?.total===t.planTally?.total}),Ls=(0,z.memo)(Rs,(e,t)=>Is.every(n=>n(e,t)));function Rs({run:e,planTally:t,tab:n=`session`,onMarkedUnread:r,continuationEngine:i,tabs:a,headerActions:o,wide:c=!1}){let l=h(e),u=p(e),d=js(e),f=li(e),m=Ms(e,{onMarkedUnread:r}),g=n===`session`,[,_]=(0,z.useReducer)(e=>e+1,0),v=(0,z.useId)(),y=Fs.get(e.id)??!1,b=()=>{Fs.set(e.id,!y),_()},x=De((0,z.useMemo)(()=>t=>e.status===`queued`?s(t).get(e.id):void 0,[e.id,e.status])).data,S=se(),C=rn(S.data),w=Js(e),[T,E]=dc();return(0,B.jsx)(Ye,{projectId:w.projectId,requests:w.requests,children:(0,B.jsxs)(`header`,{"data-slot":`run-header`,className:`relative z-20 border-b border-border bg-background/95 px-3 pt-2 backdrop-blur md:sticky md:top-0 md:px-6 md:pt-3`,children:[(0,B.jsxs)(`div`,{className:P(`mx-auto w-full`,!c&&`max-w-[var(--measure)]`),children:[(0,B.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-h-[30px] min-w-0 items-center gap-2`,children:[(0,B.jsxs)(`span`,{"data-slot":`run-identity`,className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,B.jsx)(Gs,{run:e}),(0,B.jsx)(Bs,{planTally:t,budget:u})]}),(0,B.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2.5`,children:[(0,B.jsx)(zs,{attention:l,queuePosition:x}),o,(0,B.jsx)(F,{variant:`ghost`,size:`icon-sm`,"data-action":`collapse-header`,className:`hidden text-muted-foreground md:inline-flex`,"aria-label":T?`Expand header`:`Collapse header`,"aria-expanded":!T,title:T?`Expand header`:`Collapse header`,onClick:()=>E(!T),children:T?(0,B.jsx)(dn,{"aria-hidden":`true`}):(0,B.jsx)(un,{"aria-hidden":`true`})}),(0,B.jsx)(F,{variant:`ghost`,size:`icon-sm`,className:`md:hidden`,"aria-label":y?`Hide run details`:`Show run details`,"aria-controls":v,"aria-expanded":y,onClick:b,children:(0,B.jsx)(ht,{"aria-hidden":`true`,className:P(`transition-transform`,y&&`rotate-180`)})}),(0,B.jsx)(ic,{run:e,actions:m,showRunControls:!g})]})]}),(0,B.jsx)(`div`,{id:v,"data-slot":`run-details`,className:P(y?`block`:`hidden`,T?`md:hidden`:`md:block`),children:(0,B.jsx)(qs,{run:e,references:w.references,actions:(0,B.jsxs)(`div`,{"data-slot":`run-actions`,className:`hidden items-center gap-1 md:flex`,children:[(0,B.jsx)(Hs,{run:e,actions:m,showRunControls:!g}),(0,B.jsx)(Ws,{run:e,canResume:d,onResume:()=>m.terminal.mutate()})]}),continuationEngine:i,showTokens:C.tokens,showCost:C.cost,automationsAvailable:S.data?.capabilities?.automations===!0})}),(0,B.jsx)(nc,{run:e}),(0,B.jsx)(Zs,{run:e}),(0,B.jsx)(ec,{run:e}),(0,B.jsx)(`div`,{"data-slot":`run-tabs`,className:`mt-1.5 flex items-end gap-1 overflow-x-auto md:mt-2.5 md:overflow-x-visible`,children:a??(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(R,{to:`/tasks/${e.id}`,active:n===`session`,children:`Session`}),(0,B.jsx)(R,{to:`/tasks/${e.id}/changes`,active:n===`changes`,children:`Changes`}),(0,B.jsx)(R,{to:`/tasks/${e.id}/commits`,active:n===`commits`,children:`Commits`}),(0,B.jsx)(R,{to:`/tasks/${e.id}/files`,active:n===`files`,children:`Files`}),e.workflowDef?(0,B.jsx)(R,{to:`/tasks/${e.id}/graph`,active:n===`graph`,children:`Graph`}):null,(0,B.jsx)(R,{to:`/tasks/${e.id}/notes`,active:n===`notes`,children:`Notes`}),(0,B.jsx)(R,{to:`/tasks/${e.id}/preview`,active:n===`preview`,children:`Preview`}),S.data?.capabilities?.terminal?(0,B.jsx)(R,{to:`/tasks/${e.id}/terminal`,active:n===`terminal`,children:`Terminal`}):null]})}),e.steps.length>0?(0,B.jsx)(`div`,{className:P(`border-t border-border pt-1 pb-0 md:pt-2 md:pb-1`,T&&`md:hidden`),children:(0,B.jsx)(gs,{runId:e.id,steps:e.steps})}):null,f?(0,B.jsx)(`div`,{className:T?`md:hidden`:void 0,children:(0,B.jsx)(lc,{hint:f})}):null]}),(0,B.jsx)(Po,{run:e,confirming:m.confirming,lifecycleDelete:m.lifecycleDelete,onOpenChange:e=>!e&&m.setConfirming(null),onConfirm:e=>e===`delete`?m.delete.mutate():m.cancel.mutate()})]})})}function zs({attention:e,queuePosition:t}){return(0,B.jsxs)(Gt,{className:`shrink-0`,dot:e.tone,pulse:e.pulse,children:[e.label,t===void 0?``:` #${t}`]})}function Bs({planTally:e,budget:t}){return(0,B.jsxs)(B.Fragment,{children:[e?(0,B.jsxs)(`span`,{"data-slot":`plan-mirror`,className:`hidden shrink-0 text-[11px] text-soft-foreground tabular-nums md:inline`,children:[`Plan `,e.done,`/`,e.total]}):null,t?(0,B.jsxs)(`span`,{"data-slot":`budget-stop`,className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:[`Spent `,be(t.spent)||`$0.00`,` of `,be(t.ceiling)||`$0.00`]}):null]})}function Vs(e){return W(e.status)?`Stop the task first`:void 0}function Hs({run:e,actions:t,showRunControls:n}){let r=di(e),i=Vs(e),a=n&&r.cancel,o=n&&e.status===`waiting`&&r.finish,s=e.worktreeLifecycle?.activeOperationId?`Resolve the worktree operation first`:void 0;return(0,B.jsxs)(`span`,{"data-slot":`task-item-actions`,className:`mx-1 flex items-center gap-0.5`,children:[r.markRead||r.markUnread?(0,B.jsx)(Us,{slot:`unread-toggle`,label:r.markRead?`Mark read`:`Mark unread`,title:r.markRead?`Unread — mark it read`:`Mark unread — put it back in your unread list`,pressed:r.markRead,pending:t.markRead.isPending||t.markUnread.isPending,onClick:()=>r.markRead?t.markRead.mutate():t.markUnread.mutate(),className:P(r.markRead&&`text-violet hover:text-violet [&_svg]:fill-violet/25`),children:(0,B.jsx)(Dn,{"aria-hidden":`true`})}):null,(0,B.jsx)(Us,{slot:`pin-run`,label:e.pinned?`Unpin`:`Pin`,title:e.pinned?`Pinned — unpin from the top of this project’s task list`:`Pin to the top of this project’s task list`,pressed:!!e.pinned,unavailable:r.pin?void 0:`Archived tasks can’t be pinned`,pending:t.pin.isPending,onClick:()=>t.pin.mutate(),className:P(e.pinned&&`text-violet hover:text-violet [&_svg]:fill-violet/25`),children:(0,B.jsx)(Nn,{"aria-hidden":`true`})}),(0,B.jsx)(Us,{slot:`archive-run`,label:e.archived?`Unarchive`:`Archive`,title:e.archived?`Archived — move it back to the active list`:`Move to the archived list`,pressed:!!e.archived,unavailable:i,pending:t.archive.isPending,onClick:()=>t.archive.mutate(void 0),className:P(e.archived&&`text-violet hover:text-violet [&_svg]:fill-violet/25`),children:(0,B.jsx)(sn,{"aria-hidden":`true`})}),(0,B.jsx)(Us,{slot:`delete-run`,label:`Delete`,title:`Delete the task, its worktree and its branch`,unavailable:i??s,danger:!0,onClick:()=>t.setConfirming(`delete`),className:`ml-1`,children:(0,B.jsx)(ft,{"aria-hidden":`true`})}),a||o?(0,B.jsxs)(wt,{children:[(0,B.jsx)(Ot,{label:`More actions`,children:(0,B.jsx)(kt,{asChild:!0,children:(0,B.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":`More actions`,children:(0,B.jsx)(bn,{"aria-hidden":`true`})})})}),(0,B.jsxs)(Et,{align:`end`,"data-slot":`run-more-menu`,children:[o?(0,B.jsxs)(L,{onSelect:()=>t.finish.mutate(),children:[(0,B.jsx)(mt,{"aria-hidden":`true`}),` End session`]}):null,a?(0,B.jsxs)(L,{variant:`destructive`,onSelect:()=>t.setConfirming(`cancel`),children:[(0,B.jsx)(fn,{"aria-hidden":`true`}),` Stop`]}):null]})]}):null]})}function Us({slot:e,label:t,title:n,unavailable:r,pending:i=!1,pressed:a,danger:o=!1,onClick:s,className:c,children:l}){let u=r!==void 0;return(0,B.jsx)(Ot,{label:r??n,children:(0,B.jsx)(F,{variant:`ghost`,size:`icon-sm`,"data-slot":e,"aria-label":t,"aria-pressed":a,"aria-disabled":u||void 0,disabled:i,onClick:u?void 0:s,className:P(c,o&&`hover:bg-danger/10 hover:text-danger`,u&&`cursor-not-allowed opacity-50 hover:bg-transparent hover:text-muted-foreground`),children:l})})}function Ws({run:e,canResume:t,onResume:n}){let{choices:r,canResumeHere:i,open:a}=Ps(e,t);return!i&&r.length===0?null:(0,B.jsx)(Yr,{choices:r,onPick:a,title:`Resume in a terminal, or open the worktree locally`,leading:i?(0,B.jsxs)(L,{"data-target":`terminal-resume`,onSelect:n,children:[(0,B.jsx)(Rn,{"aria-hidden":`true`}),`Terminal (resume session)`]}):null,trailing:e.worktreePath?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(St,{}),(0,B.jsxs)(L,{onSelect:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>I(`Worktree path copied`)).catch(()=>I(`Path: ${t}`))},children:[(0,B.jsx)(gn,{"aria-hidden":`true`}),`Copy worktree path`]})]}):null})}function Gs({run:e}){let t=Ae(e.id),n=_(e),r=ks(e.id,`title`),i=ua(n,e=>t.mutate({title:e},{onError:e=>I(e.message,{tone:`danger`})})),a={...i,setDraft:e=>{i.setDraft(e),r.setText(e)},commit:()=>{i.commit(),r.clear()},cancel:()=>{i.cancel(),r.clear()}},o=(0,z.useRef)(i.beginWith);o.current=i.beginWith;let s=i.editing;return(0,z.useEffect)(()=>{s||!r.ready||!r.hasDraft||o.current(r.text)},[r.hasDraft,r.ready,r.text,s]),i.editing?(0,B.jsx)(da,{editor:a,className:`flex-1 text-[15px] font-semibold`}):(0,B.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,B.jsx)(`h1`,{className:`min-w-0 truncate text-[15px] font-semibold`,title:e.task,children:n}),(0,B.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:i.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,B.jsx)(Bt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Ks({branch:e}){let[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),(0,B.jsx)(vt,{children:(0,B.jsxs)(yt,{open:r,onOpenChange:e=>{e&&a.current===null&&n(!1),i(e)},children:[(0,B.jsx)(gt,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,"data-slot":`branch-chip`,className:`cursor-copy rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,"aria-label":`Copy branch name ${e}`,onClick:()=>{if(!navigator.clipboard){I(`Branch: ${e}`);return}navigator.clipboard.writeText(e).then(()=>{n(!0),i(!0),a.current!==null&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,i(!1)},1500)}).catch(()=>I(`Branch: ${e}`))},children:[e,(0,B.jsx)(`span`,{className:`sr-only`,role:`status`,children:t?`Branch name copied`:``})]})}),(0,B.jsx)(_t,{children:t?`Copied`:`Copy branch name`})]})})}function qs({run:e,references:t,actions:n,showTokens:r,showCost:i,automationsAvailable:a,continuationEngine:o}){let s=S(),c=[(0,B.jsx)(`span`,{children:Te(e)},`workflow`)],l=e.branch;l&&c.push((0,B.jsx)(Ks,{branch:l},`branch`)),e.diffStat&&c.push((0,B.jsx)(an,{stat:e.diffStat},`diff`)),c.push(...Ys(e,t));let u=ge(e,s);if(u&&ze(u)){let t=Ce(u);c.push((0,B.jsx)(at,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:u},taskTitle:_(e),className:`h-5`},`issue`))}return e.automation&&c.push(a?(0,B.jsx)(We,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,B.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`)),(0,B.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[c.map((e,t)=>(0,B.jsxs)(z.Fragment,{children:[t>0?(0,B.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,B.jsx)(Xs,{run:e,showTokens:r,showCost:i,continuationEngine:o,className:`ml-auto`}),n]})}function Js(e){let t=S(),n=w(),r=(0,z.useMemo)(()=>re(e,t),[e,t]);return{projectId:n,references:r,requests:(0,z.useMemo)(()=>n===void 0?[]:r.map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n])}}function Ys(e,t){let n=[],r=t.filter(e=>e.kind===`PR`),i=pe(e);i&&ze(i)&&!r.some(e=>e.url===i)&&r.push({kind:`PR`,url:i});let[a]=r;return a&&n.push((0,B.jsxs)(`span`,{"data-slot":`run-pr-refs`,className:`flex flex-nowrap items-center gap-1`,children:[(0,B.jsx)(at,{reference:a,taskTitle:_(e),className:`h-5 shrink-0`,conflictAction:(0,B.jsx)(Di,{run:e,prNumber:a.number})}),r.length>1?(0,B.jsx)(ha,{references:r,taskTitle:_(e),hidden:r.length-1}):null]},`pr`)),n}function Xs({run:e,showTokens:t,showCost:n,continuationEngine:r,className:i}){let a=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&a.push((0,B.jsx)(Ut,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&a.push((0,B.jsx)(`span`,{className:`tabular-nums`,children:be(e.costUsd)},`cost`)),(0,B.jsxs)(`span`,{"data-slot":`run-usage`,className:P(`flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,i),children:[a.map((e,t)=>(0,B.jsxs)(z.Fragment,{children:[t>0?(0,B.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,B.jsx)(rc,{run:e,continuationEngine:r})]})}function Zs({run:e}){let t=De(),n=e.dispatch?.parentRunId;if(n===void 0)return null;let r=(t.data??[]).find(e=>e.id===n),i=r?h(r):null;return(0,B.jsxs)(`div`,{"data-slot":`dispatch-parent-line`,className:`mt-1 flex min-w-0 items-center gap-2 overflow-hidden text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`shrink-0`,children:`Dispatched by`}),(0,B.jsxs)(We,{to:`/tasks/${n}`,"data-slot":`dispatch-parent`,"data-run-id":n,className:`inline-flex min-w-0 items-center gap-1.5 truncate hover:text-foreground`,children:[i?(0,B.jsx)(nn,{tone:i.tone,pulse:i.pulse}):null,(0,B.jsx)(`span`,{className:`truncate`,children:r?_(r):n})]})]})}var Qs=4,$s=new Map;function ec({run:e}){let t=De(),[,n]=(0,z.useReducer)(e=>e+1,0),r=(0,z.useId)(),i=(t.data??[]).filter(t=>t.dispatch?.parentRunId===e.id);if(i.length===0)return null;let a=$s.get(e.id)??i.length<=Qs;return(0,B.jsxs)(`div`,{"data-slot":`dispatch-children`,className:`mt-1 min-w-0 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`button`,{type:`button`,"data-slot":`dispatch-children-toggle`,"aria-controls":r,"aria-expanded":a,onClick:()=>{$s.set(e.id,!a),n()},className:`flex min-w-0 max-w-full items-center gap-1.5 overflow-hidden hover:text-foreground`,children:[(0,B.jsx)(ht,{"aria-hidden":`true`,className:P(`size-3 shrink-0 transition-transform`,!a&&`-rotate-90`)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`Subtasks`}),(0,B.jsx)(`span`,{"data-slot":`dispatch-children-count`,className:`shrink-0 tabular-nums`,children:i.length}),(0,B.jsx)(tc,{subtasks:i})]}),a?(0,B.jsx)(`div`,{id:r,"data-slot":`dispatch-children-list`,className:`mt-0.5 flex max-h-28 min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 overflow-y-auto overscroll-contain pl-[1.125rem]`,children:i.map(e=>{let t=h(e);return(0,B.jsxs)(We,{to:`/tasks/${e.id}`,"data-slot":`dispatch-child`,"data-run-id":e.id,title:`${_(e)} — ${t.label}`,className:`inline-flex max-w-52 items-center gap-1.5 truncate hover:text-foreground`,children:[(0,B.jsx)(nn,{tone:t.tone,pulse:t.pulse}),(0,B.jsx)(`span`,{className:`truncate`,children:_(e)})]},e.id)})}):null]})}function tc({subtasks:e}){let t=new Map;for(let n of e){let e=h(n),r=t.get(e.label);if(r){r.count+=1;continue}t.set(e.label,{tone:e.tone,pulse:e.pulse,rank:l[e.bucket],count:1})}return(0,B.jsx)(`span`,{"data-slot":`dispatch-children-tally`,className:`flex min-w-0 items-center gap-2 overflow-hidden`,children:[...t.entries()].sort(([,e],[,t])=>e.rank-t.rank||t.count-e.count).map(([e,t])=>(0,B.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,B.jsx)(nn,{tone:t.tone,pulse:t.pulse}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:t.count}),(0,B.jsx)(`span`,{children:e})]},e))})}function nc({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,B.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Automatic checks paused — 40/40 reached`});let t=e.monitoringWakeAt?new Date(e.monitoringWakeAt):null,n=t&&Number.isFinite(t.getTime())?t:null;if(!n)return(0,B.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Parked — no automatic check scheduled`});let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n);return(0,B.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,B.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function rc({run:e,continuationEngine:t}){let{runner:n,account:r,model:i,identity:a,summary:o}=ss(e);return(0,B.jsxs)(wt,{children:[(0,B.jsx)(Ot,{label:o,children:(0,B.jsx)(kt,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,"data-slot":`agent-badge`,"aria-label":`Agent: ${n}, ${r?`account ${r}, `:``}model ${i}`,className:`flex shrink-0 items-center rounded-sm p-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,B.jsx)(lt,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})})})}),(0,B.jsxs)(Et,{align:`end`,className:`min-w-[9rem]`,children:[(0,B.jsxs)(xt,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,n]}),r?(0,B.jsxs)(xt,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,r]}):null,(0,B.jsxs)(xt,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,i]}),a?(0,B.jsxs)(xt,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,a]}):null,t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(St,{}),(0,B.jsx)(xt,{className:`pb-1 text-[11px] font-normal text-muted-foreground`,children:`Next continuation`}),(0,B.jsx)(`div`,{"data-slot":`agent-badge-engine-picker`,className:`px-2 pb-1`,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:t})]}):null]})]})}function ic({run:e,actions:t,showRunControls:n}){let r=la(e);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`hidden md:contents`,children:(0,B.jsx)(Nt,{action:r.action,pending:r.pending,onAction:r.onAction})}),(0,B.jsx)(ac,{run:e,actions:t,git:r,showRunControls:n}),r.dialogs]})}function ac({run:e,actions:t,git:n,showRunControls:r}){let i=To({run:e,canResume:js(e),git:n.action,gitPending:n.pending,workspace:null,terminalAvailable:!1,openChoices:[],taskUrl:``},{markRead:()=>t.markRead.mutate(),markUnread:()=>t.markUnread.mutate(),pin:()=>t.pin.mutate(),archive:()=>t.archive.mutate(void 0),rename:()=>{},finish:()=>t.finish.mutate(),confirmStop:()=>t.setConfirming(`cancel`),confirmDelete:()=>t.setConfirming(`delete`),resumeInTerminal:()=>t.terminal.mutate(),gitAction:n.onAction,openIn:()=>{},navigate:()=>{},openUrl:()=>{},copy:()=>{}}),a=new Map(i.map(e=>[e.id,e])),o=e=>{let t=a.get(e);return t&&t.unavailable===void 0?t:void 0},s=i.filter(e=>e.group===`git`&&e.id.startsWith(`git:`)),c=[r?o(`end-session`):void 0,o(`open:terminal-resume`),o(`toggle-read`),o(`pin`),o(`archive`)].filter(e=>e!==void 0),l=r?o(`stop`):void 0,u=o(`delete`),d={"toggle-read":t.markRead.isPending||t.markUnread.isPending,pin:t.pin.isPending};return(0,B.jsxs)(wt,{children:[(0,B.jsx)(kt,{asChild:!0,children:(0,B.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run actions`,className:`md:hidden`,children:(0,B.jsx)(yn,{"aria-hidden":`true`})})}),(0,B.jsxs)(Et,{align:`end`,"data-slot":`run-actions-menu`,children:[s.length>0?(0,B.jsxs)(B.Fragment,{children:[s.map(e=>(0,B.jsxs)(L,{"data-action":e.id.slice(4),disabled:e.unavailable!==void 0,title:e.unavailable,onSelect:()=>e.perform(),children:[e.icon,e.label]},e.id)),(0,B.jsx)(St,{})]}):null,c.map(e=>(0,B.jsxs)(L,{"data-slot":oc[e.id],"aria-pressed":e.id in oc||e.id===`archive`?!!e.pressed:void 0,disabled:d[e.id],onSelect:()=>e.perform(),children:[e.pressed?cc(e.icon):e.icon,sc[e.id]??e.label]},e.id)),l||u?(0,B.jsx)(St,{}):null,[l,u].map(e=>e?(0,B.jsxs)(L,{variant:`destructive`,onSelect:()=>e.perform(),children:[e.icon,` `,sc[e.id]??e.label]},e.id):null)]})]})}var oc={"toggle-read":`unread-toggle`,pin:`pin-run`},sc={"open:terminal-resume":`Terminal`,stop:`Stop`,delete:`Delete`};function cc(e){return(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{className:P(e.props.className,fa)}):e}function lc({hint:e}){return(0,B.jsxs)(`button`,{type:`button`,"data-slot":`resume-hint`,title:`Copy the command`,onClick:()=>void Ns(e,`Command copied to clipboard.`),className:`mb-2 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,B.jsx)(gn,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{className:`truncate`,children:[`take over interactively: `,e]})]})}var uc=`cez:run-header-collapsed`;function dc(){let[e,t]=(0,z.useState)(()=>{try{return window.localStorage.getItem(uc)===`1`}catch{return!1}});return[e,e=>{t(e);try{e?window.localStorage.setItem(uc,`1`):window.localStorage.removeItem(uc)}catch{}}]}var fc={changes:`Loading changes…`,commits:`Loading changes…`,files:`Loading files…`,graph:`Loading the graph…`,notes:`Loading notes…`,terminal:`Loading the terminal…`,preview:`Loading the preview…`};function pc({tab:e}){return(0,B.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,B.jsx)(on,{icon:(0,B.jsx)(zt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:fc[e],subtitle:`Fetching the run record.`})})}function mc({tab:e,error:t}){let n=t instanceof T&&t.status===404;return(0,B.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,B.jsx)(on,{icon:n?(0,B.jsx)(Ht,{}):(0,B.jsx)(Rt,{}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,B.jsx)(F,{asChild:!0,variant:`outline`,children:(0,B.jsx)(We,{to:`/`,children:`Back to tasks`})})})})}export{ao as $,Yr as $t,Jo as A,gn as An,ua as At,yo as B,Pi as Bt,qo as C,kn as Cn,Ya as Ct,Uo as D,bn as Dn,ha as Dt,Ho as E,Cn as En,wa as Et,Po as F,Li as Ft,ho as G,ai as Gt,Co as H,ki as Ht,Fo as I,Mi as It,Ma as J,W as Jt,_a as K,bi as Kt,wo as L,Ri as Lt,Yo as M,sn as Mn,Ki as Mt,es as N,Gi as Nt,Lo as O,yn as On,pa as Ot,Io as P,zi as Pt,va as Q,ii as Qt,To as R,Ni as Rt,Ro as S,jn as Sn,Ka as St,Ko as T,En as Tn,co as Tt,mo as U,Ei as Ut,bo as V,Oi as Vt,po as W,yi as Wt,ka as X,ri as Xt,ja as Y,ti as Yt,ga as Z,ni as Zt,is as _,er as _n,no as _t,Ns as a,Mr as an,Ga as at,ns as b,Ln as bn,$a as bt,Ps as c,Zn as cn,io as ct,ys as d,Jn as dn,oo as dt,Jr as en,X as et,vs as f,qn as fn,Ta as ft,cs as g,Qn as gn,ro as gt,Es as h,$n as hn,eo as ht,Js as i,Pr as in,Za as it,Qo as j,hn as jn,la as jt,Xo as k,_n as kn,da as kt,As as l,Xn as ln,Ea as lt,Ds as m,tr as mn,xa as mt,pc as n,Ir as nn,Wa as nt,js as o,Nr as on,Fa as ot,Ts as p,nr as pn,uo as pt,Oa as q,di as qt,Ls as r,sr as rn,lo as rt,Ms as s,ir as sn,Na as st,mc as t,Ur as tn,Ja as tt,ks as u,Yn as un,to as ut,os as v,Vn as vn,Xa as vt,$o as w,On as wn,Qa as wt,ts as x,Mn as xn,za as xt,rs as y,Rn as yn,qa as yt,_o as z,G as zt};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1,18 +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{Nt as r,Qt as i,Sa as a,Ut as o,Yi as s,br as c,it as l,r as ee,s as te,u,wr as d,xi as f}from"./queries-B--Cyn_0.js";import{F as p,_t as m,gt as ne,r as h,t as g}from"./button-ZPJ84lSe.js";import{f as _,t as v}from"./project-router-CIOAbq2D.js";import{D as re,E as ie,T as y,a as ae,i as oe,r as se,w as b}from"./reference-chip-C0KB59wJ.js";import{h as ce,l as le,m as ue,t as x}from"./use-now-DUGH_55J.js";import{an as de,d as fe,f as pe,h as me,ln as he,m as ge,on as _e,p as ve,un as ye,zt as S}from"./git-tab-loading-BL6wGQi_.js";import{n as be}from"./file-BuJHbBa7.js";import{t as C}from"./check-Blje0ysd.js";import{t as xe}from"./icon-tooltip-BEOrU9g6.js";import{t as Se}from"./loader-circle-i7B5PoZa.js";import{t as Ce}from"./use-submit-shortcut-D4G7Y1CV.js";import{t as we}from"./square-Du4NO0cr.js";import{t as Te}from"./x-PavsP4k3.js";import{a as w,c as Ee,i as De,n as T,o as E,r as Oe,s as D,t as O}from"./alert-dialog-BRafiUQO.js";import{t as ke}from"./centered-state-DPvWqO6I.js";var k=p(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),A=p(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Ae=p(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),je=p(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),j=e(t(),1),Me=new Set([`ai`,`cezar`,`agents`,`team`]);function M(e){return Me.has(e.source)}function N(e){return[...e].sort((e,t)=>Number(!M(e))-Number(!M(t)))}var Ne=5;function Pe(e,t,{mostUsedLimit:n=Ne}={}){let r=e.map((e,n)=>({skill:e,index:n,count:F(t,e.name)})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count||Number(!M(e.skill))-Number(!M(t.skill))||e.index-t.index).slice(0,n).map(e=>e.skill),i=new Set(r),a=e.filter(e=>!i.has(e));return{mostUsed:r,project:a.filter(M),global:a.filter(e=>!M(e))}}function P(e,t){let n=Pe(e,t);return[...n.mostUsed,...n.project,...n.global]}function F(e,t){if(!e||!Object.hasOwn(e,t))return 0;let n=e[t];return typeof n==`number`?n:0}function Fe(e,t){return{...e,[t]:F(e,t)+1}}function Ie(e,t){if(t===``)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e of r){if(i=n.indexOf(e,i),i===-1)return!1;i+=1}return!0}function I(e,t){let n=[];for(let r of e)for(let e of r.steps??[])e.skill===t&&n.push(`${r.name} › ${e.name??e.id}`);return n}var L=/[\s\-/_.]/;function R(e,t){let n=0;for(let r=e.indexOf(t);r!==-1;r=e.indexOf(t,r+1)){let i=1,a=e[r-1];if(r===0||a!==void 0&&L.test(a)){let n=e[r+t.length];i=n===void 0||L.test(n)?3:2}if(i>n&&(n=i),n===3)break}return n}function z(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=[e,...n??[]].join(` `).toLowerCase(),a=0;for(let e of r){let t=R(i,e);if(t===0)return 0;a+=t}return a/(r.length*3)}function Le(e,t){if(t===``)return 1;let n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 6;if(n.startsWith(r))return 5;let i=n.indexOf(r);if(i>0){let e=n[i-1];return e!==void 0&&L.test(e)?4:3}return+!!Ie(n,r)}function B(e,t){let n=e.split(`-`).filter(Boolean);return t?[...n,t]:n}var Re=10;function V(e,t,n){let r=n.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=0;for(let n of r){let r=Le(e,n),a=t?Le(t,n):0;if(r===0&&a===0)return 0;i+=r>0?r+Re:a}return i}var H=.5;function U(e,t,n){return t.trim()===``?[...e]:e.map((e,r)=>{let i=V(e.name,e.description,t),a=F(n,e.name),o=Math.min(a,Ne)*H;return{item:e,index:r,count:a,score:i>0?i+o:0}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||t.count-e.count||e.index-t.index).map(e=>e.item)}function W(e,t,n){return U(e,t,n)}function ze(e,t){return U(e,t)}function Be(e,t,n){return U(P(e,n),t,n)}function G(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function K(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Ve(e,t,{inEditable:n=!1}={}){if(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat)return!1;if(G(e.target)&&!K(e.target)){if(!n)return!1;let t=S();if(e.target instanceof HTMLElement&&e.target.closest(`.xterm`))return t&&e.metaKey;if(t?!e.metaKey:!e.ctrlKey)return!1}return!0}function He(e,t,n={}){let r=j.useRef(t);j.useLayoutEffect(()=>{r.current=t});let i=n.inEditable===!0;j.useEffect(()=>{let t=t=>{Ve(t,e,{inEditable:i})&&(t.preventDefault(),r.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,i])}function q(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||G(e.target))}function Ue(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function We(e,t){let n=j.useRef(t);j.useLayoutEffect(()=>{n.current=t}),j.useEffect(()=>{let t=t=>{q(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var J=`cezar:recent-tasks:v1`,Y=null;function Ge(){if(Y)return Y;try{let e=JSON.parse(window.localStorage.getItem(J)??`[]`);Y=Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{Y=[]}return Y}function Ke(){return Ge()}function qe(e){let t=[e,...Ge().filter(t=>t!==e)].slice(0,30);Y=t;try{window.localStorage.setItem(J,JSON.stringify(t))}catch{}}function Je(e,t,n){let r=new Map(n.map((e,t)=>[e,t])),i=e.filter(e=>r.has(t(e)));return i.sort((e,n)=>r.get(t(e))-r.get(t(n))),[...i,...e.filter(e=>!r.has(t(e)))]}var X=null,Z=null;function Ye(e){X=e}function Xe(e){X===e&&(X=null)}function Ze(e){return e!==void 0&&X?.runId===e?X:null}function Qe(e,t){Z={runId:e,path:t}}function $e(e){if(Z?.runId!==e)return null;let{path:t}=Z;return Z=null,t}var et=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],tt={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,junie:`Junie`,copilot:`GitHub Copilot CLI`};function nt(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of et){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function rt(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return et.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:tt[e],authFailureId:r.authFailureId}]})}function it(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function at(){let e=u(),t=l(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),r=t.data?.info?.root;return{accounts:n,repoAccount:ot(r?e.data?.selections?.[r]:void 0,e.data?.defaults)}}function ot(e,t){let n={};for(let r of[t,e])for(let[e,t]of Object.entries(r??{}))t&&(n[e]=t);return Object.keys(n).length>0?n:void 0}function st(e,t){return`${tt[e]} account "${t.replace(/"/g,``)}" is not signed in. Sign it in under Settings → Agent accounts, or choose another account for this task.`}function ct(e,t){let n=a(),r=u().data?.profiles.find(n=>n.provider===e&&n.id===t&&!n.isDefault),o=r?ne(r):``,s=r?.status,c=te(o,r!==void 0&&s?.status!==`connected`).data?.status??(s?.status===`connected`?s:void 0),l=t=>r&&t!==void 0&&t!==`connected`?st(e,r.label||r.id):null;return{blocked:l(c?.status),verify:async()=>{if(!r)return null;try{let e=await d(o,{refresh:!0});return n.setQueryData(i.agentAccountStatus(o),e),l(e.status.status)}catch{return null}}}}function lt(e,t){return e.filter(e=>e.provider===t).length>1}var ut=80,dt=m,ft=50,pt=200,mt=50,ht=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`},{id:`review-open-prs`,label:`Review open PRs`,text:'Check this repository\'s open pull requests that still need a review (use `gh pr list --state open --json number,title,headRefName,isDraft,reviewDecision` and skip drafts and PRs already approved). For each one, dispatch a separate review task with `cez task create --kind review --review-of <headRefName> --title "Review PR #<number>" "Review pull request #<number> (<title>) on branch <headRefName>: read the diff, run the tests, and report a verdict with findings."`, at most 4 at a time. Then end your turn with CEZ:MONITORING and, when their reports arrive, summarise every verdict in one message. If `cez task create` is refused or unavailable, stop and report that dispatch is disabled on this cockpit — do not review the PRs yourself and do not use sub-agents instead.'},{id:`create-automation`,label:`Create an automation`,skills:[`create-cezar-automation`],text:`Create an automation for this repository.
2
- Trigger: <when — e.g. every new pull request; every issue labelled \`needs-agent\`; every day at 04:00; weekdays at 07:30; every 6 hours>.
3
- Task for each run: <what the launched task must do — e.g. review the diff, run the tests and post findings as a review comment>.
4
- Leave it paused and, for a GitHub trigger, preview its matches so I can check the filter before enabling it.`}],gt=new Set([`review-open-prs`]),_t=new Set([`create-automation`]);function vt(e,t){return e.filter(e=>(t?.dispatch===!0||!gt.has(e.id))&&(t?.automations===!0||!_t.has(e.id)))}function yt(e){return!!e&&typeof e==`object`}function bt(e){if(e===void 0||!Array.isArray(e))return ht.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!yt(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=xt(r.skills);if(n.push({id:e,label:i.slice(0,ut),text:a.slice(0,dt),...o.length>0?{skills:o}:{}}),n.length>=ft)break}return n}function xt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,pt)),t.size>=mt))break}return[...t]}function St(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Ct(e,t){return St(e,t).map(e=>e.text).join(`
5
-
6
- `)}function wt(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function Tt(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Et(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
7
-
8
- `)?``:i.endsWith(`
9
- `)?`
10
- `:`
11
-
12
- `);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
13
-
14
- `)?``:s.startsWith(`
15
- `)?`
16
- `:`
17
-
18
- `),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}var Q=new Map;function Dt(e){let t=Q.get(e.data);return t||(t=s(me(e)).then(e=>typeof e?.uploadId==`string`?e.uploadId:null,e=>(de(e),null)),Q.set(e.data,t),t.then(n=>{n===null&&Q.get(e.data)===t&&Q.delete(e.data)})),t}async function Ot(e){let t=await Dt(e);return t===null?me(e):{uploadId:t,...e.originalName?{name:e.originalName}:{}}}function kt(e){for(let t of e){let e=Q.get(t.data);e&&(Q.delete(t.data),e.then(e=>e===null?void 0:c(e)).catch(()=>{}))}}function At(e){for(let t of e)Q.delete(t.data)}function jt(e){return e instanceof Error&&e.message.includes(`attachment upload expired — attach the file again`)}async function Mt(e,t){if(e.length===0)return t([]);try{return await t(await Promise.all(e.map(Ot)))}catch(n){if(!jt(n))throw n;At(e);try{let n=await t(await Promise.all(e.map(Ot)));return he(`recovered`),n}catch(e){throw he(`failed`),e}}}var Nt=new Set([`/`,`@`]);function Pt(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(Nt.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Ft(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function It(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Lt(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}var Rt=`Dictation needs https or localhost`,zt=`Dictation is not available in this browser`;function Bt(e){switch(e){case`aborted`:return null;case`no-speech`:return{message:`Dictation heard nothing — try again`,failure:null};case`not-allowed`:return{message:`Dictation needs microphone access — allow it for this site in the browser settings`,failure:e};case`service-not-allowed`:return{message:zt,failure:e};case`audio-capture`:return{message:`Dictation failed — no microphone was found`,failure:e};case`network`:return{message:`Dictation failed — the speech service could not be reached`,failure:e};default:return{message:`Dictation failed${e?` — ${e}`:``}`,failure:e||`unknown`}}}var Vt=!1;function Ht(e){let[t,n]=j.useState(null),r=j.useRef(null),i=j.useRef(``),[a]=j.useState(()=>It()!==void 0),[o,s]=j.useState(()=>window.isSecureContext===!1?Rt:Vt?zt:null),c=j.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return j.useEffect(()=>c,[c]),{supported:a,unavailable:o,recording:t,start:j.useCallback(()=>{if(r.current||o)return;let t=It();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let o=Date.now();a.onresult=e=>{let t=Lt(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:o})},a.onerror=t=>{c(),t.error===`service-not-allowed`&&(Vt=!0,s(zt));let n=Bt(t.error);n&&e(n)},a.start(),r.current=a,n({transcript:``,startedAt:o})}catch{e({message:`Dictation failed — the microphone could not be started`,failure:`start-threw`}),c()}},[e,c,o]),cancel:j.useCallback(()=>c(),[c]),finish:j.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function Ut(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var $=n(),Wt={KeyA:`Yes, approved.`,KeyC:`Continue.`};function Gt({onSubmit:e,value:t,onValueChange:n,images:i,onImagesChange:s,autoFocus:c=!1,draftItems:l,footerStart:te,footerEnd:u,sendAriaLabel:d=`Send`,stop:p,disabled:m=!1,disabledReason:ne=`Session closed — Continue to reopen.`,allowEmptySubmit:v=!1,placeholder:re=`Reply — / for skills, @ for files…`,ariaLabel:ie=`Reply to the agent`,autocompleteSkills:y=!0,quickReplies:b=!1,getMentionCandidates:x,ref:de}){let[me,he]=(0,j.useState)(``),S=t??me,C=(0,j.useRef)(S);C.current=S;let Se=(0,j.useRef)(n);Se.current=n;let w=(0,j.useCallback)(e=>{let t=typeof e==`function`?e(C.current):e;he(t),Se.current?.(t)},[]),[Ee,De]=(0,j.useState)([]),T=i??Ee,E=(0,j.useRef)(T);E.current=T;let Oe=(0,j.useRef)(s);Oe.current=s;let D=(0,j.useCallback)((e,t=`edit`)=>{let n=typeof e==`function`?e(E.current):e;E.current=n,De(n),Oe.current?.(n,t)},[]),[O,ke]=(0,j.useState)(!1),[k,A]=(0,j.useState)(null),[Me,N]=(0,j.useState)(``),[Ne,Pe]=(0,j.useState)(!1),P=(0,j.useRef)(null),F=(0,j.useRef)(null),I=(0,j.useRef)(null),L=(0,j.useRef)(new Map),R=r(y&&Ne),z=o(),Le=a(),B=Ht(({message:e,failure:t})=>{t&&_e(t),_(e,t?{tone:`danger`,reported:!0}:{})});(0,j.useEffect)(()=>{c&&P.current?.focus()},[]),(0,j.useImperativeHandle)(de,()=>({insertAtCaret:e=>{let t=P.current,n=Et(C.current,t?.selectionStart??C.current.length,e);w(n.text),I.current=n.caret,t?.focus()}}),[w]);let Re=(0,j.useCallback)(()=>{let e=P.current;if(!e||m){A(null);return}let t=Pt(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!y||t?.trigger===`@`&&x===void 0)return A(null);t?.trigger===`/`&&Pe(!0),A(t)},[y,m,x]),V=(0,j.useMemo)(()=>k===null?[]:k.trigger===`/`?Be(R.data??[],k.query,z.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:M(e)})):(x?.()??[]).filter(e=>Ie(e,k.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[x,R.data,k,z.data?.skillUsage]),H=V.some(e=>e.value===Me)?Me:V[0]?.value,U=k!==null,W=(0,j.useCallback)(()=>A(null),[]),ze=e=>{let t=P.current;if(!t||k===null)return;let n=t.selectionStart??t.value.length,r=Ft(t.value,k,n,e.insert);k.trigger===`/`&&z.data!==void 0&&f({skillUsage:Fe(z.data.skillUsage,e.insert)}).then(()=>Le.invalidateQueries({queryKey:ee.uiState})).catch(()=>{}),w(r.text),I.current=r.caret,A(null),t.focus()};(0,j.useEffect)(()=>{!U||H==null||L.current.get(H)?.scrollIntoView({block:`nearest`})},[H,U]),(0,j.useLayoutEffect)(()=>{let e=I.current,t=P.current;e!==null&&t&&(t.setSelectionRange(e,e),I.current=null)},[S]),(0,j.useLayoutEffect)(()=>{let e=P.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[S]);let K=(0,j.useCallback)((e,t=`file`)=>{if(m)return;let n=ge(e,E.current.length,pe(E.current));for(let e of n.rejected)_(e,{tone:`danger`});for(let e of n.accepted)ve(e,t).then(e=>{let t=fe(E.current,e);t&&(Dt(e),D(t))})},[m]),Ve=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),K(t,`clipboard`))},He=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),K(t))},q=(0,j.useCallback)(async(t,n,r,i)=>{let a=t.trim();if(!(m||O)&&!(a===``&&n.length===0&&!v)){ke(!0);try{await Mt(n,t=>i?e(a,t,i):e(a,t)),kt(n),ye(n.length)}catch(e){if(_(e instanceof Error?e.message:String(e),{tone:`danger`}),r){w(e=>e===``?t:`${t}\n${e}`);let e=[],r=E.current.reduce((t,n)=>{let r=fe(t,n);return r||e.push(n),r??t},n);for(let t of e)_(`${t.name} removed — the restored message fills the attachment limit`,{tone:`danger`});D(r)}}finally{ke(!1)}}},[v,O,m,e]),Ue=(0,j.useCallback)(()=>{if(S.trim()===``&&T.length===0&&!v)return;let e=S,t=T;w(``),D([],`submit`),A(null),q(e,t,!0)},[v,T,q,S]),We=e=>{if(U){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),V.length===0)return;let t=V.findIndex(e=>e.value===H),n=e.key===`ArrowDown`?1:-1,r=V[(t+n+V.length)%V.length];N(r.value);return}if(e.key===`Escape`){e.preventDefault(),W();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=V.find(e=>e.value===H);if(t){e.preventDefault(),ze(t);return}W()}}if(e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){e.currentTarget.blur();return}Ce({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Ue())};(0,j.useEffect)(()=>{if(!b||m)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||G(e.target))return;let t=Wt[e.code];t!==void 0&&(e.preventDefault(),q(t,[],!1,{quickReply:!0}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,b,q]);let J=e=>{let t=B.finish();if(t===``)return;let n=S.trim()===``?t:`${S.replace(/\s*$/,``)} ${t}`;if(e){w(``),D([],`submit`),q(n,T,!0);return}w(n),I.current=n.length,P.current?.focus()},Y=B.recording;return(0,$.jsxs)(se,{open:U,onOpenChange:e=>e?void 0:W(),children:[(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsxs)(`div`,{ref:F,"data-slot":`composer`,"data-disabled":m||void 0,onDrop:He,onDragOver:e=>e.preventDefault(),className:h(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,m&&`opacity-80`),children:[T.length>0||l?(0,$.jsxs)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap items-center gap-2 px-4 pt-3`,children:[l,T.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:h(`group relative overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{kt([e]),D(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,$.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,$.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,$.jsx)(Te,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))]}):null,(0,$.jsx)(`textarea`,{ref:P,rows:1,value:S,disabled:m,"aria-label":ie,placeholder:m?ne:re,className:`block max-h-[220px] min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,onChange:e=>{w(e.target.value),Re()},onKeyDown:We,onSelect:Re,onPaste:Ve}),Y?(0,$.jsx)(qt,{transcript:Y.transcript,startedAt:Y.startedAt,onCancel:B.cancel,onInsert:()=>J(!1),onInsertAndSend:()=>J(!0)}):(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[(0,$.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,$.jsx)(Kt,{disabled:m,onFiles:K}),te]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[B.supported&&B.unavailable?(0,$.jsx)(xe,{label:B.unavailable,side:`top`,children:(0,$.jsxs)(g,{type:`button`,variant:`ghost`,size:`sm`,"aria-disabled":`true`,"aria-label":`Start dictation`,className:`h-8 cursor-not-allowed gap-1.5 px-2.5 text-xs font-medium text-muted-foreground opacity-50 hover:bg-transparent`,children:[(0,$.jsx)(Ae,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]})}):B.supported?(0,$.jsxs)(g,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:B.start,children:[(0,$.jsx)(Ae,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,u?(0,$.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:u}):null,p?(0,$.jsx)(xe,{label:p.label,side:`top`,children:(0,$.jsx)(g,{type:`button`,size:`icon-sm`,variant:`contrast`,"data-slot":`composer-stop`,"aria-label":p.label,disabled:p.pending,className:`size-8`,onClick:p.onStop,children:(0,$.jsx)(we,{"aria-hidden":`true`,className:`size-3 fill-current`})})}):null,!p||S.trim()!==``||T.length>0||v?(0,$.jsx)(g,{type:`button`,size:`icon-sm`,"aria-label":d,disabled:m||O||S.trim()===``&&T.length===0&&!v,className:`size-8`,onClick:Ue,children:(0,$.jsx)(be,{"aria-hidden":`true`})}):null]})]})]})}),(0,$.jsx)(ae,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},children:(0,$.jsx)(le,{shouldFilter:!1,value:H??``,onValueChange:N,children:(0,$.jsx)(ce,{"data-slot":`composer-menu`,"data-trigger":k?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:V.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:k?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:R.isPending?`Loading skills…`:`No matching skills.`}):V.map(e=>(0,$.jsxs)(ue,{ref:t=>{t?L.current.set(e.value,t):L.current.delete(e.value)},value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>ze(e),children:[(0,$.jsx)(`span`,{className:h(`shrink-0 truncate`,e.emphasized&&`font-semibold`,k?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Kt({disabled:e,onFiles:t}){let n=(0,j.useRef)(null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach images or files (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,$.jsx)(je,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,$.jsx)(`input`,{ref:n,type:`file`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function qt({transcript:e,startedAt:t,onCancel:n,onInsert:r,onInsertAndSend:i}){let a=x(1e3);return(0,$.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:Ut(t,a)}),(0,$.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,$.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,$.jsx)(Te,{"aria-hidden":`true`})}),(0,$.jsx)(g,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:r,children:(0,$.jsx)(C,{"aria-hidden":`true`})}),(0,$.jsx)(g,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:i,children:(0,$.jsx)(be,{"aria-hidden":`true`})})]})}function Jt(){return(0,$.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(ke,{icon:(0,$.jsx)(Se,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}var Yt={retry:`Retry`,"start-anyway":`Start task anyway`,"cancel-task":`Cancel task`,"keep-worktree":`Keep worktree`,"force-delete":`Force delete`,stop:`Stop scripts`},Xt=new Set([`start-anyway`,`cancel-task`,`keep-worktree`,`force-delete`]);function Zt(e,t){switch(e){case`force-delete`:return`Skip remaining cleanup commands and ${t.intent===`delete-task`?`delete this task and its worktree`:`remove this worktree`}? Containers, volumes, and other resources may remain. ${t.intent===`reclaim`?`The task branch is kept.`:`The managed task branch is removed.`}`;case`start-anyway`:return`Start the task with an incomplete environment? Remaining setup commands will be skipped.`;case`cancel-task`:return`Cancel this task? The worktree and resources already created are kept; cleanup remains explicit.`;case`keep-worktree`:return`Keep this worktree and suppress automatic cleanup for this generation? Some resources may already have been stopped.`;default:return``}}function Qt(e){return e.state===`completed`?e.phase===`setup`?`Worktree ready`:`Worktree cleanup complete`:e.state===`bypassed`?`Setup bypassed`:e.state===`kept`?`Worktree kept — automatic cleanup suppressed`:e.state===`cancelled`?`Task cancelled — worktree retained`:e.state===`needs_attention`||e.state===`interrupted`?e.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`:e.state===`committing`?e.phase===`setup`?`Finishing worktree preparation`:`Removing worktree`:e.phase===`setup`?`Preparing worktree`:`Cleaning up worktree`}function $t({operationId:e,worktreePath:t,taskTitle:n}){let r=y(e),i=b(e),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(!1),l=ie(e,s),ee=(0,j.useRef)(null),[te,u]=(0,j.useState)(Date.now()),d=r.data?.operation.state===`running`;if((0,j.useEffect)(()=>{if(!d)return;let e=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(e)},[d]),r.isPending)return(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading worktree operation…`});if(r.isError)return(0,$.jsxs)(`p`,{role:`alert`,className:`text-xs text-danger`,children:[`Worktree operation could not load: `,r.error.message]});let f=r.data.operation,p=async e=>{o(null);try{await i.mutateAsync({action:e,requestId:crypto.randomUUID(),expectedRevision:f.revision}),ee.current?.focus()}catch{}},m=[...new Map((l.data?.pages.flatMap(e=>e.items)??[]).map(e=>[e.seq,e])).values()].sort((e,t)=>e.seq-t.seq),ne=[`queued`,`running`,`committing`].includes(f.state),h=[`completed`,`bypassed`,`cancelled`,`kept`].includes(f.state);return(0,$.jsxs)(`section`,{"data-slot":`worktree-lifecycle-operation`,className:`rounded-lg border border-border bg-card p-3 text-sm`,children:[(0,$.jsx)(`h2`,{ref:ee,tabIndex:-1,className:`font-medium outline-none`,"aria-live":`polite`,children:Qt(f)}),n?(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:n}):null,t?(0,$.jsx)(`p`,{className:`mt-1 break-all font-mono text-[11px] text-muted-foreground`,children:t}):null,f.phase===`setup`&&ne?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`The agent starts after worktree preparation finishes.`}):null,f.error?h?(0,$.jsxs)(`details`,{className:`mt-2 break-words text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`Previous operation error`}),(0,$.jsx)(`p`,{className:`mt-1`,children:f.error})]}):(0,$.jsxs)(`p`,{role:`alert`,className:`mt-2 break-words text-xs text-danger`,children:[f.failureStage===`commit`?`Scripts completed, but the worktree transition failed. `:``,f.error]}):null,(0,$.jsx)(`ol`,{className:`mt-3 space-y-2`,children:f.entries.map(e=>{let t=[...f.history].reverse().find(t=>t.entryId===e.entryId&&t.commandPreview===e.commandPreview),n=t?Math.max(0,Math.round(((t.finishedAt?Date.parse(t.finishedAt):te)-Date.parse(t.startedAt))/1e3)):void 0;return(0,$.jsxs)(`li`,{className:`rounded border border-border px-2 py-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-1 text-xs`,children:[(0,$.jsx)(`span`,{className:`break-words font-medium`,children:e.label}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.state.replaceAll(`-`,` `),e.attempt?` · attempt ${e.attempt}`:``,n===void 0?``:` · ${n}s`]})]}),(0,$.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all text-[11px] text-muted-foreground`,children:e.commandPreview})]},e.entryId)})}),f.history.length?(0,$.jsxs)(`details`,{className:`mt-3 text-xs`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:[`Attempt history (`,f.history.length,`)`]}),(0,$.jsx)(`ol`,{className:`mt-2 space-y-2`,children:f.history.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`span`,{children:[e.label,` · attempt `,e.attempt,` · `,e.state]}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-[11px] text-muted-foreground`,children:e.commandPreview}),e.reason?(0,$.jsx)(`p`,{className:`text-danger`,children:e.reason}):null]},e.id))})]}):null,f.allowedActions.includes(`retry`)?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Retry loads current saved scripts. Unchanged completed commands stay completed; edited commands run again.`}):null,(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[f.allowedActions.map(e=>(0,$.jsx)(g,{size:`sm`,variant:e===`force-delete`||e===`cancel-task`?`danger-ghost`:`outline`,disabled:i.isPending,onClick:()=>Xt.has(e)?o(e):void p(e),children:Yt[e]},e)),(0,$.jsx)(g,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,$.jsx)(v,{to:`/settings/worktrees?operation=${encodeURIComponent(e)}`,children:`Edit scripts`})}),(0,$.jsx)(g,{size:`sm`,variant:`ghost`,"aria-expanded":s,onClick:()=>c(e=>!e),children:s?`Hide output`:`Show output`})]}),i.isError?(0,$.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:i.error.message}):null,s?(0,$.jsxs)(`div`,{className:`mt-3`,children:[l.isPending?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading output…`}):null,l.isError?(0,$.jsxs)(`p`,{role:`alert`,className:`text-xs text-danger`,children:[`Output could not load: `,l.error.message]}):null,l.data?.pages.some(e=>e.truncated)?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Some earlier output was truncated.`}):null,(0,$.jsx)(`pre`,{"aria-label":`Script output`,className:`max-h-64 overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-[11px]`,children:m.map(e=>e.text).join(``)||`No output recorded.`}),l.hasNextPage?(0,$.jsx)(g,{size:`sm`,variant:`ghost`,disabled:l.isFetchingNextPage,onClick:()=>void l.fetchNextPage(),children:`Load more output`}):null]}):null,(0,$.jsx)(O,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,$.jsxs)(De,{children:[(0,$.jsxs)(D,{children:[(0,$.jsx)(Ee,{children:a?Yt[a]:`Confirm action`}),(0,$.jsxs)(w,{children:[a?Zt(a,f):``,(0,$.jsx)(`span`,{className:`mt-2 block break-all font-medium`,children:n??t??`Worktree operation ${e}`})]})]}),(0,$.jsxs)(E,{children:[(0,$.jsx)(Oe,{children:`Go back`}),(0,$.jsx)(T,{onClick:()=>{a&&p(a)},children:a?Yt[a]:`Continue`})]})]})})]})}function en({worktreeId:e,operationId:t,worktreePath:n,taskTitle:r}){let i=re(e,!t),a=t??[...i.data?.worktree.history??[]].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]?.id;return a?(0,$.jsx)($t,{operationId:a,worktreePath:n,taskTitle:r}):null}export{We as A,ze as B,Xe as C,Ue as D,qe as E,N as F,k as G,I as H,P as I,Pe as L,Be as M,M as N,G as O,z as P,V as R,Ze as S,Ke as T,je as U,B as V,A as W,nt as _,ht as a,Qe as b,vt as c,bt as d,wt as f,it as g,ct as h,Gt as i,Fe as j,He as k,Et as l,at as m,en as n,dt as o,lt as p,Jt as r,Ct as s,$t as t,Tt as u,rt as v,Je as w,$e as x,Ye as y,W as z};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-ZPJ84lSe.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};