@wjarka/cezarion 0.14.5 → 0.14.6
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/README.md +4 -1
- package/dist/automations/types.d.ts +2 -0
- package/dist/contract/automations.d.ts +8 -0
- package/dist/contract/delegation.d.ts +1 -0
- package/dist/contract/index.js +5 -1
- package/dist/contract/runs.d.ts +7 -0
- package/dist/contract/skills.d.ts +1 -0
- package/dist/contract/workflows.d.ts +6 -0
- package/dist/delegation/cli.js +5 -3
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/execution-identity.d.ts +92 -4
- package/dist/delegation/execution-identity.js +40 -10
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/provision.js +5 -2
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/routes.d.ts +1 -0
- package/dist/delegation/service.js +95 -13
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +1 -0
- package/dist/runs/store.d.ts +1 -0
- package/dist/server/server.d.ts +68 -0
- package/dist/workflows/load.d.ts +2 -0
- package/dist/workflows/load.js +5 -0
- package/dist/workflows/load.js.map +1 -1
- package/dist/workflows/run.d.ts +37 -2
- package/dist/workflows/run.js +160 -47
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +5 -1
- package/dist/workflows/types.js +6 -2
- package/dist/workflows/types.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{agent-accounts-4EqNShyp.js → agent-accounts-lP_xK83o.js} +1 -1
- package/web/dist/assets/{alert-dialog-CVF_qvQ8.js → alert-dialog-CmDuefYh.js} +1 -1
- package/web/dist/assets/{collapsible-DVDGHZAE.js → collapsible-BqX8REmY.js} +1 -1
- package/web/dist/assets/{commit-list-BuNsBn8P.js → commit-list-BWvv1H7A.js} +1 -1
- package/web/dist/assets/{compare-variants-BnQ1O8Ix.js → compare-variants-Bg7eLW3z.js} +1 -1
- package/web/dist/assets/{diff-DWmKlqw52.js → diff-0GBum40Q2.js} +2 -2
- package/web/dist/assets/{diff-controls-CuqRa-63.js → diff-controls-HwWHHait.js} +1 -1
- package/web/dist/assets/{diff-stat-BXriPIds.js → diff-stat-mNkhAc5m.js} +1 -1
- package/web/dist/assets/{diff-view-DLPDcgEV.js → diff-view-DW64doDY.js} +1 -1
- package/web/dist/assets/{dropdown-menu-IsTcumXE.js → dropdown-menu-sZjYPcLh.js} +1 -1
- package/web/dist/assets/{git-toolbar-BjMzETip.js → git-toolbar-DBW5EIcY.js} +1 -1
- package/web/dist/assets/{github-BvowTAuy.js → github-CkZ4hWI5.js} +1 -1
- package/web/dist/assets/{image-preview-WXKTY8KT.js → image-preview-DZicGNkU.js} +1 -1
- package/web/dist/assets/{index-Cz3N9b18.js → index-DWWI-B9n.js} +3 -3
- package/web/dist/assets/{markdown-gFxX4dDH.js → markdown-AY2K3kIV.js} +1 -1
- package/web/dist/assets/{pill-BlaWNkHk.js → pill-CcJqA1cL.js} +1 -1
- package/web/dist/assets/{project-router-CX1jLqj-.js → project-router-SwsXRKXs.js} +1 -1
- package/web/dist/assets/{prompt-templates-DwdQcfSc.js → prompt-templates-iV2WD2jy.js} +1 -1
- package/web/dist/assets/{repo-git-DnbE8dR5.js → repo-git-BW3TOs3U.js} +1 -1
- package/web/dist/assets/{run-diff-Mfc85irR.js → run-diff-DPUNj56q.js} +1 -1
- package/web/dist/assets/{run-header-CDO3LV4z.js → run-header-DbDluWoV.js} +1 -1
- package/web/dist/assets/{skills-DHfsyXTQ.js → skills-Dv8Vwv5D.js} +1 -1
- package/web/dist/assets/{tab-link-DhREnUYE.js → tab-link-DSftvkZS.js} +1 -1
- package/web/dist/assets/{task-changes-Cfo-vtEl.js → task-changes-CTCuVls1.js} +1 -1
- package/web/dist/assets/{task-commits-CvK4flXT.js → task-commits-weJQ5GSl.js} +1 -1
- package/web/dist/assets/{task-files-BwVGUObK.js → task-files-B4bUimY8.js} +1 -1
- package/web/dist/assets/{task-thread-g1vc4tKn.js → task-thread-BuXrVB9K.js} +1 -1
- package/web/dist/assets/{textarea-DCP8bOOf.js → textarea-CxRdTWlq.js} +1 -1
- package/web/dist/assets/{thread-loading-D9DbIsIS.js → thread-loading-JlP6dUpX.js} +1 -1
- package/web/dist/assets/{token-metrics-PSnNTJZF.js → token-metrics-Z3UFYbuD.js} +1 -1
- package/web/dist/assets/{utils-DNvmfH6b.js → utils-CUnaAifW.js} +1 -1
- package/web/dist/assets/{workflows-BDdUJIFT.js → workflows-vA27Yi8W.js} +3 -3
- package/web/dist/assets/{zoomable-image-yNqiuVu7.js → zoomable-image-DUE1KFJ0.js} +1 -1
- package/web/dist/index.html +13 -13
|
@@ -1,2 +1,2 @@
|
|
|
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,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./alert-dialog-
|
|
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,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./alert-dialog-CmDuefYh.js";import{i as d,n as f}from"./chunk-BO2N2NFS-DE6qKn3r.js";import{i as p,o as m,r as h,t as g}from"./highlighter-CdHqIwFr.js";function _(e,t=Date.now()){if(!e)return``;let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=Math.max(0,(t-n)/1e3);return r<60?`${Math.floor(r)}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function v(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${(Math.floor(e/1e5)/10).toFixed(1)}M`:e>=1e3?`${(Math.floor(e/100)/10).toFixed(1)}k`:String(Math.floor(e))}var y=e(t(),1),b=n();function x({isOpen:e,onClose:t,onConfirm:n,url:d}){return(0,b.jsx)(u,{open:e,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(a,{"data-slot":`link-safety-dialog`,children:[(0,b.jsxs)(l,{children:[(0,b.jsx)(i,{children:`Open this link?`}),(0,b.jsxs)(r,{children:[`It leaves cezar in a new tab. The words of a link in a transcript are the agent's — the address below is where it actually goes.`,(0,b.jsx)(`span`,{"data-slot":`link-safety-url`,className:`mt-3 block wrap-anywhere rounded-md border border-border bg-muted px-3 py-2 font-mono text-xs text-foreground`,children:d})]})]}),(0,b.jsxs)(s,{children:[(0,b.jsx)(c,{children:`Cancel`}),(0,b.jsx)(o,{onClick:n,children:`Open link`})]})]})})}var S={name:`shiki`,type:`code-highlighter`,getThemes:()=>[g,g],getSupportedLanguages:()=>m(),supportsLanguage:e=>m().includes(String(e).toLowerCase()),highlight:({code:e,language:t},n)=>p(e,String(t))||(h(e,String(t)).then(e=>n?.(e)),null)};function C(){let e=t=>{if(!t.children)return;let n=[];for(let r of t.children)if(r.type===`text`&&r.value?.includes(`
|
|
2
2
|
`)){let e=r.value.split(/\r?\n/);e.forEach((t,r)=>{r>0&&!(t===``&&r===e.length-1)&&n.push({type:`break`}),t&&n.push({type:`text`,value:t})})}else e(r),n.push(r);t.children=n};return e}var w=[...Object.values(f),C],T=[`p`,`strong`,`em`,`del`,`code`,`a`],E={p:`span`,a:`span`},D={enabled:!0,renderModal:e=>(0,b.jsx)(x,{...e})},O=(0,y.memo)(function({children:e,breaks:t=!1,inline:n=!1}){return(0,b.jsx)(d,{className:n?`thread-markdown thread-markdown-inline`:`thread-markdown`,plugins:{code:S},shikiTheme:[g,g],remarkPlugins:t?w:void 0,allowedElements:n?T:void 0,unwrapDisallowed:n||void 0,components:n?E:void 0,linkSafety:D,controls:{code:{copy:!0,download:!1},table:!1,mermaid:!1},lineNumbers:!1,children:e})});export{v as n,_ as r,O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,$r as i,B as a,Fn as o,Hn as s,Kr as c,Q as l,Qr as u,Rn as d,Xr as f,Yt as p,bt as m,d as h,da as g,dr as _,et as v,kt as y,mn as b,ni as x,nt as S,sa as C,tt as w,vt as T,xt as ee,yt as te}from"./alert-dialog-CVF_qvQ8.js";import{n as E,t as D}from"./utils-DNvmfH6b.js";import{c as ne,i as re,l as ie,r as ae,t as oe}from"./dropdown-menu-IsTcumXE.js";import{a as se,i as ce,r as le}from"./agent-accounts-4EqNShyp.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as k}from"./external-link-BE6y205O.js";import{t as ue}from"./square-terminal-B6RYYieR.js";var de=O(`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`}]]),A=O(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),fe=O(`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`}]]),pe=O(`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`}]]),me=O(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),he=O(`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`}]]),ge=O(`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`}]]),_e=O(`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`}]]),j=O(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ve=O(`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`}]]),M=O(`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`}]]),ye=O(`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`}]]),be=O(`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`}]]),xe=O(`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`}]]),Se=O(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ce=O(`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`}]]),we=O(`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`}]]),Te=O(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Ee=O(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),De=O(`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`}]]),Oe=O(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),N=e(t(),1),P=n(),ke=a(`inline-block size-[7px] shrink-0 rounded-full`,{variants:{tone:{success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,running:`bg-running`,neutral:`bg-soft-foreground`},pulse:{true:`animate-pulse motion-reduce:animate-none`,false:``}},defaultVariants:{tone:`neutral`,pulse:!1}});function F({className:e,tone:t=`neutral`,pulse:n=!1,...r}){return(0,P.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:D(ke({tone:t,pulse:n,className:e})),...r})}var Ae=[`done`,`failed`,`cancelled`],je=[`done`,`failed`];function Me(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function Ne(e){return Ae.includes(e)}function I(e){return e.archived||Me(e)||!je.includes(e.status)?!1:e.finishedAt!==void 0}function L(e){let t=e.finishedAt;return t===void 0||!I(e)?!1:e.seenAt===void 0||e.seenAt<t}function Pe(e){return!Me(e)&&Ne(e.status)&&!L(e)}function Fe(e){return e.reduce((e,t)=>L(t)?e+1:e,0)}var R=(0,N.createContext)(null);function Ie({children:e}){let[t,n]=(0,N.useState)(()=>new Map),r=(0,N.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,N.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=s((0,N.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,N.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,P.jsx)(R.Provider,{value:o,children:e})}var z=(0,N.createContext)(null);function Le({projectId:e,requests:t,children:n}){let r=(0,N.useContext)(R),i=(0,N.useId)();(0,N.useEffect)(()=>{if(r)return r.publish(i,t),()=>r.retract(i)},[r,i,t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let a=s(r?Re:t),o=r?.lookup??a,c=(0,N.useMemo)(()=>({lookup:o,projectId:e}),[o,e]);return(0,P.jsx)(z.Provider,{value:c,children:n})}var Re=[];function ze(e,t,n){let r=(0,N.useContext)(z),i=n??r?.projectId;return!r||!i||t===void 0?Be:r.lookup({projectId:i,kind:e,number:t})}var Be=Object.freeze({state:`idle`}),Ve={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},He={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},Ue={draft:m,"review-required":ee,"changes-requested":y,"checks-pending":null,"checks-failing":S,ready:l,merged:T,closed:te,open:r,completed:l,"not-planned":w};function B({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:a,projectId:o,className:s,compact:c=!1}){let{kind:l,number:d,url:f}=e,m=ze(l,d,o),h=n??m.status,g=i(h),_=l===`PR`&&(r??m.conflicting)===!0,v=_?u:g,y=D(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[10px] font-normal`,Ve[v?.tone??`accent`],s),b=qe(m,v,_?g:void 0),x=d?`${!c&&l===`Issue`?`Issue `:``}#${d}`:l,S=l===`PR`?`pull request`:`issue`,C=`Open the ${S} for ${t}${v?` — ${v.label}`:``}`,w=(0,P.jsxs)(P.Fragment,{children:[_?(0,P.jsx)(p,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,P.jsx)(Ye,{status:v?h:void 0}),x]}),T=!f||!E(f)?(0,P.jsx)(`span`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},"aria-label":v?`${S} ${x} — ${v.label}`:void 0,className:y,children:w}):(0,P.jsx)(`a`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:b?void 0:f,"aria-label":C,className:D(y,He[v?.tone??`accent`]),children:w});if(!b)return T;let ee=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{className:`block font-medium`,children:[l===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,b.headline]}),(0,P.jsx)(`span`,{className:`block`,children:b.detail}),b.also?(0,P.jsx)(`span`,{className:`block opacity-70`,children:b.also}):null,f&&E(f)?(0,P.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,P.jsx)(Ke,{chip:T,action:_?a:void 0,state:m.state,children:ee})}var V=(0,N.createContext)(()=>{});function We(){return(0,N.useContext)(V)}var Ge=150,H=120;function Ke({chip:e,action:t,state:n,children:r}){let[i,a]=(0,N.useState)(!1),o=(0,N.useRef)(null),s=(0,N.useRef)(null),c=(0,N.useRef)(void 0),l=(0,N.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,N.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,N.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,P.jsxs)(le,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,P.jsx)(ce,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Ge)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,H)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,P.jsxs)(se,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,H)},children:[(0,P.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,P.jsx)(V.Provider,{value:u,children:t}):null]})]})}function qe(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${Je(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function Je(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Ye({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,P.jsx)(v,{"data-slot":`status-dot`,"data-tone":`pending`,className:`size-3 animate-pulse motion-reduce:animate-none`,"aria-hidden":`true`});let t=Ue[e];return t?(0,P.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}var U={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function W(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 G(e){return e.runner??`claude`}function K(e,t){let n=g(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${U[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${U[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function Xe(e,t){return K(W(e),t)}function Ze(e,t){return K(G(e),t)}function q(e){let t=d(),n=W(e);return t.isSuccess&&t.data?Xe(e,t.data):{provider:n,usable:!0}}function Qe(e){let t=d(),n=G(e);return t.isSuccess&&t.data?Ze(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var $e={folder:j,terminal:ue,vscode:me,cursor:xe,zed:Oe,windsurf:De,sublime:_e,idea:ge,pycharm:be,webstorm:M,goland:we,rubymine:ve,phpstorm:pe,clion:he,rider:fe,"android-studio":Te,xcode:ye,warp:Ce,claude:A,codex:Ee,opencode:A,pi:A};function J(e){return e.icon&&$e[e.icon]||k}function Y(e){let t=/^cli:(claude|codex|opencode|pi|cursor)$/.exec(e);return t?t[1]:void 0}function et({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,P.jsxs)(oe,{children:[(0,P.jsx)(ie,{asChild:!0,children:(0,P.jsxs)(h,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,P.jsx)(k,{"aria-hidden":`true`}),n]})}),(0,P.jsxs)(ae,{align:`end`,children:[o,o&&e.length>0?(0,P.jsx)(ne,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=J(e);return(0,P.jsxs)(re,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,P.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}function X(e){return e===`running`||e===`queued`||e===`waiting`}function Z(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}function Q(e){return[...e.steps].reverse().find(e=>e.sessionId)?.backend??e.runner??`claude`}var tt=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function nt(e,t){if(tt.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`cursor`:return;case`opencode`:return`opencode --session ${t}`;default:return`claude --resume ${t}`}}function rt(e){if(X(e.status))return;let t=Z(e);if(t===void 0||!tt.test(t))return;let n=Q(e),r=n===`cursor`?e.cliResumeCommand:nt(n,t);if(r!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${r}`:r}function it(e,t){let n=Y(t);return!n||X(e.status)?!1:n===Q(e)&&Z(e)!==void 0}function at(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function ot(e){let t=X(e.status),n=Z(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(n||at(e)),terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:I(e)&&!L(e),cancel:t,deleteRun:!t}}function st(e,t=!1){return e.status===`waiting`&&e.finishBlocked===null&&f(e,t).bucket===`waiting`}function ct(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function lt(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function ut(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var dt=[50,100,200,400,800,1e3,1e3,1e3,1e3],ft=e=>new Promise(t=>setTimeout(t,e));function pt(e){return e instanceof x&&e.status===409&&e.message===`run is still active`}async function mt(e,t=ft){for(let n=0;;n+=1)try{return await e()}catch(e){let r=dt[n];if(!pt(e)||r===void 0)throw e;await t(r)}}function ht(e){return X(e.status)?`live`:ot(e).continueRun?`resume`:`unavailable`}function gt(e,t){let n=_(e.id,t),r=b(e.id,t),i=q(e),a=Qe(e),[o,s]=(0,N.useState)(void 0),[c,l]=(0,N.useState)(!1),u=(0,N.useRef)(!1),d=ht(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await mt(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof x&&n.status===409&&Z(e)!==void 0){try{await mt(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function $({run:e,projectId:t,prNumber:n}){let r=gt(e,t),i=We(),[a,o]=(0,N.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(ct(n));t?C(t,{tone:`danger`}):(C(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(h,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,P.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function _t({projectId:e,runId:t,prNumber:n}){let r=o(e,t);return r.data?(0,P.jsx)($,{run:r.data,projectId:e,prNumber:n}):(0,P.jsx)(h,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function vt({run:e,reference:t,className:n,compact:r=!1}){return(0,P.jsx)(B,{reference:t,taskTitle:c(e),conflictAction:(0,P.jsx)($,{run:e,prNumber:t.number}),className:n,compact:r})}function yt(e,t){let[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(``),o=(0,N.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function bt({editor:e,className:t}){return(0,P.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:D(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function xt({className:e,dot:t,pulse:n=!1,children:r,...i}){return(0,P.jsxs)(`span`,{"data-slot":`pill`,className:D(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...i,children:[t?(0,P.jsx)(F,{tone:t,pulse:n}):null,r]})}export{Se as A,Le as C,L as D,Pe as E,j as M,de as N,Fe as O,B as S,I as T,ot as _,_t as a,J as b,it as c,at as d,Q as f,rt as g,ut as h,$ as i,M as j,F as k,lt as l,st as m,bt as n,vt as o,Z as p,yt as r,gt as s,xt as t,X as u,et as v,Ie as w,q as x,Y as y};
|
|
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,$r as i,B as a,Fn as o,Hn as s,Kr as c,Q as l,Qr as u,Rn as d,Xr as f,Yt as p,bt as m,d as h,da as g,dr as _,et as v,kt as y,mn as b,ni as x,nt as S,sa as C,tt as w,vt as T,xt as ee,yt as te}from"./alert-dialog-CmDuefYh.js";import{n as E,t as D}from"./utils-CUnaAifW.js";import{c as ne,i as re,l as ie,r as ae,t as oe}from"./dropdown-menu-sZjYPcLh.js";import{a as se,i as ce,r as le}from"./agent-accounts-lP_xK83o.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as k}from"./external-link-BE6y205O.js";import{t as ue}from"./square-terminal-B6RYYieR.js";var de=O(`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`}]]),A=O(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),fe=O(`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`}]]),pe=O(`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`}]]),me=O(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),he=O(`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`}]]),ge=O(`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`}]]),_e=O(`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`}]]),j=O(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ve=O(`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`}]]),M=O(`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`}]]),ye=O(`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`}]]),be=O(`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`}]]),xe=O(`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`}]]),Se=O(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ce=O(`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`}]]),we=O(`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`}]]),Te=O(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Ee=O(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),De=O(`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`}]]),Oe=O(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),N=e(t(),1),P=n(),ke=a(`inline-block size-[7px] shrink-0 rounded-full`,{variants:{tone:{success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,running:`bg-running`,neutral:`bg-soft-foreground`},pulse:{true:`animate-pulse motion-reduce:animate-none`,false:``}},defaultVariants:{tone:`neutral`,pulse:!1}});function F({className:e,tone:t=`neutral`,pulse:n=!1,...r}){return(0,P.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:D(ke({tone:t,pulse:n,className:e})),...r})}var Ae=[`done`,`failed`,`cancelled`],je=[`done`,`failed`];function Me(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function Ne(e){return Ae.includes(e)}function I(e){return e.archived||Me(e)||!je.includes(e.status)?!1:e.finishedAt!==void 0}function L(e){let t=e.finishedAt;return t===void 0||!I(e)?!1:e.seenAt===void 0||e.seenAt<t}function Pe(e){return!Me(e)&&Ne(e.status)&&!L(e)}function Fe(e){return e.reduce((e,t)=>L(t)?e+1:e,0)}var R=(0,N.createContext)(null);function Ie({children:e}){let[t,n]=(0,N.useState)(()=>new Map),r=(0,N.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,N.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=s((0,N.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,N.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,P.jsx)(R.Provider,{value:o,children:e})}var z=(0,N.createContext)(null);function Le({projectId:e,requests:t,children:n}){let r=(0,N.useContext)(R),i=(0,N.useId)();(0,N.useEffect)(()=>{if(r)return r.publish(i,t),()=>r.retract(i)},[r,i,t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let a=s(r?Re:t),o=r?.lookup??a,c=(0,N.useMemo)(()=>({lookup:o,projectId:e}),[o,e]);return(0,P.jsx)(z.Provider,{value:c,children:n})}var Re=[];function ze(e,t,n){let r=(0,N.useContext)(z),i=n??r?.projectId;return!r||!i||t===void 0?Be:r.lookup({projectId:i,kind:e,number:t})}var Be=Object.freeze({state:`idle`}),Ve={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},He={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},Ue={draft:m,"review-required":ee,"changes-requested":y,"checks-pending":null,"checks-failing":S,ready:l,merged:T,closed:te,open:r,completed:l,"not-planned":w};function B({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:a,projectId:o,className:s,compact:c=!1}){let{kind:l,number:d,url:f}=e,m=ze(l,d,o),h=n??m.status,g=i(h),_=l===`PR`&&(r??m.conflicting)===!0,v=_?u:g,y=D(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[10px] font-normal`,Ve[v?.tone??`accent`],s),b=qe(m,v,_?g:void 0),x=d?`${!c&&l===`Issue`?`Issue `:``}#${d}`:l,S=l===`PR`?`pull request`:`issue`,C=`Open the ${S} for ${t}${v?` — ${v.label}`:``}`,w=(0,P.jsxs)(P.Fragment,{children:[_?(0,P.jsx)(p,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,P.jsx)(Ye,{status:v?h:void 0}),x]}),T=!f||!E(f)?(0,P.jsx)(`span`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},"aria-label":v?`${S} ${x} — ${v.label}`:void 0,className:y,children:w}):(0,P.jsx)(`a`,{"data-slot":l===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:b?void 0:f,"aria-label":C,className:D(y,He[v?.tone??`accent`]),children:w});if(!b)return T;let ee=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{className:`block font-medium`,children:[l===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,b.headline]}),(0,P.jsx)(`span`,{className:`block`,children:b.detail}),b.also?(0,P.jsx)(`span`,{className:`block opacity-70`,children:b.also}):null,f&&E(f)?(0,P.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,P.jsx)(Ke,{chip:T,action:_?a:void 0,state:m.state,children:ee})}var V=(0,N.createContext)(()=>{});function We(){return(0,N.useContext)(V)}var Ge=150,H=120;function Ke({chip:e,action:t,state:n,children:r}){let[i,a]=(0,N.useState)(!1),o=(0,N.useRef)(null),s=(0,N.useRef)(null),c=(0,N.useRef)(void 0),l=(0,N.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,N.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,N.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,P.jsxs)(le,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,P.jsx)(ce,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Ge)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,H)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,P.jsxs)(se,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,H)},children:[(0,P.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,P.jsx)(V.Provider,{value:u,children:t}):null]})]})}function qe(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${Je(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function Je(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Ye({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,P.jsx)(v,{"data-slot":`status-dot`,"data-tone":`pending`,className:`size-3 animate-pulse motion-reduce:animate-none`,"aria-hidden":`true`});let t=Ue[e];return t?(0,P.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}var U={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function W(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 G(e){return e.runner??`claude`}function K(e,t){let n=g(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${U[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${U[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function Xe(e,t){return K(W(e),t)}function Ze(e,t){return K(G(e),t)}function q(e){let t=d(),n=W(e);return t.isSuccess&&t.data?Xe(e,t.data):{provider:n,usable:!0}}function Qe(e){let t=d(),n=G(e);return t.isSuccess&&t.data?Ze(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var $e={folder:j,terminal:ue,vscode:me,cursor:xe,zed:Oe,windsurf:De,sublime:_e,idea:ge,pycharm:be,webstorm:M,goland:we,rubymine:ve,phpstorm:pe,clion:he,rider:fe,"android-studio":Te,xcode:ye,warp:Ce,claude:A,codex:Ee,opencode:A,pi:A};function J(e){return e.icon&&$e[e.icon]||k}function Y(e){let t=/^cli:(claude|codex|opencode|pi|cursor)$/.exec(e);return t?t[1]:void 0}function et({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,P.jsxs)(oe,{children:[(0,P.jsx)(ie,{asChild:!0,children:(0,P.jsxs)(h,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,P.jsx)(k,{"aria-hidden":`true`}),n]})}),(0,P.jsxs)(ae,{align:`end`,children:[o,o&&e.length>0?(0,P.jsx)(ne,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=J(e);return(0,P.jsxs)(re,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,P.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}function X(e){return e===`running`||e===`queued`||e===`waiting`}function Z(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}function Q(e){return[...e.steps].reverse().find(e=>e.sessionId)?.backend??e.runner??`claude`}var tt=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function nt(e,t){if(tt.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`cursor`:return;case`opencode`:return`opencode --session ${t}`;default:return`claude --resume ${t}`}}function rt(e){if(X(e.status))return;let t=Z(e);if(t===void 0||!tt.test(t))return;let n=Q(e),r=n===`cursor`?e.cliResumeCommand:nt(n,t);if(r!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${r}`:r}function it(e,t){let n=Y(t);return!n||X(e.status)?!1:n===Q(e)&&Z(e)!==void 0}function at(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function ot(e){let t=X(e.status),n=Z(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(n||at(e)),terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:I(e)&&!L(e),cancel:t,deleteRun:!t}}function st(e,t=!1){return e.status===`waiting`&&e.finishBlocked===null&&f(e,t).bucket===`waiting`}function ct(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function lt(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function ut(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var dt=[50,100,200,400,800,1e3,1e3,1e3,1e3],ft=e=>new Promise(t=>setTimeout(t,e));function pt(e){return e instanceof x&&e.status===409&&e.message===`run is still active`}async function mt(e,t=ft){for(let n=0;;n+=1)try{return await e()}catch(e){let r=dt[n];if(!pt(e)||r===void 0)throw e;await t(r)}}function ht(e){return X(e.status)?`live`:ot(e).continueRun?`resume`:`unavailable`}function gt(e,t){let n=_(e.id,t),r=b(e.id,t),i=q(e),a=Qe(e),[o,s]=(0,N.useState)(void 0),[c,l]=(0,N.useState)(!1),u=(0,N.useRef)(!1),d=ht(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await mt(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof x&&n.status===409&&Z(e)!==void 0){try{await mt(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function $({run:e,projectId:t,prNumber:n}){let r=gt(e,t),i=We(),[a,o]=(0,N.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(ct(n));t?C(t,{tone:`danger`}):(C(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(h,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,P.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function _t({projectId:e,runId:t,prNumber:n}){let r=o(e,t);return r.data?(0,P.jsx)($,{run:r.data,projectId:e,prNumber:n}):(0,P.jsx)(h,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function vt({run:e,reference:t,className:n,compact:r=!1}){return(0,P.jsx)(B,{reference:t,taskTitle:c(e),conflictAction:(0,P.jsx)($,{run:e,prNumber:t.number}),className:n,compact:r})}function yt(e,t){let[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(``),o=(0,N.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function bt({editor:e,className:t}){return(0,P.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:D(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function xt({className:e,dot:t,pulse:n=!1,children:r,...i}){return(0,P.jsxs)(`span`,{"data-slot":`pill`,className:D(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...i,children:[t?(0,P.jsx)(F,{tone:t,pulse:n}):null,r]})}export{Se as A,Le as C,L as D,Pe as E,j as M,de as N,Fe as O,B as S,I as T,ot as _,_t as a,J as b,it as c,at as d,Q as f,rt as g,ut as h,$ as i,M as j,F as k,lt as l,st as m,bt as n,vt as o,Z as p,yt as r,gt as s,xt as t,X as u,et as v,Ie as w,q as x,Y as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Sa as r,ba as i,ga as a,ha as o,ma as s,ti as c,xa as l}from"./alert-dialog-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Sa as r,ba as i,ga as a,ha as o,ma as s,ti as c,xa as l}from"./alert-dialog-CmDuefYh.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";var d=u(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),f=e(t(),1),p=n(),m=/^\/p\/([^/]+)(?=\/|$)/;function h(e){let t=m.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function g(e){let t=m.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function _(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function v(e,t){return e===null?t:typeof t==`string`?_(e,t):t.pathname===void 0?t:{...t,pathname:_(e,t.pathname)}}function y(){let{projectId:e}=c(),{pathname:t}=l();return e??h(t)}function b(){let e=y();return(0,f.useCallback)(t=>v(e,t),[e])}function x(e){let{pathname:t}=l();return(0,f.useMemo)(()=>i(e,g(t)),[e,t])}function S({to:e,...t}){let n=b();return(0,p.jsx)(s,{...t,to:n(e)})}function C({to:e,...t}){let n=b();return(0,p.jsx)(o,{...t,to:n(e)})}function w({to:e,...t}){let n=b();return(0,p.jsx)(a,{...t,to:n(e)})}function T(){let e=r(),t=b();return(0,f.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{v as a,T as c,h as i,x as l,C as n,g as o,w as r,y as s,S as t,d as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,N as i,R as a,Rt as o,X as s,_ as c,f as l,g as u,m as d}from"./alert-dialog-CVF_qvQ8.js";import{p as f,t as p}from"./utils-DNvmfH6b.js";import{i as m,l as h,o as g,r as _,s as v,t as y}from"./dropdown-menu-IsTcumXE.js";import{i as b,n as x,o as S,r as C,s as w}from"./textarea-DCP8bOOf.js";import{t as T}from"./createLucideIcon-BHp8sXmF.js";var E=T(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),D=T(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),O=e(t(),1),k=1,A=.9,j=.8,ee=.17,M=.1,N=.999,P=.9999,F=.99,I=/[\\\/_+.#"@\[\(\{&]/,L=/[\\\/_+.#"@\[\(\{&]/g,R=/[\s-]/,z=/[\s-]/g;function te(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?k:F;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=te(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=k:I.test(e.charAt(l-1))?(d*=j,p=e.slice(i,l-1).match(L),p&&i>0&&(d*=N**+p.length)):R.test(e.charAt(l-1))?(d*=A,m=e.slice(i,l-1).match(z),m&&i>0&&(d*=N**+m.length)):(d*=ee,i>0&&(d*=N**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=P)),(d<M&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=te(e,t,n,r,l+1,a+2,o),f*M>d&&(d=f*M)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ne(e){return e.toLowerCase().replace(z,` `)}function re(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,te(e,t,ne(e),ne(t),0,0,{})}var B=`[cmdk-group=""]`,ie=`[cmdk-group-items=""]`,ae=`[cmdk-group-heading=""]`,oe=`[cmdk-item=""]`,se=`${oe}:not([aria-disabled="true"])`,V=`cmdk-item-select`,H=`data-value`,ce=(e,t,n)=>re(e,t,n),le=O.createContext(void 0),U=()=>O.useContext(le),ue=O.createContext(void 0),W=()=>O.useContext(ue),de=O.createContext(void 0),fe=O.forwardRef((e,t)=>{let n=q(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),a=q(()=>new Set),o=q(()=>new Map),s=q(()=>new Map),c=q(()=>new Set),l=Ce(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=r(),x=r(),S=r(),C=O.useRef(null),w=Te();K(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,T.emit()}},[f]),K(()=>{w(6,ee)},[]);let T=O.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)j(),k(),w(1,A);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,ee),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),E=O.useMemo(()=>({value:(e,t,r)=>{t!==s.current.get(e)?.value&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{k(),T.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),w(3,()=>{j(),k(),n.current.value||A(),T.emit()}),()=>{s.current.delete(e),a.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{j(),t?.getAttribute(`id`)===e&&A(),T.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{s.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=l.current?.filter??ce;return e?r(e,n.current.search,t):0}function k(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=o.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ie);t?t.appendChild(e.parentElement===t?e:e.closest(`${ie} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ie} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${B}[${H}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function A(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(H);T.setState(`value`,e||void 0)}function j(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of a.current){let r=D(s.current.get(t)?.value??``,s.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of o.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ee(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(B)?.querySelector(ae))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${oe}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(se)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(H))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(H))}function I(e){let t=M()?.closest(B),n;for(;t&&!n;)t=e>0?xe(t,B):Se(t,B),n=t?.querySelector(se);n?T.setState(`value`,n.getAttribute(H)):F(e)}let L=()=>P(N().length-1),R=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return O.createElement(i.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&R(e);break;case`ArrowDown`:R(e);break;case`p`:case`k`:v&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(V);t.dispatchEvent(e)}}}}},O.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:De},u),Y(e,e=>O.createElement(ue.Provider,{value:T},O.createElement(le.Provider,{value:E},e))))}),pe=O.forwardRef((e,t)=>{let n=r(),o=O.useRef(null),s=O.useContext(de),c=U(),l=Ce(e),u=l.current?.forceMount??s?.forceMount;K(()=>{if(!u)return c.item(n,s?.id)},[u]);let d=we(n,o,[e.value,e.children,o],e.keywords),f=W(),p=J(e=>e.value&&e.value===d.current),m=J(e=>u||c.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);O.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(V,h),()=>t.removeEventListener(V,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return O.createElement(i.div,{ref:a(o,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),me=O.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:s,...c}=e,l=r(),u=O.useRef(null),d=O.useRef(null),f=r(),p=U(),m=J(e=>s||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));K(()=>p.group(l),[]),we(l,u,[e.value,e.heading,d]);let h=O.useMemo(()=>({id:l,forceMount:s}),[s]);return O.createElement(i.div,{ref:a(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&O.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Y(e,e=>O.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},O.createElement(de.Provider,{value:h},e))))}),he=O.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=O.useRef(null),s=J(e=>!e.search);return!n&&!s?null:O.createElement(i.div,{ref:a(o,t),...r,"cmdk-separator":``,role:`separator`})}),ge=O.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=W(),s=J(e=>e.search),c=J(e=>e.selectedItemId),l=U();return O.useEffect(()=>{e.value!=null&&o.setState(`search`,e.value)},[e.value]),O.createElement(i.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:a?e.value:s,onChange:e=>{a||o.setState(`search`,e.target.value),n?.(e.target.value)}})}),_e=O.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...o}=e,s=O.useRef(null),c=O.useRef(null),l=J(e=>e.selectedItemId),u=U();return O.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),O.createElement(i.div,{ref:a(s,t),...o,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},Y(e,e=>O.createElement(`div`,{ref:a(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),ve=O.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return O.createElement(l,{open:n,onOpenChange:r},O.createElement(c,{container:o},O.createElement(u,{"cmdk-overlay":``,className:i}),O.createElement(d,{"aria-label":e.label,"cmdk-dialog":``,className:a},O.createElement(fe,{ref:t,...s}))))}),ye=O.forwardRef((e,t)=>J(e=>e.filtered.count===0)?O.createElement(i.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),be=O.forwardRef((e,t)=>{let{progress:n,children:r,label:a=`Loading...`,...o}=e;return O.createElement(i.div,{ref:t,...o,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Y(e,e=>O.createElement(`div`,{"aria-hidden":!0},e)))}),G=Object.assign(fe,{List:_e,Item:pe,Input:ge,Group:me,Separator:he,Dialog:ve,Empty:ye,Loading:be});function xe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Se(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Ce(e){let t=O.useRef(e);return K(()=>{t.current=e}),t}var K=typeof window>`u`?O.useEffect:O.useLayoutEffect;function q(e){let t=O.useRef();return t.current===void 0&&(t.current=e()),t}function J(e){let t=W(),n=()=>e(t.snapshot());return O.useSyncExternalStore(t.subscribe,n,n)}function we(e,t,n,r=[]){let i=O.useRef(),a=U();return K(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(H,s),i.current=s}),i}var Te=()=>{let[e,t]=O.useState(),n=q(()=>new Map);return K(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ee(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Y({asChild:e,children:t},n){return e&&O.isValidElement(t)?O.cloneElement(Ee(t),{ref:t.ref},n(t.props.children)):n(t)}var De={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},X=n();function Oe({className:e,...t}){return(0,X.jsx)(G,{"data-slot":`command`,className:p(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function ke({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,filter:a,...o}){return(0,X.jsxs)(x,{...o,children:[(0,X.jsxs)(S,{className:`sr-only`,children:[(0,X.jsx)(w,{children:e}),(0,X.jsx)(b,{children:t})]}),(0,X.jsx)(C,{className:p(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,X.jsx)(Oe,{filter:a,className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Ae({className:e,...t}){return(0,X.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 shrink-0 items-center gap-2 border-b px-3 max-md:h-[44px]`,children:[(0,X.jsx)(o,{className:`size-4 shrink-0 opacity-50`}),(0,X.jsx)(G.Input,{"data-slot":`command-input`,className:p(`flex h-10 w-full rounded-md bg-transparent py-3 text-base md:text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function je({className:e,onPointerMoveCapture:t,...n}){return(0,X.jsx)(G.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:p(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function Me({...e}){return(0,X.jsx)(G.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Ne({className:e,...t}){return(0,X.jsx)(G.Group,{"data-slot":`command-group`,className:p(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Pe({className:e,...t}){return(0,X.jsx)(G.Separator,{"data-slot":`command-separator`,className:p(`-mx-1 h-px bg-border`,e),...t})}function Fe({className:e,...t}){return(0,X.jsx)(G.Item,{"data-slot":`command-item`,className:p(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ie({className:e,...t}){return(0,X.jsx)(`span`,{"data-slot":`command-shortcut`,className:p(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Le=`quick-task`;function Re(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var ze=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`cursor`,label:`Cursor`,desc:`Cursor CLI (ACP)`}],Z={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}]},Q=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function Be(e,t,n){let r=e===`cursor`?[Q[0]]:Q,i=f(e)&&(e!==`cursor`||n?.runner===e)?n?.models.find(e=>e.id===t)?.effortLevels:void 0;if(!i?.length)return r;let a=[Q[0]],o=new Set;for(let e of i){if(o.has(e))continue;let t=Q.find(t=>t.value===e);t&&(o.add(e),a.push(t))}return a.length>1?a:r}function Ve(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}var He=[`opencode`,`pi`];function Ue(e,t){return t===`cursor`||!e||Z[t].some(t=>t.id===e)?!1:t!==`claude`&&[`claude-fable-5`,`claude-opus-4-8`,`claude-sonnet-5`,`claude-haiku-4-5`].includes(e)?!0:Object.entries(Z).some(([n,r])=>n!==t&&!He.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function We(e,t,n=[]){let r=t?.runner===e?t.models:[],i=Z[e]??Z.claude,a=[...r.length?i.slice(0,1):i],o=new Set(a.map(e=>e.id));if(f(e))for(let e of r)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||Ue(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}var Ge={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,pi:`Pi`,cursor:`Cursor`};function Ke(e,t,n=!1,r=!1){if(!f(e))return;let i=Ge[e];if(t?.stale)return`Using cached ${i} model list`;if(n||t?.source===`unavailable`)return`Latest ${i} models unavailable`;if(r&&!t)return`Loading ${i} models…`}function qe(e){let t=ze.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Je(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Ye(e,t,n=!1){return!n&&e===t?void 0:e}function Xe(e,t,n,r){let i=We(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function Ze(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function Qe(e,t,n){return e&&Ze(e,t,n)?e:null}function $e(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,variants:u,images:d,worktree:f,autonomous:p,generateFollowups:m,todoId:h}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:Ye(o,c,s),agentProfile:l||void 0,variants:u>1?u:void 0,images:d.length>0?[...d]:void 0,worktree:f===!1&&u<=1?!1:void 0,autonomous:p===!0||void 0,generateFollowups:m!==!1&&void 0,todoId:h||void 0}}function et(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var tt=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,nt=(0,X.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`});function rt({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:c=!1,hint:l,disabledHint:u,status:d,icon:f,fieldLabel:b=!1}){let x=f?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,S=(0,X.jsxs)(X.Fragment,{children:[f,(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,title:typeof n==`string`?n:void 0,children:[b?(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[t,` · `]}):null,n]})]});if(c)return(0,X.jsx)(`span`,{"data-slot":e,"aria-label":t,title:u??l,className:p(tt,x,`cursor-default hover:bg-card hover:text-muted-foreground`),children:S});let C=(0,X.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?u:l,className:p(tt,x),children:[S,f?(0,X.jsx)(s,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):nt]});return o?(0,X.jsx)(`span`,{title:u,className:`inline-flex`,children:C}):(0,X.jsxs)(y,{children:[(0,X.jsx)(h,{asChild:!0,children:C}),(0,X.jsxs)(_,{align:`start`,"data-testid":`${e}-menu`,children:[(0,X.jsx)(g,{value:r,onValueChange:a,children:i.map(e=>(0,X.jsx)(v,{value:e.value,className:`gap-2.5`,children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,X.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),d?(0,X.jsx)(m,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:d}):null]})]})}var $=(e,t)=>t===null?e:`${e}:${t}`;function it({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=ze.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:$(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:$(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===$(t,u))?$(t,u):$(t,null);return(0,X.jsx)(rt,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}var at=80,ot=2e3,st=50,ct=200,lt=50,ut=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function dt(e){return!!e&&typeof e==`object`}function ft(e){if(e===void 0||!Array.isArray(e))return ut.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!dt(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=pt(r.skills);if(n.push({id:e,label:i.slice(0,at),text:a.slice(0,ot),...o.length>0?{skills:o}:{}}),n.length>=st)break}return n}function pt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,ct)),t.size>=lt))break}return[...t]}function mt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function ht(e,t){return mt(e,t).map(e=>e.text).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,N as i,R as a,Rt as o,X as s,_ as c,f as l,g as u,m as d}from"./alert-dialog-CmDuefYh.js";import{p as f,t as p}from"./utils-CUnaAifW.js";import{i as m,l as h,o as g,r as _,s as v,t as y}from"./dropdown-menu-sZjYPcLh.js";import{i as b,n as x,o as S,r as C,s as w}from"./textarea-CxRdTWlq.js";import{t as T}from"./createLucideIcon-BHp8sXmF.js";var E=T(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),D=T(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),O=e(t(),1),k=1,A=.9,j=.8,ee=.17,M=.1,N=.999,P=.9999,F=.99,I=/[\\\/_+.#"@\[\(\{&]/,L=/[\\\/_+.#"@\[\(\{&]/g,R=/[\s-]/,z=/[\s-]/g;function te(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?k:F;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=te(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=k:I.test(e.charAt(l-1))?(d*=j,p=e.slice(i,l-1).match(L),p&&i>0&&(d*=N**+p.length)):R.test(e.charAt(l-1))?(d*=A,m=e.slice(i,l-1).match(z),m&&i>0&&(d*=N**+m.length)):(d*=ee,i>0&&(d*=N**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=P)),(d<M&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=te(e,t,n,r,l+1,a+2,o),f*M>d&&(d=f*M)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ne(e){return e.toLowerCase().replace(z,` `)}function re(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,te(e,t,ne(e),ne(t),0,0,{})}var B=`[cmdk-group=""]`,ie=`[cmdk-group-items=""]`,ae=`[cmdk-group-heading=""]`,oe=`[cmdk-item=""]`,se=`${oe}:not([aria-disabled="true"])`,V=`cmdk-item-select`,H=`data-value`,ce=(e,t,n)=>re(e,t,n),le=O.createContext(void 0),U=()=>O.useContext(le),ue=O.createContext(void 0),W=()=>O.useContext(ue),de=O.createContext(void 0),fe=O.forwardRef((e,t)=>{let n=q(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),a=q(()=>new Set),o=q(()=>new Map),s=q(()=>new Map),c=q(()=>new Set),l=Ce(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=r(),x=r(),S=r(),C=O.useRef(null),w=Te();K(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,T.emit()}},[f]),K(()=>{w(6,ee)},[]);let T=O.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)j(),k(),w(1,A);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,ee),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),E=O.useMemo(()=>({value:(e,t,r)=>{t!==s.current.get(e)?.value&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{k(),T.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),w(3,()=>{j(),k(),n.current.value||A(),T.emit()}),()=>{s.current.delete(e),a.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{j(),t?.getAttribute(`id`)===e&&A(),T.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{s.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=l.current?.filter??ce;return e?r(e,n.current.search,t):0}function k(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=o.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ie);t?t.appendChild(e.parentElement===t?e:e.closest(`${ie} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ie} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${B}[${H}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function A(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(H);T.setState(`value`,e||void 0)}function j(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of a.current){let r=D(s.current.get(t)?.value??``,s.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of o.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ee(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(B)?.querySelector(ae))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${oe}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(se)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(H))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(H))}function I(e){let t=M()?.closest(B),n;for(;t&&!n;)t=e>0?xe(t,B):Se(t,B),n=t?.querySelector(se);n?T.setState(`value`,n.getAttribute(H)):F(e)}let L=()=>P(N().length-1),R=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return O.createElement(i.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&R(e);break;case`ArrowDown`:R(e);break;case`p`:case`k`:v&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(V);t.dispatchEvent(e)}}}}},O.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:De},u),Y(e,e=>O.createElement(ue.Provider,{value:T},O.createElement(le.Provider,{value:E},e))))}),pe=O.forwardRef((e,t)=>{let n=r(),o=O.useRef(null),s=O.useContext(de),c=U(),l=Ce(e),u=l.current?.forceMount??s?.forceMount;K(()=>{if(!u)return c.item(n,s?.id)},[u]);let d=we(n,o,[e.value,e.children,o],e.keywords),f=W(),p=J(e=>e.value&&e.value===d.current),m=J(e=>u||c.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);O.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(V,h),()=>t.removeEventListener(V,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return O.createElement(i.div,{ref:a(o,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),me=O.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:s,...c}=e,l=r(),u=O.useRef(null),d=O.useRef(null),f=r(),p=U(),m=J(e=>s||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));K(()=>p.group(l),[]),we(l,u,[e.value,e.heading,d]);let h=O.useMemo(()=>({id:l,forceMount:s}),[s]);return O.createElement(i.div,{ref:a(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&O.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Y(e,e=>O.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},O.createElement(de.Provider,{value:h},e))))}),he=O.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=O.useRef(null),s=J(e=>!e.search);return!n&&!s?null:O.createElement(i.div,{ref:a(o,t),...r,"cmdk-separator":``,role:`separator`})}),ge=O.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=W(),s=J(e=>e.search),c=J(e=>e.selectedItemId),l=U();return O.useEffect(()=>{e.value!=null&&o.setState(`search`,e.value)},[e.value]),O.createElement(i.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:a?e.value:s,onChange:e=>{a||o.setState(`search`,e.target.value),n?.(e.target.value)}})}),_e=O.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...o}=e,s=O.useRef(null),c=O.useRef(null),l=J(e=>e.selectedItemId),u=U();return O.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),O.createElement(i.div,{ref:a(s,t),...o,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},Y(e,e=>O.createElement(`div`,{ref:a(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),ve=O.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return O.createElement(l,{open:n,onOpenChange:r},O.createElement(c,{container:o},O.createElement(u,{"cmdk-overlay":``,className:i}),O.createElement(d,{"aria-label":e.label,"cmdk-dialog":``,className:a},O.createElement(fe,{ref:t,...s}))))}),ye=O.forwardRef((e,t)=>J(e=>e.filtered.count===0)?O.createElement(i.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),be=O.forwardRef((e,t)=>{let{progress:n,children:r,label:a=`Loading...`,...o}=e;return O.createElement(i.div,{ref:t,...o,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Y(e,e=>O.createElement(`div`,{"aria-hidden":!0},e)))}),G=Object.assign(fe,{List:_e,Item:pe,Input:ge,Group:me,Separator:he,Dialog:ve,Empty:ye,Loading:be});function xe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Se(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Ce(e){let t=O.useRef(e);return K(()=>{t.current=e}),t}var K=typeof window>`u`?O.useEffect:O.useLayoutEffect;function q(e){let t=O.useRef();return t.current===void 0&&(t.current=e()),t}function J(e){let t=W(),n=()=>e(t.snapshot());return O.useSyncExternalStore(t.subscribe,n,n)}function we(e,t,n,r=[]){let i=O.useRef(),a=U();return K(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(H,s),i.current=s}),i}var Te=()=>{let[e,t]=O.useState(),n=q(()=>new Map);return K(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ee(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Y({asChild:e,children:t},n){return e&&O.isValidElement(t)?O.cloneElement(Ee(t),{ref:t.ref},n(t.props.children)):n(t)}var De={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},X=n();function Oe({className:e,...t}){return(0,X.jsx)(G,{"data-slot":`command`,className:p(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function ke({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,filter:a,...o}){return(0,X.jsxs)(x,{...o,children:[(0,X.jsxs)(S,{className:`sr-only`,children:[(0,X.jsx)(w,{children:e}),(0,X.jsx)(b,{children:t})]}),(0,X.jsx)(C,{className:p(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,X.jsx)(Oe,{filter:a,className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Ae({className:e,...t}){return(0,X.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 shrink-0 items-center gap-2 border-b px-3 max-md:h-[44px]`,children:[(0,X.jsx)(o,{className:`size-4 shrink-0 opacity-50`}),(0,X.jsx)(G.Input,{"data-slot":`command-input`,className:p(`flex h-10 w-full rounded-md bg-transparent py-3 text-base md:text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function je({className:e,onPointerMoveCapture:t,...n}){return(0,X.jsx)(G.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:p(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function Me({...e}){return(0,X.jsx)(G.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Ne({className:e,...t}){return(0,X.jsx)(G.Group,{"data-slot":`command-group`,className:p(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Pe({className:e,...t}){return(0,X.jsx)(G.Separator,{"data-slot":`command-separator`,className:p(`-mx-1 h-px bg-border`,e),...t})}function Fe({className:e,...t}){return(0,X.jsx)(G.Item,{"data-slot":`command-item`,className:p(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ie({className:e,...t}){return(0,X.jsx)(`span`,{"data-slot":`command-shortcut`,className:p(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Le=`quick-task`;function Re(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var ze=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`cursor`,label:`Cursor`,desc:`Cursor CLI (ACP)`}],Z={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}]},Q=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function Be(e,t,n){let r=e===`cursor`?[Q[0]]:Q,i=f(e)&&(e!==`cursor`||n?.runner===e)?n?.models.find(e=>e.id===t)?.effortLevels:void 0;if(!i?.length)return r;let a=[Q[0]],o=new Set;for(let e of i){if(o.has(e))continue;let t=Q.find(t=>t.value===e);t&&(o.add(e),a.push(t))}return a.length>1?a:r}function Ve(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}var He=[`opencode`,`pi`];function Ue(e,t){return t===`cursor`||!e||Z[t].some(t=>t.id===e)?!1:t!==`claude`&&[`claude-fable-5`,`claude-opus-4-8`,`claude-sonnet-5`,`claude-haiku-4-5`].includes(e)?!0:Object.entries(Z).some(([n,r])=>n!==t&&!He.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function We(e,t,n=[]){let r=t?.runner===e?t.models:[],i=Z[e]??Z.claude,a=[...r.length?i.slice(0,1):i],o=new Set(a.map(e=>e.id));if(f(e))for(let e of r)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||Ue(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}var Ge={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,pi:`Pi`,cursor:`Cursor`};function Ke(e,t,n=!1,r=!1){if(!f(e))return;let i=Ge[e];if(t?.stale)return`Using cached ${i} model list`;if(n||t?.source===`unavailable`)return`Latest ${i} models unavailable`;if(r&&!t)return`Loading ${i} models…`}function qe(e){let t=ze.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Je(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Ye(e,t,n=!1){return!n&&e===t?void 0:e}function Xe(e,t,n,r){let i=We(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function Ze(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function Qe(e,t,n){return e&&Ze(e,t,n)?e:null}function $e(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,variants:u,images:d,worktree:f,autonomous:p,generateFollowups:m,todoId:h}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:Ye(o,c,s),agentProfile:l||void 0,variants:u>1?u:void 0,images:d.length>0?[...d]:void 0,worktree:f===!1&&u<=1?!1:void 0,autonomous:p===!0||void 0,generateFollowups:m!==!1&&void 0,todoId:h||void 0}}function et(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var tt=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,nt=(0,X.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`});function rt({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:c=!1,hint:l,disabledHint:u,status:d,icon:f,fieldLabel:b=!1}){let x=f?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,S=(0,X.jsxs)(X.Fragment,{children:[f,(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,title:typeof n==`string`?n:void 0,children:[b?(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[t,` · `]}):null,n]})]});if(c)return(0,X.jsx)(`span`,{"data-slot":e,"aria-label":t,title:u??l,className:p(tt,x,`cursor-default hover:bg-card hover:text-muted-foreground`),children:S});let C=(0,X.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?u:l,className:p(tt,x),children:[S,f?(0,X.jsx)(s,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):nt]});return o?(0,X.jsx)(`span`,{title:u,className:`inline-flex`,children:C}):(0,X.jsxs)(y,{children:[(0,X.jsx)(h,{asChild:!0,children:C}),(0,X.jsxs)(_,{align:`start`,"data-testid":`${e}-menu`,children:[(0,X.jsx)(g,{value:r,onValueChange:a,children:i.map(e=>(0,X.jsx)(v,{value:e.value,className:`gap-2.5`,children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,X.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),d?(0,X.jsx)(m,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:d}):null]})]})}var $=(e,t)=>t===null?e:`${e}:${t}`;function it({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=ze.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:$(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:$(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===$(t,u))?$(t,u):$(t,null);return(0,X.jsx)(rt,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}var at=80,ot=2e3,st=50,ct=200,lt=50,ut=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function dt(e){return!!e&&typeof e==`object`}function ft(e){if(e===void 0||!Array.isArray(e))return ut.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!dt(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=pt(r.skills);if(n.push({id:e,label:i.slice(0,at),text:a.slice(0,ot),...o.length>0?{skills:o}:{}}),n.length>=st)break}return n}function pt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,ct)),t.size>=lt))break}return[...t]}function mt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function ht(e,t){return mt(e,t).map(e=>e.text).join(`
|
|
2
2
|
|
|
3
3
|
`)}function gt(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function _t(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function vt(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Ai as i,Ca as a,Ea as o,It as s,Jn as c,Ki as l,Rt as u,Ta as d,U as f,Wi as p,Xn as m,Yn as h,Yt as g,_t as _,a as ee,c as v,d as y,gt as b,hi as x,i as te,in as S,l as C,lt as w,n as T,ni as E,o as D,r as O,s as k,sa as A,t as ne,vn as j,wn as M,xt as N}from"./alert-dialog-CVF_qvQ8.js";import{n as P,t as F}from"./utils-DNvmfH6b.js";import{t as I}from"./createLucideIcon-BHp8sXmF.js";import{n as L}from"./diff-controls-CuqRa-63.js";import{i as R,r as z,t as B}from"./git-toolbar-BjMzETip.js";import{t as V,u as H}from"./project-router-CX1jLqj-.js";import{t as U}from"./search-x-I9Q8pgUa.js";import{t as W}from"./diff-stat-BXriPIds.js";import{a as G,h as K}from"./index-Cz3N9b18.js";import{t as q}from"./diff-DWmKlqw52.js";import{t as J}from"./tab-link-DhREnUYE.js";import{t as Y}from"./use-desktop-BaYgO7YW.js";import{t as X}from"./commit-list-BuNsBn8P.js";var re=I(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Z=e(t(),1),Q=n();function ie({repo:e,info:t}){let n=M(),i=r(),a=e=>A(e.message,{tone:`danger`}),o=d({mutationFn:e=>x({name:e}),onSuccess:async e=>{A(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([i.invalidateQueries({queryKey:S.repo}),i.invalidateQueries({queryKey:S.health})]),i.setQueryData(S.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),i.setQueryData(S.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:a}),c=d({mutationFn:e=>l({baseBranch:e}),onSuccess:e=>{A(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),i.invalidateQueries({queryKey:S.repo})},onError:a}),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),g=m.trim().toLowerCase(),_=g?e.branches.filter(e=>e.toLowerCase().includes(g)):e.branches;return(0,Q.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(u,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:m,onChange:e=>h(e.target.value),className:`h-11 pl-10`})]}),(0,Q.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[_.map(e=>{let n=e===t.branch;return(0,Q.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,Q.jsx)(`span`,{className:F(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),n?(0,Q.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[10px] font-medium text-accent-text`,children:`Current`}):(0,Q.jsxs)(y,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:o.isPending,onClick:()=>o.mutate(e),children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),_.length===0?(0,Q.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,m.trim(),`”.`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Q.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&o.mutate(t,{onSuccess:()=>p(``)})},children:[(0,Q.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Q.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,Q.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:f,onChange:e=>p(e.target.value)}),(0,Q.jsxs)(y,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!f.trim()||o.isPending,children:[(0,Q.jsx)(s,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Q.jsxs)(`div`,{className:`mt-5`,children:[(0,Q.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-sm font-medium`,children:`Agents’ base branch`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`New task worktrees branch from this.`}),(0,Q.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:c.isPending,onChange:e=>c.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block min-h-11 w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})]}),(0,Q.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,Q.jsx)(ae,{}):null]})}function ae(){let e=j({limit:20});return(0,Q.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,Q.jsx)(oe,{pr:e},e.number))}):(0,Q.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function oe({pr:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Q.jsx)(se,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Q.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:P(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:F(n,`hover:bg-muted`),children:t}):(0,Q.jsx)(`span`,{className:n,children:t})})}function se({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:F(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function ce(){let e=h(),t=Y(),[n,r]=(0,Z.useState)(`unified`),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null),l=e.isError&&e.error instanceof E&&e.error.status===409,u=e.data?.files??[],d=(0,Z.useMemo)(()=>z(u),[u]),f=t?n:`unified`,p=!t||i;return(0,Q.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,Q.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,Q.jsx)(B,{stat:e.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(L,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(C,{icon:l?(0,Q.jsx)(w,{size:16}):(0,Q.jsx)(g,{size:16}),tone:l?`neutral`:`danger`,heading:`h2`,title:l?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):u.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(w,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,Q.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Q.jsx)(R,{root:d,selected:o,onSelect:e=>{s(e),c.current?.scrollToPath(e)}})]}),(0,Q.jsx)(q,{files:u,viewRef:c,mode:f,wrap:p,className:`min-w-0 flex-1`})]})]})}function $({log:e}){let{sha:t}=a();return t?(0,Q.jsx)(le,{sha:t}):e.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(_,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,Q.jsx)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:(0,Q.jsx)(X,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})})}function le({sha:e}){let t=m(e),n=Y(),[r,i]=(0,Z.useState)(`unified`),[a,o]=(0,Z.useState)(!1),s=t.isError&&t.error instanceof E&&t.error.status===409,c=n?r:`unified`,l=!n||a;return(0,Q.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,Q.jsx)(y,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,Q.jsxs)(V,{to:`/git/commits`,children:[(0,Q.jsx)(f,{size:16,"aria-hidden":`true`}),`All commits`]})}),t.data?(0,Q.jsx)(W,{stat:t.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(L,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,Q.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,Q.jsx)(C,{icon:s?(0,Q.jsx)(U,{}):(0,Q.jsx)(g,{size:16}),tone:s?`neutral`:`danger`,heading:`h2`,title:s?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(_,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,Q.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`,children:(0,Q.jsx)(q,{files:t.data.files,mode:c,wrap:l,className:`min-w-0`})})]})]})}function ue({repo:e,info:t}){let n=r(),[a,s]=(0,Z.useState)(e.baseBranch??t.branch),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),f=S.repo,m=S.health,h=[...f,`pull`],g=!!t.remote,_=o({queryKey:h,queryFn:({signal:e})=>i({signal:e}),enabled:g}),x=d({mutationFn:p}),C=()=>Promise.all([n.invalidateQueries({queryKey:f}),n.invalidateQueries({queryKey:m})]),w=async(e,t=!1)=>{try{let n=await x.mutateAsync(t?{branch:e,confirm:!0}:{branch:e});if(`risks`in n){l(n);return}l(null),A(n.summary),await C()}catch(e){l(null),A(e instanceof Error?e.message:String(e),{tone:`danger`}),await C()}},E=_.data?.branches??e.branches,j=_.data===void 0||E.includes(a),M=j?E:[a,...E],N=g&&_.isPending,P=g?_.isError?`Could not load local branches: ${_.error.message}`:j?null:`${a} is not a local branch. Choose a local branch to pull.`:`No remote configured. Add a Git remote before pulling.`,F=x.isPending||N||!g||_.isError,I=F||!j,L=a!==t.branch;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-pull`,className:`max-w-full md:w-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`repo-pull-branch`,className:`sr-only`,children:`Branch to pull`}),(0,Q.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(`select`,{id:`repo-pull-branch`,value:a,disabled:F,onChange:e=>s(e.target.value),className:`h-11 max-w-full min-w-[88px] appearance-none rounded-lg border border-input bg-card pr-3 pl-9 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,style:{width:`${Math.max(88,a.length*8+56)}px`},children:M.map(e=>(0,Q.jsx)(`option`,{value:e,disabled:!j&&e===a,children:e},e))})]}),(0,Q.jsxs)(y,{ref:u,type:`button`,"data-action":`repo-pull`,className:`h-11 px-4`,disabled:I,title:P??void 0,onClick:()=>void w(a),children:[x.isPending?(0,Q.jsx)(H,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(re,{"aria-hidden":`true`}),L?`Switch & pull`:`Pull`]})]}),P||L?(0,Q.jsx)(`p`,{"data-slot":`repo-pull-note`,className:`mt-1 break-all text-[11px] text-soft-foreground md:text-left`,children:P??`${a} stays checked out after the pull.`}):null]}),(0,Q.jsx)(ne,{open:c!==null,onOpenChange:e=>{!e&&!x.isPending&&l(null)},children:(0,Q.jsxs)(te,{onCloseAutoFocus:e=>{e.preventDefault(),u.current?.focus()},children:[(0,Q.jsxs)(k,{children:[(0,Q.jsxs)(v,{children:[`Pull `,c?.branch,` anyway?`]}),(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[c?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,c?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the switch or pull to protect them.`}):null,(0,Q.jsxs)(`p`,{children:[c?.branch,` will stay checked out after this attempt.`]})]})})]}),(0,Q.jsxs)(D,{children:[(0,Q.jsx)(O,{className:`h-11`,disabled:x.isPending,children:`Cancel`}),(0,Q.jsx)(T,{className:`h-11`,disabled:x.isPending||c===null,onClick:e=>{e.preventDefault(),c&&w(c.branch,!0)},children:x.isPending?`Pulling…`:`Pull anyway`})]})]})})]})}function de({tab:e}){let t=c();if(t.isPending)return(0,Q.jsx)(G,{});if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(C,{icon:(0,Q.jsx)(g,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,Q.jsx)(fe,{repo:t.data,info:n,tab:e}):(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(C,{icon:(0,Q.jsx)(b,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function fe({repo:e,info:t,tab:n}){return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{"data-slot":`repo-header`,className:`px-[18px] pt-[18px] md:px-9 md:pt-9`,children:[(0,Q.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:[`Git · `,n===`changes`?`Changes`:n===`commits`?`Commits`:`Branches`]}),(0,Q.jsxs)(`p`,{"data-slot":`repo-remote`,className:`mt-2 break-all text-[13px] text-muted-foreground`,children:[t.root.split(`/`).filter(Boolean).at(-1),t.remote?` · ${t.remote}`:``,` · `,(0,Q.jsx)(`span`,{"data-slot":`branch-chip`,children:t.branch})]}),(0,Q.jsx)(`div`,{className:`my-[22px] flex min-w-0 items-start gap-2.5`,children:(0,Q.jsx)(ue,{repo:e,info:t})}),(0,Q.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`flex items-end gap-6 border-b border-border [&>a]:min-h-11`,children:[(0,Q.jsx)(J,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,Q.jsx)(J,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,Q.jsx)(J,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,Q.jsx)(ce,{}):n===`commits`?(0,Q.jsx)($,{log:e.log}):(0,Q.jsx)(ie,{repo:e,info:t})]})}export{de as RepoGitRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Ai as i,Ca as a,Ea as o,It as s,Jn as c,Ki as l,Rt as u,Ta as d,U as f,Wi as p,Xn as m,Yn as h,Yt as g,_t as _,a as ee,c as v,d as y,gt as b,hi as x,i as te,in as S,l as C,lt as w,n as T,ni as E,o as D,r as O,s as k,sa as A,t as ne,vn as j,wn as M,xt as N}from"./alert-dialog-CmDuefYh.js";import{n as P,t as F}from"./utils-CUnaAifW.js";import{t as I}from"./createLucideIcon-BHp8sXmF.js";import{n as L}from"./diff-controls-HwWHHait.js";import{i as R,r as z,t as B}from"./git-toolbar-DBW5EIcY.js";import{t as V,u as H}from"./project-router-SwsXRKXs.js";import{t as U}from"./search-x-I9Q8pgUa.js";import{t as W}from"./diff-stat-mNkhAc5m.js";import{a as G,h as K}from"./index-DWWI-B9n.js";import{t as q}from"./diff-0GBum40Q2.js";import{t as J}from"./tab-link-DSftvkZS.js";import{t as Y}from"./use-desktop-BaYgO7YW.js";import{t as X}from"./commit-list-BWvv1H7A.js";var re=I(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Z=e(t(),1),Q=n();function ie({repo:e,info:t}){let n=M(),i=r(),a=e=>A(e.message,{tone:`danger`}),o=d({mutationFn:e=>x({name:e}),onSuccess:async e=>{A(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([i.invalidateQueries({queryKey:S.repo}),i.invalidateQueries({queryKey:S.health})]),i.setQueryData(S.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),i.setQueryData(S.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:a}),c=d({mutationFn:e=>l({baseBranch:e}),onSuccess:e=>{A(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),i.invalidateQueries({queryKey:S.repo})},onError:a}),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),g=m.trim().toLowerCase(),_=g?e.branches.filter(e=>e.toLowerCase().includes(g)):e.branches;return(0,Q.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(u,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:m,onChange:e=>h(e.target.value),className:`h-11 pl-10`})]}),(0,Q.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[_.map(e=>{let n=e===t.branch;return(0,Q.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,Q.jsx)(`span`,{className:F(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),n?(0,Q.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[10px] font-medium text-accent-text`,children:`Current`}):(0,Q.jsxs)(y,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:o.isPending,onClick:()=>o.mutate(e),children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),_.length===0?(0,Q.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,m.trim(),`”.`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Q.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&o.mutate(t,{onSuccess:()=>p(``)})},children:[(0,Q.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Q.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,Q.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:f,onChange:e=>p(e.target.value)}),(0,Q.jsxs)(y,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!f.trim()||o.isPending,children:[(0,Q.jsx)(s,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Q.jsxs)(`div`,{className:`mt-5`,children:[(0,Q.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-sm font-medium`,children:`Agents’ base branch`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`New task worktrees branch from this.`}),(0,Q.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:c.isPending,onChange:e=>c.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block min-h-11 w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})]}),(0,Q.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,Q.jsx)(ae,{}):null]})}function ae(){let e=j({limit:20});return(0,Q.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,Q.jsx)(oe,{pr:e},e.number))}):(0,Q.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function oe({pr:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Q.jsx)(se,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Q.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:P(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:F(n,`hover:bg-muted`),children:t}):(0,Q.jsx)(`span`,{className:n,children:t})})}function se({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:F(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function ce(){let e=h(),t=Y(),[n,r]=(0,Z.useState)(`unified`),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null),l=e.isError&&e.error instanceof E&&e.error.status===409,u=e.data?.files??[],d=(0,Z.useMemo)(()=>z(u),[u]),f=t?n:`unified`,p=!t||i;return(0,Q.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,Q.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,Q.jsx)(B,{stat:e.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(L,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(C,{icon:l?(0,Q.jsx)(w,{size:16}):(0,Q.jsx)(g,{size:16}),tone:l?`neutral`:`danger`,heading:`h2`,title:l?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):u.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(w,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,Q.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Q.jsx)(R,{root:d,selected:o,onSelect:e=>{s(e),c.current?.scrollToPath(e)}})]}),(0,Q.jsx)(q,{files:u,viewRef:c,mode:f,wrap:p,className:`min-w-0 flex-1`})]})]})}function $({log:e}){let{sha:t}=a();return t?(0,Q.jsx)(le,{sha:t}):e.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(_,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,Q.jsx)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:(0,Q.jsx)(X,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})})}function le({sha:e}){let t=m(e),n=Y(),[r,i]=(0,Z.useState)(`unified`),[a,o]=(0,Z.useState)(!1),s=t.isError&&t.error instanceof E&&t.error.status===409,c=n?r:`unified`,l=!n||a;return(0,Q.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,Q.jsx)(y,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,Q.jsxs)(V,{to:`/git/commits`,children:[(0,Q.jsx)(f,{size:16,"aria-hidden":`true`}),`All commits`]})}),t.data?(0,Q.jsx)(W,{stat:t.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(L,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,Q.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,Q.jsx)(C,{icon:s?(0,Q.jsx)(U,{}):(0,Q.jsx)(g,{size:16}),tone:s?`neutral`:`danger`,heading:`h2`,title:s?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(_,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,Q.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`,children:(0,Q.jsx)(q,{files:t.data.files,mode:c,wrap:l,className:`min-w-0`})})]})]})}function ue({repo:e,info:t}){let n=r(),[a,s]=(0,Z.useState)(e.baseBranch??t.branch),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),f=S.repo,m=S.health,h=[...f,`pull`],g=!!t.remote,_=o({queryKey:h,queryFn:({signal:e})=>i({signal:e}),enabled:g}),x=d({mutationFn:p}),C=()=>Promise.all([n.invalidateQueries({queryKey:f}),n.invalidateQueries({queryKey:m})]),w=async(e,t=!1)=>{try{let n=await x.mutateAsync(t?{branch:e,confirm:!0}:{branch:e});if(`risks`in n){l(n);return}l(null),A(n.summary),await C()}catch(e){l(null),A(e instanceof Error?e.message:String(e),{tone:`danger`}),await C()}},E=_.data?.branches??e.branches,j=_.data===void 0||E.includes(a),M=j?E:[a,...E],N=g&&_.isPending,P=g?_.isError?`Could not load local branches: ${_.error.message}`:j?null:`${a} is not a local branch. Choose a local branch to pull.`:`No remote configured. Add a Git remote before pulling.`,F=x.isPending||N||!g||_.isError,I=F||!j,L=a!==t.branch;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-pull`,className:`max-w-full md:w-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`repo-pull-branch`,className:`sr-only`,children:`Branch to pull`}),(0,Q.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(`select`,{id:`repo-pull-branch`,value:a,disabled:F,onChange:e=>s(e.target.value),className:`h-11 max-w-full min-w-[88px] appearance-none rounded-lg border border-input bg-card pr-3 pl-9 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,style:{width:`${Math.max(88,a.length*8+56)}px`},children:M.map(e=>(0,Q.jsx)(`option`,{value:e,disabled:!j&&e===a,children:e},e))})]}),(0,Q.jsxs)(y,{ref:u,type:`button`,"data-action":`repo-pull`,className:`h-11 px-4`,disabled:I,title:P??void 0,onClick:()=>void w(a),children:[x.isPending?(0,Q.jsx)(H,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(re,{"aria-hidden":`true`}),L?`Switch & pull`:`Pull`]})]}),P||L?(0,Q.jsx)(`p`,{"data-slot":`repo-pull-note`,className:`mt-1 break-all text-[11px] text-soft-foreground md:text-left`,children:P??`${a} stays checked out after the pull.`}):null]}),(0,Q.jsx)(ne,{open:c!==null,onOpenChange:e=>{!e&&!x.isPending&&l(null)},children:(0,Q.jsxs)(te,{onCloseAutoFocus:e=>{e.preventDefault(),u.current?.focus()},children:[(0,Q.jsxs)(k,{children:[(0,Q.jsxs)(v,{children:[`Pull `,c?.branch,` anyway?`]}),(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[c?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,c?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the switch or pull to protect them.`}):null,(0,Q.jsxs)(`p`,{children:[c?.branch,` will stay checked out after this attempt.`]})]})})]}),(0,Q.jsxs)(D,{children:[(0,Q.jsx)(O,{className:`h-11`,disabled:x.isPending,children:`Cancel`}),(0,Q.jsx)(T,{className:`h-11`,disabled:x.isPending||c===null,onClick:e=>{e.preventDefault(),c&&w(c.branch,!0)},children:x.isPending?`Pulling…`:`Pull anyway`})]})]})})]})}function de({tab:e}){let t=c();if(t.isPending)return(0,Q.jsx)(G,{});if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(C,{icon:(0,Q.jsx)(g,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,Q.jsx)(fe,{repo:t.data,info:n,tab:e}):(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(C,{icon:(0,Q.jsx)(b,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function fe({repo:e,info:t,tab:n}){return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{"data-slot":`repo-header`,className:`px-[18px] pt-[18px] md:px-9 md:pt-9`,children:[(0,Q.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:[`Git · `,n===`changes`?`Changes`:n===`commits`?`Commits`:`Branches`]}),(0,Q.jsxs)(`p`,{"data-slot":`repo-remote`,className:`mt-2 break-all text-[13px] text-muted-foreground`,children:[t.root.split(`/`).filter(Boolean).at(-1),t.remote?` · ${t.remote}`:``,` · `,(0,Q.jsx)(`span`,{"data-slot":`branch-chip`,children:t.branch})]}),(0,Q.jsx)(`div`,{className:`my-[22px] flex min-w-0 items-start gap-2.5`,children:(0,Q.jsx)(ue,{repo:e,info:t})}),(0,Q.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`flex items-end gap-6 border-b border-border [&>a]:min-h-11`,children:[(0,Q.jsx)(J,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,Q.jsx)(J,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,Q.jsx)(J,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,Q.jsx)(ce,{}):n===`commits`?(0,Q.jsx)($,{log:e.log}):(0,Q.jsx)(ie,{repo:e,info:t})]})}export{de as RepoGitRoute};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,d as i,in as a,nr as o}from"./alert-dialog-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,d as i,in as a,nr as o}from"./alert-dialog-CmDuefYh.js";import{t as s}from"./utils-CUnaAifW.js";import{n as c,r as l,t as u}from"./collapsible-BqX8REmY.js";import{t as d}from"./chevron-right-BENZ-1ZN.js";import{i as f,r as p}from"./highlighter-CdHqIwFr.js";var m=e(t(),1),h=/^diff --git /;function g(e){let t=e.replace(h,``),n=t.lastIndexOf(` b/`);return _(n>=0?t.slice(n+3):t)}function _(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function v(e){let t=_(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function y(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
2
2
|
`)){if(h.test(i)){n={path:g(i),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]},t.push(n),r=!1;continue}if(n){if(!r){if(i.startsWith(`@@`))r=!0,n.lines.push(i);else if(i.startsWith(`rename from `))n.status=`renamed`,n.oldPath=_(i.slice(12));else if(i.startsWith(`rename to `))n.status=`renamed`,n.path=_(i.slice(10));else if(i.startsWith(`new file mode`))n.status=`added`;else if(i.startsWith(`deleted file mode`))n.status=`deleted`;else if(i.startsWith(`Binary files `)||i===`GIT binary patch`)n.binary=!0;else if(i.startsWith(`+++ `)){let e=v(i);e!==void 0&&(n.path=e)}else if(i.startsWith(`--- `)){let e=v(i);e!==void 0&&n.status===`deleted`&&(n.path=e)}continue}n.lines.push(i),i.startsWith(`+`)?n.additions+=1:i.startsWith(`-`)&&(n.deletions+=1)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function b(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var x=n(),S=20,C=300;function w({runId:e}){let t=r(),n=o(e);(0,m.useEffect)(()=>{t.invalidateQueries({queryKey:a.runs.diff(e)})},[t,e]);let s=(0,m.useMemo)(()=>y(n.data??``),[n.data]),[c,l]=(0,m.useState)(!1);if(n.isPending)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(n.isError)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:n.error.message});if(s.length===0)return(0,x.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:n.data.trim()||`(no changes)`});let u=b(s),d=c?s:s.slice(0,S);return(0,x.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,x.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,x.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,u.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.deletions]})]})]}),d.map(e=>(0,x.jsx)(E,{file:e},`${e.oldPath??``}→${e.path}`)),s.length>d.length?(0,x.jsxs)(i,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>l(!0),children:[`Show `,s.length-d.length,` more files`]}):null]})}var T={added:`added`,deleted:`deleted`,renamed:`renamed`};function E({file:e}){let[t,n]=(0,m.useState)(!0),r=T[e.status];return(0,x.jsxs)(u,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-border bg-card`,children:[(0,x.jsxs)(l,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,x.jsx)(d,{className:s(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,x.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),(0,x.jsx)(c,{children:(0,x.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,x.jsx)(D,{lines:e.lines})})})]})}function D({lines:e}){let[t,n]=(0,m.useState)(!1),r=t?e:e.slice(0,C),i=r.join(`
|
|
3
3
|
`),[a,o]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=!1;return p(i,`diff`).then(t=>{e||o({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=a?.text===i?a.tokens:f(i,`diff`)?.tokens??null;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,x.jsxs)(`span`,{className:s(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,x.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>C?(0,x.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Fr as i,Ft as a,J as o,Jt as s,K as c,Kr as l,Lr as u,Mn as d,Mr as f,Nn as p,Pn as m,Pr as h,Q as g,Qn as _,Ri as v,Rn as y,Ta as b,V as ee,Vn as te,Wr as ne,X as x,Xr as re,Yr as S,a as C,ar as w,c as T,cr as E,d as D,et as ie,fa as ae,fn as oe,gt as se,i as ce,in as le,ir as ue,it as O,jn as de,kn as fe,kr as pe,n as k,ni as me,nt as A,o as j,oi as he,r as M,s as N,sa as P,st as ge,t as F,tn as I,tt as _e,un as ve,wn as ye,yi as be,zi as xe,zr as Se}from"./alert-dialog-CVF_qvQ8.js";import{n as L,t as R}from"./utils-DNvmfH6b.js";import{a as z,c as Ce,i as B,l as V,n as we,r as Te,t as Ee}from"./dropdown-menu-IsTcumXE.js";import{n as De,r as Oe,t as ke}from"./collapsible-DVDGHZAE.js";import{n as Ae,t as je}from"./agent-accounts-4EqNShyp.js";import{t as H}from"./createLucideIcon-BHp8sXmF.js";import{A as Me,C as Ne,N as Pe,S as U,_ as W,b as Fe,c as Ie,f as Le,g as Re,i as ze,n as Be,r as Ve,t as He,y as Ue}from"./pill-BlaWNkHk.js";import{c as We,s as Ge,t as G,u as Ke}from"./project-router-CX1jLqj-.js";import{t as qe}from"./square-terminal-B6RYYieR.js";import{t as Je}from"./markdown-gFxX4dDH.js";import{t as Ye}from"./diff-stat-BXriPIds.js";import{n as Xe,t as Ze}from"./token-metrics-PSnNTJZF.js";import{t as K}from"./tab-link-DhREnUYE.js";import{t as Qe}from"./use-desktop-BaYgO7YW.js";var $e=H(`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`}]]),et=H(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),tt=H(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),q=e(t(),1),J=n();function nt(e){let t=r();return b({mutationFn:t=>he(e,t),onSuccess:()=>t.invalidateQueries({queryKey:le.runs.all}),onError:e=>P(e.message,{tone:`danger`})})}function rt(e){return e.archived?`Unarchive`:`Archive task`}function it({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,J.jsx)(F,{open:t,onOpenChange:n,children:(0,J.jsxs)(ce,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(N,{children:[(0,J.jsx)(T,{children:`Archive task?`}),(0,J.jsxs)(C,{children:[`Move “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(M,{children:`Cancel`}),(0,J.jsx)(k,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function at({run:e,className:t}){let[n,r]=(0,q.useState)(!1),i=nt(e.id),a=rt(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":a,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:i.isPending,className:R(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?i.mutate(!1):r(!0),children:[e.archived?(0,J.jsx)(Pe,{"aria-hidden":`true`}):(0,J.jsx)(ee,{"aria-hidden":`true`}),a]}),(0,J.jsx)(it,{run:e,open:n,onOpenChange:r,onConfirm:()=>{i.mutate(!0),r(!1)}})]})}function ot(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function st({slot:e,icon:t,title:n,meta:r,open:i,onToggle:a,children:o}){return(0,J.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":i?`open`:`collapsed`,className:`min-w-0 border-t border-border first:border-t-0`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:a,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-left hover:bg-muted/40`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,J.jsx)(`span`,{className:`min-w-0 shrink truncate text-[13.5px] font-semibold text-foreground`,children:n}),(0,J.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[12.5px] text-muted-foreground tabular-nums`,children:r}),(0,J.jsx)(x,{"aria-hidden":!0,className:R(`ml-auto size-4 shrink-0 text-soft-foreground transition-transform`,i&&`rotate-180`)})]}),i?(0,J.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:o}):null]})}var ct=`flex min-h-11 min-w-0 items-center rounded-md px-2 text-sm text-foreground hover:bg-muted break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;function lt({run:e}){return!e.delegation||e.delegation.role===`invalid`?null:(0,J.jsx)(dt,{run:e})}function Y(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId):[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])].slice(0,32)}function ut(e){let t=e.delegation,n=t!==void 0&&t.role!==`invalid`,r=w(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=Y(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function dt({run:e}){let t=w(e.id),n=Qe(),[r,i]=(0,q.useState)(null),a=n||r===e.id,s=(0,q.useId)(),c=E(),u=e.delegation,d=u?.role===`worker`?u.parentRunId:t.data?.parentRunId,f=new Map(t.data?.workers.map(e=>[e.workerId,e])),p=Y(u,t.data),m=u&&u.role!==`invalid`?u.wait:void 0,h=S(u);return(0,J.jsxs)(`section`,{"aria-label":`Task relationships`,className:`min-w-0 border-t border-border py-2 text-sm text-muted-foreground`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-2 text-left text-xs md:hidden`,"aria-expanded":a,"aria-controls":s,onClick:()=>i(r===e.id?null:e.id),children:[(0,J.jsx)(se,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),u?.role===`worker`?`Worker session`:`Parent`,(0,J.jsx)(o,{"aria-hidden":`true`,className:`ml-1 size-4`}),u?.role===`worker`?`Parent & workers`:p.length>0?`Workers ${p.length}`:t.isSuccess?`Workers 0`:t.isError?`Workers unavailable`:`Workers…`,(0,J.jsx)(x,{"aria-hidden":`true`,className:`ml-auto size-4 ${a?`rotate-180`:``}`})]}),u?.role===`worker`&&u.destroy?(0,J.jsx)(X,{state:u.destroy}):null,m?(0,J.jsx)(_t,{wait:m,dependencyLabel:h}):null,(0,J.jsxs)(`div`,{id:s,hidden:!a,children:[d?(0,J.jsx)(vt,{id:d}):null,p.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-1 overflow-y-auto`,children:p.map(e=>{let n=f.get(e),r=c.data?.find(t=>t.id===e);return(0,J.jsxs)(`li`,{className:`min-w-0 rounded-md bg-muted/40 px-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(G,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:ct,children:r?l(r):`Worker ${e.slice(0,8)}`}),(0,J.jsx)(`span`,{className:`px-2 text-xs`,children:n?.status??(t.isSuccess?`Record unavailable or deleted`:`Status unavailable`)})]}),n?.destroy?(0,J.jsx)(X,{state:n.destroy}):null]},e)})}):u?.role===`root`&&t.isSuccess?(0,J.jsx)(`p`,{className:`px-2`,children:`No workers`}):null,t.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-2`,children:`Offline — relationship details will refresh when connected.`}):t.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-2`,children:`Loading relationships…`}):null,t.isError?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,J.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry relationships`})]}):null]})]})}function ft({run:e,open:t,onToggle:n}){let r=w(e.id),i=E(),a=Qe(),o=e.delegation,s=o?.role===`worker`?o.parentRunId:r.data?.parentRunId,u=new Map(r.data?.workers.map(e=>[e.workerId,e])),d=Y(o,r.data),f=o&&o.role!==`invalid`?o.wait:void 0,p=S(o);return(0,J.jsx)(st,{slot:`workers`,icon:(0,J.jsx)(se,{className:`size-4`}),title:`Workers`,meta:pt({ids:d,workers:u,parentId:s,desktop:a,query:r}),open:t,onToggle:n,children:(0,J.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[o?.role===`worker`&&o.destroy?(0,J.jsx)(X,{state:o.destroy}):null,f?(0,J.jsx)(_t,{wait:f,dependencyLabel:p}):null,s?(0,J.jsx)(vt,{id:s}):null,d.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:d.map(e=>{let t=u.get(e),n=i.data?.find(t=>t.id===e),a=t?ht(t.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,J.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":t?.status,className:`min-w-0`,children:[(0,J.jsxs)(G,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,J.jsx)(mt,{status:t?.status}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n?l(n):`Worker ${e.slice(0,8)}`}),(0,J.jsx)(`span`,{className:R(`max-w-[45%] shrink-0 truncate text-xs`,gt(t?.status)),children:a}),(0,J.jsx)(c,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),t?.destroy?(0,J.jsx)(X,{state:t.destroy}):null]},e)})}):o?.role===`root`&&r.isSuccess?(0,J.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,J.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function pt({ids:e,workers:t,parentId:n,desktop:r,query:i}){if(e.length===0)return i.isError?`Unavailable`:i.isPending?`Linking…`:n?`Parent linked`:`No workers`;let a=`${e.length} linked`;if(!r)return a;let o=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&o.set(e,(o.get(e)??0)+1)}return[a,...[...o.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function mt({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,J.jsx)(g,{"aria-hidden":!0,className:R(t,`text-success`)}):e===`failed`?(0,J.jsx)(A,{"aria-hidden":!0,className:R(t,`text-danger`)}):e===`cancelled`?(0,J.jsx)(_e,{"aria-hidden":!0,className:R(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,J.jsx)(Ke,{role:`status`,"aria-label":`Worker running`,className:R(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,J.jsx)(ie,{"aria-hidden":!0,className:R(t,`text-soft-foreground`)})}function ht(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function gt(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function _t({wait:e,dependencyLabel:t}){return(0,J.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,` `,`Deadline: `,(0,J.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]})}function vt({id:e}){let t=_(e);return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(G,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,className:ct,children:t.data?`Parent · ${l(t.data)}`:`Parent task ${e}`}),t.isError?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`px-2 text-xs`,children:`Parent record unavailable or deleted`}),(0,J.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}function X({state:e}){return e.phase===`complete`&&e.remaining.length===0&&e.error===void 0?null:(0,J.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${e.error}`:``]})}function Z(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 yt(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 Q({steps:e}){if(e.length===0)return null;let t=yt(e)*100;return(0,J.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,J.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":Z(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,J.jsx)(bt,{visual:Z(t.status)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,J.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,J.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,J.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function bt({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,J.jsx)(g,{"aria-hidden":!0,className:R(t,`text-success`)});case`active`:return(0,J.jsx)(Ke,{role:`status`,"aria-label":`Step running`,className:R(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,J.jsx)(A,{"aria-hidden":!0,className:R(t,`text-danger`)});case`pending`:return(0,J.jsx)(ie,{"aria-hidden":!0,className:R(t,`text-soft-foreground`)})}}function xt(e){let t=e.findIndex(e=>Z(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>Z(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function St({visual:e}){return(0,J.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:R(`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 Ct=new Map;function wt({runId:e,steps:t}){let[n,r]=(0,q.useState)(()=>Ct.get(e)??!1);if(t.length===0)return null;let i=t=>{Ct.set(e,t),r(t)},a=xt(t),o=t[a],s=yt(t)*100;return(0,J.jsxs)(ke,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,J.jsxs)(Oe,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group flex min-h-11 w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground md:min-h-[30px] md:gap-2.5`,children:[(0,J.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,J.jsx)(St,{visual:Z(e.status)},e.id))}),(0,J.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,J.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,J.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,J.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,J.jsx)(x,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,J.jsx)(De,{children:(0,J.jsx)(`div`,{className:`pt-2`,children:(0,J.jsx)(Q,{steps:t})})})]})}var Tt=new Map;function Et({run:e,tab:t=`session`,hasPendingHumanAsk:n=!1,onMarkedUnread:r}){let i=re(e,n),a=W(e),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),u=Ot(e,r),[,d]=(0,q.useReducer)(e=>e+1,0),f=(0,q.useId)(),p=Ge(),m=JSON.stringify([p,e.id]),h=Tt.get(m)??!1,g=()=>{Tt.set(m,!h),d()},_=E(),v=ye(),y=Ze(v.data),b=e.status===`queued`?ne(_.data??[]).get(e.id):void 0;return(0,J.jsxs)(`header`,{"data-slot":`run-header`,className:R(`relative z-20 bg-background px-[18px] pt-[18px] md:px-9 md:pt-7`,t===`session`&&`md:sticky md:top-0`),children:[(0,J.jsxs)(`div`,{className:`w-full`,children:[(0,J.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,J.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[10px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:e.delegation?.role===`worker`?`Worker session`:e.delegation?.role===`root`?`Parent session`:`Task session`}),(0,J.jsx)(kt,{run:e}),(0,J.jsxs)(He,{dot:i.tone,pulse:i.pulse,children:[i.label,b===void 0?``:` #${b}`]}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[(0,J.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":h?`Hide run details`:`Show run details`,"aria-controls":f,"aria-expanded":h,onClick:g,children:(0,J.jsx)(x,{"aria-hidden":`true`,className:R(`transition-transform motion-reduce:transition-none`,h&&`rotate-180`)})}),t!==`session`&&a.archive?(0,J.jsx)(at,{run:e}):null,(0,J.jsx)(Nt,{run:e,actions:u,onOpenChooser:()=>l(!0),onToggleNotes:()=>s(e=>!e)})]})]}),(0,J.jsx)(`div`,{id:f,"data-slot":`run-details`,className:R(h?`block`:`hidden`,`md:block`),children:(0,J.jsx)(At,{run:e,showTokens:y.tokens,showCost:y.cost,automationsAvailable:v.data?.capabilities?.automations===!0})}),(0,J.jsx)(jt,{run:e}),(0,J.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:[&>a]:min-h-11`,children:[(0,J.jsx)(K,{to:`/tasks/${e.id}`,active:t===`session`,children:`Session`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/changes`,active:t===`changes`,children:`Changes`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/commits`,active:t===`commits`,children:`Commits`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/files`,active:t===`files`,children:`Files`})]}),t===`session`?null:(0,J.jsx)(lt,{run:e}),t!==`session`&&e.steps.length>0?(0,J.jsx)(`div`,{className:`border-t border-border pt-1 pb-0 md:pt-2 md:pb-1`,children:(0,J.jsx)(wt,{runId:e.id,steps:e.steps})}):null,o?(0,J.jsx)(Ft,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,J.jsx)(Dt,{run:e,canResume:W(e).terminal,onResume:()=>u.terminal.mutate(),onClose:()=>l(!1)}):null]}),(0,J.jsx)(Pt,{run:e,actions:u})]})}function Dt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let a=de(),o=y(),s=b({mutationFn:t=>v(e.id,t),onError:e=>P(e.message,{tone:`danger`})}),c=ae(o.data),l=e=>!o.isSuccess||c.includes(e??`claude`),u=t&&l(Le(e)),d=e.worktreePath?(a.data?.targets??[]).filter(e=>{let t=Ue(e.id);return t===void 0||l(t)}).map(t=>({target:t,...Ie(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];if(!u&&d.length===0)return null;let f=()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>P(`Worktree path copied`)).catch(()=>P(`Path: ${t}`))};if(r)return(0,J.jsx)(B,{onSelect:r,children:`Open in…`});let p=Re(e);return(0,J.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,J.jsx)(I,{})})]}),e.worktreePath?(0,J.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,J.jsxs)(`div`,{className:`task-open-targets mt-4 flex flex-wrap gap-3`,children:[u?(0,J.jsxs)(D,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,J.jsx)(qe,{}),`Terminal (resume session)`]}):null,d.map(({target:e,suffix:t,title:n})=>{let r=Fe(e);return(0,J.jsxs)(D,{variant:`outline`,"data-target":e.id,title:n,disabled:s.isPending,onClick:()=>s.mutate(e.id),children:[(0,J.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,J.jsxs)(D,{variant:`outline`,onClick:f,children:[(0,J.jsx)(O,{}),`Copy worktree path`]}):null]}),p?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-border pt-5`,children:[(0,J.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,J.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:p}),(0,J.jsxs)(D,{variant:`outline`,onClick:()=>void $(p,`Command copied to clipboard.`),children:[(0,J.jsx)(O,{}),`Copy resume command`]})]}):null]})}function Ot(e,t){let n=r(),i=We(),[a,o]=(0,q.useState)(null),s=()=>n.invalidateQueries({queryKey:le.runs.all}),c=e=>P(e.message,{tone:`danger`}),l=p(),u={isPending:l.isPending,mutate:()=>l.mutate({id:e.id,pinned:!e.pinned})},d=fe();return{pin:u,markUnread:{isPending:d.isPending,mutate:()=>{t?.(),d.mutate(e.id,{onError:c})}},delete:b({mutationFn:()=>be(e.id),onSuccess:()=>{s(),i(`/`)},onError:c}),terminal:b({mutationFn:()=>xe(e.id),onError:e=>{if(e instanceof me&&e.command){$(e.command,`No terminal found — command copied to clipboard.`);return}c(e)}}),confirming:a,setConfirming:o}}async function $(e,t){try{await navigator.clipboard.writeText(e),P(t)}catch{P(`Run manually: ${e}`)}}function kt({run:e}){let t=d(e.id),n=l(e),r=Ve(n,e=>t.mutate({title:e},{onError:e=>P(e.message,{tone:`danger`})}));return r.editing?(0,J.jsx)(Be,{editor:r,className:`flex-1 text-[15px] font-semibold`}):(0,J.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,J.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:n}),(0,J.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,J.jsx)(Me,{className:`size-3.5`,"aria-hidden":`true`})})]})}function At({run:e,showTokens:t,showCost:n,automationsAvailable:r}){let a=m(),o=te(),s=(0,q.useMemo)(()=>u(e,a),[e,a]),c=(0,q.useMemo)(()=>o===void 0?[]:s.map(e=>({projectId:o,kind:e.kind,number:e.number})),[s,o]),d=[(0,J.jsx)(`span`,{className:`max-md:max-w-full max-md:break-all`,children:Se(e)},`workflow`)];e.branch&&d.push((0,J.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 max-md:max-w-full max-md:break-all`,children:e.branch},`branch`));let p=s.filter(e=>e.kind===`PR`);for(let t of p)d.push((0,J.jsx)(U,{reference:t,taskTitle:l(e),className:`h-5`,conflictAction:(0,J.jsx)(ze,{run:e,prNumber:t.number})},`pr-${t.number}`));let g=i(e);g&&L(g)&&!p.some(e=>e.url===g)&&d.push((0,J.jsx)(U,{reference:{kind:`PR`,url:g},taskTitle:l(e),className:`h-5`},`pr`));let _=h(e,a);if(_&&L(_)){let t=f(_);d.push((0,J.jsx)(U,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:_},taskTitle:l(e),className:`h-5`},`issue`))}e.diffStat&&d.push((0,J.jsx)(Ye,{stat:e.diffStat},`diff`)),e.automation&&d.push(r?(0,J.jsx)(G,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,J.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`));let v=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&v.push((0,J.jsx)(Xe,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&v.push((0,J.jsx)(`span`,{className:`tabular-nums`,children:pe(e.costUsd)},`cost`)),(0,J.jsx)(Ne,{projectId:o,requests:c,children:(0,J.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[d.map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0?(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 max-md:min-w-0 max-md:max-w-full`,children:[v.map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0?(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,J.jsx)(Mt,{run:e})]})]})})}function jt({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,J.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,J.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,J.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,J.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function Mt({run:e}){let t=oe(),n=ve(),{accounts:r}=Ae(),i=e.runner??t.data?.defaultRunner??`claude`,a=e.model??`auto`,s=e.effort||void 0,c=[...e.steps].reverse().find(e=>e.profileId),l=c?.profileId,u=c?.backend??i,d=n.data?.profiles.find(e=>e.id===l),f=l===void 0||n.isPending?void 0:n.isError?l:d?je(r,u)?l==="default"?`default`:d.label:void 0:`${l} (removed)`,p=e.modelIdentity&&e.modelIdentity!==a?e.modelIdentity:void 0,m=[i,f,a,s].filter(Boolean).join(` · `);return(0,J.jsxs)(Ee,{children:[(0,J.jsx)(V,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:m,"aria-label":`Agent: ${i}, ${f?`account ${f}, `:``}model ${a}${s?`, effort ${s}`:``}`,className:`flex min-w-0 shrink items-center max-md:min-h-11 gap-1.5 rounded-sm px-1 py-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,J.jsx)(o,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{"data-slot":`agent-badge-summary`,className:`truncate font-mono text-[11px]`,children:m})]})}),(0,J.jsxs)(Te,{align:`end`,className:`min-w-[9rem] max-md:max-w-[calc(100vw-2rem)] max-md:break-all`,children:[(0,J.jsxs)(z,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,i]}),f?(0,J.jsxs)(z,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,f]}):null,(0,J.jsxs)(z,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,a]}),s?(0,J.jsxs)(z,{"data-slot":`agent-badge-effort`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`effort: `,s]}):null,p?(0,J.jsxs)(z,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,p]}):null]})]})}function Nt({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=W(e),o=Re(e);return(0,J.jsxs)(Ee,{children:[(0,J.jsx)(V,{asChild:!0,children:(0,J.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,J.jsx)(ge,{"aria-hidden":`true`})})}),(0,J.jsxs)(Te,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,J.jsx)(z,{className:`px-2 py-3 text-[10px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,J.jsxs)(B,{onSelect:n,children:[(0,J.jsx)($e,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,J.jsx)(Dt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,J.jsxs)(B,{onSelect:()=>void $(o,`Command copied to clipboard.`),children:[(0,J.jsx)(O,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,J.jsxs)(B,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,J.jsx)(et,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,J.jsxs)(we,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,J.jsx)(tt,{"aria-hidden":`true`}):(0,J.jsx)(a,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,i.deleteRun?(0,J.jsx)(Ce,{}):null,i.deleteRun?(0,J.jsxs)(B,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,J.jsx)(s,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function Pt({run:e,actions:t}){let n=t.confirming;return(0,J.jsx)(F,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,J.jsxs)(ce,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(N,{children:[(0,J.jsx)(T,{className:`text-danger`,children:`Delete task permanently?`}),(0,J.jsx)(C,{children:(0,J.jsxs)(J.Fragment,{children:[`Delete “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(M,{children:`Cancel`}),(0,J.jsx)(k,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function Ft({runId:e,onClose:t}){let n=ue(e);return(0,J.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,J.jsx)(I,{})})]}),n.isPending?(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,J.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,J.jsx)(Je,{children:n.data}):(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,J.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,J.jsx)(D,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void $(n.data??``,`Notes copied`),children:`Copy notes`}),(0,J.jsx)(D,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{ft as a,ot as c,Z as i,at as l,Q as n,ut as o,xt as r,st as s,Et as t,$e as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Fr as i,Ft as a,J as o,Jt as s,K as c,Kr as l,Lr as u,Mn as d,Mr as f,Nn as p,Pn as m,Pr as h,Q as g,Qn as _,Ri as v,Rn as y,Ta as b,V as ee,Vn as te,Wr as ne,X as x,Xr as re,Yr as S,a as C,ar as w,c as T,cr as E,d as D,et as ie,fa as ae,fn as oe,gt as se,i as ce,in as le,ir as ue,it as O,jn as de,kn as fe,kr as pe,n as k,ni as me,nt as A,o as j,oi as he,r as M,s as N,sa as P,st as ge,t as F,tn as I,tt as _e,un as ve,wn as ye,yi as be,zi as xe,zr as Se}from"./alert-dialog-CmDuefYh.js";import{n as L,t as R}from"./utils-CUnaAifW.js";import{a as z,c as Ce,i as B,l as V,n as we,r as Te,t as Ee}from"./dropdown-menu-sZjYPcLh.js";import{n as De,r as Oe,t as ke}from"./collapsible-BqX8REmY.js";import{n as Ae,t as je}from"./agent-accounts-lP_xK83o.js";import{t as H}from"./createLucideIcon-BHp8sXmF.js";import{A as Me,C as Ne,N as Pe,S as U,_ as W,b as Fe,c as Ie,f as Le,g as Re,i as ze,n as Be,r as Ve,t as He,y as Ue}from"./pill-CcJqA1cL.js";import{c as We,s as Ge,t as G,u as Ke}from"./project-router-SwsXRKXs.js";import{t as qe}from"./square-terminal-B6RYYieR.js";import{t as Je}from"./markdown-AY2K3kIV.js";import{t as Ye}from"./diff-stat-mNkhAc5m.js";import{n as Xe,t as Ze}from"./token-metrics-Z3UFYbuD.js";import{t as K}from"./tab-link-DSftvkZS.js";import{t as Qe}from"./use-desktop-BaYgO7YW.js";var $e=H(`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`}]]),et=H(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),tt=H(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),q=e(t(),1),J=n();function nt(e){let t=r();return b({mutationFn:t=>he(e,t),onSuccess:()=>t.invalidateQueries({queryKey:le.runs.all}),onError:e=>P(e.message,{tone:`danger`})})}function rt(e){return e.archived?`Unarchive`:`Archive task`}function it({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,J.jsx)(F,{open:t,onOpenChange:n,children:(0,J.jsxs)(ce,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(N,{children:[(0,J.jsx)(T,{children:`Archive task?`}),(0,J.jsxs)(C,{children:[`Move “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(M,{children:`Cancel`}),(0,J.jsx)(k,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function at({run:e,className:t}){let[n,r]=(0,q.useState)(!1),i=nt(e.id),a=rt(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":a,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:i.isPending,className:R(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?i.mutate(!1):r(!0),children:[e.archived?(0,J.jsx)(Pe,{"aria-hidden":`true`}):(0,J.jsx)(ee,{"aria-hidden":`true`}),a]}),(0,J.jsx)(it,{run:e,open:n,onOpenChange:r,onConfirm:()=>{i.mutate(!0),r(!1)}})]})}function ot(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function st({slot:e,icon:t,title:n,meta:r,open:i,onToggle:a,children:o}){return(0,J.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":i?`open`:`collapsed`,className:`min-w-0 border-t border-border first:border-t-0`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:a,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-left hover:bg-muted/40`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,J.jsx)(`span`,{className:`min-w-0 shrink truncate text-[13.5px] font-semibold text-foreground`,children:n}),(0,J.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[12.5px] text-muted-foreground tabular-nums`,children:r}),(0,J.jsx)(x,{"aria-hidden":!0,className:R(`ml-auto size-4 shrink-0 text-soft-foreground transition-transform`,i&&`rotate-180`)})]}),i?(0,J.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:o}):null]})}var ct=`flex min-h-11 min-w-0 items-center rounded-md px-2 text-sm text-foreground hover:bg-muted break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;function lt({run:e}){return!e.delegation||e.delegation.role===`invalid`?null:(0,J.jsx)(dt,{run:e})}function Y(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId):[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])].slice(0,32)}function ut(e){let t=e.delegation,n=t!==void 0&&t.role!==`invalid`,r=w(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=Y(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function dt({run:e}){let t=w(e.id),n=Qe(),[r,i]=(0,q.useState)(null),a=n||r===e.id,s=(0,q.useId)(),c=E(),u=e.delegation,d=u?.role===`worker`?u.parentRunId:t.data?.parentRunId,f=new Map(t.data?.workers.map(e=>[e.workerId,e])),p=Y(u,t.data),m=u&&u.role!==`invalid`?u.wait:void 0,h=S(u);return(0,J.jsxs)(`section`,{"aria-label":`Task relationships`,className:`min-w-0 border-t border-border py-2 text-sm text-muted-foreground`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-2 text-left text-xs md:hidden`,"aria-expanded":a,"aria-controls":s,onClick:()=>i(r===e.id?null:e.id),children:[(0,J.jsx)(se,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),u?.role===`worker`?`Worker session`:`Parent`,(0,J.jsx)(o,{"aria-hidden":`true`,className:`ml-1 size-4`}),u?.role===`worker`?`Parent & workers`:p.length>0?`Workers ${p.length}`:t.isSuccess?`Workers 0`:t.isError?`Workers unavailable`:`Workers…`,(0,J.jsx)(x,{"aria-hidden":`true`,className:`ml-auto size-4 ${a?`rotate-180`:``}`})]}),u?.role===`worker`&&u.destroy?(0,J.jsx)(X,{state:u.destroy}):null,m?(0,J.jsx)(_t,{wait:m,dependencyLabel:h}):null,(0,J.jsxs)(`div`,{id:s,hidden:!a,children:[d?(0,J.jsx)(vt,{id:d}):null,p.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-1 overflow-y-auto`,children:p.map(e=>{let n=f.get(e),r=c.data?.find(t=>t.id===e);return(0,J.jsxs)(`li`,{className:`min-w-0 rounded-md bg-muted/40 px-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(G,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:ct,children:r?l(r):`Worker ${e.slice(0,8)}`}),(0,J.jsx)(`span`,{className:`px-2 text-xs`,children:n?.status??(t.isSuccess?`Record unavailable or deleted`:`Status unavailable`)})]}),n?.destroy?(0,J.jsx)(X,{state:n.destroy}):null]},e)})}):u?.role===`root`&&t.isSuccess?(0,J.jsx)(`p`,{className:`px-2`,children:`No workers`}):null,t.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-2`,children:`Offline — relationship details will refresh when connected.`}):t.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-2`,children:`Loading relationships…`}):null,t.isError?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,J.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry relationships`})]}):null]})]})}function ft({run:e,open:t,onToggle:n}){let r=w(e.id),i=E(),a=Qe(),o=e.delegation,s=o?.role===`worker`?o.parentRunId:r.data?.parentRunId,u=new Map(r.data?.workers.map(e=>[e.workerId,e])),d=Y(o,r.data),f=o&&o.role!==`invalid`?o.wait:void 0,p=S(o);return(0,J.jsx)(st,{slot:`workers`,icon:(0,J.jsx)(se,{className:`size-4`}),title:`Workers`,meta:pt({ids:d,workers:u,parentId:s,desktop:a,query:r}),open:t,onToggle:n,children:(0,J.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[o?.role===`worker`&&o.destroy?(0,J.jsx)(X,{state:o.destroy}):null,f?(0,J.jsx)(_t,{wait:f,dependencyLabel:p}):null,s?(0,J.jsx)(vt,{id:s}):null,d.length>0?(0,J.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:d.map(e=>{let t=u.get(e),n=i.data?.find(t=>t.id===e),a=t?ht(t.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,J.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":t?.status,className:`min-w-0`,children:[(0,J.jsxs)(G,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,J.jsx)(mt,{status:t?.status}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n?l(n):`Worker ${e.slice(0,8)}`}),(0,J.jsx)(`span`,{className:R(`max-w-[45%] shrink-0 truncate text-xs`,gt(t?.status)),children:a}),(0,J.jsx)(c,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),t?.destroy?(0,J.jsx)(X,{state:t.destroy}):null]},e)})}):o?.role===`root`&&r.isSuccess?(0,J.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,J.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,J.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function pt({ids:e,workers:t,parentId:n,desktop:r,query:i}){if(e.length===0)return i.isError?`Unavailable`:i.isPending?`Linking…`:n?`Parent linked`:`No workers`;let a=`${e.length} linked`;if(!r)return a;let o=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&o.set(e,(o.get(e)??0)+1)}return[a,...[...o.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function mt({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,J.jsx)(g,{"aria-hidden":!0,className:R(t,`text-success`)}):e===`failed`?(0,J.jsx)(A,{"aria-hidden":!0,className:R(t,`text-danger`)}):e===`cancelled`?(0,J.jsx)(_e,{"aria-hidden":!0,className:R(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,J.jsx)(Ke,{role:`status`,"aria-label":`Worker running`,className:R(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,J.jsx)(ie,{"aria-hidden":!0,className:R(t,`text-soft-foreground`)})}function ht(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function gt(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function _t({wait:e,dependencyLabel:t}){return(0,J.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,` `,`Deadline: `,(0,J.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]})}function vt({id:e}){let t=_(e);return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(G,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,className:ct,children:t.data?`Parent · ${l(t.data)}`:`Parent task ${e}`}),t.isError?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`px-2 text-xs`,children:`Parent record unavailable or deleted`}),(0,J.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}function X({state:e}){return e.phase===`complete`&&e.remaining.length===0&&e.error===void 0?null:(0,J.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${e.error}`:``]})}function Z(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 yt(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 Q({steps:e}){if(e.length===0)return null;let t=yt(e)*100;return(0,J.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,J.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":Z(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,J.jsx)(bt,{visual:Z(t.status)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,J.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,J.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,J.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function bt({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,J.jsx)(g,{"aria-hidden":!0,className:R(t,`text-success`)});case`active`:return(0,J.jsx)(Ke,{role:`status`,"aria-label":`Step running`,className:R(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,J.jsx)(A,{"aria-hidden":!0,className:R(t,`text-danger`)});case`pending`:return(0,J.jsx)(ie,{"aria-hidden":!0,className:R(t,`text-soft-foreground`)})}}function xt(e){let t=e.findIndex(e=>Z(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>Z(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function St({visual:e}){return(0,J.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:R(`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 Ct=new Map;function wt({runId:e,steps:t}){let[n,r]=(0,q.useState)(()=>Ct.get(e)??!1);if(t.length===0)return null;let i=t=>{Ct.set(e,t),r(t)},a=xt(t),o=t[a],s=yt(t)*100;return(0,J.jsxs)(ke,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,J.jsxs)(Oe,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group flex min-h-11 w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground md:min-h-[30px] md:gap-2.5`,children:[(0,J.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,J.jsx)(St,{visual:Z(e.status)},e.id))}),(0,J.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,J.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,J.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,J.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,J.jsx)(x,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,J.jsx)(De,{children:(0,J.jsx)(`div`,{className:`pt-2`,children:(0,J.jsx)(Q,{steps:t})})})]})}var Tt=new Map;function Et({run:e,tab:t=`session`,hasPendingHumanAsk:n=!1,onMarkedUnread:r}){let i=re(e,n),a=W(e),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),u=Ot(e,r),[,d]=(0,q.useReducer)(e=>e+1,0),f=(0,q.useId)(),p=Ge(),m=JSON.stringify([p,e.id]),h=Tt.get(m)??!1,g=()=>{Tt.set(m,!h),d()},_=E(),v=ye(),y=Ze(v.data),b=e.status===`queued`?ne(_.data??[]).get(e.id):void 0;return(0,J.jsxs)(`header`,{"data-slot":`run-header`,className:R(`relative z-20 bg-background px-[18px] pt-[18px] md:px-9 md:pt-7`,t===`session`&&`md:sticky md:top-0`),children:[(0,J.jsxs)(`div`,{className:`w-full`,children:[(0,J.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,J.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[10px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:e.delegation?.role===`worker`?`Worker session`:e.delegation?.role===`root`?`Parent session`:`Task session`}),(0,J.jsx)(kt,{run:e}),(0,J.jsxs)(He,{dot:i.tone,pulse:i.pulse,children:[i.label,b===void 0?``:` #${b}`]}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[(0,J.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":h?`Hide run details`:`Show run details`,"aria-controls":f,"aria-expanded":h,onClick:g,children:(0,J.jsx)(x,{"aria-hidden":`true`,className:R(`transition-transform motion-reduce:transition-none`,h&&`rotate-180`)})}),t!==`session`&&a.archive?(0,J.jsx)(at,{run:e}):null,(0,J.jsx)(Nt,{run:e,actions:u,onOpenChooser:()=>l(!0),onToggleNotes:()=>s(e=>!e)})]})]}),(0,J.jsx)(`div`,{id:f,"data-slot":`run-details`,className:R(h?`block`:`hidden`,`md:block`),children:(0,J.jsx)(At,{run:e,showTokens:y.tokens,showCost:y.cost,automationsAvailable:v.data?.capabilities?.automations===!0})}),(0,J.jsx)(jt,{run:e}),(0,J.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:[&>a]:min-h-11`,children:[(0,J.jsx)(K,{to:`/tasks/${e.id}`,active:t===`session`,children:`Session`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/changes`,active:t===`changes`,children:`Changes`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/commits`,active:t===`commits`,children:`Commits`}),(0,J.jsx)(K,{to:`/tasks/${e.id}/files`,active:t===`files`,children:`Files`})]}),t===`session`?null:(0,J.jsx)(lt,{run:e}),t!==`session`&&e.steps.length>0?(0,J.jsx)(`div`,{className:`border-t border-border pt-1 pb-0 md:pt-2 md:pb-1`,children:(0,J.jsx)(wt,{runId:e.id,steps:e.steps})}):null,o?(0,J.jsx)(Ft,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,J.jsx)(Dt,{run:e,canResume:W(e).terminal,onResume:()=>u.terminal.mutate(),onClose:()=>l(!1)}):null]}),(0,J.jsx)(Pt,{run:e,actions:u})]})}function Dt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let a=de(),o=y(),s=b({mutationFn:t=>v(e.id,t),onError:e=>P(e.message,{tone:`danger`})}),c=ae(o.data),l=e=>!o.isSuccess||c.includes(e??`claude`),u=t&&l(Le(e)),d=e.worktreePath?(a.data?.targets??[]).filter(e=>{let t=Ue(e.id);return t===void 0||l(t)}).map(t=>({target:t,...Ie(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];if(!u&&d.length===0)return null;let f=()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>P(`Worktree path copied`)).catch(()=>P(`Path: ${t}`))};if(r)return(0,J.jsx)(B,{onSelect:r,children:`Open in…`});let p=Re(e);return(0,J.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,J.jsx)(I,{})})]}),e.worktreePath?(0,J.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,J.jsxs)(`div`,{className:`task-open-targets mt-4 flex flex-wrap gap-3`,children:[u?(0,J.jsxs)(D,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,J.jsx)(qe,{}),`Terminal (resume session)`]}):null,d.map(({target:e,suffix:t,title:n})=>{let r=Fe(e);return(0,J.jsxs)(D,{variant:`outline`,"data-target":e.id,title:n,disabled:s.isPending,onClick:()=>s.mutate(e.id),children:[(0,J.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,J.jsxs)(D,{variant:`outline`,onClick:f,children:[(0,J.jsx)(O,{}),`Copy worktree path`]}):null]}),p?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-border pt-5`,children:[(0,J.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,J.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:p}),(0,J.jsxs)(D,{variant:`outline`,onClick:()=>void $(p,`Command copied to clipboard.`),children:[(0,J.jsx)(O,{}),`Copy resume command`]})]}):null]})}function Ot(e,t){let n=r(),i=We(),[a,o]=(0,q.useState)(null),s=()=>n.invalidateQueries({queryKey:le.runs.all}),c=e=>P(e.message,{tone:`danger`}),l=p(),u={isPending:l.isPending,mutate:()=>l.mutate({id:e.id,pinned:!e.pinned})},d=fe();return{pin:u,markUnread:{isPending:d.isPending,mutate:()=>{t?.(),d.mutate(e.id,{onError:c})}},delete:b({mutationFn:()=>be(e.id),onSuccess:()=>{s(),i(`/`)},onError:c}),terminal:b({mutationFn:()=>xe(e.id),onError:e=>{if(e instanceof me&&e.command){$(e.command,`No terminal found — command copied to clipboard.`);return}c(e)}}),confirming:a,setConfirming:o}}async function $(e,t){try{await navigator.clipboard.writeText(e),P(t)}catch{P(`Run manually: ${e}`)}}function kt({run:e}){let t=d(e.id),n=l(e),r=Ve(n,e=>t.mutate({title:e},{onError:e=>P(e.message,{tone:`danger`})}));return r.editing?(0,J.jsx)(Be,{editor:r,className:`flex-1 text-[15px] font-semibold`}):(0,J.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,J.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:n}),(0,J.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,J.jsx)(Me,{className:`size-3.5`,"aria-hidden":`true`})})]})}function At({run:e,showTokens:t,showCost:n,automationsAvailable:r}){let a=m(),o=te(),s=(0,q.useMemo)(()=>u(e,a),[e,a]),c=(0,q.useMemo)(()=>o===void 0?[]:s.map(e=>({projectId:o,kind:e.kind,number:e.number})),[s,o]),d=[(0,J.jsx)(`span`,{className:`max-md:max-w-full max-md:break-all`,children:Se(e)},`workflow`)];e.branch&&d.push((0,J.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 max-md:max-w-full max-md:break-all`,children:e.branch},`branch`));let p=s.filter(e=>e.kind===`PR`);for(let t of p)d.push((0,J.jsx)(U,{reference:t,taskTitle:l(e),className:`h-5`,conflictAction:(0,J.jsx)(ze,{run:e,prNumber:t.number})},`pr-${t.number}`));let g=i(e);g&&L(g)&&!p.some(e=>e.url===g)&&d.push((0,J.jsx)(U,{reference:{kind:`PR`,url:g},taskTitle:l(e),className:`h-5`},`pr`));let _=h(e,a);if(_&&L(_)){let t=f(_);d.push((0,J.jsx)(U,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:_},taskTitle:l(e),className:`h-5`},`issue`))}e.diffStat&&d.push((0,J.jsx)(Ye,{stat:e.diffStat},`diff`)),e.automation&&d.push(r?(0,J.jsx)(G,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,J.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`));let v=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&v.push((0,J.jsx)(Xe,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&v.push((0,J.jsx)(`span`,{className:`tabular-nums`,children:pe(e.costUsd)},`cost`)),(0,J.jsx)(Ne,{projectId:o,requests:c,children:(0,J.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[d.map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0?(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 max-md:min-w-0 max-md:max-w-full`,children:[v.map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0?(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,J.jsx)(Mt,{run:e})]})]})})}function jt({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,J.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,J.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,J.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,J.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function Mt({run:e}){let t=oe(),n=ve(),{accounts:r}=Ae(),i=e.runner??t.data?.defaultRunner??`claude`,a=e.model??`auto`,s=e.effort||void 0,c=[...e.steps].reverse().find(e=>e.profileId),l=c?.profileId,u=c?.backend??i,d=n.data?.profiles.find(e=>e.id===l),f=l===void 0||n.isPending?void 0:n.isError?l:d?je(r,u)?l==="default"?`default`:d.label:void 0:`${l} (removed)`,p=e.modelIdentity&&e.modelIdentity!==a?e.modelIdentity:void 0,m=[i,f,a,s].filter(Boolean).join(` · `);return(0,J.jsxs)(Ee,{children:[(0,J.jsx)(V,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:m,"aria-label":`Agent: ${i}, ${f?`account ${f}, `:``}model ${a}${s?`, effort ${s}`:``}`,className:`flex min-w-0 shrink items-center max-md:min-h-11 gap-1.5 rounded-sm px-1 py-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,J.jsx)(o,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{"data-slot":`agent-badge-summary`,className:`truncate font-mono text-[11px]`,children:m})]})}),(0,J.jsxs)(Te,{align:`end`,className:`min-w-[9rem] max-md:max-w-[calc(100vw-2rem)] max-md:break-all`,children:[(0,J.jsxs)(z,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,i]}),f?(0,J.jsxs)(z,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,f]}):null,(0,J.jsxs)(z,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,a]}),s?(0,J.jsxs)(z,{"data-slot":`agent-badge-effort`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`effort: `,s]}):null,p?(0,J.jsxs)(z,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,p]}):null]})]})}function Nt({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=W(e),o=Re(e);return(0,J.jsxs)(Ee,{children:[(0,J.jsx)(V,{asChild:!0,children:(0,J.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,J.jsx)(ge,{"aria-hidden":`true`})})}),(0,J.jsxs)(Te,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,J.jsx)(z,{className:`px-2 py-3 text-[10px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,J.jsxs)(B,{onSelect:n,children:[(0,J.jsx)($e,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,J.jsx)(Dt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,J.jsxs)(B,{onSelect:()=>void $(o,`Command copied to clipboard.`),children:[(0,J.jsx)(O,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,J.jsxs)(B,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,J.jsx)(et,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,J.jsxs)(we,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,J.jsx)(tt,{"aria-hidden":`true`}):(0,J.jsx)(a,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,i.deleteRun?(0,J.jsx)(Ce,{}):null,i.deleteRun?(0,J.jsxs)(B,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,J.jsx)(s,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function Pt({run:e,actions:t}){let n=t.confirming;return(0,J.jsx)(F,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,J.jsxs)(ce,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,J.jsxs)(N,{children:[(0,J.jsx)(T,{className:`text-danger`,children:`Delete task permanently?`}),(0,J.jsx)(C,{children:(0,J.jsxs)(J.Fragment,{children:[`Delete “`,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(M,{children:`Cancel`}),(0,J.jsx)(k,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function Ft({runId:e,onClose:t}){let n=ue(e);return(0,J.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,J.jsx)(I,{})})]}),n.isPending?(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,J.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,J.jsx)(Je,{children:n.data}):(0,J.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,J.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,J.jsx)(D,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void $(n.data??``,`Notes copied`),children:`Copy notes`}),(0,J.jsx)(D,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{ft as a,ot as c,Z as i,at as l,Q as n,ut as o,xt as r,st as s,Et as t,$e as u};
|