@open-mercato/cezar 0.9.2 → 0.9.3
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.
- package/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/contract/health.d.ts +2 -0
- package/dist/contract/index.js +23 -10
- package/dist/git-diff-base.d.ts +51 -26
- package/dist/git-diff-base.js +163 -37
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-worktree.d.ts +15 -6
- package/dist/git-worktree.js +10 -3
- package/dist/git-worktree.js.map +1 -1
- package/dist/server/capabilities.d.ts +15 -1
- package/dist/server/capabilities.js +16 -1
- package/dist/server/capabilities.js.map +1 -1
- package/dist/server/git-changes.d.ts +7 -5
- package/dist/server/git-changes.js +15 -10
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/server.d.ts +59 -58
- package/dist/server/server.js +54 -3
- package/dist/server/server.js.map +1 -1
- package/dist/workflows/run.d.ts +27 -7
- package/dist/workflows/run.js +106 -43
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/config.d.ts +8 -0
- package/dist/workspace/config.js +29 -2
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/semaphore.d.ts +7 -1
- package/dist/workspace/semaphore.js +10 -4
- package/dist/workspace/semaphore.js.map +1 -1
- package/dist/workspace/ui-state.d.ts +3 -2
- package/dist/workspace/ui-state.js +3 -2
- package/dist/workspace/ui-state.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{alert-dialog-ghffK6g9.js → alert-dialog-V9cigyAO.js} +1 -1
- package/web/dist/assets/arrow-down-DflHdNlN.js +1 -0
- package/web/dist/assets/arrow-left-IIL4uR-C.js +1 -0
- package/web/dist/assets/centered-state-BkAJVLJE.js +43 -0
- package/web/dist/assets/chevron-right-CxAoD1eD.js +1 -0
- package/web/dist/assets/circle-check-CdwcIbkx.js +1 -0
- package/web/dist/assets/{circle-x-C3EFZ3xf.js → circle-x-Cnc43xJ2.js} +1 -1
- package/web/dist/assets/{collapsible-B0JVzd0B.js → collapsible-BlF-7CeC.js} +1 -1
- package/web/dist/assets/{commit-list-wm6DPHNs.js → commit-list-D2mKElUx.js} +1 -1
- package/web/dist/assets/{compare-variants-DbdP4Y5T.js → compare-variants-CFBY16Rc.js} +1 -1
- package/web/dist/assets/{diff-Bizc96qe.js → diff-DE6u5dTe.js} +2 -2
- package/web/dist/assets/{diff-stat-Dyfg3ltF.js → diff-stat-B1j6L7C6.js} +1 -1
- package/web/dist/assets/{diff-view-CG8ek6tC.js → diff-view-Gb2kk3Le.js} +1 -1
- package/web/dist/assets/{dropdown-menu-C1Dlf35P.js → dropdown-menu-Ns-rY6sm.js} +1 -1
- package/web/dist/assets/editable-title-BGuiDxFT.js +1 -0
- package/web/dist/assets/{ellipsis-vertical-DpGTRqC2.js → ellipsis-vertical-BbxtXb6s.js} +1 -1
- package/web/dist/assets/{file-DlUGpUlb.js → file-j5O4NryU.js} +1 -1
- package/web/dist/assets/{folder-BAY6Vddy.js → folder-w9Lwj9x9.js} +1 -1
- package/web/dist/assets/{git-pull-request-agOG0iGM.js → git-pull-request-DlSop3Ch.js} +1 -1
- package/web/dist/assets/{git-toolbar-DGiNMmtY.js → git-toolbar-BdJ8XSxI.js} +1 -1
- package/web/dist/assets/github-CCLn2OAU.js +1 -0
- package/web/dist/assets/{image-preview-BWGk5fPX.js → image-preview-CcFdkZXW.js} +1 -1
- package/web/dist/assets/index-BmHHLbwc.js +6 -0
- package/web/dist/assets/index-u8OAnq0r.css +2 -0
- package/web/dist/assets/{markdown-BGBOGCA_.js → markdown-q9lm7kQ2.js} +1 -1
- package/web/dist/assets/{new-task-form-BpAw_Dks.js → new-task-form-BuYxAWN7.js} +1 -1
- package/web/dist/assets/{pill-Dvs-P0xy.js → pill-t97MvPW_.js} +1 -1
- package/web/dist/assets/{project-router-Cx8NPoqn.js → project-router-DudOmkHf.js} +1 -1
- package/web/dist/assets/{prompt-templates-CSBYBR1I.js → prompt-templates-C5iO3Lda.js} +1 -1
- package/web/dist/assets/{refresh-cw-BoGdAykg.js → refresh-cw-_C2EGJK5.js} +1 -1
- package/web/dist/assets/{repo-git-PmX-BNMo.js → repo-git-DqQzj33d.js} +1 -1
- package/web/dist/assets/{run-diff-EcOkf3ti.js → run-diff-BLoKEnTx.js} +1 -1
- package/web/dist/assets/run-header-Dho4eurS.js +1 -0
- package/web/dist/assets/{search-x-X3EpVhgs.js → search-x-BgxaJgro.js} +1 -1
- package/web/dist/assets/{skill-empty-hint-CZLALx6l.js → skill-empty-hint-D5MOmycv.js} +1 -1
- package/web/dist/assets/skills-B5g064CC.js +1 -0
- package/web/dist/assets/{sparkles-Dt4q7pbG.js → sparkles-ANSka5bH.js} +1 -1
- package/web/dist/assets/{square-terminal-hwBL8XsC.js → square-terminal-qojq20cH.js} +1 -1
- package/web/dist/assets/{tab-link-DIlR5T07.js → tab-link-CIcwFJtC.js} +1 -1
- package/web/dist/assets/task-changes-yRfsEsnh.js +1 -0
- package/web/dist/assets/{task-commits-BTTA5k5T.js → task-commits-yXmDrCoE.js} +1 -1
- package/web/dist/assets/{task-files-Da8_4C9g.js → task-files-BDRmCCPN.js} +2 -2
- package/web/dist/assets/task-thread-C9AnIz4Z.js +9 -0
- package/web/dist/assets/{textarea-CUdokhkv.js → textarea-DVO7pg8Y.js} +1 -1
- package/web/dist/assets/{thread-loading-B8q8ukXJ.js → thread-loading-DJDl701Z.js} +1 -1
- package/web/dist/assets/{trash-2-DhVIdWv8.js → trash-2-DKcnmg6e.js} +1 -1
- package/web/dist/assets/{triangle-alert-XYT0DGCI.js → triangle-alert-CPUEVSZ3.js} +1 -1
- package/web/dist/assets/{upload-BKjN59-1.js → upload-D5Jrq7QK.js} +1 -1
- package/web/dist/assets/{use-desktop-Bf5LS_P4.js → use-desktop-CXae6uyk.js} +1 -1
- package/web/dist/assets/{use-submit-shortcut-CzVyoAMd.js → use-submit-shortcut-RKJLKdsW.js} +1 -1
- package/web/dist/assets/{utils-DsLuRXwV.js → utils-Wtkd5E6j.js} +1 -1
- package/web/dist/assets/{workflows-o2QU_pvU.js → workflows-CGyTdyds.js} +3 -3
- package/web/dist/assets/{zoomable-image-7WyUiaVD.js → zoomable-image-hcqwUIlQ.js} +1 -1
- package/web/dist/index.html +22 -22
- package/web/dist/assets/arrow-down-Cz8qb71e.js +0 -1
- package/web/dist/assets/arrow-left-wcYKQXI_.js +0 -1
- package/web/dist/assets/centered-state-ZtnFHA-n.js +0 -43
- package/web/dist/assets/chevron-right-G4caF2QV.js +0 -1
- package/web/dist/assets/circle-check--KvBxXWp.js +0 -1
- package/web/dist/assets/editable-title-5rC_QRBZ.js +0 -1
- package/web/dist/assets/github-Vp7lxYGQ.js +0 -1
- package/web/dist/assets/index-DSxyJpuK.css +0 -2
- package/web/dist/assets/index-DiawI6RX.js +0 -6
- package/web/dist/assets/run-header-BGiv6_qX.js +0 -1
- package/web/dist/assets/skills-CC91ouGH.js +0 -1
- package/web/dist/assets/task-changes-XkHDxzQA.js +0 -1
- package/web/dist/assets/task-thread-DoNXUsHr.js +0 -9
|
@@ -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{$ as r,$t as i,A as a,Bt as o,Dn as s,En as c,Ft as l,Gt as u,It as d,J as f,Kt as p,Lt as ee,Nt as te,O as ne,P as re,U as ie,X as ae,Xn as m,Xt as oe,Y as se,_t as ce,a as h,an as le,dn as ue,en as de,fr as g,ht as fe,i as _,k as v,lr as y,pn as pe}from"./centered-state-ZtnFHA-n.js";import{n as b,r as x,t as S}from"./utils-DsLuRXwV.js";import{a as C,i as me,n as he,o as w,r as T,t as ge}from"./editable-title-5rC_QRBZ.js";import{c as _e,f as ve,m as ye,p as E}from"./new-task-form-BpAw_Dks.js";import{t as be}from"./circle-check--KvBxXWp.js";import{t as xe}from"./circle-x-C3EFZ3xf.js";import{c as D,h as Se,i as O,n as k,r as A,s as j,t as M}from"./dropdown-menu-C1Dlf35P.js";import{n as N,t as P}from"./trash-2-DhVIdWv8.js";import{t as Ce}from"./ellipsis-vertical-DpGTRqC2.js";import{n as F,t as I}from"./tab-link-DIlR5T07.js";import{t as we}from"./folder-BAY6Vddy.js";import{t as Te}from"./sparkles-Dt4q7pbG.js";import{t as L}from"./square-terminal-hwBL8XsC.js";import{n as Ee,r as De,t as Oe}from"./collapsible-B0JVzd0B.js";import{a as ke,c as Ae,i as je,n as Me,o as Ne,r as Pe,s as Fe,t as Ie}from"./alert-dialog-ghffK6g9.js";import{c as Le,t as Re}from"./project-router-Cx8NPoqn.js";import{a as ze,n as Be,r as Ve,t as He}from"./pill-Dvs-P0xy.js";import{t as Ue}from"./markdown-BGBOGCA_.js";import{t as We}from"./diff-stat-Dyfg3ltF.js";var R=x(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Ge=x(`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`}]]),Ke=x(`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`}]]),z=x(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),qe=x(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Je=x(`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`}]]),Ye=x(`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`}]]),Xe=x(`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`}]]),B=x(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ze=x(`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`}]]),V=x(`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`}]]),Qe=x(`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`}]]),$e=x(`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`}]]),et=x(`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`}]]),tt=x(`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`}]]),nt=x(`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`}]]),rt=x(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),it=x(`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`}]]),H=e(t(),1);function U(e){return e===`running`||e===`queued`||e===`waiting`}function W(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var at=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function ot(e,t){if(at.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`opencode`:return`opencode --session ${t}`;default:return`claude --resume ${t}`}}function st(e){if(U(e.status))return;let t=W(e);if(t===void 0)return;let n=ot(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function G(e){let t=/^cli:(claude|codex|opencode)$/.exec(e);return t?t[1]:void 0}function ct(e,t){let n=G(t);return!n||U(e.status)?!1:n===(e.runner??`claude`)&&W(e)!==void 0}function K(e){let t=U(e.status),n=W(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&n,terminal:!t&&n,notes:!0,archive:!t,cancel:t,deleteRun:!t}}function q(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function lt(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}function J(e,t=null){let n=r(),i=m(n.data),a=e.runner??`claude`,o=_e(t,i,a),s=i.includes(a),c=n.isSuccess&&i.length>0,l=n.isPending?`Checking agent providers…`:n.isError?`Provider authentication could not be verified.`:c?void 0:`Connect an agent provider to continue.`;return{runners:i,currentRunner:a,runner:o,currentRunnerConnected:s,canContinue:c,providerPending:n.isPending,providerError:n.isError,reason:l,runnerOverride:t!==null||!s?o:void 0}}var Y=n();function X(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 Z(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 ut({steps:e}){if(e.length===0)return null;let t=Z(e)*100;return(0,Y.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,Y.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":X(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,Y.jsx)(dt,{visual:X(t.status)}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,Y.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,Y.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,Y.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function dt({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,Y.jsx)(be,{"aria-hidden":!0,className:S(t,`text-success`)});case`active`:return(0,Y.jsx)(ne,{role:`status`,"aria-label":`Step running`,className:S(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,Y.jsx)(xe,{"aria-hidden":!0,className:S(t,`text-danger`)});case`pending`:return(0,Y.jsx)(Se,{"aria-hidden":!0,className:S(t,`text-soft-foreground`)})}}function ft(e){let t=e.findIndex(e=>X(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>X(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function pt({visual:e}){return(0,Y.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:S(`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 Q=new Map;function mt({runId:e,steps:t}){let[n,r]=(0,H.useState)(()=>Q.get(e)??!1);if(t.length===0)return null;let i=t=>{Q.set(e,t),r(t)},a=ft(t),o=t[a],s=Z(t)*100;return(0,Y.jsxs)(Oe,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,Y.jsxs)(De,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group flex min-h-[30px] w-full items-center gap-2.5 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,Y.jsx)(pt,{visual:X(e.status)},e.id))}),(0,Y.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,Y.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,Y.jsx)(ye,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,Y.jsx)(Ee,{children:(0,Y.jsx)(`div`,{className:`pt-2`,children:(0,Y.jsx)(ut,{steps:t})})})]})}function $(e){let t=g();return y({mutationFn:()=>pe(e),onSuccess:()=>t.invalidateQueries({queryKey:a.runs.all}),onError:e=>_(e.message,{tone:`danger`})})}function ht({run:e,planTally:t,tab:n=`session`}){let r=ze(e),i=K(e),a=st(e),[o,s]=(0,H.useState)(!1),c=yt(e),l=ce(),d=Be(ie().data),f=e.status===`queued`?u(l.data??[]).get(e.id):void 0;return(0,Y.jsxs)(`header`,{"data-slot":`run-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[var(--measure)]`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(xt,{run:e}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2.5`,children:[t?(0,Y.jsxs)(`span`,{"data-slot":`plan-mirror`,className:`text-[11px] text-soft-foreground tabular-nums`,children:[`Plan `,t.done,`/`,t.total]}):null,(0,Y.jsxs)(He,{dot:r.tone,pulse:r.pulse,children:[r.label,f===void 0?``:` #${f}`]}),(0,Y.jsx)(Tt,{run:e,actions:c,onToggleNotes:()=>s(e=>!e)})]})]}),(0,Y.jsx)(St,{run:e,showTokens:d.tokens,showCost:d.cost}),(0,Y.jsx)(Ct,{run:e}),(0,Y.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Y.jsx)(I,{to:`/tasks/${e.id}`,active:n===`session`,children:`Session`}),(0,Y.jsx)(I,{to:`/tasks/${e.id}/changes`,active:n===`changes`,children:`Changes`}),(0,Y.jsx)(I,{to:`/tasks/${e.id}/commits`,active:n===`commits`,children:`Commits`}),(0,Y.jsx)(I,{to:`/tasks/${e.id}/files`,active:n===`files`,children:`Files`}),(0,Y.jsxs)(`div`,{"data-slot":`run-actions`,className:`ml-auto hidden items-center gap-1 pb-1 md:flex`,children:[i.finish?(0,Y.jsxs)(h,{variant:`outline`,size:`sm`,title:q(e.status),onClick:()=>c.finish.mutate(),children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Finish`]}):null,i.continueRun?(0,Y.jsxs)(h,{variant:`outline`,size:`sm`,title:c.continuation.reason??`Reopen the session`,disabled:c.continueRun.isPending||!c.continuation.canContinue,onClick:()=>c.continueRun.mutate(),children:[(0,Y.jsx)(E,{"aria-hidden":`true`}),`Continue`]}):null,(0,Y.jsx)(vt,{run:e,canResume:i.terminal,onResume:()=>c.terminal.mutate()}),(0,Y.jsxs)(h,{variant:`ghost`,size:`sm`,title:`Handoff notes — what the agent did and what's left`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,Y.jsx)(B,{"aria-hidden":`true`}),`Notes`]}),i.archive?(0,Y.jsxs)(h,{variant:`ghost`,size:`sm`,onClick:()=>c.archive.mutate(),children:[e.archived?(0,Y.jsx)(R,{"aria-hidden":`true`}):(0,Y.jsx)(w,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,i.cancel?(0,Y.jsxs)(h,{variant:`danger-ghost`,size:`sm`,onClick:()=>c.setConfirming(`cancel`),children:[(0,Y.jsx)(z,{"aria-hidden":`true`}),`Cancel`]}):null,i.deleteRun?(0,Y.jsxs)(h,{variant:`danger-ghost`,size:`sm`,onClick:()=>c.setConfirming(`delete`),children:[(0,Y.jsx)(P,{"aria-hidden":`true`}),`Delete`]}):null]})]}),e.steps.length>0?(0,Y.jsx)(`div`,{className:`border-t border-border pt-2 pb-1`,children:(0,Y.jsx)(mt,{runId:e.id,steps:e.steps})}):null,a?(0,Y.jsx)(Dt,{hint:a}):null,o?(0,Y.jsx)(Ot,{runId:e.id}):null]}),(0,Y.jsx)(Et,{run:e,actions:c})]})}var gt={folder:we,terminal:L,vscode:qe,cursor:et,zed:ve,windsurf:it,sublime:Xe,idea:Ye,pycharm:$e,webstorm:V,goland:nt,rubymine:Ze,phpstorm:Ke,clion:Je,rider:Ge,"android-studio":rt,xcode:Qe,warp:tt,claude:C,codex:Te,opencode:C};function _t(e){return e.icon&>[e.icon]||F}function vt({run:e,canResume:t,onResume:n}){let i=f(),a=r(),o=y({mutationFn:t=>c(e.id,t),onError:e=>_(e.message,{tone:`danger`})}),s=m(a.data),l=e=>!a.isSuccess||s.includes(e??`claude`),u=t&&l(e.runner),d=e.worktreePath?(i.data?.targets??[]).filter(e=>{let t=G(e.id);return t===void 0||l(t)}):[];return!u&&d.length===0?null:(0,Y.jsxs)(M,{children:[(0,Y.jsx)(D,{asChild:!0,children:(0,Y.jsxs)(h,{variant:`ghost`,size:`sm`,title:`Resume in a terminal, or open the worktree locally`,children:[(0,Y.jsx)(F,{"aria-hidden":`true`}),`Open in…`]})}),(0,Y.jsxs)(k,{align:`end`,children:[u?(0,Y.jsxs)(A,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(L,{"aria-hidden":`true`}),`Terminal (resume session)`]}):null,u&&d.length>0?(0,Y.jsx)(j,{}):null,d.map(t=>{let n=ct(e,t.id),r=_t(t);return(0,Y.jsxs)(A,{"data-target":t.id,title:n?`Resume this run's session`:void 0,onSelect:()=>o.mutate(t.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),t.label,n?` (resume)`:``]},t.id)}),e.worktreePath?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{}),(0,Y.jsxs)(A,{onSelect:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>_(`Worktree path copied`)).catch(()=>_(`Path: ${t}`))},children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Copy worktree path`]})]}):null]})]})}function yt(e){let t=g(),n=Le(),[r,o]=(0,H.useState)(null),c=()=>t.invalidateQueries({queryKey:a.runs.all}),l=e=>_(e.message,{tone:`danger`}),u=$(e.id),d=J(e);return{finish:u,continuation:d,continueRun:y({mutationFn:async()=>d.canContinue?le(e.id,{runner:d.runnerOverride}):null,onSuccess:e=>{e!==null&&c()},onError:l}),archive:y({mutationFn:()=>i(e.id,!e.archived),onSuccess:c,onError:l}),cancel:y({mutationFn:()=>de(e.id),onSuccess:c,onError:l}),delete:y({mutationFn:()=>ue(e.id),onSuccess:()=>{c(),n(`/`)},onError:l}),terminal:y({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof oe&&e.command){bt(e.command,`No terminal found — command copied to clipboard.`);return}l(e)}}),confirming:r,setConfirming:o}}async function bt(e,t){try{await navigator.clipboard.writeText(e),_(t)}catch{_(`Run manually: ${e}`)}}function xt({run:e}){let t=se(e.id),n=p(e),r=he(n,e=>t.mutate({title:e},{onError:e=>_(e.message,{tone:`danger`})}));return r.editing?(0,Y.jsx)(ge,{editor:r,className:`flex-1 text-[15px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`min-w-0 truncate text-[15px] font-semibold`,title:e.task,children:n}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:r.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,Y.jsx)(me,{className:`size-3.5`,"aria-hidden":`true`})})]})}function St({run:e,showTokens:t,showCost:n}){let r=ae(),i=[(0,Y.jsx)(`span`,{children:o(e)},`workflow`)];e.branch&&i.push((0,Y.jsx)(`span`,{"data-slot":`branch-chip`,className:`rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:e.branch},`branch`));let a=ee(e);if(a&&b(a)){let t=l(a);i.push((0,Y.jsx)(T,{reference:{kind:`PR`,...t?{number:Number(t)}:{},url:a},taskTitle:p(e),className:`h-5`},`pr`))}let s=d(e,r);if(s&&b(s)){let t=l(s);i.push((0,Y.jsx)(T,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:s},taskTitle:p(e),className:`h-5`},`issue`))}e.diffStat&&i.push((0,Y.jsx)(We,{stat:e.diffStat},`diff`)),e.automation&&i.push((0,Y.jsx)(Re,{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`));let c=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&c.push((0,Y.jsx)(Ve,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&c.push((0,Y.jsx)(`span`,{className:`tabular-nums`,children:te(e.costUsd)},`cost`)),(0,Y.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[i.map((e,t)=>(0,Y.jsxs)(H.Fragment,{children:[t>0?(0,Y.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[c.map((e,t)=>(0,Y.jsxs)(H.Fragment,{children:[t>0?(0,Y.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Y.jsx)(wt,{run:e})]})]})}function Ct({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,Y.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,Y.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,Y.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,Y.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function wt({run:e}){let t=re(),n=e.runner??t.data?.defaultRunner??`claude`,r=e.model??`auto`;return(0,Y.jsxs)(M,{children:[(0,Y.jsx)(D,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"data-slot":`agent-badge`,title:`${n} · ${r}`,"aria-label":`Agent: ${n}, model ${r}`,className:`flex shrink-0 items-center justify-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,Y.jsx)(C,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsxs)(k,{align:`end`,className:`min-w-[9rem]`,children:[(0,Y.jsxs)(O,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,n]}),(0,Y.jsxs)(O,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,r]})]})]})}function Tt({run:e,actions:t,onToggleNotes:n}){let r=K(e);return(0,Y.jsxs)(M,{children:[(0,Y.jsx)(D,{asChild:!0,children:(0,Y.jsx)(h,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run actions`,className:`md:hidden`,children:(0,Y.jsx)(Ce,{"aria-hidden":`true`})})}),(0,Y.jsxs)(k,{align:`end`,"data-slot":`run-actions-menu`,children:[r.finish?(0,Y.jsxs)(A,{onSelect:()=>t.finish.mutate(),children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),` Finish`]}):null,r.continueRun?(0,Y.jsxs)(A,{disabled:!t.continuation.canContinue||t.continueRun.isPending,title:t.continuation.reason,onSelect:()=>t.continueRun.mutate(),children:[(0,Y.jsx)(E,{"aria-hidden":`true`}),` Continue`]}):null,r.terminal?(0,Y.jsxs)(A,{onSelect:()=>t.terminal.mutate(),children:[(0,Y.jsx)(L,{"aria-hidden":`true`}),` Terminal`]}):null,(0,Y.jsxs)(A,{onSelect:n,children:[(0,Y.jsx)(B,{"aria-hidden":`true`}),` Notes`]}),r.archive?(0,Y.jsxs)(A,{onSelect:()=>t.archive.mutate(),children:[e.archived?(0,Y.jsx)(R,{"aria-hidden":`true`}):(0,Y.jsx)(w,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,r.cancel||r.deleteRun?(0,Y.jsx)(j,{}):null,r.cancel?(0,Y.jsxs)(A,{variant:`destructive`,onSelect:()=>t.setConfirming(`cancel`),children:[(0,Y.jsx)(z,{"aria-hidden":`true`}),` Cancel`]}):null,r.deleteRun?(0,Y.jsxs)(A,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(P,{"aria-hidden":`true`}),` Delete`]}):null]})]})}function Et({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(Ie,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(je,{children:[(0,Y.jsxs)(Fe,{children:[(0,Y.jsx)(Ae,{children:n===`delete`?`Delete this task?`:`Cancel this task?`}),(0,Y.jsx)(ke,{children:n===`delete`?(0,Y.jsxs)(Y.Fragment,{children:[`This removes the run, its transcript, its worktree and its branch. There is no undo.`,(0,Y.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:p(e),children:p(e)})]}):`The agent is stopped and the run completes as cancelled. The worktree stays.`})]}),(0,Y.jsxs)(Ne,{children:[(0,Y.jsx)(Pe,{children:`Keep it`}),(0,Y.jsx)(Me,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{n===`delete`?t.delete.mutate():t.cancel.mutate(),t.setConfirming(null)},children:n===`delete`?`Delete`:`Cancel the run`})]})]})})}function Dt({hint:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`resume-hint`,title:`Copy the command`,onClick:()=>void bt(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,Y.jsx)(N,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[`take over interactively: `,e]})]})}function Ot({runId:e}){let t=fe(e);return(0,Y.jsx)(`div`,{"data-slot":`notes-panel`,className:`mb-3 max-h-72 overflow-y-auto rounded-md border border-border bg-card px-4 py-3`,children:t.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):t.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}):t.data.trim().length>0?(0,Y.jsx)(Ue,{children:t.data}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})})}export{U as a,K as c,q as i,V as l,$ as n,W as o,J as r,lt as s,ht as t,B as u};
|
|
@@ -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{A as r,Et as i,G as a,In as o,Ot as s,Q as c,Rn as l,Yt as u,Zt as d,a as f,bt as p,cn as m,cr as h,fr as g,i as _,lr as v,nn as y,t as b,wt as x,yt as S}from"./centered-state-ZtnFHA-n.js";import{t as C}from"./utils-DsLuRXwV.js";import{t as w}from"./arrow-left-wcYKQXI_.js";import{d as T,f as E}from"./new-task-form-BpAw_Dks.js";import{t as D}from"./circle-check--KvBxXWp.js";import{r as O,t as k}from"./skill-empty-hint-CZLALx6l.js";import{t as A}from"./refresh-cw-BoGdAykg.js";import{t as j}from"./sparkles-Dt4q7pbG.js";import{t as M}from"./triangle-alert-XYT0DGCI.js";import{a as N,c as P,l as F,o as I,r as L,s as R}from"./use-submit-shortcut-CzVyoAMd.js";import{c as z,t as B}from"./project-router-Cx8NPoqn.js";import{f as ee,i as te,n as ne,o as re}from"./skills-BiWfHmCR.js";import{c as V,g as H,o as U,t as W}from"./index-DiawI6RX.js";var G=e(t(),1),K=n(),q=`https://github.com/open-mercato/skills`;function J(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function Y(e,t){return J(e)??[...t]}function ie({projectId:e}){let t=g(),n=i(),c=a(),[l,u]=(0,G.useState)(``),d=p(e,!!e),f=c.data??[],m=(0,G.useMemo)(()=>f.map(e=>e.name),[f]),h=(0,G.useRef)([]);h.current=m;let v=(0,G.useMemo)(()=>new Set(Y(n.data,m)),[n.data,m]),y=(0,G.useRef)(Promise.resolve()),x=(0,G.useRef)(0),S=(0,G.useCallback)(e=>{let n=s.uiState,i=t.getQueryData(n),a=e(Y(i,h.current));t.setQueryData(n,{...i,importedSkills:a});let c=++x.current;y.current=y.current.then(async()=>{try{let e=await o({importedSkills:a});c===x.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:r.skills}))}catch(e){_(e instanceof Error?e.message:String(e),{tone:`danger`}),c===x.current&&t.invalidateQueries({queryKey:n})}})},[t]),w=(0,G.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),T=m.length>0&&m.every(e=>v.has(e)),E=(0,G.useCallback)(()=>{if(T){let e=new Set(h.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...h.current])])},[T,S]);if(c.isError)return(0,K.jsx)(b,{icon:(0,K.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:c.error.message});let D=l.trim().toLowerCase(),O=D?f.filter(e=>e.name.toLowerCase().includes(D)||(e.description??``).toLowerCase().includes(D)):f;return(0,K.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold`,children:`Manage skills`}),(0,K.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Reusable, technology-agnostic agent skills from`,` `,(0,K.jsx)(`a`,{href:q,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`open-mercato/skills`}),` `,`— PR creation, code review, CI stabilisation, spec writing and more. They're all in your catalog and the composer picker by default; uncheck any you don't want.`]}),(0,K.jsx)(Z,{projectId:e,state:d.data,loadError:d.error}),(0,K.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`These checkboxes choose what cezar shows; updates refresh installed skill files.`}),(0,K.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,K.jsx)(H,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:l,onChange:e=>u(e.target.value),className:`h-8 text-[13px]`}),(0,K.jsx)(`button`,{type:`button`,"data-slot":`import-all`,disabled:m.length===0||n.isPending,onClick:E,className:`h-8 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:T?`Remove all`:`Enable all`})]}),(0,K.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:c.isPending?(0,K.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=v.has(e.name);return(0,K.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:C(`flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,K.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>w(e.name),className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),e.description?(0,K.jsx)(`span`,{className:`mt-0.5 block pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,K.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:f.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function X(e){return e===`project`?`Project installation`:`Global installation`}function Z({projectId:e,state:t,loadError:n}){let i=g(),a=z(),o=(0,G.useRef)(0),[c,l]=(0,G.useState)(!1),u=v({mutationFn:()=>m({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{l(!1),a(T(e))},onError:e=>_(e.message,{tone:`danger`})}),p=(t,n)=>{n.seq===o.current&&(i.setQueryData(s.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(i.invalidateQueries({queryKey:r.skills}),_(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),l(!0)))},h=(e,t)=>{t.seq===o.current&&_(e.message,{tone:`danger`})},b=v({mutationFn:t=>y(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>p(e,t),onError:(e,t)=>h(e,t)}),x=v({mutationFn:t=>d(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>p(e,t),onError:(e,t)=>h(e,t)}),S=e=>{let n=++o.current;e===`apply`?x.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):b.mutate({action:e,seq:n})},w=t?.scopes.some(e=>e.skills.length>0)??!1,E=t?.status===`error`,O=w&&(t?.available||E),k=x.isPending||t?.status===`updating`,j=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],M=t?.scopes.filter(e=>e.updatedAt&&!j.includes(e))??[],B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,K.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,K.jsxs)(`li`,{children:[X(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,j.length>0?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,j.map(e=>X(e.scope)).join(`, `),M.length?`; updated: ${M.map(e=>X(e.scope)).join(`, `)}`:``,`.`]}):null]}),O?(0,K.jsxs)(f,{"data-action":`skills-update-apply`,size:`sm`,disabled:k,onClick:()=>S(`apply`),children:[(0,K.jsx)(A,{"aria-hidden":`true`,className:C(`size-3.5`,k&&`motion-safe:animate-spin`)}),k?`Updating…`:E?`Retry`:`Update now`]}):t?.status===`current`?(0,K.jsx)(f,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,K.jsx)(f,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,K.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,K.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,K.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,K.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,K.jsx)(D,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,K.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,K.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,K.jsx)(L,{open:c,onOpenChange:e=>u.isPending?void 0:l(e),children:(0,K.jsxs)(N,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,K.jsxs)(P,{children:[(0,K.jsx)(F,{children:`Apply the upgrade notes now?`}),(0,K.jsxs)(I,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,K.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,K.jsxs)(R,{children:[(0,K.jsx)(f,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>l(!1),children:`No`}),(0,K.jsx)(f,{type:`button`,disabled:u.isPending,onClick:()=>u.mutate(),children:u.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function ae(){return(0,K.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,K.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,K.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,K.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,K.jsx)(oe,{})]})}function oe(){let e=S(),t=x(),n=a(),[i]=h(),[o,s]=(0,G.useState)(``),d=g(),f=c(),p=u().projectId??f.data?.bootProject??``,m=v({mutationFn:()=>l(),onSuccess:e=>{d.setQueryData(r.skills,e),_(`Team skills refreshed.`)},onError:e=>_(e.message,{tone:`danger`})});if(e.isError)return(0,K.jsx)(b,{icon:(0,K.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let y=re(e.data??[]),T=(n.data?.length??0)>0,D=i.get(`skill`),N=D===Q||D===$||D!==null&&y.some(e=>e.name===D)?D:y[0]?.name??(T?$:Q),P=y.find(e=>e.name===N)??null,F=ne(y,o);return(0,K.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,K.jsxs)(`section`,{"data-slot":`skills-list`,className:C(`w-full flex-col border-border md:flex md:w-[320px] md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,D===null?`flex`:`hidden md:flex`),children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,K.jsx)(H,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>s(e.target.value),className:`h-8 text-[13px]`}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:m.isPending,onClick:()=>m.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,K.jsx)(A,{"aria-hidden":`true`,className:C(`size-3`,m.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,K.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,children:e.isPending?(0,K.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):F.length>0?F.map(e=>(0,K.jsx)(se,{skill:e,active:N===e.name},e.path)):(0,K.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:y.length>0?`(no skills match)`:(0,K.jsx)(k,{})})}),(0,K.jsxs)(`div`,{className:`shrink-0 border-t border-border p-2`,children:[T?(0,K.jsxs)(B,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":N===$?`page`:void 0,className:C(`mb-1 flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===$&&`bg-muted`),children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Manage skills`}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`open-mercato`})]}),(0,K.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`Choose which open-mercato skills appear in your catalog.`})]}):null,(0,K.jsxs)(B,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":N===Q?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===Q&&`bg-muted`),children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(E,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Run from GitHub`}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`bookmarklets`})]}),(0,K.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`One-click skill launch from any GitHub PR or issue.`})]})]})]}),(0,K.jsx)(`section`,{"data-slot":`skills-detail`,className:C(`min-w-0 flex-1 flex-col`,D===null?`hidden md:flex`:`flex`),children:(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:[(0,K.jsxs)(B,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,K.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),N===$?(0,K.jsx)(ie,{projectId:p}):N===Q?(0,K.jsx)(W,{skills:y}):P?(0,K.jsx)(U,{skill:P,usedBy:ee(t.data?.workflows??[],P.name)}):e.isPending?null:(0,K.jsx)(b,{icon:(0,K.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})}function se({skill:e,active:t}){let n=te(e);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(B,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":n?`true`:void 0,"aria-current":t?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(j,{"aria-hidden":`true`,className:C(`size-3.5 shrink-0`,n?`text-violet`:`text-soft-foreground`)}),(0,K.jsx)(`span`,{className:C(`min-w-0 truncate font-mono text-[13px]`,n?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,K.jsx)(V,{source:e.source,className:`ml-auto`})]}),e.description?(0,K.jsx)(`span`,{className:`line-clamp-2 pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})})}export{ae as SkillsRoute};
|
|
@@ -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{A as r,Dn as i,Kt as a,Mn as o,Sn as s,Tn as c,U as l,Vn as u,Xt as d,a as f,fr as p,i as m,ln as h,lr as g,lt as _,rn as v,sr as y,t as b,ut as x}from"./centered-state-ZtnFHA-n.js";import{a as S,o as C,t as w}from"./run-header-BGiv6_qX.js";import{a as T,i as E,n as D,r as O}from"./git-toolbar-DGiNMmtY.js";import{i as k,t as A}from"./use-desktop-Bf5LS_P4.js";import{t as j}from"./textarea-CUdokhkv.js";import{a as M,c as N,l as P,o as F,r as I,s as L,t as R}from"./use-submit-shortcut-CzVyoAMd.js";import{n as z,r as B}from"./index-DiawI6RX.js";import{t as V}from"./diff-Bizc96qe.js";var H=e(t(),1),U=e=>e===`running`||e===`queued`||e===`waiting`,W=`no worktree — this task ran directly in the repo working tree`;function G(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${W}`)}function K(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`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${W}`)}function q(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 — ${W}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?U(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function J(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:G(e),n=e.prUrl?[G(e),K(e)]:[K(e),q(e)],r=[];if(e.localHandoff){let t=e.hasSession?U(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Y=n();function X({run:e,open:t,onOpenChange:n}){let i=p(),[o,s]=(0,H.useState)(``),c=a(e),l=(0,H.useRef)(c);l.current=c,(0,H.useEffect)(()=>{t&&s(l.current)},[t]);let u=g({mutationFn:t=>v(e.id,t),onSuccess:t=>{m(`Committed ${t.sha.slice(0,7)}`),n(!1),i.invalidateQueries({queryKey:r.runs.changes(e.id)}),i.invalidateQueries({queryKey:r.runs.all})},onError:e=>m(e.message,{tone:`danger`})}),d=()=>{let e=o.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Y.jsx)(I,{open:t,onOpenChange:n,children:(0,Y.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,Y.jsxs)(N,{children:[(0,Y.jsx)(P,{children:`Commit changes`}),(0,Y.jsxs)(F,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Y.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Y.jsx)(j,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{R({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,Y.jsxs)(L,{children:[(0,Y.jsx)(f,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(f,{"data-slot":`commit-confirm`,disabled:o.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function Z(){let{id:e}=y(),t=_(e);return t.isPending?(0,Y.jsx)(B,{tab:`changes`}):t.isError?(0,Y.jsx)(z,{tab:`changes`,error:t.error}):(0,Y.jsx)(Q,{run:t.data})}function Q({run:e}){let t=l(),n=x(e.id,S(e.status)),a=A(),[s,f]=(0,H.useState)(`unified`),[_,v]=(0,H.useState)(!1),[y,j]=(0,H.useState)(null),[M,N]=(0,H.useState)(!1),P=(0,H.useRef)(null),F=p(),I=()=>F.invalidateQueries({queryKey:r.runs.all}),L=e=>m(e.message,{tone:`danger`}),R=g({mutationFn:()=>o(e.id),onSuccess:e=>m(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:L}),z=g({mutationFn:()=>h(e.id),onSuccess:e=>{m(`Draft PR created — ${e.url}`),I()},onError:L}),B=g({mutationFn:()=>i(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>m(`No terminal found — command copied to clipboard.`)).catch(()=>m(`Run manually: ${e.command}`));return}L(e)}}),U=g({mutationFn:t=>c(e.id,t),onError:L}),W=n.isError&&n.error instanceof d&&n.error.status===409,G=J({status:e.status,hasWorktree:!!e.worktreePath&&!W,branch:e.branch,changedFiles:n.data?.stat.files,remote:t.data?.repo?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:C(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:N(!0);break;case`push`:R.mutate();break;case`create-pr`:z.mutate();break;case`open-terminal`:B.mutate();break;case`view-pr`:break}},q=n.data?.files??[],Z=(0,H.useMemo)(()=>O(q),[q]),Q=a?s:`unified`,$=!a||_;return(0,Y.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Y.jsx)(w,{run:e,tab:`changes`}),(0,Y.jsx)(D,{bar:G,branch:e.branch,stat:n.data?.stat,mode:Q,wrap:$,onModeChange:f,onWrapChange:v,onAction:K}),n.data?.repointedHead?(0,Y.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-6`,children:[`HEAD is on `,(0,Y.jsx)(`code`,{children:n.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Y.jsx)(`code`,{children:n.data.repointedHead.taskBranch}),` — showing uncommitted changes only.`]}):null,n.isPending?(0,Y.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):n.isError?(0,Y.jsx)(b,{icon:W?(0,Y.jsx)(T,{}):(0,Y.jsx)(k,{}),tone:W?`neutral`:`danger`,heading:`h2`,title:W?`No changes to show`:`Could not load the changes`,subtitle:n.error.message}):q.length===0?(0,Y.jsx)(b,{icon:(0,Y.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-5 px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:[(0,Y.jsx)(`aside`,{className:`sticky top-40 hidden w-60 shrink-0 md:block lg:w-72`,children:(0,Y.jsx)(E,{root:Z,selected:y,onSelect:e=>{j(e),P.current?.scrollToPath(e)}})}),(0,Y.jsx)(V,{files:q,viewRef:P,mode:Q,wrap:$,loadFileText:t=>ee(e.id,t),imageSrc:t=>u(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>U.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,Y.jsx)(X,{run:e,open:M,onOpenChange:N})]})}async function ee(e,t){try{let n=await s(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{Z as TaskChangesRoute};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,A as i,F as a,I as o,It as s,Lt as c,O as l,P as u,X as d,Xt as f,Y as p,Yn as m,_t as h,a as g,an as _,ar as v,fr as y,gt as b,i as x,it as ee,k as te,ln as ne,lr as S,lt as C,n as w,q as re,sr as T,t as ie,vt as ae}from"./centered-state-ZtnFHA-n.js";import{a as E,n as D,r as O,t as k}from"./utils-DsLuRXwV.js";import{a as A,c as j,i as M,l as oe,n as se,o as ce,r as N,s as le,t as ue,u as de}from"./run-header-BGiv6_qX.js";import{a as P}from"./editable-title-5rC_QRBZ.js";import{t as fe}from"./arrow-down-Cz8qb71e.js";import{a as pe,d as me,f as he,l as ge,n as _e,s as ve,t as ye,u as be}from"./thread-loading-B8q8ukXJ.js";import{a as xe,i as Se,m as Ce,s as we}from"./new-task-form-BpAw_Dks.js";import{t as F}from"./chevron-right-G4caF2QV.js";import{n as Te,t as Ee}from"./trash-2-DhVIdWv8.js";import{n as De}from"./tab-link-DIlR5T07.js";import{E as Oe,T as ke,d as Ae,f as je,p as Me}from"./prompt-templates-CSBYBR1I.js";import{t as Ne}from"./git-pull-request-agOG0iGM.js";import{t as Pe}from"./search-x-X3EpVhgs.js";import{t as Fe}from"./square-terminal-hwBL8XsC.js";import{t as Ie}from"./textarea-CUdokhkv.js";import{n as I,r as L,t as R}from"./collapsible-B0JVzd0B.js";import{t as Le}from"./use-submit-shortcut-CzVyoAMd.js";import{t as z}from"./project-router-Cx8NPoqn.js";import{s as B}from"./pill-Dvs-P0xy.js";import{t as V}from"./markdown-BGBOGCA_.js";import{t as Re}from"./lib-BQXq3kEf.js";import{t as ze}from"./zoomable-image-7WyUiaVD.js";import{t as Be}from"./run-diff-EcOkf3ti.js";var Ve=120;function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Ve?`${t.slice(0,Ve-1)}…`:t}function W(e,...t){if(H(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return U(t)}}function He(e){if(!H(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return U(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return U(e.join(` `))}}function Ue(e){if(!H(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)H(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function We(e){return W(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function G(e,t){return t?`${e} ${t}`:e}function Ge(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:G(`Ran`,He(t)),subtitle:W(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:G(`Edit`,W(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:G(`Write`,W(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:G(`Edit`,W(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Ue(t);return{toolKind:`edit`,title:G(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:G(`Read`,W(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:G(`View image`,W(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:G(`Search`,W(t,`pattern`,`query`)),subtitle:W(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:G(`Fetch`,W(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:G(`Web search`,W(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=W(t,`subagent_type`,`subagentType`),i=W(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=W(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:W(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=W(t,`server`),n=W(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:We(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?U(e):`Tool`,subtitle:We(t)}}var Ke=O(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),qe=O(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Je=O(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ye=O(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),Xe=O(`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`}]]),Ze=O(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Qe=O(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),K=e(t(),1),$e=[`run-event`,`ui-event`];function et(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function tt(e){let[t,n]=(0,K.useState)([]);return(0,K.useEffect)(()=>{if(n([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let r=0,i=null,a,o=!1,s=Date.now(),c,l=e=>{s=Date.now();let t=et(e.data);!t||!(t.seq>r)||(r=t.seq,n(e=>[...e,t]))},u=()=>{s=Date.now()},d=()=>{o||a!==void 0||(a=setTimeout(()=>{a=void 0,o||f()},1500))},f=()=>{i?.close(),s=Date.now(),i=new t(E(`/runs/${encodeURIComponent(e)}/events`),{withCredentials:!0});for(let e of $e)i.addEventListener(e,l);i.addEventListener(`ping`,u),i.addEventListener(`error`,()=>{i?.readyState===2&&d()})},p=()=>{document.visibilityState===`visible`&&(!i||i.readyState===2)&&(clearTimeout(a),a=void 0,f())},m=()=>{clearTimeout(a),a=void 0,i?.close()},h=e=>{e.persisted&&f()};return c=setInterval(()=>{o||document.visibilityState!==`visible`||Date.now()-s<=4e4||(clearTimeout(a),a=void 0,f())},1e4),document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),window.addEventListener(`pageshow`,h),f(),()=>{o=!0,clearTimeout(a),clearInterval(c),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),window.removeEventListener(`pageshow`,h),i?.close()}},[e]),t}var q=e=>e.kind===`tool`,nt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,rt=(e,t,n)=>`${e} ${e===1?t:n}`;function it(e,t){let n=[];return e>0&&n.push(rt(e,`file`,`files`)),t>0&&n.push(rt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function at(e){return`${e} earlier tool call${e===1?``:`s`}`}var ot=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function st(e){for(let t of ot)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function ct(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(q).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:it(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)q(e)&&nt(e)&&!r.has(e.id)?o.push(e):(s(),q(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var J=n(),Y=new Map,lt=(0,K.createContext)(null);function ut(){return(0,K.useContext)(lt)}function dt({runId:e,children:t}){let n=(0,K.useMemo)(()=>({get:t=>Y.get(e)?.get(t),set:(t,n)=>{let r=Y.get(e)??new Map;r.set(t,n),Y.set(e,r)}}),[e]);return(0,J.jsx)(lt.Provider,{value:n,children:t})}function ft(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function pt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var mt=new Map;function ht(e,t){mt.set(e,t)}function gt(e){return mt.get(e)}var _t=new Map;function vt(e,t){_t.set(e,t)}function yt(e,t){let n=_t.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function bt({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(e),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(),_=()=>{f(e),g(void 0),u(!0)},v=async()=>{let t=d.trim();if(!t||t===e){u(!1);return}m(!0),g(void 0);try{await r?.(t),u(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},y=async()=>{m(!0),g(void 0);try{await i?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return c?(0,J.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,J.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),u(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,J.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(!1),disabled:p,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void v(),disabled:p,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:p?(0,J.jsx)(l,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,J.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,J.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,J.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,J.jsx)(`button`,{type:`button`,"aria-label":a,onClick:_,disabled:p,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,J.jsx)(Ze,{className:`size-3.5`})}):null,i?(0,J.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void y(),disabled:p,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,J.jsx)(Ee,{className:`size-3.5`})}):null]}):null,h?(0,J.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,J.jsx)(V,{breaks:!0,children:e}),n.length>0?(0,J.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:n.map(e=>(0,J.jsx)(ze,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e))}):null,s>0?(0,J.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function xt({text:e}){return(0,J.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,J.jsx)(V,{children:e})})}function St({note:e}){return(0,J.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:k(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var Ct={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`};function wt({incident:e}){let t=Ct[e.provider];return(0,J.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,J.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,J.jsx)(z,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Tt({text:e}){let t=(0,K.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
|
-
`,1)[0]??``,r=n.length<e.length;return(0,J.jsxs)(R,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,J.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,J.jsx)(F,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,J.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,J.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,J.jsx)(V,{inline:!0,children:n})}),r?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,J.jsx)(L,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,J.jsx)(I,{children:(0,J.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,J.jsx)(V,{children:e})})})]})}function Et(){return(0,J.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,J.jsx)(l,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,J.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Dt={read:de,edit:Ze,delete:Ee,move:Je,search:ke,execute:Fe,think:Ke,fetch:oe,task:P,plan:Ye,other:Qe},Ot=e=>e.split(`
|
|
3
|
-
`).length;function kt({text:e,streaming:t}){let[n,r]=(0,K.useState)(!1),i=(0,K.useRef)(null),a=(0,K.useRef)(!0);(0,K.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Ot(e),s=!t&&!n&&o>12;return(0,J.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=ft(e.currentTarget)}:void 0,className:k(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,J.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,J.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,J.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function At({diffs:e}){return(0,J.jsx)(J.Fragment,{children:e.map((e,t)=>(0,J.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,J.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...jt(e.oldText).map((e,t)=>(0,J.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...jt(e.newText).map((e,t)=>(0,J.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
|
-
`).map((e,t)=>(0,J.jsx)(Mt,{text:e},t))})]},`${e.path}:${t}`))})}function jt(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
5
|
-
`)}function Mt({text:e}){return(0,J.jsx)(`span`,{className:k(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function Nt(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Pt({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=ut(),[a,o]=(0,K.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,u=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,d=u&&(a??Nt(e)),{verb:f,detail:p}=st(e.title),m=Dt[e.toolKind]??Qe;return(0,J.jsxs)(R,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:d,onOpenChange:s,className:k(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,J.jsxs)(L,{disabled:!u,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,J.jsx)(F,{"aria-hidden":!0,className:k(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!u&&`invisible`)}),(0,J.jsx)(m,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:k(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:f}),p===void 0?null:(0,J.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:p}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,J.jsx)(l,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,J.jsx)(`span`,{"data-slot":`tool-exit`,className:k(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,J.jsx)(I,{children:(0,J.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,J.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,J.jsx)(At,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,J.jsx)(kt,{text:e.output,streaming:c}):null,t.length>0?(0,J.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function Ft({group:e,scope:t}){return(0,J.jsxs)(R,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,J.jsxs)(L,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,J.jsx)(F,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,J.jsx)(I,{children:(0,J.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,J.jsx)(Pt,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function It({count:e,children:t}){return(0,J.jsxs)(R,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,J.jsxs)(L,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,J.jsx)(F,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),at(e)]}),(0,J.jsx)(I,{children:(0,J.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function Lt({image:e}){return(0,J.jsx)(ze,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function Rt(e){let t=y(),n=j(e).continueRun,r=u(),a=b(n),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(null),d=N(e,o),{runners:f,canContinue:p,currentRunner:m,runner:h}=d,g=h===m&&e.model?{...r.data?.defaultModels,[h]:e.model}:r.data?.defaultModels,v=xe(h,a.data,[c,g?.[h]]),x=we(c,h,g,a.data),ee=S({mutationFn:({text:t,images:n})=>p?_(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:d.runnerOverride,model:c===null?void 0:x}):Promise.reject(Error(d.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:i.runs.all})});return{available:n,canContinue:p,reason:d.reason,providerPending:d.providerPending,pills:(0,J.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[f.length>1?(0,J.jsx)(Me,{runners:f,value:h,onPick:e=>{s(e),l(null)}}):null,(0,J.jsx)(je,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:v.find(e=>e.id===x)?.label??`auto`,value:x,onPick:e=>l(e),options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Se(h,a.data,a.isError)})]}),continueWith:(e,t)=>ee.mutateAsync({text:e,images:t})}}var zt=120,Bt=e=>e!==`pending`&&e!==`running`,Vt=e=>e.kind===`tool`&&e.toolKind===`task`,X=e=>Vt(e)&&e.parentItemId===void 0,Ht=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function Ut(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>X(e)&&t.has(e.id)))return n;return 0}function Wt(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function Gt(e){if(e.kind===`tool`)return Kt(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
|
|
6
|
-
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return Kt(n)}}}function Kt(e){return e.length>zt?`${e.slice(0,zt-1).trimEnd()}…`:e}function qt(e,t=!1){let n=Qt(e,e=>e.items.some(X));if(n===-1)return[];let r=e=>!t&&!Bt(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(X);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(X)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?Ut(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!Ht(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>Jt(e,c.get(e.id)??[],t))}function Jt(e,t,n){let r={id:e.id,title:st(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=Wt(e);i!==void 0&&(r.agentType=i),n&&!Bt(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=Gt(t[e]);if(n!==void 0){r.activity=n;break}}return r}function Yt(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Xt(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function Zt(e){return e.find(e=>!Bt(e.status))??e[0]}function Qt(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function $t(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&X(e));if(i!==void 0)return Jt(i,en(e,t),n)}}function en(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&X(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)Ht(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var tn=new Map,nn=!1;function rn({runId:e,agents:t,onSelect:n}){let[r,i]=(0,K.useState)(()=>tn.get(e)??nn);if(t.length===0)return null;let{done:a,total:o}=Yt(t),s=Zt(t);return(0,J.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,J.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(tn.set(e,!t),!t)),"aria-expanded":r,className:k(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,J.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,J.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,J.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,Xt(s)]}):null,(0,J.jsx)(Ce,{"aria-hidden":!0,className:k(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,J.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,J.jsx)(an,{agent:e,onSelect:n},e.id))}):null]})}function an({agent:e,onSelect:t}){let n=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(on,{status:e.status,stalled:e.stalled===!0}),(0,J.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,J.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,J.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Xt(e)}),(0,J.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,J.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,J.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function on({status:e,stalled:t=!1}){return t?(0,J.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,J.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,J.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,J.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,J.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,J.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var sn=new Map;function cn(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function ln(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function un(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function dn({runId:e,entries:t}){let[n,r]=(0,K.useState)(()=>sn.get(e)??cn());if(t.length===0)return null;let{done:i,total:a}=ln(t),o=un(t);return(0,J.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":n?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,J.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>r(t=>(sn.set(e,!t),!t)),"aria-expanded":n,className:k(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,n?`pt-2 pb-1.5`:`py-2`),children:[(0,J.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,J.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,i,`/`,a]}),!n&&o!==void 0?(0,J.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,o.activeForm??o.content]}):null,(0,J.jsx)(Ce,{"aria-hidden":!0,className:k(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!n&&`rotate-180`)})]}),n?(0,J.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,J.jsx)(fn,{entry:e},`${t}:${e.content}`))}):null]})}function fn({entry:e}){return(0,J.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:k(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,J.jsx)(pn,{status:e.status}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,J.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function pn({status:e}){return e===`cancelled`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,J.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,J.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,J.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,J.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,J.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function mn(e,t=`document`){let n=(0,K.useRef)(null),[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(!1),s=(0,K.useRef)(!0),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=(0,K.useRef)(null),d=(0,K.useCallback)(e=>{i(e),e&&(n.current=e.closest(t===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`))},[t]),f=(0,K.useCallback)(e=>{let t=n.current;if(!t)return;let r=u.current;r?r.scrollTo(e):t.scrollTop=e},[]),p=(0,K.useCallback)(()=>{let e=n.current;e&&f(e.scrollHeight-e.clientHeight)},[f]),m=(0,K.useCallback)(()=>{s.current&&p()},[p]),h=(0,K.useCallback)(()=>{let e=n.current;e&&(c.current=null,s.current=!0,e.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`}))},[]);return(0,K.useEffect)(()=>{let t=n.current,i=r;if(!t||!i)return;if(l.current!==e){l.current=e;let n=gt(e);n&&!n.atBottom?(s.current=!1,c.current=n.top,t.scrollTop=n.top):(s.current=!0,p())}let a=0,u=null,d=()=>{c.current=null,s.current=!1,a=0},m=()=>{a=Date.now()},h=e=>{e.deltaY<0?d():m()},g=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?d():[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&m()},_=()=>{ft(t,80)||(d(),m())},v=e=>{u=e.touches[0]?.clientY??null},y=e=>{let t=e.touches[0]?.clientY;t!==void 0&&(u!==null&&t>u+1?d():u!==null&&t<u-1&&m(),u=t)},b=()=>{let n=ft(t,80);n&&c.current===null&&(s.current||Date.now()-a<2e3)&&(s.current=!0),o(!n),c.current===null&&ht(e,{top:t.scrollTop,atBottom:n})};t.addEventListener(`scroll`,b,{passive:!0}),t.addEventListener(`wheel`,h,{passive:!0}),t.addEventListener(`touchstart`,v,{passive:!0}),t.addEventListener(`touchmove`,y,{passive:!0}),t.addEventListener(`pointerdown`,_,{passive:!0}),t.addEventListener(`keydown`,g);let x;return typeof ResizeObserver<`u`&&(x=new ResizeObserver(()=>{let e=c.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;f(Math.min(e,n)),n>=e&&(c.current=null)}else s.current&&p()}),x.observe(i)),()=>{t.removeEventListener(`scroll`,b),t.removeEventListener(`wheel`,h),t.removeEventListener(`touchstart`,v),t.removeEventListener(`touchmove`,y),t.removeEventListener(`pointerdown`,_),t.removeEventListener(`keydown`,g),x?.disconnect()}},[e,r,f,p]),{attachContent:d,scrollElRef:n,virtualizerRef:u,pillVisible:a,jumpToLatest:h,restickIfStuck:m}}function hn({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,J.jsx)(gn,{runId:e,rows:t,controls:r}):(0,J.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,J.jsx)(`div`,{"data-slot":`thread-row`,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function gn({runId:e,rows:t,controls:n}){let r=(0,K.useRef)(null),[i]=(0,K.useState)(()=>yt(e,t.length)),a=(0,K.useRef)(t.length);a.current=t.length;let o=(0,K.useRef)(null),s=(0,K.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(vt(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,K.useState)(0);return(0,K.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,J.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,J.jsx)(Re,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,J.jsx)(`div`,{"data-slot":`thread-row`,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function _n({onJump:e}){return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,J.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function vn(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[]},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[]},entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images}},entries:e.items});return n}function yn(e,t){return[{id:`agent:${e}`,entries:t}]}function bn(e,t){let n=[];for(let t of e){t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of ct([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}})}return n}function xn({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c}){let l=(0,K.useMemo)(()=>bn(n,e),[n,e]),u=mn(`${e}:${t}`,r),d=s??u,f=(0,K.useMemo)(()=>l.map(e=>({key:e.key,node:e.content.kind===`user-message`?(0,J.jsx)(Sn,{message:e.content.message,actions:o?.[e.key]}):(0,J.jsx)(Cn,{block:e.content.block,scope:e.scope,renderAsk:a})})),[o,a,l]),p=c??pt(``,f.length),m=f.length===0?i??null:(0,J.jsx)(hn,{runId:`${e}:${t}`,rows:f,mode:p,controls:d});return(0,J.jsx)(dt,{runId:e,children:r===`panel`?(0,J.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:m}),d.pillVisible?(0,J.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,J.jsx)(_n,{onJump:d.jumpToLatest})}):null]}):m})}function Sn({message:e,actions:t}){return(0,J.jsx)(bt,{text:e.text,imageCount:e.imageCount,images:e.images,onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function Cn({block:e,scope:t,renderAsk:n}){switch(e.kind){case`entry`:return(0,J.jsx)(Tn,{entry:e.entry,scope:t,renderAsk:n});case`tool-card`:return(0,J.jsx)(Pt,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,J.jsx)(wn,{entries:e,scope:t,renderAsk:n})});case`context-group`:return(0,J.jsx)(Ft,{group:e,scope:t});case`streak`:return(0,J.jsx)(It,{count:e.count,children:e.blocks.map(e=>(0,J.jsx)(Cn,{block:e,scope:t,renderAsk:n},e.id))});default:return En(e)}}function wn({entries:e,scope:t,renderAsk:n}){return ct([...e]).map(e=>(0,J.jsx)(Cn,{block:e,scope:t,renderAsk:n},e.id))}function Tn({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,J.jsx)(xt,{text:e.text}):(0,J.jsx)(bt,{text:e.text});case`reasoning`:return(0,J.jsx)(Tt,{text:e.text});case`tool`:return(0,J.jsx)(Pt,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,J.jsx)(St,{note:e});case`image`:return(0,J.jsx)(Lt,{image:e});case`ask`:return n===void 0?(0,J.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,J.jsx)(wt,{incident:e});default:return En(e)}}function En(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function Dn({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,J.jsx)(ve,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,J.jsx)(ge,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,J.jsx)(On,{runId:e,renderAsk:t,agent:n,entries:r})})})}function On({runId:e,renderAsk:t,agent:n,entries:r}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,J.jsxs)(he,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,J.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,J.jsxs)(be,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(kn,{status:n.status}),(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,J.jsx)(xn,{runId:e,viewId:`agent:${n.id}`,sections:yn(n.id,r),mode:`panel`,renderAsk:t,empty:(0,J.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function kn({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,J.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:k(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function An({run:e}){return(0,J.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,J.jsx)(Oe,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,J.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,J.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,J.jsx)(Be,{runId:e.id}),(0,J.jsx)(jn,{run:e})]})}function jn({run:e}){let t=y(),n=(0,K.useRef)(null),[r,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),c=se(e.id),l=N(e),u=()=>t.invalidateQueries({queryKey:i.runs.all}),d=S({mutationFn:async t=>l.canContinue?_(e.id,{text:`Review feedback:\n${t}`,runner:l.runnerOverride}):null,onSuccess:e=>{e!==null&&(a(``),u())},onError:e=>x(e.message,{tone:`danger`})}),p=S({mutationFn:()=>ne(e.id),onSuccess:e=>{x(`Draft PR created — ${e.url}`),u()},onError:e=>{e instanceof f&&e.manual!==void 0&&s(e.manual),x(e.message,{tone:`danger`})}}),m=()=>{let e=r.trim();if(e.length===0){x(`Write what to change first.`),n.current?.focus();return}d.mutate(e)};return(0,J.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,J.jsx)(Ie,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{Le({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(),m())},className:`min-h-[52px] text-[13px]`}),l.canContinue?null:(0,J.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:l.reason}),l.providerPending?null:(0,J.jsx)(z,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(g,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:l.reason??`Send the notes back into the agent's session`,"aria-describedby":l.canContinue?void 0:`review-provider-guidance`,disabled:d.isPending||!l.canContinue,onClick:m,children:[(0,J.jsx)(qe,{"aria-hidden":`true`}),`Send back`]}),D(e.pullRequestUrl)?(0,J.jsx)(g,{asChild:!0,variant:`outline`,size:`sm`,children:(0,J.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,J.jsx)(De,{"aria-hidden":`true`}),`PR ↗`]})}):(0,J.jsxs)(g,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,J.jsx)(Ne,{"aria-hidden":`true`}),`Draft PR`]}),(0,J.jsxs)(g,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:M(`review`),disabled:c.isPending,onClick:()=>c.mutate(),children:[(0,J.jsx)(te,{"aria-hidden":`true`}),`Accept`]})]}),o===null?null:(0,J.jsx)(Mn,{command:o})]})}function Mn({command:e}){return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>x(`Command copied to clipboard.`)).catch(()=>x(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,J.jsx)(Te,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Nn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Pn=1500;function Fn({status:e}){let t=(0,K.useRef)(e),[n,r]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Nn())return;r(!0);let i=setTimeout(()=>r(!1),Pn);return()=>clearTimeout(i)},[e]),n?(0,J.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,J.jsx)(w,{}),(0,J.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,J.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}var In={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`};function Ln(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 Rn(e){return e.runner??`claude`}function zn(e,t){let n=m(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${In[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${In[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function Bn(e,t){return zn(Ln(e),t)}function Vn(e,t){return zn(Rn(e),t)}function Hn(e){let t=r(),n=Ln(e);return t.isSuccess&&t.data?Bn(e,t.data):{provider:n,usable:!0}}function Un(e){let t=r(),n=Rn(e);return t.isSuccess&&t.data?Vn(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}function Wn(e){return A(e.status)?`live`:j(e).continueRun?`resume`:`unavailable`}function Gn(e){let t=ae(e.id),n=a(e.id),r=Hn(e),i=Un(e),[o,s]=(0,K.useState)(void 0),c=Wn(e),l=c===`resume`?!i.usable:c===`live`&&!r.usable,u=c===`unavailable`?`no-session`:l?`provider`:void 0,d=u===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:u===`provider`?c===`resume`?i.reason:r.reason:void 0,p=e=>i.usable?n.mutateAsync({text:e}):Promise.reject(Error(i.reason??`The run provider is unavailable.`));return{mode:c,blockedBy:u,reason:d,isPending:t.isPending||n.isPending,error:o,send:async n=>{if(!u){if(s(void 0),c===`resume`){try{await p(n)}catch(e){s(e instanceof Error?e.message:String(e))}return}try{await t.mutateAsync({text:n})}catch(t){if(t instanceof f&&t.status===409&&ce(e)!==void 0)try{await p(n);return}catch(e){s(e instanceof Error?e.message:String(e));return}s(t instanceof Error?t.message:String(t))}}}}}function Kn(e,t){return`${e.header}: ${t.join(`, `)}`}function qn({ask:e,run:t}){return e.resolved?(0,J.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,J.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,J.jsx)(Jn,{ask:e,run:t})}function Jn({ask:e,run:t}){let n=Gn(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,K.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>Kn(e,o[t]??[])).join(`
|
|
7
|
-
`)),d=n.mode===`resume`;return(0,J.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,J.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,J.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`The agent is asking`})}),(0,J.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,J.jsx)(Yn,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(Kn(e,i)):c(t,i))}},e.id??t))}),a?d?(0,J.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,J.jsx)(g,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,J.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,J.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:n.reason}),(0,J.jsx)(z,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,J.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,J.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function Yn({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,J.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,J.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,J.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,J.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,J.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:k(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,J.jsx)(`span`,{"aria-hidden":!0,className:k(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,J.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var Xn=2e3;function Zn(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Qn(e,t){let n=y(),r=(0,K.useMemo)(()=>Zn(t),[t]),a=e?.id,o=e?.status;(0,K.useEffect)(()=>{if(r===0||a===void 0||o!==`running`&&o!==`waiting`)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:i.runs.detail(a)}),n.invalidateQueries({queryKey:i.runs.list()})},Xn);return()=>clearTimeout(e)},[r,a,o,n])}function $n(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function er(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function tr(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`string`?e:void 0}function nr(e){return e===`claude`||e===`codex`||e===`opencode`?e:void 0}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``)),n.includes(`CEZ:`)?n.split(`
|
|
8
|
-
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
9
|
-
`):n}function rr(e){let t=e=>$(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function ir(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var ar=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,or=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function sr(e){if(!Z(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!Z(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:or.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function cr(e,t={}){let n=[],r=new Map,i,a=0,o,s=()=>{a+=1;let e={id:`turn-${a}`,entries:[],v2Items:!1};return n.push(e),e},c=()=>n.at(-1)??s(),l=(e,t)=>{let n=Q(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})};for(let t of e)switch(t.type){case`user-message`:{let e=Q(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=s();n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=Q(t.turnId),r=n.at(-1);r&&r.turnId===void 0&&!r.v2Items?r.turnId=e:s().turnId=e;break}case`turn.completed`:{let e=Q(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);i&&(i.completed={stopReason:Q(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!Z(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=l(t,i.id);u(r.get(a)?.turn??c(),i,a);break}case`item.delta`:{let e=Q(t.itemId)??``,n=r.get(l(t,e)),i=Q(t.delta)??``;if(!n||i===``||!ar(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=c(),n=Q(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=Q(t.tool)??`Tool`;if(lr.has(n))break;let i=Ge(n,t.input);if(i.toolKind===`plan`){let n=sr(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:Q(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get(Q(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=ir(t.result);break}case`note`:case`lifecycle`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`dim`}});break}case`error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=Q(t.error)?` — ${Q(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${Q(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=Q(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:Q(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=nr(t.provider),n=Q(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;c().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=Q(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=Q(t.name);r!==void 0&&(n.name=r),c().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(c().planEntries=t.entries);break;case`session.ended`:i={reason:Q(t.reason)??`end_turn`,...Q(t.message)===void 0?{}:{message:Q(t.message)}};break;case`ask.requested`:{let e=Q(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>Z(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1};c().entries.push({origin:`meta`,entry:r}),o=r;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add($(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has($(e.entry.text,!0).trim()))),rr(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:$(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var lr=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function ur(){let{id:e}=T(),t=C(e),n=tt(e),r=t.data?.status,i=(0,K.useMemo)(()=>cr(n,{activeTurn:r===`running`}),[n,r]),{mutate:a}=re();if((0,K.useEffect)(()=>{t.data&&pe(t.data)&&a(t.data.id)},[a,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),Qn(t.data,n),t.isPending)return(0,J.jsx)(ye,{});if(t.isError){let e=t.error instanceof f&&t.error.status===404;return(0,J.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(ie,{icon:e?(0,J.jsx)(Pe,{}):(0,J.jsx)(Xe,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,J.jsx)(g,{asChild:!0,variant:`outline`,children:(0,J.jsx)(z,{to:`/`,children:`Back to tasks`})})})})}return(0,J.jsx)(dr,{run:t.data,thread:i})}function dr({run:e,thread:t}){let n=tr(e.status,e.error),r=$n(t),i=r!==void 0&&r.length>0?ln(r):void 0,a=e.status===`running`||e.status===`waiting`,l=e.status===`queued`,u=Rt(e),f=!a&&!l&&u.available,m=f&&u.canContinue,h=!a&&e.status!==`queued`,g=(0,K.useMemo)(()=>qt(t.turns,h),[t.turns,h]),[_,y]=(0,K.useState)(void 0),[b,x]=(0,K.useState)(e.id);b!==e.id&&(x(e.id),y(void 0));let te=(0,K.useMemo)(()=>_===void 0?void 0:$t(t.turns,_,h),[t.turns,_,h]),ne=(0,K.useMemo)(()=>_===void 0?[]:en(t.turns,_),[t.turns,_]),S=ae(e.id),C=Hn(e),w=a&&!C.usable,re=f&&!u.canContinue,T=w||re,ie=w?C.reason:u.reason,{mutateAsync:E}=p(e.id),{mutateAsync:O}=o(e.id),{mutateAsync:A}=ee(e.id),j=(0,K.useMemo)(()=>l?{onEditTask:async e=>{await E({task:e})},onEditMessage:(e,t)=>O({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>A(e).then(()=>void 0)}:void 0,[l,E,O,A]),M=(0,K.useMemo)(()=>vn(e,t),[e,t]),oe=(0,K.useMemo)(()=>bn(M,e.id),[M,e.id]),se=(0,K.useCallback)(t=>(0,J.jsx)(qn,{ask:t,run:e}),[e]),ce=(0,K.useMemo)(()=>{if(j===void 0)return;let t={task:{onEdit:j.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>j.onEditMessage(n.id,e),onRemove:()=>j.onRemoveMessage(n.id)};return t},[j,e.queuedMessages]),N=s(e,d()),{search:le}=v(),de=pt(le,oe.length),P=mn(`${e.id}:main`);return Ae(P.restickIfStuck),(0,J.jsxs)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(ue,{run:e,planTally:i}),(0,J.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-3.5 px-4 py-5 md:px-6`,children:[(0,J.jsx)(xn,{runId:e.id,viewId:`main`,sections:M,mode:`document`,renderAsk:se,messageActions:ce,scrollControls:P,renderMode:de}),t.turns.length===0?e.status===`queued`?(0,J.jsx)(fr,{run:e}):(0,J.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,J.jsx)(Et,{}):null,n&&n.state===`closed`?(0,J.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":n.state,className:k(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,n.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[n.label,D(c(e))?(0,J.jsx)(`a`,{"data-slot":`pr-link`,href:c(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,D(N)?(0,J.jsx)(`a`,{"data-slot":`issue-link`,href:N,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,J.jsx)(An,{run:e}):null]}),(0,J.jsx)(Fn,{status:e.status}),(0,J.jsx)(Dn,{runId:e.id,renderAsk:se,agent:te,entries:ne,onClose:()=>y(void 0)}),(0,J.jsxs)(`div`,{"data-slot":`thread-dock`,className:`sticky bottom-[var(--kb,0px)] z-10 bg-background px-4 pt-1.5 pb-3 max-md:border-t max-md:border-border md:px-6 md:pb-4`,children:[P.pillVisible?(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,J.jsx)(_n,{onJump:P.jumpToLatest})}):null,(0,J.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-2.5`,children:[(0,J.jsx)(rn,{runId:e.id,agents:g,onSelect:y},`agents:${e.id}`),r!==void 0&&r.length>0?(0,J.jsx)(dn,{runId:e.id,entries:r},e.id):null,e.status===`waiting`?(0,J.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(B,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,l?(0,J.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(B,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,J.jsx)(_e,{onSubmit:m?(e,t)=>u.continueWith(e,t):(e,t)=>S.mutateAsync({text:e,images:t}),disabled:T||!a&&!l&&!m,disabledReason:T?ie:`Session closed — no session to resume.`,footerEnd:T&&!u.providerPending?(0,J.jsx)(z,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):m?u.pills:void 0,allowEmptySubmit:m,sendAriaLabel:m?`Continue`:`Send`,placeholder:l?`Add to the prompt — sent when the run starts…`:m?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>er(t)})]})]})]})}function fr({run:e}){let t=le(h().data??[],e.id);return(0,J.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,J.jsx)(B,{tone:`pending`,pulse:!0}),(0,J.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,J.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{ur as TaskThreadRoute};
|