@wjarka/cezarion 0.18.0-dev.6810 → 0.18.0-dev.6835
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/package.json +2 -2
- package/web/dist/assets/{activity-motion-AuQA350-.js → activity-motion-awuRigEi.js} +1 -1
- package/web/dist/assets/{activity-route-BNZ9bOOZ.js → activity-route-rhYVhpXu.js} +1 -1
- package/web/dist/assets/{agent-accounts-D2uZHuiM.js → agent-accounts-D3q1WLxk.js} +1 -1
- package/web/dist/assets/attention-CdwMIvQG.js +1 -0
- package/web/dist/assets/{cez-idle-MToU9Wv_.js → cez-idle-BqmM5iRr.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-DBW7us79.js → commit-diff-panel-CZAQ_wMQ.js} +1 -1
- package/web/dist/assets/{diff-C3Cms5Ep.js → diff-BDJ4xGSd.js} +2 -2
- package/web/dist/assets/{diff-view-D5zTYOKV.js → diff-view-Bn7tV6S7.js} +1 -1
- package/web/dist/assets/{file-preview-FhzIdXZ3.js → file-preview-1f8vPVsK.js} +1 -1
- package/web/dist/assets/{git-toolbar-MFjkjDDG.js → git-toolbar-BbY7l1x9.js} +1 -1
- package/web/dist/assets/{github-CYmdc5Dh.js → github-CTdrVztq.js} +1 -1
- package/web/dist/assets/{global-activity-route-C41ofuHV.js → global-activity-route-xvY0P60v.js} +1 -1
- package/web/dist/assets/{index-e1OpsDKN.js → index-MgNz22Tg.js} +4 -4
- package/web/dist/assets/{live-protocol-B8boP96Z.js → live-protocol-BmbbwF5R.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Ds209_UZ.js → preview-pane-connected-D6TfZFTU.js} +1 -1
- package/web/dist/assets/{project-router-F1inY-EB.js → project-router-BqAKGSaS.js} +1 -1
- package/web/dist/assets/{project-scope-context-0Z0nsheq.js → project-scope-context-B0yKt2yI.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-uUjg9v98.js → prompt-template-menu-DpCrLDWG.js} +1 -1
- package/web/dist/assets/{queries-7W9tOZsg.js → queries-DoYRza8s.js} +1 -1
- package/web/dist/assets/{reference-chip-BqRpnpaI.js → reference-chip-Dd_YU2KX.js} +1 -1
- package/web/dist/assets/{repo-git-BZcRanYE.js → repo-git-BrkR6pTH.js} +1 -1
- package/web/dist/assets/{report-reader-BLlV3dPF.js → report-reader-BeZdoVhf.js} +1 -1
- package/web/dist/assets/{reports-C--EXqf1.js → reports-D93WfzdD.js} +1 -1
- package/web/dist/assets/{run-header-CJg8dyfz.js → run-header-FB4j_Fjm.js} +1 -1
- package/web/dist/assets/{skills-CHWVejdV.js → skills-BV3eF6mC.js} +1 -1
- package/web/dist/assets/{tab-link-XI9xWLwR.js → tab-link-CGzPcVvS.js} +1 -1
- package/web/dist/assets/{task-changes-DFm_EHnj.js → task-changes-f9ldtHuA.js} +1 -1
- package/web/dist/assets/{task-commits-BX-GVdXG.js → task-commits-CLjEhkFM.js} +1 -1
- package/web/dist/assets/{task-files-Dsn11PYu.js → task-files-BEKlg0dR.js} +1 -1
- package/web/dist/assets/{task-github-item-3N6jEijR.js → task-github-item-CbdPCKot.js} +1 -1
- package/web/dist/assets/{task-thread-VNPhkI8i.js → task-thread-BPSL3OMS.js} +1 -1
- package/web/dist/assets/{thread-state-D1XLo7ab.js → thread-state-ZdBez7Ij.js} +1 -1
- package/web/dist/assets/{use-desktop-DdcA0Atl.js → use-desktop-BwkqVHep.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-2tzEmCDo.js → use-hand-to-agent-state-BOD9cT6o.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BmmIZbVY.js → useInfiniteQuery-DYAQvmMU.js} +1 -1
- package/web/dist/assets/useQuery-CnVG8NoC.js +1 -0
- package/web/dist/assets/{workflows-CqqdPBFr.js → workflows-Driy32Xn.js} +1 -1
- package/web/dist/assets/{ws-BvDSfSVH.js → ws-BXpZYApG.js} +1 -1
- package/web/dist/index.html +14 -14
- package/web/dist/live-worker.js +1 -1
- package/web/dist/assets/attention-B7icDSLh.js +0 -1
- package/web/dist/assets/useQuery-CBKC2lBX.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,S as r,d as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{$n as l,Bn as u,Gt as d,Jn as f,Ln as p,Ur as ee,Vn as te,Wt as m,Yn as h,er as g,i as _,k as ne,nr as v,o as re,yr as ie}from"./project-scope-context-0Z0nsheq.js";import{$ as y,H as b,P as ae,Q as oe,R as se,St as x,Tt as ce,U as S,V as C,Yt as le,en as ue,ht as de,n as fe,nn as w,nt as pe,q as T,tn as me,x as he,xt as ge,z as _e}from"./queries-7W9tOZsg.js";import{J as ve,L as ye,S as E,_ as be,a as xe,b as Se,d as Ce,f as we,n as Te,o as Ee,p as D,r as De,v as Oe,y as ke,z as O}from"./use-desktop-DdcA0Atl.js";import{n as k}from"./toaster-CoMJoQvk.js";import{I as Ae,S as je,Y as Me,_ as Ne,a as Pe,g as Fe,h as Ie,j as Le,m as Re,mt as ze,o as Be,p as Ve,st as He,t as Ue,u as We,y as A}from"./design-icons-DmYTv2r1.js";import{t as j}from"./createLucideIcon-BHp8sXmF.js";import{t as Ge}from"./app-window-CSHwDX9N.js";import{t as Ke}from"./info-DA1x_4bz.js";import{a as qe,t as Je}from"./format-BNCkW110.js";import{t as Ye}from"./message-square-B-MD-8rD.js";import{i as Xe,n as Ze,t as M}from"./reference-chip-BqRpnpaI.js";import{a as N,i as P,l as F,n as I,p as L,r as R,t as z}from"./dropdown-menu-DPrTX-zi.js";import{a as B,c as V,i as H,n as U,o as Qe,r as $e,s as et,t as tt}from"./alert-dialog-CH4SXGfX.js";import{a as nt,i as rt,o as it,r as at,s as ot,t as st}from"./dialog-B7p5oc5r.js";import{c as ct,s as lt,t as W}from"./project-router-F1inY-EB.js";import"./attention-B7icDSLh.js";import{$ as ut,$t as dt,Bt as ft,Jt as pt,Kt as mt,L as ht,M as gt,N as _t,Ot as G,Rt as vt,Yt as yt,_ as bt,_n as xt,_t as St,a as Ct,bt as wt,cn as Tt,j as Et,kt as K,nn as Dt,o as Ot,qt as kt,r as At,t as jt,tn as Mt,vt as Nt,wt as Pt,xt as Ft,z as It,zt as Lt}from"./index-e1OpsDKN.js";import{t as q}from"./tab-link-XI9xWLwR.js";var Rt=j(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),zt=j(`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`}]]),Bt=j(`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`}]]),J=e(s(),1),Y=c();function Vt(e){let t=le();return w({mutationFn:t=>re(me(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>ue()),onError:e=>k(e.message,{tone:`danger`})})}function Ht(e){return e.archived?`Unarchive`:`Archive task`}function Ut({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(tt,{open:t,onOpenChange:n,children:(0,Y.jsxs)(H,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(et,{children:[(0,Y.jsx)(V,{children:`Archive task?`}),(0,Y.jsxs)(B,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:O(e),children:O(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(Qe,{children:[(0,Y.jsx)($e,{children:`Cancel`}),(0,Y.jsx)(U,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function X({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,J.useState)(!1),s=Vt(e.id),c=Ht(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(a,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:s.isPending,className:o(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?s.mutate(!1):i(!0),children:[e.archived?(0,Y.jsx)(xt,{"aria-hidden":`true`}):(0,Y.jsx)(Ue,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:o(n&&`max-md:sr-only`),children:c})]}),(0,Y.jsx)(Ut,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function Wt({run:e,action:t,prUrl:n,patch:r}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,Y.jsx)(a,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(a,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>k(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Gt({run:e,blocker:t,flags:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Y.jsx)(a,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(W,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,Y.jsx)(a,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(X,{run:e}):null]})]})}function Kt({run:e}){let t=b(e.id),n=K(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Y.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,Y.jsx)(Wt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Y.jsx)(Gt,{run:e,blocker:i,flags:n}):null]})}var qt=[`running`,`queued`,`waiting`];function Jt(e,{queuePosition:t,now:n=new Date}){let r=p(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=qt.includes(e.status)?Xt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Yt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Xt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Je(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),k(t)}catch{k(`Run manually: ${e}`)}}function Zt(e){let t=T(),n=pe(),r=(0,J.useMemo)(()=>E(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>Ce(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Qt(e){return w({mutationFn:()=>d(e.id),onError:e=>{if(e instanceof _&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}k(e.message,{tone:`danger`})}})}function Q(e,t){let n=C(),r=y(),i=w({mutationFn:t=>m(e.id,t),onError:e=>k(e.message,{tone:`danger`})}),a=ie(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`);return{canResumeHere:t&&o(Pt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=pt(e.id);return t===void 0||o(t)}).map(t=>({target:t,...Ft(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:i}}function $t({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=Q(e,t),s=G(e);return!r&&i.length===0&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(a,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)(dt,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=yt(e);return(0,Y.jsxs)(a,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(a,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>k(`Worktree path copied`)).catch(()=>k(`Path: ${t}`))},children:[(0,Y.jsx)(A,{}),`Copy worktree path`]}):null]}):null,s?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Y.jsxs)(a,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(A,{}),`Copy resume command`]})]}):null]})}function en({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=Q(e,t),s=G(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(kt,{choices:i,onPick:e=>o.mutate(e),disabled:o.isPending,triggerVariant:`outline`,className:l,leading:r?(0,Y.jsxs)(P,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(dt,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,Y.jsxs)(a,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Z(c,`Worktree path copied`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,Y.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function tn({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:o,choices:s}=Q(e,t);return!o&&s.length===0?null:r?(0,Y.jsx)(P,{onSelect:r,children:`Open in…`}):(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(ze,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)($t,{run:e,canResume:t,onResume:n})})]})}function nn({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{k(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Y.jsx)(A,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function rn({run:e}){let t=T(),n=pe(),r=r=>n===void 0?void 0:Oe(n,e.id,r,t),a=(0,J.useMemo)(()=>E(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Y.jsx)(M,{reference:t,to:r(t),taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)(Nt,{run:e,prNumber:t.number})},D(t)));let l=Se(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,Y.jsx)(M,{reference:{kind:`PR`,url:l},taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Y.jsx)(M,{reference:t,to:r(t),taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},D(t)));let d=be(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=we(d);s.push((0,Y.jsx)(M,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Y.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Y.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function an(){let e=lt(),t=oe();return Et(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var on=e=>e.map(e=>`${e.name}: ${gt(e.url)}`).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,S as r,d as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{$n as l,Bn as u,Gt as d,Jn as f,Ln as p,Ur as ee,Vn as te,Wt as m,Yn as h,er as g,i as _,k as ne,nr as v,o as re,yr as ie}from"./project-scope-context-B0yKt2yI.js";import{$ as y,H as b,P as ae,Q as oe,R as se,St as x,Tt as ce,U as S,V as C,Yt as le,en as ue,ht as de,n as fe,nn as w,nt as pe,q as T,tn as me,x as he,xt as ge,z as _e}from"./queries-DoYRza8s.js";import{J as ve,L as ye,S as E,_ as be,a as xe,b as Se,d as Ce,f as we,n as Te,o as Ee,p as D,r as De,v as Oe,y as ke,z as O}from"./use-desktop-BwkqVHep.js";import{n as k}from"./toaster-CoMJoQvk.js";import{I as Ae,S as je,Y as Me,_ as Ne,a as Pe,g as Fe,h as Ie,j as Le,m as Re,mt as ze,o as Be,p as Ve,st as He,t as Ue,u as We,y as A}from"./design-icons-DmYTv2r1.js";import{t as j}from"./createLucideIcon-BHp8sXmF.js";import{t as Ge}from"./app-window-CSHwDX9N.js";import{t as Ke}from"./info-DA1x_4bz.js";import{a as qe,t as Je}from"./format-BNCkW110.js";import{t as Ye}from"./message-square-B-MD-8rD.js";import{i as Xe,n as Ze,t as M}from"./reference-chip-Dd_YU2KX.js";import{a as N,i as P,l as F,n as I,p as L,r as R,t as z}from"./dropdown-menu-DPrTX-zi.js";import{a as B,c as V,i as H,n as U,o as Qe,r as $e,s as et,t as tt}from"./alert-dialog-CH4SXGfX.js";import{a as nt,i as rt,o as it,r as at,s as ot,t as st}from"./dialog-B7p5oc5r.js";import{c as ct,s as lt,t as W}from"./project-router-BqAKGSaS.js";import"./attention-CdwMIvQG.js";import{$ as ut,$t as dt,Bt as ft,Jt as pt,Kt as mt,L as ht,M as gt,N as _t,Ot as G,Rt as vt,Yt as yt,_ as bt,_n as xt,_t as St,a as Ct,bt as wt,cn as Tt,j as Et,kt as K,nn as Dt,o as Ot,qt as kt,r as At,t as jt,tn as Mt,vt as Nt,wt as Pt,xt as Ft,z as It,zt as Lt}from"./index-MgNz22Tg.js";import{t as q}from"./tab-link-CGzPcVvS.js";var Rt=j(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),zt=j(`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`}]]),Bt=j(`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`}]]),J=e(s(),1),Y=c();function Vt(e){let t=le();return w({mutationFn:t=>re(me(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>ue()),onError:e=>k(e.message,{tone:`danger`})})}function Ht(e){return e.archived?`Unarchive`:`Archive task`}function Ut({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(tt,{open:t,onOpenChange:n,children:(0,Y.jsxs)(H,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(et,{children:[(0,Y.jsx)(V,{children:`Archive task?`}),(0,Y.jsxs)(B,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:O(e),children:O(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(Qe,{children:[(0,Y.jsx)($e,{children:`Cancel`}),(0,Y.jsx)(U,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function X({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,J.useState)(!1),s=Vt(e.id),c=Ht(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(a,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:s.isPending,className:o(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?s.mutate(!1):i(!0),children:[e.archived?(0,Y.jsx)(xt,{"aria-hidden":`true`}):(0,Y.jsx)(Ue,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:o(n&&`max-md:sr-only`),children:c})]}),(0,Y.jsx)(Ut,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function Wt({run:e,action:t,prUrl:n,patch:r}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&i(n)?(0,Y.jsx)(a,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(a,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>k(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Gt({run:e,blocker:t,flags:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Y.jsx)(a,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(W,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&i(t.pullRequestUrl)?(0,Y.jsx)(a,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(X,{run:e}):null]})]})}function Kt({run:e}){let t=b(e.id),n=K(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Y.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,Y.jsx)(Wt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Y.jsx)(Gt,{run:e,blocker:i,flags:n}):null]})}var qt=[`running`,`queued`,`waiting`];function Jt(e,{queuePosition:t,now:n=new Date}){let r=p(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=qt.includes(e.status)?Xt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Yt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Xt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Je(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),k(t)}catch{k(`Run manually: ${e}`)}}function Zt(e){let t=T(),n=pe(),r=(0,J.useMemo)(()=>E(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>Ce(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Qt(e){return w({mutationFn:()=>d(e.id),onError:e=>{if(e instanceof _&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}k(e.message,{tone:`danger`})}})}function Q(e,t){let n=C(),r=y(),i=w({mutationFn:t=>m(e.id,t),onError:e=>k(e.message,{tone:`danger`})}),a=ie(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`);return{canResumeHere:t&&o(Pt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=pt(e.id);return t===void 0||o(t)}).map(t=>({target:t,...Ft(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:i}}function $t({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=Q(e,t),s=G(e);return!r&&i.length===0&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(a,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)(dt,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=yt(e);return(0,Y.jsxs)(a,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(a,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>k(`Worktree path copied`)).catch(()=>k(`Path: ${t}`))},children:[(0,Y.jsx)(A,{}),`Copy worktree path`]}):null]}):null,s?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Y.jsxs)(a,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(A,{}),`Copy resume command`]})]}):null]})}function en({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=Q(e,t),s=G(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(kt,{choices:i,onPick:e=>o.mutate(e),disabled:o.isPending,triggerVariant:`outline`,className:l,leading:r?(0,Y.jsxs)(P,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(dt,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,Y.jsxs)(a,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Z(c,`Worktree path copied`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,Y.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function tn({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:o,choices:s}=Q(e,t);return!o&&s.length===0?null:r?(0,Y.jsx)(P,{onSelect:r,children:`Open in…`}):(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(ze,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)($t,{run:e,canResume:t,onResume:n})})]})}function nn({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{k(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Y.jsx)(A,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function rn({run:e}){let t=T(),n=pe(),r=r=>n===void 0?void 0:Oe(n,e.id,r,t),a=(0,J.useMemo)(()=>E(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Y.jsx)(M,{reference:t,to:r(t),taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)(Nt,{run:e,prNumber:t.number})},D(t)));let l=Se(e);l&&i(l)&&!c.some(e=>e.url===l)&&o.push((0,Y.jsx)(M,{reference:{kind:`PR`,url:l},taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Y.jsx)(M,{reference:t,to:r(t),taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},D(t)));let d=be(e,t);if(d&&i(d)&&!u.some(e=>e.url===d)){let t=we(d);s.push((0,Y.jsx)(M,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:O(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Y.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Y.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function an(){let e=lt(),t=oe();return Et(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var on=e=>e.map(e=>`${e.name}: ${gt(e.url)}`).join(`
|
|
2
2
|
`);function sn(e){return an().length>0||e.notify===!0}function cn({run:e}){let t=an(),n=t.length>0,r=_e(e.id),[i,o]=(0,J.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[s?(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${_t(t)} — webhook actions`:`Notifying — webhook actions`,title:n?on(t):void 0,children:[(0,Y.jsx)(mt,{tone:`success`}),(0,Y.jsx)(`span`,{children:`Notifying`}),(0,Y.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Y.jsxs)(R,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Y.jsx)(N,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,Y.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:gt(e.url),children:e.name},e.id))}):null,n?(0,Y.jsxs)(P,{className:`min-h-11`,onSelect:()=>o(`note`),children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Y.jsxs)(P,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>k(`Stopped notifying the webhook`),onError:e=>k(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Y.jsx)(Rt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Y.jsxs)(a,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>o(`handoff`),children:[(0,Y.jsx)(Mt,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Y.jsx)(ln,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&o(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{o(null),k(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>k(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function ln({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let o=(0,J.useId)(),s=(0,J.useId)(),[c,l]=(0,J.useState)(``);(0,J.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=_t(t);return(0,Y.jsx)(st,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,Y.jsx)(at,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Y.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,Y.jsxs)(it,{className:`text-left`,children:[(0,Y.jsx)(ot,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Y.jsx)(rt,{children:(0,Y.jsx)(`span`,{"data-webhook-destination":``,title:on(t),children:u?`${d} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${d} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(`label`,{htmlFor:o,className:`text-[13px] font-medium`,children:`Note`}),(0,Y.jsx)(ut,{id:o,"data-slot":`handoff-note`,"aria-describedby":s,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:c,onChange:e=>l(e.target.value)}),(0,Y.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Y.jsx)(Ke,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Y.jsxs)(nt,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Y.jsx)(a,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(a,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,Y.jsx)(Mt,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function un({runId:e,children:t}){let n=r(),i=(0,J.useMemo)(()=>({runId:e}),[e]);return n?(0,Y.jsx)(dn,{runId:e,children:t}):(0,Y.jsx)(It.Provider,{value:i,children:t})}function dn({runId:e,children:n}){let{projectId:r}=t(),i=(0,J.useMemo)(()=>({runId:e,...r?{projectId:r}:{}}),[e,r]);return(0,Y.jsx)(It.Provider,{value:i,children:n})}function fn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function pn(e){return typeof e==`object`&&!!e&&!(0,J.isValidElement)(e)&&`keep`in e}function mn({slot:e,icon:t,title:n,meta:r,summary:i,aside:a,open:s,onToggle:c,className:l,children:u}){let d=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,Y.jsx)(`span`,{className:o(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),i??(pn(r)?(0,Y.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,Y.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,Y.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,Y.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),f=c!==void 0;return(0,Y.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:o(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,a,(0,Y.jsx)(We,{"aria-hidden":!0,className:o(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!a&&`ms-auto`,s&&`rotate-180`)})]}):(0,Y.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,a]}),f&&s?(0,Y.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:u}):null]})}function hn(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function gn(e){let t=e.delegation,n=t?.role===`root`,r=x(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=hn(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 _n(e){let t=x(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>ve(e.status))}function vn({run:e,open:t,onToggle:n}){let r=x(e.id),i=ce(),s=Te(),c=e.delegation,u=new Map(r.data?.workers.map(e=>[e.workerId,e])),d=hn(c,r.data),f=l(e)??v(e),p=f?yn(e,f):void 0;return(0,Y.jsx)(mn,{slot:`workers`,icon:(0,Y.jsx)(Le,{className:`size-4`}),title:`Workers`,meta:bn({ids:d,workers:u,desktop:s,query:r}),aside:r.data?.capacity?(0,Y.jsx)(Dn,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,Y.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,f?(0,Y.jsx)(wn,{wait:f,dependencyLabel:p}):null,d.length>0?(0,Y.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:d.map(t=>{let n=u.get(t),a=i.data?.find(e=>e.id===t)??r.data?.titles?.find(e=>e.id===t),s=n?Sn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,Y.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,Y.jsxs)(W,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Y.jsx)(xn,{status:n?.status}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a?O(a):`Worker ${t.slice(0,8)}`}),(0,Y.jsx)(`span`,{className:o(`max-w-[45%] shrink-0 truncate text-xs`,Cn(n?.status)),children:s}),(0,Y.jsx)(Be,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,Y.jsx)(kn,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,Y.jsx)(An,{state:n.destroy}):null]},t)})}):c?.role===`root`&&r.isSuccess?(0,Y.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,Y.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function yn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return te(e)??u(n.role,t,`requestIds`in t&&g(n,t.requestIds))}function bn({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function xn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,Y.jsx)(Ve,{"aria-hidden":!0,className:o(t,`text-success`)}):e===`failed`?(0,Y.jsx)(Ne,{"aria-hidden":!0,className:o(t,`text-danger`)}):e===`cancelled`?(0,Y.jsx)(Fe,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,Y.jsx)(qe,{role:`status`,"aria-label":`Worker running`,className:o(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,Y.jsx)(Ie,{"aria-hidden":!0,className:o(t,`text-soft-foreground`)})}function Sn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function Cn(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function wn({wait:e,dependencyLabel:t}){return(0,Y.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`requestIds`in e&&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`in e?(0,Y.jsxs)(Y.Fragment,{children:[` `,`Deadline: `,(0,Y.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: ${n(`Cezar`)} wakes this task when they have all settled.`]})}function Tn(e){return e.delegation?.role===`worker`&&v(e)?.phase===`wake-pending`}function En({run:e}){let t=v(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,Y.jsx)(wn,{wait:t,dependencyLabel:u(`worker`,t)}):null}function Dn({capacity:e}){return(0,Y.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var On=new Set([`review`,`done`,`failed`,`cancelled`]);function kn({parentRunId:e,worker:t}){let n=he(e),[r,i]=(0,J.useState)(!1);if(!On.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let o=t.workerId.slice(0,8),s=!!t.destroy&&t.destroy.phase!==`complete`;return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`break-words text-xs`,children:`Removes this worker's worktree and branch. Its result is saved first.`}),(0,Y.jsx)(a,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${o}`,onClick:()=>{i(!1),n.mutate(t.workerId)},children:`Clean up`}),(0,Y.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,Y.jsx)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":s?`Retry clean up of worker ${o}`:`Clean up worker ${o}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:s?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,Y.jsxs)(`span`,{role:`status`,className:`break-words text-xs`,children:[`Cleanup did not finish: `,n.error.message]}):null]})}function $(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function An({state:e}){if(!$(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,Y.jsx)(jn,{at:t.nextAt});return(0,Y.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,Y.jsxs)(Y.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,Y.jsxs)(Y.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function jn({at:e}){let t=St(3e4);return(0,Y.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:jt(t,Date.parse(e))})}function Mn({id:e}){return(0,Y.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,Y.jsx)(Pe,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Nn({id:e}){let t=de(e),n=t.data?O(t.data):e;return(0,Y.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,Y.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,Y.jsx)(Pe,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Y.jsx)(a,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Pn=3,Fn=(e,t)=>e.kind===t.kind&&e.number===t.number;function In(e,t,n=Pn){let r=t?e.findIndex(e=>Fn(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Ln=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Rn({tab:e}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(e.kind===`pr`?Ae:Re,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Y.jsx)(Ze,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function zn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Bn({servers:e}){let t=bt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,Y.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Y.jsx)(Ge,{"aria-hidden":`true`}),zn(e,n),t.live?(0,Y.jsx)(mt,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Vn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function Hn({run:e,compact:t=!1}){return e.delegation?.role===`worker`?t?(0,Y.jsx)(Mn,{id:e.delegation.parentRunId}):(0,Y.jsx)(Nn,{id:e.delegation.parentRunId}):null}function Un(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!wt(e,r))?(0,Y.jsx)(X,{run:e}):null}function Wn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Y.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Gn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=sn(t);return e&&(n||r||i)?(0,Y.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,Y.jsx)(cn,{run:t})]}):null}function Kn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,J.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,J.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,Y.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,Y.jsx)(q,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,Y.jsx)(q,{to:Ln(e.id,t),active:n!==null&&Fn(t,n),replace:a,children:(0,Y.jsx)(Rn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,Y.jsxs)(z,{children:[(0,Y.jsxs)(L,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,Y.jsx)(R,{align:`end`,children:i.map(t=>(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(W,{to:Ln(e.id,t),replace:a,children:(0,Y.jsx)(Rn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function qn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=p(e),i=K(e),a=_n(e),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),d=Jn(e,n),f=ce(),ee=ae(),te=Jt(e,{queuePosition:e.status===`queued`?ye(f.data??[]).get(e.id):void 0}),m=ft(),h=Lt(),g=m!==null&&!h?m:null,_=g!==null,{referenceProjectId:ne,repoBase:v,requests:re}=Zt(e),ie=(0,J.useMemo)(()=>ke(e,v),[e,v]),y=typeof t==`object`?t:null,{inline:b,overflow:oe}=In(ie,y),se=ee.data?.capabilities?.preview===!0,x=e.worktreePath&&se?(0,Y.jsx)(Bn,{servers:e.previewServers??[]}):null,S=(0,Y.jsx)(Qn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),C=Un(e,i,t,a);return(0,Y.jsx)(Xe,{projectId:ne,repoBase:v,requests:re,children:(0,Y.jsxs)(`header`,{"data-slot":`run-header`,className:o(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,_?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,Y.jsx)(Wn,{run:e}),(0,Y.jsx)(Kt,{run:e}),(0,Y.jsxs)(`div`,{className:`w-full`,children:[(0,Y.jsx)(Hn,{run:e}),g?(0,Y.jsxs)(vt,{slot:g,children:[(0,Y.jsx)(Zn,{run:e}),(0,Y.jsx)(Hn,{run:e,compact:!0}),S]}):(0,Y.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,Y.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:Vn(e.delegation)}),(0,Y.jsx)(Xn,{run:e}),(0,Y.jsx)(At,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Yt(te)}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[C,x,(0,Y.jsx)(cn,{run:e}),S]})]}),(0,Y.jsx)(Gn,{shown:g!==null,run:e,archiveButton:C,previewToggle:x}),(0,Y.jsx)(Kn,{run:e,tab:t,activeItem:y,inlineItemTabs:b,overflowItemTabs:oe,phoneBar:_,isDesktop:h}),s?(0,Y.jsx)(tr,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,Y.jsx)(tn,{run:e,canResume:K(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Y.jsx)(er,{run:e,actions:d})]})})}function Jn(e,t){let n=ee(),r=ct(),[i,a]=(0,J.useState)(null),o=()=>n.invalidateQueries({queryKey:fe.runs.all}),s=e=>k(e.message,{tone:`danger`}),c=S(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=se();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:w({mutationFn:()=>ne(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Qt(e),confirming:i,setConfirming:a}}function Yn(e){let t=b(e.id),n=O(e);return{title:n,editor:Ot(n,e=>t.mutate({title:e},{onError:e=>k(e.message,{tone:`danger`})}))}}function Xn({run:e}){let{title:t,editor:n}=Yn(e);return n.editing?(0,Y.jsx)(Ct,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Dt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Zn({run:e}){let{title:t,editor:n}=Yn(e);return(0,Y.jsxs)(De,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,Y.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,Y.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,Y.jsx)(Ee,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Dt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(xe,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,Y.jsx)(Ct,{editor:n,className:`text-[16px] font-semibold`})})]})}function Qn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=K(e),o=G(e),s=b(e.id),c=(0,J.useId)();return(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(a,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Y.jsx)(je,{"aria-hidden":`true`})})}),(0,Y.jsxs)(R,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Y.jsx)(N,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,Y.jsxs)(P,{onSelect:n,children:[(0,Y.jsx)(Tt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Y.jsx)(tn,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,Y.jsxs)(P,{onSelect:()=>void Z(o,`Command copied to clipboard.`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Y.jsxs)(P,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Y.jsx)(zt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Y.jsxs)(I,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Y.jsx)(Bt,{"aria-hidden":`true`}):(0,Y.jsx)(Me,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Y.jsx)(F,{}),(0,Y.jsx)(N,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Y.jsx)(I,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>k(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Y.jsx)(I,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:s.isPending,"aria-describedby":c,onCheckedChange:e=>s.mutate({autoMergePr:e},{onError:e=>k(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Y.jsx)(`p`,{id:c,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,Y.jsx)($n,{run:e,patch:s}),i.deleteRun?(0,Y.jsx)(F,{}):null,i.deleteRun?(0,Y.jsxs)(P,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(He,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function $n({run:e,patch:t}){let r=(0,J.useId)(),i=(0,J.useId)(),a=(0,J.useId)(),o=e=>k(e.message,{tone:`danger`});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{}),(0,Y.jsx)(N,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Y.jsxs)(I,{"data-slot":`allow-workers`,className:`min-h-11`,checked:h(e),disabled:t.isPending,"aria-describedby":`${r} ${a}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:o}),children:[`Allow `,n(`cezar`),` workers`]}),(0,Y.jsxs)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:[`Agents in this task can start `,n(`Cezar`),` workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`]}),(0,Y.jsx)(I,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:f(e),disabled:t.isPending,"aria-describedby":`${i} ${a}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:o}),children:`Allow task messaging`}),(0,Y.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,Y.jsx)(`p`,{id:a,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function er({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(tt,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(H,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(et,{children:[(0,Y.jsx)(V,{className:`text-danger`,children:`Delete task permanently?`}),(0,Y.jsx)(B,{children:(0,Y.jsxs)(Y.Fragment,{children:[`Delete “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:O(e),children:O(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,Y.jsxs)(Qe,{children:[(0,Y.jsx)($e,{children:`Cancel`}),(0,Y.jsx)(U,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function tr({runId:e,onClose:t}){let n=ge(e);return(0,Y.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Y.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Y.jsx)(ze,{})})]}),n.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Y.jsx)(un,{runId:e,children:(0,Y.jsx)(ht,{children:n.data})}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Y.jsx)(a,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Y.jsx)(a,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Jt as _,$ as a,gn as c,un as d,nn as f,Zt as g,Qt as h,En as i,mn as l,en as m,An as n,Tn as o,rn as p,vn as r,_n as s,qn as t,fn as u,X as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{D as t,I as n,L as r,M as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{Lt as l,Sn as u,Ur as d,an as f,en as p,f as m}from"./project-scope-context-0Z0nsheq.js";import{$ as h,J as g,Q as _,R as v,X as y,Z as b,at as x,nt as S,tt as C}from"./live-protocol-B8boP96Z.js";import{At as ee,I as te,Lt as ne,X as re,n as w,nn as T}from"./queries-7W9tOZsg.js";import{t as ie}from"./useQuery-CBKC2lBX.js";import{n as E}from"./toaster-CoMJoQvk.js";import{G as ae,Q as oe,Z as D,ct as O,d as se,l as ce,mt as le,u as ue}from"./design-icons-DmYTv2r1.js";import{t as de}from"./project-router-F1inY-EB.js";import{c as fe,i as pe,o as me,p as he}from"./skills-DFBiAuJG.js";import{t as ge}from"./centered-state-B5QmAy2y.js";import{I as _e,P as ve,Xt as ye,Zt as k}from"./index-e1OpsDKN.js";import{t as be}from"./skill-empty-hint-YDmkqgo-.js";var A=e(s(),1),j=`owner/name, an https, ssh or git URL, git@host:path, or a local or file:// path`,xe=new Set([`https`,`http`,`ssh`,`git`,`file`]);function M(e){let t=e.trim();if(!t||t.startsWith(`-`)||t.includes(`::`))return null;if(t.startsWith(`~/`))return`home`;if(/^(\/|\.\/|\.\.\/)/.test(t)||/^[A-Za-z]:[\\/]/.test(t))return`local`;if(/^[\w.-]+\/[\w.-]+$/.test(t))return`github`;let n=/^([a-z][a-z0-9+.-]*):\/\//i.exec(t);return n?xe.has(n[1].toLowerCase())?`url`:null:/^[\w.-]+@[\w.-]+:/.test(t)?`scp`:null}function N(e){return e.length>0&&e.length<=256&&!e.startsWith(`-`)&&!e.includes(`..`)&&/^[A-Za-z0-9._/-]+$/.test(e)}var Se=x().trim().min(1).max(500).refine(e=>M(e)!==null,{message:`Use ${j}.`}),Ce=x().trim().refine(N,{message:`Use a branch, tag or commit SHA, such as main.`}),we=S({repo:x().min(1).max(500),ref:x().min(1).max(256)}).strict();S({repo:Se,ref:Ce.optional()}).strict(),we.extend({enabled:b()}).strict();var Te=g([`refused-format`,`fetch-failed`,`ref-not-found`]),Ee=_(`state`,[S({state:h(`idle`)}),S({state:h(`loading`)}),S({state:h(`ok`),skillCount:C().int().min(0)}),S({state:h(`error`),cause:Te,detail:x(),skillCount:C().int().min(0)})]);S({sources:y(S({repo:x(),ref:x(),enabled:b(),status:Ee})),editable:b(),configIssue:x().nullable()});var P=()=>[i(),`skills`,`sources`];async function De(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$get({param:{projectId:i()}},l(e)),`/skills/sources`)}async function Oe(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$post({param:{projectId:i()},json:e}),`/skills/sources`)}async function ke(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$patch({param:{projectId:i()},json:e}),`/skills/sources`)}async function Ae(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$delete({param:{projectId:i()},json:e}),`/skills/sources`)}async function je(e){return u(await m.api.v1.p[`:projectId`].skills.sources.retry.$post({param:{projectId:i()},json:e}),`/skills/sources/retry`)}var F=c(),Me=1e3,I=e=>`${e.repo} @ ${e.ref}`;function Ne(){return ie({queryKey:P(),queryFn:({signal:e})=>De({signal:e}),refetchInterval:e=>e.state.data?.sources.some(e=>e.status.state===`loading`)?Me:!1})}function L(){return{sources:P(),lists:[w.skills,w.skillsReady,w.importableSkills,w.importableSkillsReady]}}function R(e,t=L()){for(let n of t.lists)e.invalidateQueries({queryKey:n,exact:!0})}function z(e,t){let n=d();return T({mutationFn:async t=>{let n=L();return{answer:await e(t),keys:n}},onSuccess:({answer:e,keys:r},i)=>{n.setQueryData(r.sources,e),n.invalidateQueries({queryKey:r.sources,exact:!0}),R(n,r),t?.(i)},onError:e=>E(e.message,{tone:`danger`})})}function Pe(e){let t=d(),n=(0,A.useRef)(!1),r=e?.sources.some(e=>e.status.state===`loading`)??!1;(0,A.useEffect)(()=>{n.current&&!r&&R(t),n.current=r},[r,t])}function Fe(){let e=Ne();Pe(e.data);let t=z(ke),i=z(Ae,e=>E(`Removed ${I(e)}. Add it again to restore its skill switches.`)),o=z(je),s=e.data,c=s?.editable===!0&&s.configIssue===null,l=t.isPending||i.isPending;return(0,F.jsxs)(`section`,{"data-slot":`skill-sources`,"aria-labelledby":`skill-sources-heading`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-3 @min-[520px]:p-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{id:`skill-sources-heading`,className:`text-[15px] font-semibold`,children:`Team skill sources`}),(0,F.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`Repos whose skills this project can use. Changes are saved to`,` `,(0,F.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/config.json`}),`.`]})]}),e.isError?(0,F.jsxs)(B,{slot:`skill-sources-error`,alert:!0,children:[`Could not load the team skill sources: `,e.error.message,` `,(0,F.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2 min-h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,s?.configIssue?(0,F.jsx)(B,{slot:`skill-sources-config-issue`,alert:!0,children:s.configIssue}):null,s&&!s.editable?(0,F.jsxs)(B,{slot:`skill-sources-read-only`,children:[`Sources are read-only on this remote cockpit. To edit them here, run`,` `,(0,F.jsxs)(`span`,{className:`font-mono`,children:[n(),` remote-settings enable`]}),` on the machine running `,r(`cezar`),`.`]}):null,e.isPending?(0,F.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`text-xs text-muted-foreground`,children:`Loading sources…`}):s&&s.configIssue===null&&s.sources.length===0?(0,F.jsx)(`p`,{"data-slot":`skill-sources-empty`,className:`text-xs leading-relaxed text-soft-foreground`,children:`No team skill sources yet. Add a repo below to use its skills in this project.`}):s&&s.sources.length>0?(0,F.jsx)(`ul`,{"data-slot":`skill-source-list`,className:`flex flex-col divide-y divide-border rounded-lg border border-border`,children:s.sources.map(e=>(0,F.jsx)(Ie,{source:e,editable:c,busy:l,retrying:o.isPending,onToggle:()=>t.mutate({repo:e.repo,ref:e.ref,enabled:!e.enabled}),onRemove:()=>i.mutate({repo:e.repo,ref:e.ref}),onRetry:()=>o.mutate({repo:e.repo,ref:e.ref})},JSON.stringify([e.repo,e.ref])))}):null,s?(0,F.jsx)(Be,{disabled:!c}):null]})}function B({slot:e,alert:t=!1,children:n}){return(0,F.jsxs)(`div`,{role:t?`alert`:void 0,"data-slot":e,className:`flex items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs leading-relaxed text-muted-foreground`,children:[t?(0,F.jsx)(O,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-danger`}):null,(0,F.jsx)(`div`,{className:`min-w-0 break-words`,children:n})]})}function Ie({source:e,editable:t,busy:n,retrying:r,onToggle:i,onRemove:o,onRetry:s}){let c=(0,A.useId)(),l=Le(e),u=e.status.state===`error`,d=e.enabled&&(u||e.status.state===`idle`);return(0,F.jsxs)(`li`,{"data-slot":`skill-source`,"data-repo":e.repo,"data-ref":e.ref,"data-state":e.enabled?e.status.state:`disabled`,className:`flex flex-col gap-2 p-2.5 @min-[520px]:flex-row @min-[520px]:items-center`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`p`,{className:`break-all font-mono text-[13px] text-foreground`,children:[e.repo,` `,(0,F.jsxs)(`span`,{className:`text-muted-foreground`,children:[`@ `,e.ref]})]}),(0,F.jsx)(`p`,{id:c,"data-slot":`skill-source-status`,role:u?`alert`:void 0,"aria-live":u?void 0:`polite`,className:u?`mt-1 text-xs leading-relaxed text-danger`:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:l})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[d?(0,F.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`skill-source-retry`,className:`min-h-11`,disabled:!t||r,"aria-label":`Retry ${I(e)}`,onClick:s,children:[(0,F.jsx)(D,{"aria-hidden":`true`}),`Retry`]}):null,(0,F.jsx)(`span`,{className:`inline-flex min-h-11 min-w-11 items-center justify-center`,children:(0,F.jsx)(ye,{"data-slot":`skill-source-switch`,"aria-label":`Enable ${I(e)}`,"aria-describedby":c,checked:e.enabled,disabled:!t||n,onCheckedChange:i,className:`relative before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-['']`})}),(0,F.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,"data-slot":`skill-source-remove`,className:`size-11`,disabled:!t||n,"aria-label":`Remove ${I(e)}`,onClick:o,children:(0,F.jsx)(le,{"aria-hidden":`true`})})]})]})}function Le(e){if(!e.enabled)return`Disabled. Its skills are hidden from the catalog and from tasks.`;let t=e.status;switch(t.state){case`loading`:return`Fetching…`;case`idle`:return`Not fetched yet. Use Retry to fetch it now.`;case`ok`:return t.skillCount===1?`1 skill`:`${t.skillCount} skills`;case`error`:{let e=t.skillCount>0?` Skills from an earlier fetch still show.`:``;return t.cause===`refused-format`?`${r(`cezar`)} does not accept this repo format. Remove it, then add it as ${j}.`:t.cause===`ref-not-found`?`${t.detail} Check the ref, or remove the source and add it with another ref.${e}`:`Could not fetch: ${Re(t.detail)} Check the network and your access to the repo, then Retry.${e}`}}}var Re=e=>/[.!?]$/.test(e.trim())?e.trim():`${e.trim()}.`;function ze(e,t){return e.trim()?M(e)===null?`Use ${j}.`:t.trim()&&!N(t.trim())?`Use a branch, tag or commit SHA for the ref, such as main.`:null:`Enter a repo.`}function Be({disabled:e}){let[t,n]=(0,A.useState)(``),[r,i]=(0,A.useState)(``),[o,s]=(0,A.useState)(null),c=(0,A.useId)(),l=(0,A.useId)(),u=(0,A.useId)(),d=z(Oe,()=>{n(``),i(``)});return(0,F.jsxs)(`form`,{"data-slot":`skill-source-add`,"aria-label":`Add a team skill source`,noValidate:!0,onSubmit:e=>{e.preventDefault();let n=ze(t,r);s(n),!n&&d.mutate(r.trim()?{repo:t.trim(),ref:r.trim()}:{repo:t.trim()})},className:`flex flex-col gap-2 @min-[520px]:flex-row @min-[520px]:flex-wrap @min-[520px]:items-end`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,F.jsx)(`label`,{htmlFor:c,className:`text-xs font-medium`,children:`Repo`}),(0,F.jsx)(k,{id:c,"data-slot":`skill-source-repo`,value:t,placeholder:`owner/name`,autoComplete:`off`,spellCheck:!1,disabled:e,"aria-invalid":o?!0:void 0,"aria-describedby":o?u:void 0,onChange:e=>{n(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1 @min-[520px]:w-36`,children:[(0,F.jsx)(`label`,{htmlFor:l,className:`text-xs font-medium`,children:`Ref`}),(0,F.jsx)(k,{id:l,"data-slot":`skill-source-ref`,value:r,placeholder:`main`,autoComplete:`off`,spellCheck:!1,disabled:e,onChange:e=>{i(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,F.jsx)(a,{type:`submit`,"data-slot":`skill-source-submit`,className:`h-11`,disabled:e||d.isPending,children:`Add source`}),o?(0,F.jsx)(`p`,{id:u,role:`alert`,"data-slot":`skill-source-problem`,className:`text-xs text-danger @min-[520px]:basis-full`,children:o}):null]})}var Ve=[[`.ai`,`cezar`,`skills`],[`.ai`,`squawk`,`skills`],[`.ai`,`skills`],[`.claude`,`skills`],[`.agents`,`skills`],[`skills`]];function He(e){let t=e.split(`/`).slice(0,-1);if((e===`SKILL.md`||e.endsWith(`/SKILL.md`)||t.at(-1)===`commands`)&&t.pop(),t[0]===`plugins`&&t[1])return{kind:`plugin`,name:t[1]};for(let e of Ve){let n=Ue(t,e);if(n!==-1&&(e.length>1||n===t.length-1)){t.splice(n,e.length);break}}return t.length>0?{kind:`directory`,name:t.join(`/`)}:null}function Ue(e,t){for(let n=e.length-t.length;n>=0;n--)if(t.every((t,r)=>e[n+r]===t))return n;return-1}var V=[{id:`project`,label:`This project`,sources:new Set([`ai`,`cezar`,`agents`])},{id:`global`,label:`Global`,sources:new Set([`global`])},{id:`builtin`,label:`Built-in`,sources:new Set([`builtin`])}],H=(e,t,n,r)=>({key:e,label:t,kind:n,locked:r,items:[],children:[]});function We(e){let t=V.map(e=>H(`source\u0000${e.id}`,e.label,`source`,!0)),n=new Map;for(let r of e){let{skill:e}=r;if(!e.team){let n=V.findIndex(t=>t.sources.has(e.source));t[n===-1?0:n].items.push(r);continue}let{repo:i,path:a}=e.team,o=n.get(i);o||(o=H(`repo\u0000${i}`,i,`repo`,!1),n.set(i,o));let s=He(a);if(!s){o.items.push(r);continue}let c=`${o.key}\u0000${s.kind}\u0000${s.name}`,l=o.children.find(e=>e.key===c);l||(l=H(c,s.name,s.kind,!1),o.children.push(l)),l.items.push(r)}for(let e of n.values())e.children.sort((e,t)=>e.label.localeCompare(t.label));let r=[...n.values()].sort((e,t)=>e.label.localeCompare(t.label));return[t[0],...r,t[1],t[2]].filter(e=>e.items.length>0||e.children.length>0)}function U(e){return e.flatMap(e=>[e.key,...U(e.children)])}function W(e){return[...e.items,...e.children.flatMap(W)]}function Ge(e,t){let n=W(e);if(e.locked)return{enabled:n.length,total:n.length,state:`on`,refs:[]};let r=[],i=0;for(let{skill:e}of n)e.team&&(r.push({repo:e.team.repo,name:e.name}),t(e)&&i++);let a=i===0?`off`:i===r.length?`on`:`mixed`;return{enabled:i,total:r.length,state:a,refs:r}}function G(e,t){if(t.trim()===``)return null;let n=new Set,r=(e,i)=>{let a=[...i,e.label];for(let{skill:r,key:i}of e.items){let e=[r.description??``,...a].join(` `);fe(r.name,e,t)>0&&n.add(i)}for(let t of e.children)r(t,a)};for(let t of e)r(t,[]);return n}function K(e,t){let n=[],r=(e,i)=>{let a=[...i,e.key],o=e.items.some(e=>t.has(e.key));o&&n.push(...a.filter(e=>!n.includes(e)));for(let t of e.children)o=r(t,a)||o;return o};for(let t of e)r(t,[]);return n}function q(e){let t=e?.disabledTeamSkills;if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=v.safeParse(e);t.success&&n.push(t.data)}return n}var J=(e,t)=>e.repo===t.repo&&e.name===t.name;function Y(e){return e.team?{repo:e.team.repo,name:e.name}:void 0}function Ke(e,t,n){let r=new Map;for(let e of t)r.has(e.name)||r.set(e.name,e);let i=[],a=new Set;for(let t of e){let e=Y(t);if(!e)continue;let o=JSON.stringify([e.repo,e.name]);if(a.has(o))continue;a.add(o);let s=n(e),c=r.get(t.name),l=c?Y(c):void 0;s&&c&&!(l&&J(l,e))?i.push({skill:t,on:s,hiddenBy:c.team?.repo??c.source}):i.push({skill:t,on:s})}return i}var X=new Map;function qe(e){let t=X.get(e);return t||(t={chain:Promise.resolve(),latest:0},X.set(e,t)),t}function Je(e){let t=d(),n=re(e),[r,i]=A.useState(0),a=A.useMemo(()=>q(n.data),[n.data]),o=A.useCallback(e=>!a.some(t=>J(t,e)),[a]),s=A.useCallback(n=>{let r=[e,`ui-state`],a=[e,`skills`],o=t.getQueryData(r),s=n(q(o));t.setQueryData(r,{...o,disabledTeamSkills:s});let c=qe(e),l=++c.latest;i(e=>e+1),c.chain=c.chain.then(async()=>{try{let n=await p({disabledTeamSkills:s},e);l===c.latest&&(t.setQueryData(r,n),t.invalidateQueries({queryKey:a}))}catch(e){E(e instanceof Error?e.message:String(e),{tone:`danger`}),l===c.latest&&t.invalidateQueries({queryKey:r})}finally{i(e=>e-1)}})},[e,t]);return{disabled:a,isOn:o,toggle:A.useCallback(e=>{let t={repo:e.repo,name:e.name};s(e=>e.some(e=>J(e,t))?e.filter(e=>!J(e,t)):[...e,t])},[s]),setMany:A.useCallback((e,t)=>{let n=e.map(e=>({repo:e.repo,name:e.name}));s(e=>{if(t)return e.filter(e=>!n.some(t=>J(e,t)));let r=[...e];for(let e of n)r.some(t=>J(t,e))||r.push(e);return r})},[s]),pending:r>0,ready:n.isSuccess}}var Ye=`__import`,Z=e=>e.team?`${e.team.repo}\u0000${e.name}`:e.path,Q=e=>e.source!==`team`&&e.source!==`builtin`;function Xe(){return(0,F.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,F.jsx)(Ze,{})})}function Ze(){let e=ee(),n=ne(),r=te(),[a]=t(),[o,s]=(0,A.useState)(``),c=Je(i()),l=Qe(),u=(0,A.useMemo)(()=>e.data??[],[e.data]),d=(0,A.useMemo)(()=>r.data??[],[r.data]),f=r.isSuccess,p=(0,A.useMemo)(()=>$e(u,f?d:null,c.isOn),[u,d,f,c.isOn]),m=(0,A.useMemo)(()=>We(p),[p]),h=new Map;for(let e of p)h.set(e.skill.name,(h.get(e.skill.name)??0)+1);let g=e=>(h.get(e.name)??0)>1&&e.team!==void 0,_=e=>{let t=Y(e);return t&&f?c.isOn(t):!0},v=e=>{let t=Y(e);return t?{ariaLabel:g(e)?`Enable ${e.name} from ${t.repo}`:`Enable ${e.name}`,checked:_(e),disabled:!f||!c.ready,locked:!1,onCheckedChange:()=>c.toggle(t)}:{ariaLabel:`${e.name} is always enabled`,checked:!0,disabled:!0,locked:!0,onCheckedChange:()=>{}}},y=e=>`/skills?skill=${encodeURIComponent(e.name)}${g(e)?`&repo=${encodeURIComponent(e.team.repo)}`:``}`,b=et(p,a.get(`skill`),a.get(`repo`),_)?.key??null,x=tt(m,b),S=e=>{s(e);let t=G(m,e);t&&t.size>0&&x.open(K(m,t))};if(e.isError)return(0,F.jsx)(ge,{icon:(0,F.jsx)(O,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let C=e.isPending?[]:nt({tree:m,matches:G(m,o),isOpen:x.isOpen,onFold:x.toggle,openKey:b,workflows:n.data?.workflows??[],activationFor:v,linkFor:y,groupActivationFor:e=>Ge(e,_),switchable:f&&c.ready,onActivate:c.setMany});return(0,F.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,F.jsx)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,F.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]})}),(0,F.jsx)(Fe,{}),(0,F.jsx)(it,{query:o,onQuery:S,refreshing:l.isPending,onRefresh:()=>l.mutate(),onFoldAll:x.setAll}),(0,F.jsxs)(`section`,{"data-slot":`skills-list`,"aria-label":`Skills`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-2 @min-[520px]:p-3`,children:[r.isError?(0,F.jsx)(at,{message:r.error.message,retrying:r.isFetching,onRetry:()=>void r.refetch()}):null,(0,F.jsx)(`div`,{"data-slot":`skill-rows`,className:`min-h-0 overflow-y-auto md:max-h-[calc(100dvh-260px)]`,children:e.isPending?(0,F.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-muted-foreground`,children:`Loading skills…`}):C.length>0?(0,F.jsxs)(`table`,{"data-slot":`skills-table`,className:`w-full table-fixed border-collapse text-left`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`border-b border-border text-[12px] text-muted-foreground`,children:[(0,F.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-semibold`,children:`Skill / group`}),(0,F.jsx)(`th`,{scope:`col`,className:`hidden w-[30%] px-2 py-2 font-semibold @min-[520px]:table-cell`,children:`Used by`}),(0,F.jsx)(`th`,{scope:`col`,className:`w-[116px] px-2 py-2 text-right font-semibold`,children:`Enabled`})]})}),(0,F.jsx)(`tbody`,{children:C})]}):(0,F.jsx)(`p`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:p.length>0?`(no skills match)`:(0,F.jsx)(be,{})})})]})]})}function Qe(){let e=d();return T({mutationFn:()=>f(),onSuccess:t=>{e.setQueryData(w.skills,t),e.invalidateQueries({queryKey:w.importableSkills}),E(`Team skills refreshed.`)},onError:e=>E(e.message,{tone:`danger`})})}function $e(e,t,n){let r=new Set(e.filter(Q).map(e=>e.name)),i=t?Ke(t.filter(e=>!r.has(e.name)),e,n):[],a=(e,t)=>({skill:e,key:Z(e),...t?{hiddenBy:t}:{}}),o=new Set((t??[]).map(Z)),s=[...e.filter(e=>e.source!==`team`||!o.has(Z(e))).map(e=>a(e)),...i.map(e=>a(e.skill,e.on?e.hiddenBy:void 0))].sort((e,t)=>e.skill.name.localeCompare(t.skill.name)),c=new Map(s.map(e=>[e.skill,e]));return me(s.map(e=>e.skill)).map(e=>c.get(e))}function et(e,t,n,r){if(t===null)return null;if(t===Ye)return e.find(e=>!r(e.skill))??null;let i=e.filter(e=>e.skill.name===t);return i.find(e=>n===null||e.skill.team?.repo===n)??i[0]??null}function tt(e,t){let[n,r]=(0,A.useState)({}),i=e=>r(t=>({...t,...Object.fromEntries(e.map(e=>[e,!0]))})),a=t?K(e,new Set([t])).join(``):``;return(0,A.useEffect)(()=>{a&&r(e=>({...e,...Object.fromEntries(a.split(``).map(e=>[e,!0]))}))},[a]),{isOpen:(e,t)=>n[e.key]??t===0,toggle:(e,t)=>r(n=>({...n,[e]:t})),open:i,setAll:t=>r(Object.fromEntries(U(e).map(e=>[e,t])))}}function nt(e){let t=[],n=t=>e.matches===null||e.matches.has(t.key),r=e=>e.items.some(n)||e.children.some(r),i=(a,o)=>{if(!r(a))return;let s=e.isOpen(a,o);if(t.push((0,F.jsx)(st,{node:a,depth:o,open:s,onFold:()=>e.onFold(a.key,!s),activation:e.groupActivationFor(a),switchable:e.switchable,onActivate:e.onActivate},a.key)),s){for(let r of a.items.filter(n)){let n=r.key===e.openKey,i=he(e.workflows,r.skill.name),a=e.activationFor(r.skill);t.push((0,F.jsx)(lt,{item:r,depth:o+1,href:n?`/skills`:e.linkFor(r.skill),expanded:n,usedBy:i,activation:a},r.key)),n&&t.push((0,F.jsx)(rt,{skill:r.skill,usedBy:i,activation:a},`${r.key}\u0000detail`))}for(let e of a.children)i(e,o+1)}};for(let t of e.tree)i(t,0);return t}function rt({skill:e,usedBy:t,activation:n}){return(0,F.jsx)(`tr`,{"data-slot":`skill-detail-row`,children:(0,F.jsx)(`td`,{colSpan:3,className:`border-b border-border px-3 pb-5 @min-[520px]:px-5`,children:(0,F.jsx)(`div`,{"data-slot":`skills-detail`,className:`min-w-0 rounded-lg border border-border bg-background p-4 md:p-5`,children:(0,F.jsx)(ve,{skill:e,usedBy:t,activation:n})})})})}function it({query:e,onQuery:t,refreshing:n,onRefresh:r,onFoldAll:i}){return(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsxs)(`div`,{className:`sw-search relative min-w-0 basis-full sm:basis-auto sm:flex-1`,children:[(0,F.jsx)(oe,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,F.jsx)(k,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:e,onChange:e=>t(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,F.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:n,onClick:r,className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-55`,children:[(0,F.jsx)(D,{"aria-hidden":`true`,className:o(`size-3`,n&&`motion-safe:animate-spin`)}),n?`Refreshing…`:`Refresh`]}),(0,F.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-expand-all`,className:`h-11 text-xs`,onClick:()=>i(!0),children:`Expand groups`}),(0,F.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-collapse-all`,className:`h-11 text-xs`,onClick:()=>i(!1),children:`Collapse groups`})]})}function at({message:e,retrying:t,onRetry:n}){return(0,F.jsxs)(`div`,{role:`alert`,"data-slot":`skills-importable-error`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`span`,{children:[`Could not load the team skills, so they cannot be switched right now. Your saved choice is kept.`,` `,e]}),(0,F.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11`,disabled:t,onClick:n,children:`Retry`})]})}var ot={repo:`repository`,plugin:`plugin`,directory:`directory`},$=e=>({paddingInlineStart:`${e*16}px`});function st({node:e,depth:t,open:n,onFold:r,activation:i,switchable:a,onActivate:s}){let c=n?ue:se,l=ot[e.kind],u=e.locked||a;return(0,F.jsxs)(`tr`,{"data-slot":`skill-group-row`,"data-group":e.label,"data-kind":e.kind,"data-level":t,className:o(`border-b border-border`,t===0&&`bg-muted/40`),children:[(0,F.jsx)(`th`,{scope:`row`,className:`min-w-0 p-0 text-left font-normal`,children:(0,F.jsx)(`span`,{className:`flex min-w-0`,style:$(t),children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`skill-group-toggle`,"aria-expanded":n,onClick:r,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,children:[(0,F.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),(0,F.jsx)(`span`,{className:o(`min-w-0 [overflow-wrap:anywhere]`,t===0?`text-[13px] font-semibold`:`text-[13px] font-medium`),children:e.label}),l?(0,F.jsx)(`span`,{className:`shrink-0 text-[12px] text-soft-foreground`,children:l}):null]})})}),(0,F.jsx)(`td`,{"aria-hidden":`true`,className:`hidden @min-[520px]:table-cell`}),(0,F.jsx)(`td`,{className:`px-1 py-0 text-right`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1`,children:[(0,F.jsx)(`span`,{"data-slot":`skill-group-count`,className:`text-[12px] tabular-nums text-muted-foreground`,children:u?`${i.enabled} / ${i.total}`:`—`}),(0,F.jsx)(ct,{label:e.label,locked:e.locked,state:u?i.state:null,disabled:e.locked||!a||i.total===0,onClick:()=>s(i.refs,i.state!==`on`)})]})})]})}function ct({label:e,locked:t,state:n,disabled:r,onClick:i}){return(0,F.jsx)(`button`,{type:`button`,role:`checkbox`,"data-slot":`skill-group-switch`,"data-state":n??`unknown`,"aria-checked":n===null?void 0:n===`mixed`?`mixed`:n===`on`,"aria-busy":n===null||void 0,"aria-label":t?`${e} skills are always enabled`:`Enable all skills in ${e}`,disabled:r,onClick:i,className:`group/check inline-flex size-11 shrink-0 items-center justify-center rounded-md focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground disabled:cursor-default`,children:(0,F.jsx)(`span`,{"aria-hidden":`true`,className:o(`inline-flex size-5 items-center justify-center rounded border-2 transition-colors`,n===`on`||n===`mixed`?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-muted-foreground bg-card text-transparent`,n===null&&`border-dashed border-soft-foreground`,`group-disabled/check:opacity-60`),children:n===`mixed`?(0,F.jsx)(ae,{className:`size-3.5`}):(0,F.jsx)(ce,{className:`size-3.5`})})})}function lt({item:e,depth:t,href:n,expanded:r,usedBy:i,activation:a}){let{skill:s,hiddenBy:c}=e,l=pe(s),u=[...new Set(i.map(e=>e.split(` › `)[0]))];return(0,F.jsxs)(`tr`,{"data-slot":`skill-table-row`,className:o(`border-b border-border`,r&&`border-transparent`),children:[(0,F.jsx)(`td`,{className:`min-w-0 p-0`,style:$(t),children:(0,F.jsxs)(de,{to:n,"data-slot":`skill-row`,"data-skill":s.name,"data-repo":s.team?.repo,"data-project":l?`true`:void 0,"data-enabled":a.checked?`true`:void 0,"aria-current":r?`page`:void 0,"aria-expanded":r,className:o(`selection-row flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-3 py-2 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,r&&`bg-accent-strong/10`),children:[(0,F.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,F.jsx)(`span`,{className:o(`min-w-0 break-words text-[13px]`,l?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:s.name})}),s.description?(0,F.jsx)(`span`,{className:`line-clamp-1 text-xs leading-relaxed text-supporting-foreground`,children:s.description}):null,u.length>0?(0,F.jsxs)(`span`,{"data-slot":`skill-used-by-inline`,className:`text-xs text-supporting-foreground @min-[520px]:hidden`,children:[`Used by `,u.join(`, `)]}):null,c?(0,F.jsxs)(`span`,{"data-slot":`skill-hidden-by`,className:`min-w-0 text-xs text-supporting-foreground [overflow-wrap:anywhere]`,children:[`hidden by `,c]}):null]})}),(0,F.jsx)(`td`,{"data-slot":`skill-used-by-cell`,className:`hidden px-2 py-2 align-middle text-xs text-supporting-foreground @min-[520px]:table-cell`,children:u.length>0?(0,F.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:u.join(`, `)}):(0,F.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})}),(0,F.jsx)(`td`,{className:`px-1 py-0 text-right align-middle`,children:(0,F.jsx)(`span`,{className:`inline-flex justify-end`,children:(0,F.jsx)(_e,{skill:s,activation:a})})})]})}export{Xe as SkillsRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{D as t,I as n,L as r,M as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{Lt as l,Sn as u,Ur as d,an as f,en as p,f as m}from"./project-scope-context-B0yKt2yI.js";import{$ as h,J as g,Q as _,R as v,X as y,Z as b,at as x,nt as S,tt as C}from"./live-protocol-BmbbwF5R.js";import{At as ee,I as te,Lt as ne,X as re,n as w,nn as T}from"./queries-DoYRza8s.js";import{t as ie}from"./useQuery-CnVG8NoC.js";import{n as E}from"./toaster-CoMJoQvk.js";import{G as ae,Q as oe,Z as D,ct as O,d as se,l as ce,mt as le,u as ue}from"./design-icons-DmYTv2r1.js";import{t as de}from"./project-router-BqAKGSaS.js";import{c as fe,i as pe,o as me,p as he}from"./skills-DFBiAuJG.js";import{t as ge}from"./centered-state-B5QmAy2y.js";import{I as _e,P as ve,Xt as ye,Zt as k}from"./index-MgNz22Tg.js";import{t as be}from"./skill-empty-hint-YDmkqgo-.js";var A=e(s(),1),j=`owner/name, an https, ssh or git URL, git@host:path, or a local or file:// path`,xe=new Set([`https`,`http`,`ssh`,`git`,`file`]);function M(e){let t=e.trim();if(!t||t.startsWith(`-`)||t.includes(`::`))return null;if(t.startsWith(`~/`))return`home`;if(/^(\/|\.\/|\.\.\/)/.test(t)||/^[A-Za-z]:[\\/]/.test(t))return`local`;if(/^[\w.-]+\/[\w.-]+$/.test(t))return`github`;let n=/^([a-z][a-z0-9+.-]*):\/\//i.exec(t);return n?xe.has(n[1].toLowerCase())?`url`:null:/^[\w.-]+@[\w.-]+:/.test(t)?`scp`:null}function N(e){return e.length>0&&e.length<=256&&!e.startsWith(`-`)&&!e.includes(`..`)&&/^[A-Za-z0-9._/-]+$/.test(e)}var Se=x().trim().min(1).max(500).refine(e=>M(e)!==null,{message:`Use ${j}.`}),Ce=x().trim().refine(N,{message:`Use a branch, tag or commit SHA, such as main.`}),we=S({repo:x().min(1).max(500),ref:x().min(1).max(256)}).strict();S({repo:Se,ref:Ce.optional()}).strict(),we.extend({enabled:b()}).strict();var Te=g([`refused-format`,`fetch-failed`,`ref-not-found`]),Ee=_(`state`,[S({state:h(`idle`)}),S({state:h(`loading`)}),S({state:h(`ok`),skillCount:C().int().min(0)}),S({state:h(`error`),cause:Te,detail:x(),skillCount:C().int().min(0)})]);S({sources:y(S({repo:x(),ref:x(),enabled:b(),status:Ee})),editable:b(),configIssue:x().nullable()});var P=()=>[i(),`skills`,`sources`];async function De(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$get({param:{projectId:i()}},l(e)),`/skills/sources`)}async function Oe(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$post({param:{projectId:i()},json:e}),`/skills/sources`)}async function ke(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$patch({param:{projectId:i()},json:e}),`/skills/sources`)}async function Ae(e){return u(await m.api.v1.p[`:projectId`].skills.sources.$delete({param:{projectId:i()},json:e}),`/skills/sources`)}async function je(e){return u(await m.api.v1.p[`:projectId`].skills.sources.retry.$post({param:{projectId:i()},json:e}),`/skills/sources/retry`)}var F=c(),Me=1e3,I=e=>`${e.repo} @ ${e.ref}`;function Ne(){return ie({queryKey:P(),queryFn:({signal:e})=>De({signal:e}),refetchInterval:e=>e.state.data?.sources.some(e=>e.status.state===`loading`)?Me:!1})}function L(){return{sources:P(),lists:[w.skills,w.skillsReady,w.importableSkills,w.importableSkillsReady]}}function R(e,t=L()){for(let n of t.lists)e.invalidateQueries({queryKey:n,exact:!0})}function z(e,t){let n=d();return T({mutationFn:async t=>{let n=L();return{answer:await e(t),keys:n}},onSuccess:({answer:e,keys:r},i)=>{n.setQueryData(r.sources,e),n.invalidateQueries({queryKey:r.sources,exact:!0}),R(n,r),t?.(i)},onError:e=>E(e.message,{tone:`danger`})})}function Pe(e){let t=d(),n=(0,A.useRef)(!1),r=e?.sources.some(e=>e.status.state===`loading`)??!1;(0,A.useEffect)(()=>{n.current&&!r&&R(t),n.current=r},[r,t])}function Fe(){let e=Ne();Pe(e.data);let t=z(ke),i=z(Ae,e=>E(`Removed ${I(e)}. Add it again to restore its skill switches.`)),o=z(je),s=e.data,c=s?.editable===!0&&s.configIssue===null,l=t.isPending||i.isPending;return(0,F.jsxs)(`section`,{"data-slot":`skill-sources`,"aria-labelledby":`skill-sources-heading`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-3 @min-[520px]:p-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{id:`skill-sources-heading`,className:`text-[15px] font-semibold`,children:`Team skill sources`}),(0,F.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`Repos whose skills this project can use. Changes are saved to`,` `,(0,F.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/config.json`}),`.`]})]}),e.isError?(0,F.jsxs)(B,{slot:`skill-sources-error`,alert:!0,children:[`Could not load the team skill sources: `,e.error.message,` `,(0,F.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2 min-h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,s?.configIssue?(0,F.jsx)(B,{slot:`skill-sources-config-issue`,alert:!0,children:s.configIssue}):null,s&&!s.editable?(0,F.jsxs)(B,{slot:`skill-sources-read-only`,children:[`Sources are read-only on this remote cockpit. To edit them here, run`,` `,(0,F.jsxs)(`span`,{className:`font-mono`,children:[n(),` remote-settings enable`]}),` on the machine running `,r(`cezar`),`.`]}):null,e.isPending?(0,F.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`text-xs text-muted-foreground`,children:`Loading sources…`}):s&&s.configIssue===null&&s.sources.length===0?(0,F.jsx)(`p`,{"data-slot":`skill-sources-empty`,className:`text-xs leading-relaxed text-soft-foreground`,children:`No team skill sources yet. Add a repo below to use its skills in this project.`}):s&&s.sources.length>0?(0,F.jsx)(`ul`,{"data-slot":`skill-source-list`,className:`flex flex-col divide-y divide-border rounded-lg border border-border`,children:s.sources.map(e=>(0,F.jsx)(Ie,{source:e,editable:c,busy:l,retrying:o.isPending,onToggle:()=>t.mutate({repo:e.repo,ref:e.ref,enabled:!e.enabled}),onRemove:()=>i.mutate({repo:e.repo,ref:e.ref}),onRetry:()=>o.mutate({repo:e.repo,ref:e.ref})},JSON.stringify([e.repo,e.ref])))}):null,s?(0,F.jsx)(Be,{disabled:!c}):null]})}function B({slot:e,alert:t=!1,children:n}){return(0,F.jsxs)(`div`,{role:t?`alert`:void 0,"data-slot":e,className:`flex items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs leading-relaxed text-muted-foreground`,children:[t?(0,F.jsx)(O,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-danger`}):null,(0,F.jsx)(`div`,{className:`min-w-0 break-words`,children:n})]})}function Ie({source:e,editable:t,busy:n,retrying:r,onToggle:i,onRemove:o,onRetry:s}){let c=(0,A.useId)(),l=Le(e),u=e.status.state===`error`,d=e.enabled&&(u||e.status.state===`idle`);return(0,F.jsxs)(`li`,{"data-slot":`skill-source`,"data-repo":e.repo,"data-ref":e.ref,"data-state":e.enabled?e.status.state:`disabled`,className:`flex flex-col gap-2 p-2.5 @min-[520px]:flex-row @min-[520px]:items-center`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`p`,{className:`break-all font-mono text-[13px] text-foreground`,children:[e.repo,` `,(0,F.jsxs)(`span`,{className:`text-muted-foreground`,children:[`@ `,e.ref]})]}),(0,F.jsx)(`p`,{id:c,"data-slot":`skill-source-status`,role:u?`alert`:void 0,"aria-live":u?void 0:`polite`,className:u?`mt-1 text-xs leading-relaxed text-danger`:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:l})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[d?(0,F.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`skill-source-retry`,className:`min-h-11`,disabled:!t||r,"aria-label":`Retry ${I(e)}`,onClick:s,children:[(0,F.jsx)(D,{"aria-hidden":`true`}),`Retry`]}):null,(0,F.jsx)(`span`,{className:`inline-flex min-h-11 min-w-11 items-center justify-center`,children:(0,F.jsx)(ye,{"data-slot":`skill-source-switch`,"aria-label":`Enable ${I(e)}`,"aria-describedby":c,checked:e.enabled,disabled:!t||n,onCheckedChange:i,className:`relative before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-['']`})}),(0,F.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,"data-slot":`skill-source-remove`,className:`size-11`,disabled:!t||n,"aria-label":`Remove ${I(e)}`,onClick:o,children:(0,F.jsx)(le,{"aria-hidden":`true`})})]})]})}function Le(e){if(!e.enabled)return`Disabled. Its skills are hidden from the catalog and from tasks.`;let t=e.status;switch(t.state){case`loading`:return`Fetching…`;case`idle`:return`Not fetched yet. Use Retry to fetch it now.`;case`ok`:return t.skillCount===1?`1 skill`:`${t.skillCount} skills`;case`error`:{let e=t.skillCount>0?` Skills from an earlier fetch still show.`:``;return t.cause===`refused-format`?`${r(`cezar`)} does not accept this repo format. Remove it, then add it as ${j}.`:t.cause===`ref-not-found`?`${t.detail} Check the ref, or remove the source and add it with another ref.${e}`:`Could not fetch: ${Re(t.detail)} Check the network and your access to the repo, then Retry.${e}`}}}var Re=e=>/[.!?]$/.test(e.trim())?e.trim():`${e.trim()}.`;function ze(e,t){return e.trim()?M(e)===null?`Use ${j}.`:t.trim()&&!N(t.trim())?`Use a branch, tag or commit SHA for the ref, such as main.`:null:`Enter a repo.`}function Be({disabled:e}){let[t,n]=(0,A.useState)(``),[r,i]=(0,A.useState)(``),[o,s]=(0,A.useState)(null),c=(0,A.useId)(),l=(0,A.useId)(),u=(0,A.useId)(),d=z(Oe,()=>{n(``),i(``)});return(0,F.jsxs)(`form`,{"data-slot":`skill-source-add`,"aria-label":`Add a team skill source`,noValidate:!0,onSubmit:e=>{e.preventDefault();let n=ze(t,r);s(n),!n&&d.mutate(r.trim()?{repo:t.trim(),ref:r.trim()}:{repo:t.trim()})},className:`flex flex-col gap-2 @min-[520px]:flex-row @min-[520px]:flex-wrap @min-[520px]:items-end`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,F.jsx)(`label`,{htmlFor:c,className:`text-xs font-medium`,children:`Repo`}),(0,F.jsx)(k,{id:c,"data-slot":`skill-source-repo`,value:t,placeholder:`owner/name`,autoComplete:`off`,spellCheck:!1,disabled:e,"aria-invalid":o?!0:void 0,"aria-describedby":o?u:void 0,onChange:e=>{n(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1 @min-[520px]:w-36`,children:[(0,F.jsx)(`label`,{htmlFor:l,className:`text-xs font-medium`,children:`Ref`}),(0,F.jsx)(k,{id:l,"data-slot":`skill-source-ref`,value:r,placeholder:`main`,autoComplete:`off`,spellCheck:!1,disabled:e,onChange:e=>{i(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,F.jsx)(a,{type:`submit`,"data-slot":`skill-source-submit`,className:`h-11`,disabled:e||d.isPending,children:`Add source`}),o?(0,F.jsx)(`p`,{id:u,role:`alert`,"data-slot":`skill-source-problem`,className:`text-xs text-danger @min-[520px]:basis-full`,children:o}):null]})}var Ve=[[`.ai`,`cezar`,`skills`],[`.ai`,`squawk`,`skills`],[`.ai`,`skills`],[`.claude`,`skills`],[`.agents`,`skills`],[`skills`]];function He(e){let t=e.split(`/`).slice(0,-1);if((e===`SKILL.md`||e.endsWith(`/SKILL.md`)||t.at(-1)===`commands`)&&t.pop(),t[0]===`plugins`&&t[1])return{kind:`plugin`,name:t[1]};for(let e of Ve){let n=Ue(t,e);if(n!==-1&&(e.length>1||n===t.length-1)){t.splice(n,e.length);break}}return t.length>0?{kind:`directory`,name:t.join(`/`)}:null}function Ue(e,t){for(let n=e.length-t.length;n>=0;n--)if(t.every((t,r)=>e[n+r]===t))return n;return-1}var V=[{id:`project`,label:`This project`,sources:new Set([`ai`,`cezar`,`agents`])},{id:`global`,label:`Global`,sources:new Set([`global`])},{id:`builtin`,label:`Built-in`,sources:new Set([`builtin`])}],H=(e,t,n,r)=>({key:e,label:t,kind:n,locked:r,items:[],children:[]});function We(e){let t=V.map(e=>H(`source\u0000${e.id}`,e.label,`source`,!0)),n=new Map;for(let r of e){let{skill:e}=r;if(!e.team){let n=V.findIndex(t=>t.sources.has(e.source));t[n===-1?0:n].items.push(r);continue}let{repo:i,path:a}=e.team,o=n.get(i);o||(o=H(`repo\u0000${i}`,i,`repo`,!1),n.set(i,o));let s=He(a);if(!s){o.items.push(r);continue}let c=`${o.key}\u0000${s.kind}\u0000${s.name}`,l=o.children.find(e=>e.key===c);l||(l=H(c,s.name,s.kind,!1),o.children.push(l)),l.items.push(r)}for(let e of n.values())e.children.sort((e,t)=>e.label.localeCompare(t.label));let r=[...n.values()].sort((e,t)=>e.label.localeCompare(t.label));return[t[0],...r,t[1],t[2]].filter(e=>e.items.length>0||e.children.length>0)}function U(e){return e.flatMap(e=>[e.key,...U(e.children)])}function W(e){return[...e.items,...e.children.flatMap(W)]}function Ge(e,t){let n=W(e);if(e.locked)return{enabled:n.length,total:n.length,state:`on`,refs:[]};let r=[],i=0;for(let{skill:e}of n)e.team&&(r.push({repo:e.team.repo,name:e.name}),t(e)&&i++);let a=i===0?`off`:i===r.length?`on`:`mixed`;return{enabled:i,total:r.length,state:a,refs:r}}function G(e,t){if(t.trim()===``)return null;let n=new Set,r=(e,i)=>{let a=[...i,e.label];for(let{skill:r,key:i}of e.items){let e=[r.description??``,...a].join(` `);fe(r.name,e,t)>0&&n.add(i)}for(let t of e.children)r(t,a)};for(let t of e)r(t,[]);return n}function K(e,t){let n=[],r=(e,i)=>{let a=[...i,e.key],o=e.items.some(e=>t.has(e.key));o&&n.push(...a.filter(e=>!n.includes(e)));for(let t of e.children)o=r(t,a)||o;return o};for(let t of e)r(t,[]);return n}function q(e){let t=e?.disabledTeamSkills;if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=v.safeParse(e);t.success&&n.push(t.data)}return n}var J=(e,t)=>e.repo===t.repo&&e.name===t.name;function Y(e){return e.team?{repo:e.team.repo,name:e.name}:void 0}function Ke(e,t,n){let r=new Map;for(let e of t)r.has(e.name)||r.set(e.name,e);let i=[],a=new Set;for(let t of e){let e=Y(t);if(!e)continue;let o=JSON.stringify([e.repo,e.name]);if(a.has(o))continue;a.add(o);let s=n(e),c=r.get(t.name),l=c?Y(c):void 0;s&&c&&!(l&&J(l,e))?i.push({skill:t,on:s,hiddenBy:c.team?.repo??c.source}):i.push({skill:t,on:s})}return i}var X=new Map;function qe(e){let t=X.get(e);return t||(t={chain:Promise.resolve(),latest:0},X.set(e,t)),t}function Je(e){let t=d(),n=re(e),[r,i]=A.useState(0),a=A.useMemo(()=>q(n.data),[n.data]),o=A.useCallback(e=>!a.some(t=>J(t,e)),[a]),s=A.useCallback(n=>{let r=[e,`ui-state`],a=[e,`skills`],o=t.getQueryData(r),s=n(q(o));t.setQueryData(r,{...o,disabledTeamSkills:s});let c=qe(e),l=++c.latest;i(e=>e+1),c.chain=c.chain.then(async()=>{try{let n=await p({disabledTeamSkills:s},e);l===c.latest&&(t.setQueryData(r,n),t.invalidateQueries({queryKey:a}))}catch(e){E(e instanceof Error?e.message:String(e),{tone:`danger`}),l===c.latest&&t.invalidateQueries({queryKey:r})}finally{i(e=>e-1)}})},[e,t]);return{disabled:a,isOn:o,toggle:A.useCallback(e=>{let t={repo:e.repo,name:e.name};s(e=>e.some(e=>J(e,t))?e.filter(e=>!J(e,t)):[...e,t])},[s]),setMany:A.useCallback((e,t)=>{let n=e.map(e=>({repo:e.repo,name:e.name}));s(e=>{if(t)return e.filter(e=>!n.some(t=>J(e,t)));let r=[...e];for(let e of n)r.some(t=>J(t,e))||r.push(e);return r})},[s]),pending:r>0,ready:n.isSuccess}}var Ye=`__import`,Z=e=>e.team?`${e.team.repo}\u0000${e.name}`:e.path,Q=e=>e.source!==`team`&&e.source!==`builtin`;function Xe(){return(0,F.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,F.jsx)(Ze,{})})}function Ze(){let e=ee(),n=ne(),r=te(),[a]=t(),[o,s]=(0,A.useState)(``),c=Je(i()),l=Qe(),u=(0,A.useMemo)(()=>e.data??[],[e.data]),d=(0,A.useMemo)(()=>r.data??[],[r.data]),f=r.isSuccess,p=(0,A.useMemo)(()=>$e(u,f?d:null,c.isOn),[u,d,f,c.isOn]),m=(0,A.useMemo)(()=>We(p),[p]),h=new Map;for(let e of p)h.set(e.skill.name,(h.get(e.skill.name)??0)+1);let g=e=>(h.get(e.name)??0)>1&&e.team!==void 0,_=e=>{let t=Y(e);return t&&f?c.isOn(t):!0},v=e=>{let t=Y(e);return t?{ariaLabel:g(e)?`Enable ${e.name} from ${t.repo}`:`Enable ${e.name}`,checked:_(e),disabled:!f||!c.ready,locked:!1,onCheckedChange:()=>c.toggle(t)}:{ariaLabel:`${e.name} is always enabled`,checked:!0,disabled:!0,locked:!0,onCheckedChange:()=>{}}},y=e=>`/skills?skill=${encodeURIComponent(e.name)}${g(e)?`&repo=${encodeURIComponent(e.team.repo)}`:``}`,b=et(p,a.get(`skill`),a.get(`repo`),_)?.key??null,x=tt(m,b),S=e=>{s(e);let t=G(m,e);t&&t.size>0&&x.open(K(m,t))};if(e.isError)return(0,F.jsx)(ge,{icon:(0,F.jsx)(O,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let C=e.isPending?[]:nt({tree:m,matches:G(m,o),isOpen:x.isOpen,onFold:x.toggle,openKey:b,workflows:n.data?.workflows??[],activationFor:v,linkFor:y,groupActivationFor:e=>Ge(e,_),switchable:f&&c.ready,onActivate:c.setMany});return(0,F.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,F.jsx)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,F.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]})}),(0,F.jsx)(Fe,{}),(0,F.jsx)(it,{query:o,onQuery:S,refreshing:l.isPending,onRefresh:()=>l.mutate(),onFoldAll:x.setAll}),(0,F.jsxs)(`section`,{"data-slot":`skills-list`,"aria-label":`Skills`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-2 @min-[520px]:p-3`,children:[r.isError?(0,F.jsx)(at,{message:r.error.message,retrying:r.isFetching,onRetry:()=>void r.refetch()}):null,(0,F.jsx)(`div`,{"data-slot":`skill-rows`,className:`min-h-0 overflow-y-auto md:max-h-[calc(100dvh-260px)]`,children:e.isPending?(0,F.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-muted-foreground`,children:`Loading skills…`}):C.length>0?(0,F.jsxs)(`table`,{"data-slot":`skills-table`,className:`w-full table-fixed border-collapse text-left`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`border-b border-border text-[12px] text-muted-foreground`,children:[(0,F.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-semibold`,children:`Skill / group`}),(0,F.jsx)(`th`,{scope:`col`,className:`hidden w-[30%] px-2 py-2 font-semibold @min-[520px]:table-cell`,children:`Used by`}),(0,F.jsx)(`th`,{scope:`col`,className:`w-[116px] px-2 py-2 text-right font-semibold`,children:`Enabled`})]})}),(0,F.jsx)(`tbody`,{children:C})]}):(0,F.jsx)(`p`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:p.length>0?`(no skills match)`:(0,F.jsx)(be,{})})})]})]})}function Qe(){let e=d();return T({mutationFn:()=>f(),onSuccess:t=>{e.setQueryData(w.skills,t),e.invalidateQueries({queryKey:w.importableSkills}),E(`Team skills refreshed.`)},onError:e=>E(e.message,{tone:`danger`})})}function $e(e,t,n){let r=new Set(e.filter(Q).map(e=>e.name)),i=t?Ke(t.filter(e=>!r.has(e.name)),e,n):[],a=(e,t)=>({skill:e,key:Z(e),...t?{hiddenBy:t}:{}}),o=new Set((t??[]).map(Z)),s=[...e.filter(e=>e.source!==`team`||!o.has(Z(e))).map(e=>a(e)),...i.map(e=>a(e.skill,e.on?e.hiddenBy:void 0))].sort((e,t)=>e.skill.name.localeCompare(t.skill.name)),c=new Map(s.map(e=>[e.skill,e]));return me(s.map(e=>e.skill)).map(e=>c.get(e))}function et(e,t,n,r){if(t===null)return null;if(t===Ye)return e.find(e=>!r(e.skill))??null;let i=e.filter(e=>e.skill.name===t);return i.find(e=>n===null||e.skill.team?.repo===n)??i[0]??null}function tt(e,t){let[n,r]=(0,A.useState)({}),i=e=>r(t=>({...t,...Object.fromEntries(e.map(e=>[e,!0]))})),a=t?K(e,new Set([t])).join(``):``;return(0,A.useEffect)(()=>{a&&r(e=>({...e,...Object.fromEntries(a.split(``).map(e=>[e,!0]))}))},[a]),{isOpen:(e,t)=>n[e.key]??t===0,toggle:(e,t)=>r(n=>({...n,[e]:t})),open:i,setAll:t=>r(Object.fromEntries(U(e).map(e=>[e,t])))}}function nt(e){let t=[],n=t=>e.matches===null||e.matches.has(t.key),r=e=>e.items.some(n)||e.children.some(r),i=(a,o)=>{if(!r(a))return;let s=e.isOpen(a,o);if(t.push((0,F.jsx)(st,{node:a,depth:o,open:s,onFold:()=>e.onFold(a.key,!s),activation:e.groupActivationFor(a),switchable:e.switchable,onActivate:e.onActivate},a.key)),s){for(let r of a.items.filter(n)){let n=r.key===e.openKey,i=he(e.workflows,r.skill.name),a=e.activationFor(r.skill);t.push((0,F.jsx)(lt,{item:r,depth:o+1,href:n?`/skills`:e.linkFor(r.skill),expanded:n,usedBy:i,activation:a},r.key)),n&&t.push((0,F.jsx)(rt,{skill:r.skill,usedBy:i,activation:a},`${r.key}\u0000detail`))}for(let e of a.children)i(e,o+1)}};for(let t of e.tree)i(t,0);return t}function rt({skill:e,usedBy:t,activation:n}){return(0,F.jsx)(`tr`,{"data-slot":`skill-detail-row`,children:(0,F.jsx)(`td`,{colSpan:3,className:`border-b border-border px-3 pb-5 @min-[520px]:px-5`,children:(0,F.jsx)(`div`,{"data-slot":`skills-detail`,className:`min-w-0 rounded-lg border border-border bg-background p-4 md:p-5`,children:(0,F.jsx)(ve,{skill:e,usedBy:t,activation:n})})})})}function it({query:e,onQuery:t,refreshing:n,onRefresh:r,onFoldAll:i}){return(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsxs)(`div`,{className:`sw-search relative min-w-0 basis-full sm:basis-auto sm:flex-1`,children:[(0,F.jsx)(oe,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,F.jsx)(k,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:e,onChange:e=>t(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,F.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:n,onClick:r,className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-55`,children:[(0,F.jsx)(D,{"aria-hidden":`true`,className:o(`size-3`,n&&`motion-safe:animate-spin`)}),n?`Refreshing…`:`Refresh`]}),(0,F.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-expand-all`,className:`h-11 text-xs`,onClick:()=>i(!0),children:`Expand groups`}),(0,F.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-collapse-all`,className:`h-11 text-xs`,onClick:()=>i(!1),children:`Collapse groups`})]})}function at({message:e,retrying:t,onRetry:n}){return(0,F.jsxs)(`div`,{role:`alert`,"data-slot":`skills-importable-error`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`span`,{children:[`Could not load the team skills, so they cannot be switched right now. Your saved choice is kept.`,` `,e]}),(0,F.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11`,disabled:t,onClick:n,children:`Retry`})]})}var ot={repo:`repository`,plugin:`plugin`,directory:`directory`},$=e=>({paddingInlineStart:`${e*16}px`});function st({node:e,depth:t,open:n,onFold:r,activation:i,switchable:a,onActivate:s}){let c=n?ue:se,l=ot[e.kind],u=e.locked||a;return(0,F.jsxs)(`tr`,{"data-slot":`skill-group-row`,"data-group":e.label,"data-kind":e.kind,"data-level":t,className:o(`border-b border-border`,t===0&&`bg-muted/40`),children:[(0,F.jsx)(`th`,{scope:`row`,className:`min-w-0 p-0 text-left font-normal`,children:(0,F.jsx)(`span`,{className:`flex min-w-0`,style:$(t),children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`skill-group-toggle`,"aria-expanded":n,onClick:r,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,children:[(0,F.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),(0,F.jsx)(`span`,{className:o(`min-w-0 [overflow-wrap:anywhere]`,t===0?`text-[13px] font-semibold`:`text-[13px] font-medium`),children:e.label}),l?(0,F.jsx)(`span`,{className:`shrink-0 text-[12px] text-soft-foreground`,children:l}):null]})})}),(0,F.jsx)(`td`,{"aria-hidden":`true`,className:`hidden @min-[520px]:table-cell`}),(0,F.jsx)(`td`,{className:`px-1 py-0 text-right`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1`,children:[(0,F.jsx)(`span`,{"data-slot":`skill-group-count`,className:`text-[12px] tabular-nums text-muted-foreground`,children:u?`${i.enabled} / ${i.total}`:`—`}),(0,F.jsx)(ct,{label:e.label,locked:e.locked,state:u?i.state:null,disabled:e.locked||!a||i.total===0,onClick:()=>s(i.refs,i.state!==`on`)})]})})]})}function ct({label:e,locked:t,state:n,disabled:r,onClick:i}){return(0,F.jsx)(`button`,{type:`button`,role:`checkbox`,"data-slot":`skill-group-switch`,"data-state":n??`unknown`,"aria-checked":n===null?void 0:n===`mixed`?`mixed`:n===`on`,"aria-busy":n===null||void 0,"aria-label":t?`${e} skills are always enabled`:`Enable all skills in ${e}`,disabled:r,onClick:i,className:`group/check inline-flex size-11 shrink-0 items-center justify-center rounded-md focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground disabled:cursor-default`,children:(0,F.jsx)(`span`,{"aria-hidden":`true`,className:o(`inline-flex size-5 items-center justify-center rounded border-2 transition-colors`,n===`on`||n===`mixed`?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-muted-foreground bg-card text-transparent`,n===null&&`border-dashed border-soft-foreground`,`group-disabled/check:opacity-60`),children:n===`mixed`?(0,F.jsx)(ae,{className:`size-3.5`}):(0,F.jsx)(ce,{className:`size-3.5`})})})}function lt({item:e,depth:t,href:n,expanded:r,usedBy:i,activation:a}){let{skill:s,hiddenBy:c}=e,l=pe(s),u=[...new Set(i.map(e=>e.split(` › `)[0]))];return(0,F.jsxs)(`tr`,{"data-slot":`skill-table-row`,className:o(`border-b border-border`,r&&`border-transparent`),children:[(0,F.jsx)(`td`,{className:`min-w-0 p-0`,style:$(t),children:(0,F.jsxs)(de,{to:n,"data-slot":`skill-row`,"data-skill":s.name,"data-repo":s.team?.repo,"data-project":l?`true`:void 0,"data-enabled":a.checked?`true`:void 0,"aria-current":r?`page`:void 0,"aria-expanded":r,className:o(`selection-row flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-3 py-2 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,r&&`bg-accent-strong/10`),children:[(0,F.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,F.jsx)(`span`,{className:o(`min-w-0 break-words text-[13px]`,l?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:s.name})}),s.description?(0,F.jsx)(`span`,{className:`line-clamp-1 text-xs leading-relaxed text-supporting-foreground`,children:s.description}):null,u.length>0?(0,F.jsxs)(`span`,{"data-slot":`skill-used-by-inline`,className:`text-xs text-supporting-foreground @min-[520px]:hidden`,children:[`Used by `,u.join(`, `)]}):null,c?(0,F.jsxs)(`span`,{"data-slot":`skill-hidden-by`,className:`min-w-0 text-xs text-supporting-foreground [overflow-wrap:anywhere]`,children:[`hidden by `,c]}):null]})}),(0,F.jsx)(`td`,{"data-slot":`skill-used-by-cell`,className:`hidden px-2 py-2 align-middle text-xs text-supporting-foreground @min-[520px]:table-cell`,children:u.length>0?(0,F.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:u.join(`, `)}):(0,F.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})}),(0,F.jsx)(`td`,{className:`px-1 py-0 text-right align-middle`,children:(0,F.jsx)(`span`,{className:`inline-flex justify-end`,children:(0,F.jsx)(_e,{skill:s,activation:a})})})]})}export{Xe as SkillsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,u as t}from"./button-DGwhwRuD.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./project-router-
|
|
1
|
+
import{l as e,u as t}from"./button-DGwhwRuD.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./project-router-BqAKGSaS.js";var i=n();function a({to:n,active:a=!1,onClick:o,count:s,replace:c,className:l,children:u}){return(0,i.jsxs)(r,{to:n,...e({replace:c}),"aria-current":a?`page`:void 0,onClick:o,className:t(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,a?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,l),children:[u,s===void 0?null:(0,i.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:s})]})}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n}from"./button-DGwhwRuD.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{Gt as a,St as o,Ur as s,Ut as c,Zt as l,h as u,i as d,mn as f,rr as p,w as m}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n}from"./button-DGwhwRuD.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{Gt as a,St as o,Ur as s,Ut as c,Zt as l,h as u,i as d,mn as f,rr as p,w as m}from"./project-scope-context-B0yKt2yI.js";import{P as h,gt as g,ht as _,n as v,nn as y,ut as b}from"./queries-DoYRza8s.js";import{n as x,q as S,z as C}from"./use-desktop-BwkqVHep.js";import{n as w}from"./toaster-CoMJoQvk.js";import{M as T,w as E}from"./design-icons-DmYTv2r1.js";import{t as D}from"./run-header-FB4j_Fjm.js";import{i as O,n as k,r as A}from"./git-toolbar-BbY7l1x9.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-B7p5oc5r.js";import{t as L}from"./centered-state-B5QmAy2y.js";import{$ as R,D as z,E as B,Tt as V,Y as H}from"./index-MgNz22Tg.js";import{t as U}from"./markdown-BBDDg-4t.js";import{t as W}from"./diff-BDJ4xGSd.js";var G=e(r(),1),K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?p(e.run)?t(`Create PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):S(e.run)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff){let t=e.hasSession?S(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=i();function Q({run:e,open:t,onOpenChange:r}){let i=s(),[a,o]=(0,G.useState)(``),c=C(e),l=(0,G.useRef)(c);l.current=c,(0,G.useEffect)(()=>{t&&o(l.current)},[t]);let d=y({mutationFn:t=>u(e.id,t),onSuccess:t=>{w(`Committed ${t.sha.slice(0,7)}`),r(!1),i.invalidateQueries({queryKey:v.runs.changes(e.id)}),i.invalidateQueries({queryKey:v.runs.all})},onError:e=>w(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||d.isPending||d.mutate(e)};return(0,Z.jsx)(I,{open:t,onOpenChange:r,children:(0,Z.jsxs)(P,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(N,{children:[(0,Z.jsx)(F,{children:`Commit changes`}),(0,Z.jsxs)(M,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(R,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{H({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())}}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(n,{variant:`outline`,onClick:()=>r(!1),children:`Cancel`}),(0,Z.jsx)(n,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||d.isPending,onClick:f,children:d.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=t(),n=_(e);return n.isPending?(0,Z.jsx)(z,{tab:`changes`}):n.isError?(0,Z.jsx)(B,{tab:`changes`,error:n.error}):(0,Z.jsx)(ee,{run:n.data})}function ee({run:e}){let t=h(),n=b(),r=g(e.id,S(e)),i=x(),[o,u]=(0,G.useState)(`unified`),[f,p]=(0,G.useState)(!1),[_,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(null),[O,j]=(0,G.useState)(!1),M=(0,G.useRef)(null),N=s(),P=()=>N.invalidateQueries({queryKey:v.runs.all}),F=e=>w(e.message,{tone:`danger`}),I=y({mutationFn:()=>l(e.id),onSuccess:e=>w(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:F}),L=y({mutationFn:()=>m(e.id),onSuccess:e=>{w(`Draft PR created — ${e.url}`),P()},onError:F}),R=y({mutationFn:()=>a(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>w(`No terminal found — command copied to clipboard.`)).catch(()=>w(`Run manually: ${e.command}`));return}F(e)}}),z=y({mutationFn:t=>c(e.id,t),onError:F}),B=r.isError&&r.error instanceof d&&r.error.status===409,H=X({run:e,hasWorktree:!!e.worktreePath&&!B,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:V(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:j(!0);break;case`push`:I.mutate();break;case`create-pr`:L.mutate();break;case`open-terminal`:R.mutate();break;case`view-pr`:break}},K=r.data?.files??[],q=(0,G.useMemo)(()=>A(K),[K]),J=(0,G.useMemo)(()=>K.some(U),[K]),Y=i?o:`unified`,$=!i||f;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(D,{run:e,tab:`changes`}),(0,Z.jsx)(k,{bar:H,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:$,preview:_,onModeChange:u,onWrapChange:p,onPreviewChange:J?C:void 0,onAction:W}),r.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:r,changesRefused:B,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:T,selectFile:e=>{E(e),M.current?.scrollToPath(e)},diffRef:M,effectiveMode:Y,effectiveWrap:$,preview:_,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Z.jsx)(Q,{run:e,open:O,onOpenChange:j})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.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,Z.jsx)(L,{icon:t?(0,Z.jsx)(E,{size:16}):(0,Z.jsx)(T,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(L,{icon:(0,Z.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:r,selectFile:i,diffRef:a,effectiveMode:o,effectiveWrap:s,preview:c,localHandoff:l,onOpenInApp:u}){return(0,Z.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:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 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 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(O,{root:n,selected:r,onSelect:i})]}),(0,Z.jsx)(W,{files:t,viewRef:a,mode:o,wrap:s,preview:c,loadFileText:t=>re(e,t),imageSrc:t=>f(e,t),onOpenInApp:l?e=>u(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await o(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,u as n}from"./button-DGwhwRuD.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{i as a}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,u as n}from"./button-DGwhwRuD.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{i as a}from"./project-scope-context-B0yKt2yI.js";import{_t as o,gt as s,ht as c,vt as l}from"./queries-DoYRza8s.js";import{q as u}from"./use-desktop-BwkqVHep.js";import{C as d,M as f,Q as p,w as m}from"./design-icons-DmYTv2r1.js";import{t as h}from"./run-header-FB4j_Fjm.js";import{t as g}from"./project-router-BqAKGSaS.js";import{t as _}from"./centered-state-B5QmAy2y.js";import{D as v,E as y,Zt as b,s as x}from"./index-MgNz22Tg.js";import{t as S}from"./commit-diff-panel-CZAQ_wMQ.js";var C=e(r(),1),w=i(),T=77;function E({slot:e,commits:t,className:r,heading:i}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[f,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(b,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:n(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,r),children:[i?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(x,{scrollRef:d,startMargin:f,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(g,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:n(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:n(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:n(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:n(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(m,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=t(),n=c(e);return n.isPending?(0,w.jsx)(v,{tab:`changes`}):n.isError?(0,w.jsx)(y,{tab:`changes`,error:n.error}):(0,w.jsx)(k,{run:n.data})}function k({run:e}){let{sha:n}=t(),r=l(e.id,u(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(h,{run:e,tab:`commits`}),n?(0,w.jsx)(A,{runId:e.id,sha:n}):r.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):r.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(f,{size:16}),tone:r.error instanceof a&&r.error.status===409?`neutral`:`danger`,heading:`h2`,title:r.error instanceof a&&r.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:r.error.message}):r.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[r.data.commits.length,` `,r.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:r.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=s(e.id,u(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(g,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,D as n,E as r,T as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{N as l,i as u,s as d}from"./project-scope-context-0Z0nsheq.js";import{C as f,bt as p,f as m,ht as h,u as g}from"./queries-7W9tOZsg.js";import{C as _,E as v,Q as y,ct as b,d as x}from"./design-icons-DmYTv2r1.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{d as C,t as w}from"./run-header-CJg8dyfz.js";import{a as T,i as E,n as D,r as O}from"./file-preview-FhzIdXZ3.js";import{t as k}from"./centered-state-B5QmAy2y.js";import{D as A,E as j,Zt as M,z as N}from"./index-e1OpsDKN.js";var P=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),F=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),I=e(s(),1),L=c();function R({runId:e,path:n,artifactId:r}){let i=f(e,r?null:n),o=g(e,r),s=r?o:i,c=(0,I.useContext)(N),u=t(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=s.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...c,basePath:m.path}:null,[m,c,e]);if(!n&&!r)return(0,L.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(s.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(s.isError)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:`Could not load this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:s.error.message}),(0,L.jsx)(a,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});if(!m)return(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(m.type!==`file`)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:m.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:m.path}),(0,L.jsx)(`p`,{className:`text-sm`,children:m.reason}),(0,L.jsx)(a,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});let _=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(D,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:_?d(e,_.id,`image`):l(e,n),..._?{downloadUrl:d(e,_.id,`download`),snapshot:new Date(_.createdAt).toLocaleString()}:{}},_?.id??m.path)})}var z=new Map;function B(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var V=(0,I.createContext)(null);function H(){let{key:e}=t(),n=i()===`POP`,[r,a]=(0,I.useState)({key:e,generation:0});if(r.key===e)return r.generation;let o={key:e,generation:n?r.generation+1:r.generation};return a(o),o.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,n){let r=(0,I.useRef)(null),a=t(),o=i()===`POP`?a.key:B(a.state),[s]=(0,I.useState)(()=>{let t=o?z.get(o):void 0;return t?.runId===e?t:null}),c=(0,I.useRef)(new Set(s?.folders??[])),l=(0,I.useRef)(new Set),[u,d]=(0,I.useState)(0),f=(0,I.useRef)(s===null),p=(0,I.useCallback)(()=>{f.current&&z.set(a.key,{runId:e,folders:new Set(c.current),tree:r.current?.scrollTop??0,main:U()?.scrollTop??0})},[a.key,e]),m=(0,I.useMemo)(()=>({isOpen:e=>c.current.has(e),setOpen:(e,t)=>{t?c.current.add(e):c.current.delete(e),p()},loading:(e,t)=>{s?.folders.has(e)&&(t?l.current.add(e):l.current.delete(e),d(l.current.size))}}),[s,p]);return(0,I.useEffect)(()=>{if(f.current||!s||!n||l.current.size>0)return;r.current&&(r.current.scrollTop=s.tree);let e=U();e&&(e.scrollTop=s.main),f.current=!0,p()},[s,n,u,p]),(0,I.useEffect)(()=>{p();let e=[r.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,p,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,p)}},[p]),{tree:r,folders:m}}function G({runId:e,selected:t,onSelect:n}){return(0,L.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function K({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=p(e,t),o=(0,I.useContext)(V);return(0,I.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,L.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,L.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,L.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,L.jsx)(L.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,L.jsx)(q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,L.jsx)(J,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function q({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let s=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>s?.isOpen(n)??!1);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(x,{size:16,"aria-hidden":`true`,className:o(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function J({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let s=i===t,c=T(t)?F:_;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>a(t),className:o(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,L.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:E(n)})]})})}function Y(){let{id:e}=r(),t=h(e),n=H();return t.isPending?(0,L.jsx)(A,{tab:`files`}):t.isError?(0,L.jsx)(j,{tab:`files`,error:t.error}):(0,L.jsx)(C,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=f(e,r||n!==null?null:t),a=g(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=p(e.id,``),r=m(e.id),[i,o]=n(),s=i.get(`path`),c=i.get(`artifact`),l=i.getAll(`path`).length>1||i.getAll(`artifact`).length>1||s!==null&&c!==null,[d,f]=(0,I.useState)(s??``);(0,I.useEffect)(()=>f(s??``),[s]);let h=(e,t)=>{let n=new URLSearchParams(i);n.delete(`path`),n.delete(`artifact`),n.set(e,t),o(n)},g=t.isError&&t.error instanceof u&&t.error.status===409,_=X(e.id,s,c,l),v=W(e.id,!t.isPending&&_);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(w,{run:e,tab:`files`}),(0,L.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&h(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(y,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(M,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,L.jsx)(a,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,L.jsxs)(`aside`,{ref:v.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,L.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,L.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,L.jsx)(k,{icon:g?(0,L.jsx)(P,{}):(0,L.jsx)(b,{size:16}),tone:g?`neutral`:`danger`,heading:`h2`,title:g?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:v.folders,children:(0,L.jsx)(G,{runId:e.id,selected:s,onSelect:e=>h(`path`,e)})}),(0,L.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),r.isPending?(0,L.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):r.isError?(0,L.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):r.data.artifacts.length===0?(0,L.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,L.jsx)(`ul`,{children:r.data.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":e.id===c?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>h(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(a,{variant:`ghost`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Refresh published files`})]})]}),l?(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):s!==null||c!==null||t.isSuccess?(0,L.jsx)(R,{runId:e.id,path:s,artifactId:c}):null]}),(0,L.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}export{Y as TaskFilesRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,D as n,E as r,T as i,t as a,u as o}from"./button-DGwhwRuD.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{N as l,i as u,s as d}from"./project-scope-context-B0yKt2yI.js";import{C as f,bt as p,f as m,ht as h,u as g}from"./queries-DoYRza8s.js";import{C as _,E as v,Q as y,ct as b,d as x}from"./design-icons-DmYTv2r1.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{d as C,t as w}from"./run-header-FB4j_Fjm.js";import{a as T,i as E,n as D,r as O}from"./file-preview-1f8vPVsK.js";import{t as k}from"./centered-state-B5QmAy2y.js";import{D as A,E as j,Zt as M,z as N}from"./index-MgNz22Tg.js";var P=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),F=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),I=e(s(),1),L=c();function R({runId:e,path:n,artifactId:r}){let i=f(e,r?null:n),o=g(e,r),s=r?o:i,c=(0,I.useContext)(N),u=t(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=s.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...c,basePath:m.path}:null,[m,c,e]);if(!n&&!r)return(0,L.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(s.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(s.isError)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:`Could not load this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:s.error.message}),(0,L.jsx)(a,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});if(!m)return(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(m.type!==`file`)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:m.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:m.path}),(0,L.jsx)(`p`,{className:`text-sm`,children:m.reason}),(0,L.jsx)(a,{variant:`outline`,onClick:()=>void s.refetch(),children:`Retry`})]});let _=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(D,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:_?d(e,_.id,`image`):l(e,n),..._?{downloadUrl:d(e,_.id,`download`),snapshot:new Date(_.createdAt).toLocaleString()}:{}},_?.id??m.path)})}var z=new Map;function B(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var V=(0,I.createContext)(null);function H(){let{key:e}=t(),n=i()===`POP`,[r,a]=(0,I.useState)({key:e,generation:0});if(r.key===e)return r.generation;let o={key:e,generation:n?r.generation+1:r.generation};return a(o),o.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,n){let r=(0,I.useRef)(null),a=t(),o=i()===`POP`?a.key:B(a.state),[s]=(0,I.useState)(()=>{let t=o?z.get(o):void 0;return t?.runId===e?t:null}),c=(0,I.useRef)(new Set(s?.folders??[])),l=(0,I.useRef)(new Set),[u,d]=(0,I.useState)(0),f=(0,I.useRef)(s===null),p=(0,I.useCallback)(()=>{f.current&&z.set(a.key,{runId:e,folders:new Set(c.current),tree:r.current?.scrollTop??0,main:U()?.scrollTop??0})},[a.key,e]),m=(0,I.useMemo)(()=>({isOpen:e=>c.current.has(e),setOpen:(e,t)=>{t?c.current.add(e):c.current.delete(e),p()},loading:(e,t)=>{s?.folders.has(e)&&(t?l.current.add(e):l.current.delete(e),d(l.current.size))}}),[s,p]);return(0,I.useEffect)(()=>{if(f.current||!s||!n||l.current.size>0)return;r.current&&(r.current.scrollTop=s.tree);let e=U();e&&(e.scrollTop=s.main),f.current=!0,p()},[s,n,u,p]),(0,I.useEffect)(()=>{p();let e=[r.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,p,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,p)}},[p]),{tree:r,folders:m}}function G({runId:e,selected:t,onSelect:n}){return(0,L.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function K({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=p(e,t),o=(0,I.useContext)(V);return(0,I.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,L.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,L.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,L.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,L.jsx)(L.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,L.jsx)(q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,L.jsx)(J,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function q({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let s=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>s?.isOpen(n)??!1);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(x,{size:16,"aria-hidden":`true`,className:o(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function J({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let s=i===t,c=T(t)?F:_;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>a(t),className:o(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,L.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:E(n)})]})})}function Y(){let{id:e}=r(),t=h(e),n=H();return t.isPending?(0,L.jsx)(A,{tab:`files`}):t.isError?(0,L.jsx)(j,{tab:`files`,error:t.error}):(0,L.jsx)(C,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=f(e,r||n!==null?null:t),a=g(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=p(e.id,``),r=m(e.id),[i,o]=n(),s=i.get(`path`),c=i.get(`artifact`),l=i.getAll(`path`).length>1||i.getAll(`artifact`).length>1||s!==null&&c!==null,[d,f]=(0,I.useState)(s??``);(0,I.useEffect)(()=>f(s??``),[s]);let h=(e,t)=>{let n=new URLSearchParams(i);n.delete(`path`),n.delete(`artifact`),n.set(e,t),o(n)},g=t.isError&&t.error instanceof u&&t.error.status===409,_=X(e.id,s,c,l),v=W(e.id,!t.isPending&&_);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(w,{run:e,tab:`files`}),(0,L.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&h(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(y,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(M,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,L.jsx)(a,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,L.jsxs)(`aside`,{ref:v.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,L.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,L.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,L.jsx)(k,{icon:g?(0,L.jsx)(P,{}):(0,L.jsx)(b,{size:16}),tone:g?`neutral`:`danger`,heading:`h2`,title:g?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:v.folders,children:(0,L.jsx)(G,{runId:e.id,selected:s,onSelect:e=>h(`path`,e)})}),(0,L.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),r.isPending?(0,L.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):r.isError?(0,L.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):r.data.artifacts.length===0?(0,L.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,L.jsx)(`ul`,{children:r.data.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":e.id===c?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>h(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(a,{variant:`ghost`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Refresh published files`})]})]}),l?(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):s!==null||c!==null||t.isSuccess?(0,L.jsx)(R,{runId:e.id,path:s,artifactId:c}):null]}),(0,L.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}export{Y as TaskFilesRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e,d as t,t as n}from"./button-DGwhwRuD.js";import{t as r}from"./react-runtime-CCIEwYL0.js";import{Ur as i,et as a}from"./project-scope-context-
|
|
1
|
+
import{E as e,d as t,t as n}from"./button-DGwhwRuD.js";import{t as r}from"./react-runtime-CCIEwYL0.js";import{Ur as i,et as a}from"./project-scope-context-B0yKt2yI.js";import{E as o,P as s,Q as c,ht as l,k as u,n as d,nn as f,q as p}from"./queries-DoYRza8s.js";import{S as m,et as h,y as g}from"./use-desktop-BwkqVHep.js";import{I as _,ct as v,m as y}from"./design-icons-DmYTv2r1.js";import{t as b}from"./run-header-FB4j_Fjm.js";import{u as x}from"./reference-chip-Dd_YU2KX.js";import{t as S}from"./project-router-BqAKGSaS.js";import{t as C}from"./centered-state-B5QmAy2y.js";import{E as w,T,an as E}from"./index-MgNz22Tg.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-BOD9cT6o.js";var A=r(),j={issue:`Issue`,pr:`Pull request`};function M({kind:t}){let{id:n}=e(),r=l(n);return r.isPending?(0,A.jsx)(T,{kind:t}):r.isError?(0,A.jsx)(w,{tab:`github-item`,error:r.error}):(0,A.jsx)(N,{run:r.data,kind:t})}function N({run:t,kind:r}){let{n:i}=e(),a=Number(i),o=p(),l=c(),d=s(),f=l.isPending||d.isPending,m=g(t,o).some(e=>e.kind===r&&e.number===a),h=u(r,a,m);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(b,{run:t,tab:{kind:r,number:a}}),m?(0,A.jsx)(V,{run:t,kind:r,number:a,repoBase:o,item:h}):f?(0,A.jsx)(T,{kind:r,number:a,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${i} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${t.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:r}){return(0,A.jsx)(n,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(d.githubItem(t,r)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(v,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:r,number:i,repoBase:a,reason:o,retryError:s,retryButton:c}){let l=r===`pr`?_:y,u=m(e,a).find(e=>e.kind===`PR`==(r===`pr`)&&e.number===i)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:s?.message??o,actions:(0,A.jsxs)(A.Fragment,{children:[c,u&&t(u)?(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(h,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:n,repoBase:r,item:s}){let c=i(),l=f({mutationFn:e=>a(t,n,{refresh:!0}),onSuccess:(e,t)=>c.setQueryData(t,e)}),u=P(t,s),d=o(u?[n]:[],u),p=d.data?.available?d.data.checks:void 0,m=`${j[t]} #${n}`,h=(0,A.jsx)(I,{retry:l,kind:t,number:n});if(s.isPending)return(0,A.jsx)(T,{kind:t,number:n,heading:`h2`});if(s.isError)return(0,A.jsx)(L,{kind:t,number:n,error:l.error??s.error,retryButton:h});let g=s.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,n,p,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:r}):(0,A.jsx)(R,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:l.error,retryButton:h})}function H(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function U({item:e}){let t=k();return(0,A.jsx)(D,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{M as TaskGithubItemRoute};
|