@wjarka/cezarion 0.13.5-pr360.552 → 0.13.5

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.
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ca as r,Cn as i,Ft as a,Hi as o,Jn as s,Jt as c,Lt as l,Oa as u,Oi as d,U as f,Wi as p,Yn as m,_n as h,a as g,aa as _,bt as v,c as y,ct as b,d as x,ei as S,gt as C,ht as w,i as T,l as E,n as D,o as O,pi as k,qn as A,r as j,rn as M,s as ee,t as te,wa as N,xa as P}from"./alert-dialog-DFJbVtBQ.js";import{n as F,t as I}from"./utils-B8qbBJrk.js";import{t as L}from"./createLucideIcon-BHp8sXmF.js";import{n as R}from"./diff-controls-C_7Ket1G.js";import{i as ne,r as z,t as B}from"./git-toolbar-Ctck--gW.js";import{t as V,u as H}from"./project-router-_NlWrr1u.js";import{t as U}from"./search-x-I9Q8pgUa.js";import{t as W}from"./diff-stat-Cq4juy0u.js";import{a as G,h as K}from"./index-C1A6aKjy.js";import{t as q}from"./diff-DDUpEMjA2.js";import{t as J}from"./tab-link-CjkLjjTf.js";import{t as Y}from"./use-desktop-BaYgO7YW.js";import{t as X}from"./commit-list-DkjOXD46.js";var re=L(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Z=e(t(),1),Q=n();function ie({repo:e,info:t}){let n=i(),o=u(),s=e=>_(e.message,{tone:`danger`}),c=r({mutationFn:e=>k({name:e}),onSuccess:async e=>{_(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([o.invalidateQueries({queryKey:M.repo}),o.invalidateQueries({queryKey:M.health})]),o.setQueryData(M.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),o.setQueryData(M.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),d=r({mutationFn:e=>p({baseBranch:e}),onSuccess:e=>{_(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),o.invalidateQueries({queryKey:M.repo})},onError:s}),[f,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(``),v=h.trim().toLowerCase(),y=v?e.branches.filter(e=>e.toLowerCase().includes(v)):e.branches;return(0,Q.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(l,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>g(e.target.value),className:`h-11 pl-10`})]}),(0,Q.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[y.map(e=>{let n=e===t.branch;return(0,Q.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,Q.jsx)(`span`,{className:I(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),n?(0,Q.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[10px] font-medium text-accent-text`,children:`Current`}):(0,Q.jsxs)(x,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:c.isPending,onClick:()=>c.mutate(e),children:[(0,Q.jsx)(w,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),y.length===0?(0,Q.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Q.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&c.mutate(t,{onSuccess:()=>m(``)})},children:[(0,Q.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Q.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,Q.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:f,onChange:e=>m(e.target.value)}),(0,Q.jsxs)(x,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!f.trim()||c.isPending,children:[(0,Q.jsx)(a,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Q.jsxs)(`div`,{className:`mt-5`,children:[(0,Q.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-sm font-medium`,children:`Agents’ base branch`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`New task worktrees branch from this.`}),(0,Q.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:d.isPending,onChange:e=>d.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block min-h-11 w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})]}),(0,Q.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,Q.jsx)(ae,{}):null]})}function ae(){let e=h({limit:20});return(0,Q.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,Q.jsx)(oe,{pr:e},e.number))}):(0,Q.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function oe({pr:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Q.jsx)(se,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Q.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:F(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:I(n,`hover:bg-muted`),children:t}):(0,Q.jsx)(`span`,{className:n,children:t})})}function se({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:I(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function ce(){let e=s(),t=Y(),[n,r]=(0,Z.useState)(`unified`),[i,a]=(0,Z.useState)(!1),[o,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),d=e.isError&&e.error instanceof S&&e.error.status===409,f=e.data?.files??[],p=(0,Z.useMemo)(()=>z(f),[f]),m=t?n:`unified`,h=!t||i;return(0,Q.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,Q.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,Q.jsx)(B,{stat:e.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(R,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(E,{icon:d?(0,Q.jsx)(b,{size:16}):(0,Q.jsx)(c,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,Q.jsx)(E,{icon:(0,Q.jsx)(b,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,Q.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Q.jsx)(ne,{root:p,selected:o,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),(0,Q.jsx)(q,{files:f,viewRef:u,mode:m,wrap:h,className:`min-w-0 flex-1`})]})]})}function $({log:e}){let{sha:t}=P();return t?(0,Q.jsx)(le,{sha:t}):e.length===0?(0,Q.jsx)(E,{icon:(0,Q.jsx)(C,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,Q.jsx)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:(0,Q.jsx)(X,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})})}function le({sha:e}){let t=m(e),n=Y(),[r,i]=(0,Z.useState)(`unified`),[a,o]=(0,Z.useState)(!1),s=t.isError&&t.error instanceof S&&t.error.status===409,l=n?r:`unified`,u=!n||a;return(0,Q.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,Q.jsx)(x,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,Q.jsxs)(V,{to:`/git/commits`,children:[(0,Q.jsx)(f,{size:16,"aria-hidden":`true`}),`All commits`]})}),t.data?(0,Q.jsx)(W,{stat:t.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(R,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,Q.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,Q.jsx)(E,{icon:s?(0,Q.jsx)(U,{}):(0,Q.jsx)(c,{size:16}),tone:s?`neutral`:`danger`,heading:`h2`,title:s?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,Q.jsx)(E,{icon:(0,Q.jsx)(C,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,Q.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`,children:(0,Q.jsx)(q,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function ue({repo:e,info:t}){let n=u(),[i,a]=(0,Z.useState)(e.baseBranch??t.branch),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(null),f=M.repo,p=M.health,m=[...f,`pull`],h=!!t.remote,v=N({queryKey:m,queryFn:({signal:e})=>d({signal:e}),enabled:h}),b=r({mutationFn:o}),S=()=>Promise.all([n.invalidateQueries({queryKey:f}),n.invalidateQueries({queryKey:p})]),C=async(e,t=!1)=>{try{let n=await b.mutateAsync(t?{branch:e,confirm:!0}:{branch:e});if(`risks`in n){c(n);return}c(null),_(n.summary),await S()}catch(e){c(null),_(e instanceof Error?e.message:String(e),{tone:`danger`}),await S()}},E=v.data?.branches??e.branches,k=v.data===void 0||E.includes(i),A=k?E:[i,...E],P=h&&v.isPending,F=h?v.isError?`Could not load local branches: ${v.error.message}`:k?null:`${i} is not a local branch. Choose a local branch to pull.`:`No remote configured. Add a Git remote before pulling.`,I=b.isPending||P||!h||v.isError,L=I||!k,R=i!==t.branch;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-pull`,className:`max-w-full md:w-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`repo-pull-branch`,className:`sr-only`,children:`Branch to pull`}),(0,Q.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,Q.jsx)(w,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(`select`,{id:`repo-pull-branch`,value:i,disabled:I,onChange:e=>a(e.target.value),className:`h-11 max-w-full min-w-[88px] appearance-none rounded-lg border border-input bg-card pr-3 pl-9 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,style:{width:`${Math.max(88,i.length*8+56)}px`},children:A.map(e=>(0,Q.jsx)(`option`,{value:e,disabled:!k&&e===i,children:e},e))})]}),(0,Q.jsxs)(x,{ref:l,type:`button`,"data-action":`repo-pull`,className:`h-11 px-4`,disabled:L,title:F??void 0,onClick:()=>void C(i),children:[b.isPending?(0,Q.jsx)(H,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(re,{"aria-hidden":`true`}),R?`Switch & pull`:`Pull`]})]}),F||R?(0,Q.jsx)(`p`,{"data-slot":`repo-pull-note`,className:`mt-1 break-all text-[11px] text-soft-foreground md:text-left`,children:F??`${i} stays checked out after the pull.`}):null]}),(0,Q.jsx)(te,{open:s!==null,onOpenChange:e=>{!e&&!b.isPending&&c(null)},children:(0,Q.jsxs)(T,{onCloseAutoFocus:e=>{e.preventDefault(),l.current?.focus()},children:[(0,Q.jsxs)(ee,{children:[(0,Q.jsxs)(y,{children:[`Pull `,s?.branch,` anyway?`]}),(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[s?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,s?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the switch or pull to protect them.`}):null,(0,Q.jsxs)(`p`,{children:[s?.branch,` will stay checked out after this attempt.`]})]})})]}),(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`h-11`,disabled:b.isPending,children:`Cancel`}),(0,Q.jsx)(D,{className:`h-11`,disabled:b.isPending||s===null,onClick:e=>{e.preventDefault(),s&&C(s.branch,!0)},children:b.isPending?`Pulling…`:`Pull anyway`})]})]})})]})}function de({tab:e}){let t=A();if(t.isPending)return(0,Q.jsx)(G,{});if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(E,{icon:(0,Q.jsx)(c,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,Q.jsx)(fe,{repo:t.data,info:n,tab:e}):(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(E,{icon:(0,Q.jsx)(w,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function fe({repo:e,info:t,tab:n}){return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{"data-slot":`repo-header`,className:`px-[18px] pt-[18px] md:px-9 md:pt-9`,children:[(0,Q.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:[`Git · `,n===`changes`?`Changes`:n===`commits`?`Commits`:`Branches`]}),(0,Q.jsxs)(`p`,{"data-slot":`repo-remote`,className:`mt-2 break-all text-[13px] text-muted-foreground`,children:[t.root.split(`/`).filter(Boolean).at(-1),t.remote?` · ${t.remote}`:``,` · `,(0,Q.jsx)(`span`,{"data-slot":`branch-chip`,children:t.branch})]}),(0,Q.jsx)(`div`,{className:`my-[22px] flex min-w-0 items-start gap-2.5`,children:(0,Q.jsx)(ue,{repo:e,info:t})}),(0,Q.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`flex items-end gap-6 border-b border-border [&>a]:min-h-11`,children:[(0,Q.jsx)(J,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,Q.jsx)(J,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,Q.jsx)(J,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,Q.jsx)(ce,{}):n===`commits`?(0,Q.jsx)($,{log:e.log}):(0,Q.jsx)(ie,{repo:e,info:t})]})}export{de as RepoGitRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ca as r,Cn as i,Ft as a,Hi as o,Jn as s,Jt as c,Lt as l,Oa as u,Oi as d,U as f,Wi as p,Yn as m,_n as h,a as g,aa as _,bt as v,c as y,ct as b,d as x,ei as S,gt as C,ht as w,i as T,l as E,n as D,o as O,pi as k,qn as A,r as j,rn as M,s as ee,t as te,wa as N,xa as P}from"./alert-dialog-DFJbVtBQ.js";import{n as F,t as I}from"./utils-B8qbBJrk.js";import{t as L}from"./createLucideIcon-BHp8sXmF.js";import{n as R}from"./diff-controls-C_7Ket1G.js";import{i as ne,r as z,t as B}from"./git-toolbar-Ctck--gW.js";import{t as V,u as H}from"./project-router-_NlWrr1u.js";import{t as U}from"./search-x-I9Q8pgUa.js";import{t as W}from"./diff-stat-Cq4juy0u.js";import{a as G,h as K}from"./index-BWdizKd9.js";import{t as q}from"./diff-DDUpEMjA2.js";import{t as J}from"./tab-link-CjkLjjTf.js";import{t as Y}from"./use-desktop-BaYgO7YW.js";import{t as X}from"./commit-list-DGa1MVRq.js";var re=L(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Z=e(t(),1),Q=n();function ie({repo:e,info:t}){let n=i(),o=u(),s=e=>_(e.message,{tone:`danger`}),c=r({mutationFn:e=>k({name:e}),onSuccess:async e=>{_(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([o.invalidateQueries({queryKey:M.repo}),o.invalidateQueries({queryKey:M.health})]),o.setQueryData(M.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),o.setQueryData(M.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),d=r({mutationFn:e=>p({baseBranch:e}),onSuccess:e=>{_(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),o.invalidateQueries({queryKey:M.repo})},onError:s}),[f,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(``),v=h.trim().toLowerCase(),y=v?e.branches.filter(e=>e.toLowerCase().includes(v)):e.branches;return(0,Q.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(l,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>g(e.target.value),className:`h-11 pl-10`})]}),(0,Q.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[y.map(e=>{let n=e===t.branch;return(0,Q.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,Q.jsx)(`span`,{className:I(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),n?(0,Q.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[10px] font-medium text-accent-text`,children:`Current`}):(0,Q.jsxs)(x,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:c.isPending,onClick:()=>c.mutate(e),children:[(0,Q.jsx)(w,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),y.length===0?(0,Q.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Q.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&c.mutate(t,{onSuccess:()=>m(``)})},children:[(0,Q.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Q.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,Q.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:f,onChange:e=>m(e.target.value)}),(0,Q.jsxs)(x,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!f.trim()||c.isPending,children:[(0,Q.jsx)(a,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Q.jsxs)(`div`,{className:`mt-5`,children:[(0,Q.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-sm font-medium`,children:`Agents’ base branch`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`New task worktrees branch from this.`}),(0,Q.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:d.isPending,onChange:e=>d.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block min-h-11 w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})]}),(0,Q.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,Q.jsx)(ae,{}):null]})}function ae(){let e=h({limit:20});return(0,Q.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,Q.jsx)(oe,{pr:e},e.number))}):(0,Q.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function oe({pr:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Q.jsx)(se,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Q.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:F(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:I(n,`hover:bg-muted`),children:t}):(0,Q.jsx)(`span`,{className:n,children:t})})}function se({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:I(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function ce(){let e=s(),t=Y(),[n,r]=(0,Z.useState)(`unified`),[i,a]=(0,Z.useState)(!1),[o,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),d=e.isError&&e.error instanceof S&&e.error.status===409,f=e.data?.files??[],p=(0,Z.useMemo)(()=>z(f),[f]),m=t?n:`unified`,h=!t||i;return(0,Q.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,Q.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,Q.jsx)(B,{stat:e.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(R,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(E,{icon:d?(0,Q.jsx)(b,{size:16}):(0,Q.jsx)(c,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,Q.jsx)(E,{icon:(0,Q.jsx)(b,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,Q.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Q.jsx)(ne,{root:p,selected:o,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),(0,Q.jsx)(q,{files:f,viewRef:u,mode:m,wrap:h,className:`min-w-0 flex-1`})]})]})}function $({log:e}){let{sha:t}=P();return t?(0,Q.jsx)(le,{sha:t}):e.length===0?(0,Q.jsx)(E,{icon:(0,Q.jsx)(C,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,Q.jsx)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:(0,Q.jsx)(X,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})})}function le({sha:e}){let t=m(e),n=Y(),[r,i]=(0,Z.useState)(`unified`),[a,o]=(0,Z.useState)(!1),s=t.isError&&t.error instanceof S&&t.error.status===409,l=n?r:`unified`,u=!n||a;return(0,Q.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,Q.jsx)(x,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,Q.jsxs)(V,{to:`/git/commits`,children:[(0,Q.jsx)(f,{size:16,"aria-hidden":`true`}),`All commits`]})}),t.data?(0,Q.jsx)(W,{stat:t.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(R,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,Q.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,Q.jsx)(E,{icon:s?(0,Q.jsx)(U,{}):(0,Q.jsx)(c,{size:16}),tone:s?`neutral`:`danger`,heading:`h2`,title:s?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,Q.jsx)(E,{icon:(0,Q.jsx)(C,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,Q.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`,children:(0,Q.jsx)(q,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function ue({repo:e,info:t}){let n=u(),[i,a]=(0,Z.useState)(e.baseBranch??t.branch),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(null),f=M.repo,p=M.health,m=[...f,`pull`],h=!!t.remote,v=N({queryKey:m,queryFn:({signal:e})=>d({signal:e}),enabled:h}),b=r({mutationFn:o}),S=()=>Promise.all([n.invalidateQueries({queryKey:f}),n.invalidateQueries({queryKey:p})]),C=async(e,t=!1)=>{try{let n=await b.mutateAsync(t?{branch:e,confirm:!0}:{branch:e});if(`risks`in n){c(n);return}c(null),_(n.summary),await S()}catch(e){c(null),_(e instanceof Error?e.message:String(e),{tone:`danger`}),await S()}},E=v.data?.branches??e.branches,k=v.data===void 0||E.includes(i),A=k?E:[i,...E],P=h&&v.isPending,F=h?v.isError?`Could not load local branches: ${v.error.message}`:k?null:`${i} is not a local branch. Choose a local branch to pull.`:`No remote configured. Add a Git remote before pulling.`,I=b.isPending||P||!h||v.isError,L=I||!k,R=i!==t.branch;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-pull`,className:`max-w-full md:w-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`repo-pull-branch`,className:`sr-only`,children:`Branch to pull`}),(0,Q.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,Q.jsx)(w,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(`select`,{id:`repo-pull-branch`,value:i,disabled:I,onChange:e=>a(e.target.value),className:`h-11 max-w-full min-w-[88px] appearance-none rounded-lg border border-input bg-card pr-3 pl-9 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,style:{width:`${Math.max(88,i.length*8+56)}px`},children:A.map(e=>(0,Q.jsx)(`option`,{value:e,disabled:!k&&e===i,children:e},e))})]}),(0,Q.jsxs)(x,{ref:l,type:`button`,"data-action":`repo-pull`,className:`h-11 px-4`,disabled:L,title:F??void 0,onClick:()=>void C(i),children:[b.isPending?(0,Q.jsx)(H,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(re,{"aria-hidden":`true`}),R?`Switch & pull`:`Pull`]})]}),F||R?(0,Q.jsx)(`p`,{"data-slot":`repo-pull-note`,className:`mt-1 break-all text-[11px] text-soft-foreground md:text-left`,children:F??`${i} stays checked out after the pull.`}):null]}),(0,Q.jsx)(te,{open:s!==null,onOpenChange:e=>{!e&&!b.isPending&&c(null)},children:(0,Q.jsxs)(T,{onCloseAutoFocus:e=>{e.preventDefault(),l.current?.focus()},children:[(0,Q.jsxs)(ee,{children:[(0,Q.jsxs)(y,{children:[`Pull `,s?.branch,` anyway?`]}),(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[s?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,s?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the switch or pull to protect them.`}):null,(0,Q.jsxs)(`p`,{children:[s?.branch,` will stay checked out after this attempt.`]})]})})]}),(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`h-11`,disabled:b.isPending,children:`Cancel`}),(0,Q.jsx)(D,{className:`h-11`,disabled:b.isPending||s===null,onClick:e=>{e.preventDefault(),s&&C(s.branch,!0)},children:b.isPending?`Pulling…`:`Pull anyway`})]})]})})]})}function de({tab:e}){let t=A();if(t.isPending)return(0,Q.jsx)(G,{});if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(E,{icon:(0,Q.jsx)(c,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,Q.jsx)(fe,{repo:t.data,info:n,tab:e}):(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(E,{icon:(0,Q.jsx)(w,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function fe({repo:e,info:t,tab:n}){return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{"data-slot":`repo-header`,className:`px-[18px] pt-[18px] md:px-9 md:pt-9`,children:[(0,Q.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:[`Git · `,n===`changes`?`Changes`:n===`commits`?`Commits`:`Branches`]}),(0,Q.jsxs)(`p`,{"data-slot":`repo-remote`,className:`mt-2 break-all text-[13px] text-muted-foreground`,children:[t.root.split(`/`).filter(Boolean).at(-1),t.remote?` · ${t.remote}`:``,` · `,(0,Q.jsx)(`span`,{"data-slot":`branch-chip`,children:t.branch})]}),(0,Q.jsx)(`div`,{className:`my-[22px] flex min-w-0 items-start gap-2.5`,children:(0,Q.jsx)(ue,{repo:e,info:t})}),(0,Q.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`flex items-end gap-6 border-b border-border [&>a]:min-h-11`,children:[(0,Q.jsx)(J,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,Q.jsx)(J,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,Q.jsx)(J,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,Q.jsx)(ce,{}):n===`commits`?(0,Q.jsx)($,{log:e.log}):(0,Q.jsx)(ie,{repo:e,info:t})]})}export{de as RepoGitRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,At as i,Ca as a,Ft as o,Ht as s,In as c,It as l,Jt as u,Lt as d,Oa as f,Sa as p,Tn as m,U as h,Ut as g,Wt as _,Yi as v,Z as y,_r as b,aa as x,at as S,ci as C,d as w,dr as T,fr as E,l as D,mi as O,qi as k,rn as A,ti as j,tn as M,xr as N,yr as P}from"./alert-dialog-DFJbVtBQ.js";import{t as F}from"./utils-B8qbBJrk.js";import{a as I,i as ee,n as te,o as ne,r as re,s as ie}from"./textarea-DZV_YYw9.js";import{T as ae}from"./prompt-templates-BAHuEV4s.js";import{c as oe,t as L}from"./project-router-_NlWrr1u.js";import{i as R,l as z,n as B,o as V,p as H}from"./skills-DFBiAuJG.js";import{c as U,h as W,o as G,t as K}from"./index-C1A6aKjy.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),ce=`https://github.com/open-mercato/skills`;function Y(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return Y(e)??[...t]}function le({projectId:e}){let t=f(),n=P(),r=m(),[a,s]=(0,q.useState)(``),c=E(e,!!e),l=r.data??[],p=(0,q.useMemo)(()=>l.map(e=>e.name),[l]),h=(0,q.useRef)([]);h.current=p;let v=(0,q.useMemo)(()=>new Set(X(n.data,p)),[n.data,p]),y=(0,q.useRef)(Promise.resolve()),b=(0,q.useRef)(0),S=(0,q.useCallback)(e=>{let n=N.uiState,r=t.getQueryData(n),i=e(X(r,h.current));t.setQueryData(n,{...r,importedSkills:i});let a=++b.current;y.current=y.current.then(async()=>{try{let e=await k({importedSkills:i});a===b.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:A.skills}))}catch(e){x(e instanceof Error?e.message:String(e),{tone:`danger`}),a===b.current&&t.invalidateQueries({queryKey:n})}})},[t]),C=(0,q.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),w=p.length>0&&p.every(e=>v.has(e)),T=(0,q.useCallback)(()=>{if(w){let e=new Set(h.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...h.current])])},[w,S]);if(r.isError)return(0,J.jsx)(D,{icon:(0,J.jsx)(u,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:r.error.message});let O=z(l,a);return(0,J.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`w-full min-w-0 [&_button]:min-h-11`,children:[(0,J.jsx)(`p`,{className:`mb-4 text-[10px] font-medium tracking-wide text-link-foreground`,children:`OPEN-MERCATO / SKILLS`}),(0,J.jsx)(`h2`,{className:`text-2xl font-medium`,children:`Manage skills`}),(0,J.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`a`,{href:ce,target:`_blank`,rel:`noreferrer`,children:`open-mercato`}),` skills appear in your catalog and composer picker. All are enabled by default; uncheck any you don’t want.`]}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Applies across projects · saved automatically`}),(0,J.jsx)(ue,{projectId:e,state:c.data,loadError:c.error}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Checkboxes control visibility. Updating refreshes installed skill files; it does not change your selection.`}),(0,J.jsxs)(`div`,{className:`sw-import-controls mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`sw-search relative min-w-0 flex-1`,children:[(0,J.jsx)(d,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:a,onChange:e=>s(e.target.value),className:`h-11 min-w-0 pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`import-all`,disabled:p.length===0||n.isPending,onClick:T,className:`h-11 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[w?(0,J.jsx)(i,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),w?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:r.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=v.has(e.name);return(0,J.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:F(`flex min-h-16 cursor-pointer items-start gap-3 rounded-lg border border-border p-4 transition-colors hover:bg-muted`,t&&`bg-background`),children:[(0,J.jsxs)(`span`,{className:`relative size-5 shrink-0`,children:[(0,J.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>C(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`}):(0,J.jsx)(_,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`})]}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:`min-w-0 break-words text-[13px] font-medium text-foreground`,children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,J.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:l.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ue({projectId:e,state:t,loadError:n}){let r=f(),i=oe(),o=(0,q.useRef)(0),[s,c]=(0,q.useState)(!1),u=a({mutationFn:()=>O({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{c(!1),i(ae(e))},onError:e=>x(e.message,{tone:`danger`})}),d=(t,n)=>{n.seq===o.current&&(r.setQueryData(N.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:A.skills}),x(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),c(!0)))},p=(e,t)=>{t.seq===o.current&&x(e.message,{tone:`danger`})},m=a({mutationFn:t=>C(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>p(e,t)}),h=a({mutationFn:t=>j(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>p(e,t)}),g=e=>{let n=++o.current;e===`apply`?h.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):m.mutate({action:e,seq:n})},_=t?.scopes.some(e=>e.skills.length>0)??!1,v=t?.status===`error`,b=_&&(t?.available||v),S=h.isPending||t?.status===`updating`,T=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],E=t?.scopes.filter(e=>e.updatedAt&&!T.includes(e))??[],D=`Checking installed Open Mercato skills…`;return n?D=`Update status is unavailable right now.`:t?.status===`available`?D=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?D=`Updating installed Open Mercato skills…`:t?.status===`current`?D=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?D=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(D=`The update did not finish for every installation.`),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-background p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:D}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Project and global installations are checked separately.`}),t?.checkedAt?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,J.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,J.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,T.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,T.map(e=>Z(e.scope)).join(`, `),E.length?`; updated: ${E.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),b?(0,J.jsxs)(w,{"data-action":`skills-update-apply`,size:`sm`,disabled:S,onClick:()=>g(`apply`),children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:F(`size-3.5`,S&&`motion-safe:animate-spin`)}),S?`Updating…`:v?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(w,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>g(`check`),children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(w,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>g(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,J.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,J.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,J.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-accent-strong/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-link-foreground`}),(0,J.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,J.jsx)(te,{open:s,onOpenChange:e=>u.isPending?void 0:c(e),children:(0,J.jsxs)(re,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,J.jsxs)(ne,{children:[(0,J.jsx)(ie,{children:`Apply the upgrade notes now?`}),(0,J.jsxs)(ee,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,J.jsxs)(I,{children:[(0,J.jsx)(w,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>c(!1),children:`No`}),(0,J.jsx)(w,{type:`button`,disabled:u.isPending,onClick:()=>u.mutate(),children:u.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function de(){return(0,J.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,J.jsx)(fe,{})})}function fe(){let e=T(),t=b(),n=m(),[i]=p(),[o,g]=(0,q.useState)(``),_=f(),y=c(),C=r().projectId??y.data?.bootProject??``,w=a({mutationFn:()=>v(),onSuccess:e=>{_.setQueryData(A.skills,e),x(`Team skills refreshed.`)},onError:e=>x(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(D,{icon:(0,J.jsx)(u,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let E=V(e.data??[]),O=(n.data?.length??0)>0,k=i.get(`skill`),j=k===Q||k===$||k!==null&&E.some(e=>e.name===k)?k:E[0]?.name??(O?$:Q),N=E.find(e=>e.name===j)??null,P=B(E,o);return(0,J.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[O?(0,J.jsxs)(L,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":j===$?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(S,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Manage skills`]}):null,(0,J.jsxs)(L,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":j===Q?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(M,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})]})]}),(0,J.jsxs)(`div`,{className:F(`flex-col items-start gap-2 sm:flex-row sm:items-center md:flex`,k===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(d,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>g(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:w.isPending,onClick:()=>w.mutate(),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 disabled:opacity-55`,children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:F(`size-3`,w.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] md:grid-cols-[minmax(220px,310px)_minmax(0,1fr)]`,children:[(0,J.jsx)(`section`,{"data-slot":`skills-list`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card p-3 md:flex`,k===null?`flex`:`hidden`),children:(0,J.jsx)(`ul`,{"data-slot":`skill-rows`,className:`flex min-h-0 flex-col gap-1 overflow-y-auto md:max-h-[calc(100dvh-280px)]`,children:e.isPending?(0,J.jsx)(`li`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-soft-foreground`,children:`Loading skills…`}):P.length>0?P.map(e=>(0,J.jsx)(pe,{skill:e,active:j===e.name,highlighted:j===$&&e===E[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:E.length>0?`(no skills match)`:(0,J.jsx)(se,{})})})}),(0,J.jsx)(`section`,{"data-slot":`skills-detail`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card md:flex`,k===null?`hidden`:`flex`),children:(0,J.jsxs)(`div`,{className:`min-w-0 p-5`,children:[(0,J.jsxs)(L,{to:`/skills`,"data-slot":`skills-back`,className:`mb-4 inline-flex min-h-11 items-center gap-2 rounded-lg border border-border px-3 text-xs font-medium hover:bg-muted md:hidden`,children:[(0,J.jsx)(h,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),j===$?(0,J.jsx)(le,{projectId:C}):j===Q?(0,J.jsx)(K,{skills:E}):N?(0,J.jsx)(G,{skill:N,usedBy:H(t.data?.workflows??[],N.name)}):e.isPending?(0,J.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`min-h-72 text-xs text-muted-foreground`,children:`Loading skill…`}):(0,J.jsx)(D,{icon:(0,J.jsx)(s,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})]})}function pe({skill:e,active:t,highlighted:n}){let r=R(e);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(L,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-highlighted":n||void 0,"data-project":r?`true`:void 0,"aria-current":t?`page`:void 0,className:F(`selection-row flex min-h-24 flex-col gap-2 rounded-lg border-b border-border p-3 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,(t||n)&&`border-transparent bg-accent-strong/10`),children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:F(`min-w-0 break-words text-[13px]`,r?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-supporting-foreground`,children:e.description}):null,(0,J.jsx)(U,{source:e.source,className:`self-start border-0 bg-transparent p-0 text-link-foreground`})]})})}export{de as SkillsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,At as i,Ca as a,Ft as o,Ht as s,In as c,It as l,Jt as u,Lt as d,Oa as f,Sa as p,Tn as m,U as h,Ut as g,Wt as _,Yi as v,Z as y,_r as b,aa as x,at as S,ci as C,d as w,dr as T,fr as E,l as D,mi as O,qi as k,rn as A,ti as j,tn as M,xr as N,yr as P}from"./alert-dialog-DFJbVtBQ.js";import{t as F}from"./utils-B8qbBJrk.js";import{a as I,i as ee,n as te,o as ne,r as re,s as ie}from"./textarea-DZV_YYw9.js";import{T as ae}from"./prompt-templates-BAHuEV4s.js";import{c as oe,t as L}from"./project-router-_NlWrr1u.js";import{i as R,l as z,n as B,o as V,p as H}from"./skills-DFBiAuJG.js";import{c as U,h as W,o as G,t as K}from"./index-BWdizKd9.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),ce=`https://github.com/open-mercato/skills`;function Y(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return Y(e)??[...t]}function le({projectId:e}){let t=f(),n=P(),r=m(),[a,s]=(0,q.useState)(``),c=E(e,!!e),l=r.data??[],p=(0,q.useMemo)(()=>l.map(e=>e.name),[l]),h=(0,q.useRef)([]);h.current=p;let v=(0,q.useMemo)(()=>new Set(X(n.data,p)),[n.data,p]),y=(0,q.useRef)(Promise.resolve()),b=(0,q.useRef)(0),S=(0,q.useCallback)(e=>{let n=N.uiState,r=t.getQueryData(n),i=e(X(r,h.current));t.setQueryData(n,{...r,importedSkills:i});let a=++b.current;y.current=y.current.then(async()=>{try{let e=await k({importedSkills:i});a===b.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:A.skills}))}catch(e){x(e instanceof Error?e.message:String(e),{tone:`danger`}),a===b.current&&t.invalidateQueries({queryKey:n})}})},[t]),C=(0,q.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),w=p.length>0&&p.every(e=>v.has(e)),T=(0,q.useCallback)(()=>{if(w){let e=new Set(h.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...h.current])])},[w,S]);if(r.isError)return(0,J.jsx)(D,{icon:(0,J.jsx)(u,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:r.error.message});let O=z(l,a);return(0,J.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`w-full min-w-0 [&_button]:min-h-11`,children:[(0,J.jsx)(`p`,{className:`mb-4 text-[10px] font-medium tracking-wide text-link-foreground`,children:`OPEN-MERCATO / SKILLS`}),(0,J.jsx)(`h2`,{className:`text-2xl font-medium`,children:`Manage skills`}),(0,J.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`a`,{href:ce,target:`_blank`,rel:`noreferrer`,children:`open-mercato`}),` skills appear in your catalog and composer picker. All are enabled by default; uncheck any you don’t want.`]}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Applies across projects · saved automatically`}),(0,J.jsx)(ue,{projectId:e,state:c.data,loadError:c.error}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Checkboxes control visibility. Updating refreshes installed skill files; it does not change your selection.`}),(0,J.jsxs)(`div`,{className:`sw-import-controls mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`sw-search relative min-w-0 flex-1`,children:[(0,J.jsx)(d,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:a,onChange:e=>s(e.target.value),className:`h-11 min-w-0 pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`import-all`,disabled:p.length===0||n.isPending,onClick:T,className:`h-11 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[w?(0,J.jsx)(i,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),w?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:r.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=v.has(e.name);return(0,J.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:F(`flex min-h-16 cursor-pointer items-start gap-3 rounded-lg border border-border p-4 transition-colors hover:bg-muted`,t&&`bg-background`),children:[(0,J.jsxs)(`span`,{className:`relative size-5 shrink-0`,children:[(0,J.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>C(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`}):(0,J.jsx)(_,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`})]}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:`min-w-0 break-words text-[13px] font-medium text-foreground`,children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,J.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:l.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ue({projectId:e,state:t,loadError:n}){let r=f(),i=oe(),o=(0,q.useRef)(0),[s,c]=(0,q.useState)(!1),u=a({mutationFn:()=>O({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{c(!1),i(ae(e))},onError:e=>x(e.message,{tone:`danger`})}),d=(t,n)=>{n.seq===o.current&&(r.setQueryData(N.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:A.skills}),x(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),c(!0)))},p=(e,t)=>{t.seq===o.current&&x(e.message,{tone:`danger`})},m=a({mutationFn:t=>C(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>p(e,t)}),h=a({mutationFn:t=>j(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>p(e,t)}),g=e=>{let n=++o.current;e===`apply`?h.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):m.mutate({action:e,seq:n})},_=t?.scopes.some(e=>e.skills.length>0)??!1,v=t?.status===`error`,b=_&&(t?.available||v),S=h.isPending||t?.status===`updating`,T=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],E=t?.scopes.filter(e=>e.updatedAt&&!T.includes(e))??[],D=`Checking installed Open Mercato skills…`;return n?D=`Update status is unavailable right now.`:t?.status===`available`?D=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?D=`Updating installed Open Mercato skills…`:t?.status===`current`?D=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?D=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(D=`The update did not finish for every installation.`),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-background p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:D}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Project and global installations are checked separately.`}),t?.checkedAt?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,J.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,J.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,T.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,T.map(e=>Z(e.scope)).join(`, `),E.length?`; updated: ${E.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),b?(0,J.jsxs)(w,{"data-action":`skills-update-apply`,size:`sm`,disabled:S,onClick:()=>g(`apply`),children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:F(`size-3.5`,S&&`motion-safe:animate-spin`)}),S?`Updating…`:v?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(w,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>g(`check`),children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(w,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>g(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,J.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,J.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,J.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-accent-strong/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-link-foreground`}),(0,J.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,J.jsx)(te,{open:s,onOpenChange:e=>u.isPending?void 0:c(e),children:(0,J.jsxs)(re,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,J.jsxs)(ne,{children:[(0,J.jsx)(ie,{children:`Apply the upgrade notes now?`}),(0,J.jsxs)(ee,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,J.jsxs)(I,{children:[(0,J.jsx)(w,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>c(!1),children:`No`}),(0,J.jsx)(w,{type:`button`,disabled:u.isPending,onClick:()=>u.mutate(),children:u.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function de(){return(0,J.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,J.jsx)(fe,{})})}function fe(){let e=T(),t=b(),n=m(),[i]=p(),[o,g]=(0,q.useState)(``),_=f(),y=c(),C=r().projectId??y.data?.bootProject??``,w=a({mutationFn:()=>v(),onSuccess:e=>{_.setQueryData(A.skills,e),x(`Team skills refreshed.`)},onError:e=>x(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(D,{icon:(0,J.jsx)(u,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let E=V(e.data??[]),O=(n.data?.length??0)>0,k=i.get(`skill`),j=k===Q||k===$||k!==null&&E.some(e=>e.name===k)?k:E[0]?.name??(O?$:Q),N=E.find(e=>e.name===j)??null,P=B(E,o);return(0,J.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[O?(0,J.jsxs)(L,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":j===$?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(S,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Manage skills`]}):null,(0,J.jsxs)(L,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":j===Q?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(M,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})]})]}),(0,J.jsxs)(`div`,{className:F(`flex-col items-start gap-2 sm:flex-row sm:items-center md:flex`,k===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(d,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>g(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:w.isPending,onClick:()=>w.mutate(),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 disabled:opacity-55`,children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:F(`size-3`,w.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] md:grid-cols-[minmax(220px,310px)_minmax(0,1fr)]`,children:[(0,J.jsx)(`section`,{"data-slot":`skills-list`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card p-3 md:flex`,k===null?`flex`:`hidden`),children:(0,J.jsx)(`ul`,{"data-slot":`skill-rows`,className:`flex min-h-0 flex-col gap-1 overflow-y-auto md:max-h-[calc(100dvh-280px)]`,children:e.isPending?(0,J.jsx)(`li`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-soft-foreground`,children:`Loading skills…`}):P.length>0?P.map(e=>(0,J.jsx)(pe,{skill:e,active:j===e.name,highlighted:j===$&&e===E[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:E.length>0?`(no skills match)`:(0,J.jsx)(se,{})})})}),(0,J.jsx)(`section`,{"data-slot":`skills-detail`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card md:flex`,k===null?`hidden`:`flex`),children:(0,J.jsxs)(`div`,{className:`min-w-0 p-5`,children:[(0,J.jsxs)(L,{to:`/skills`,"data-slot":`skills-back`,className:`mb-4 inline-flex min-h-11 items-center gap-2 rounded-lg border border-border px-3 text-xs font-medium hover:bg-muted md:hidden`,children:[(0,J.jsx)(h,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),j===$?(0,J.jsx)(le,{projectId:C}):j===Q?(0,J.jsx)(K,{skills:E}):N?(0,J.jsx)(G,{skill:N,usedBy:H(t.data?.workflows??[],N.name)}):e.isPending?(0,J.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`min-h-72 text-xs text-muted-foreground`,children:`Loading skill…`}):(0,J.jsx)(D,{icon:(0,J.jsx)(s,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})]})}function pe({skill:e,active:t,highlighted:n}){let r=R(e);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(L,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-highlighted":n||void 0,"data-project":r?`true`:void 0,"aria-current":t?`page`:void 0,className:F(`selection-row flex min-h-24 flex-col gap-2 rounded-lg border-b border-border p-3 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,(t||n)&&`border-transparent bg-accent-strong/10`),children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:F(`min-w-0 break-words text-[13px]`,r?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-supporting-foreground`,children:e.description}):null,(0,J.jsx)(U,{source:e.source,className:`self-start border-0 bg-transparent p-0 text-link-foreground`})]})})}export{de as SkillsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ca as r,Cn as i,Fi as a,Gr as o,Li as s,Oa as c,Qi as l,Qn as u,Ui as d,Zn as f,aa as p,ct as m,d as h,ei as g,gt as _,hi as v,ki as y,l as b,li as x,qn as S,rn as C,xa as w}from"./alert-dialog-DFJbVtBQ.js";import{a as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./textarea-DZV_YYw9.js";import{f as M,u as ee}from"./pill-D7x-JgPk.js";import{i as te,n as N,r as P}from"./git-toolbar-Ctck--gW.js";import{t as F}from"./run-header-C3oNFHTw.js";import{t as I}from"./use-submit-shortcut-KWJsC906.js";import{n as L,r as R}from"./index-C1A6aKjy.js";import{t as z}from"./diff-DDUpEMjA2.js";import{t as B}from"./use-desktop-BaYgO7YW.js";var V=e(t(),1),H=e=>e===`running`||e===`queued`||e===`waiting`,U=`no worktree — this task ran directly in the repo working tree`;function W(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${U}`)}function G(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${U}`)}function K(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 — ${U}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?H(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function q(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:W(e),n=e.prUrl?[W(e),G(e)]:[G(e),K(e)],r=[];if(e.localHandoff){let t=e.hasSession?H(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var J=n();function Y({run:e,open:t,onOpenChange:n}){let i=c(),[a,s]=(0,V.useState)(``),l=o(e),u=(0,V.useRef)(l);u.current=l,(0,V.useEffect)(()=>{t&&s(u.current)},[t]);let d=r({mutationFn:t=>x(e.id,t),onSuccess:t=>{p(`Committed ${t.sha.slice(0,7)}`),n(!1),i.invalidateQueries({queryKey:C.runs.changes(e.id)}),i.invalidateQueries({queryKey:C.runs.all})},onError:e=>p(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||d.isPending||d.mutate(e)};return(0,J.jsx)(D,{open:t,onOpenChange:n,children:(0,J.jsxs)(k,{"data-slot":`commit-dialog`,children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(A,{children:`Commit changes`}),(0,J.jsxs)(E,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,J.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,J.jsx)(j,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>s(e.target.value),onKeyDown:e=>{I({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,J.jsxs)(T,{children:[(0,J.jsx)(h,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(h,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||d.isPending,onClick:f,children:d.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=w(),t=f(e);return t.isPending?(0,J.jsx)(R,{tab:`changes`}):t.isError?(0,J.jsx)(L,{tab:`changes`,error:t.error}):(0,J.jsx)(Z,{run:t.data})}function Z({run:e}){let t=i(),n=S(),o=u(e.id,ee(e.status)),f=B(),[h,y]=(0,V.useState)(`unified`),[x,w]=(0,V.useState)(!1),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(!1),k=(0,V.useRef)(null),A=c(),j=()=>A.invalidateQueries({queryKey:C.runs.all}),I=e=>p(e.message,{tone:`danger`}),L=r({mutationFn:()=>d(e.id),onSuccess:e=>p(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:I}),R=r({mutationFn:()=>v(e.id),onSuccess:e=>{p(`Draft PR created — ${e.url}`),j()},onError:I}),H=r({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof g&&e.command){navigator.clipboard.writeText(e.command).then(()=>p(`No terminal found — command copied to clipboard.`)).catch(()=>p(`Run manually: ${e.command}`));return}I(e)}}),U=r({mutationFn:t=>a(e.id,t),onError:I}),W=o.isError&&o.error instanceof g&&o.error.status===409,G=q({status:e.status,hasWorktree:!!e.worktreePath&&!W,branch:e.branch,changedFiles:o.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:M(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:O(!0);break;case`push`:L.mutate();break;case`create-pr`:R.mutate();break;case`open-terminal`:H.mutate();break;case`view-pr`:break}},X=o.data?.files??[],Z=(0,V.useMemo)(()=>P(X),[X]),Q=f?h:`unified`,$=!f||x;return(0,J.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(F,{run:e,tab:`changes`}),(0,J.jsx)(N,{bar:G,branch:e.branch,stat:o.data?.stat,mode:Q,wrap:$,onModeChange:y,onWrapChange:w,onAction:K}),o.data?.repointedHead?(0,J.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,J.jsx)(`code`,{children:o.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,J.jsx)(`code`,{children:o.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,o.isPending?(0,J.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):o.isError?(0,J.jsx)(b,{icon:W?(0,J.jsx)(m,{size:16}):(0,J.jsx)(_,{size:16}),tone:W?`neutral`:`danger`,heading:`h2`,title:W?`No changes to show`:`Could not load the changes`,subtitle:o.error.message}):X.length===0?(0,J.jsx)(b,{icon:(0,J.jsx)(m,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,J.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,J.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,J.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,J.jsx)(te,{root:Z,selected:T,onSelect:e=>{E(e),k.current?.scrollToPath(e)}})]}),(0,J.jsx)(z,{files:X,viewRef:k,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>l(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>U.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,J.jsx)(Y,{run:e,open:D,onOpenChange:O})]})}async function ne(e,t){try{let n=await y(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X as TaskChangesRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ca as r,Cn as i,Fi as a,Gr as o,Li as s,Oa as c,Qi as l,Qn as u,Ui as d,Zn as f,aa as p,ct as m,d as h,ei as g,gt as _,hi as v,ki as y,l as b,li as x,qn as S,rn as C,xa as w}from"./alert-dialog-DFJbVtBQ.js";import{a as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./textarea-DZV_YYw9.js";import{f as M,u as ee}from"./pill-D7x-JgPk.js";import{i as te,n as N,r as P}from"./git-toolbar-Ctck--gW.js";import{t as F}from"./run-header-C3oNFHTw.js";import{t as I}from"./use-submit-shortcut-KWJsC906.js";import{n as L,r as R}from"./index-BWdizKd9.js";import{t as z}from"./diff-DDUpEMjA2.js";import{t as B}from"./use-desktop-BaYgO7YW.js";var V=e(t(),1),H=e=>e===`running`||e===`queued`||e===`waiting`,U=`no worktree — this task ran directly in the repo working tree`;function W(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${U}`)}function G(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${U}`)}function K(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 — ${U}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?H(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function q(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:W(e),n=e.prUrl?[W(e),G(e)]:[G(e),K(e)],r=[];if(e.localHandoff){let t=e.hasSession?H(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var J=n();function Y({run:e,open:t,onOpenChange:n}){let i=c(),[a,s]=(0,V.useState)(``),l=o(e),u=(0,V.useRef)(l);u.current=l,(0,V.useEffect)(()=>{t&&s(u.current)},[t]);let d=r({mutationFn:t=>x(e.id,t),onSuccess:t=>{p(`Committed ${t.sha.slice(0,7)}`),n(!1),i.invalidateQueries({queryKey:C.runs.changes(e.id)}),i.invalidateQueries({queryKey:C.runs.all})},onError:e=>p(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||d.isPending||d.mutate(e)};return(0,J.jsx)(D,{open:t,onOpenChange:n,children:(0,J.jsxs)(k,{"data-slot":`commit-dialog`,children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(A,{children:`Commit changes`}),(0,J.jsxs)(E,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,J.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,J.jsx)(j,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>s(e.target.value),onKeyDown:e=>{I({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,J.jsxs)(T,{children:[(0,J.jsx)(h,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(h,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||d.isPending,onClick:f,children:d.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=w(),t=f(e);return t.isPending?(0,J.jsx)(R,{tab:`changes`}):t.isError?(0,J.jsx)(L,{tab:`changes`,error:t.error}):(0,J.jsx)(Z,{run:t.data})}function Z({run:e}){let t=i(),n=S(),o=u(e.id,ee(e.status)),f=B(),[h,y]=(0,V.useState)(`unified`),[x,w]=(0,V.useState)(!1),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(!1),k=(0,V.useRef)(null),A=c(),j=()=>A.invalidateQueries({queryKey:C.runs.all}),I=e=>p(e.message,{tone:`danger`}),L=r({mutationFn:()=>d(e.id),onSuccess:e=>p(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:I}),R=r({mutationFn:()=>v(e.id),onSuccess:e=>{p(`Draft PR created — ${e.url}`),j()},onError:I}),H=r({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof g&&e.command){navigator.clipboard.writeText(e.command).then(()=>p(`No terminal found — command copied to clipboard.`)).catch(()=>p(`Run manually: ${e.command}`));return}I(e)}}),U=r({mutationFn:t=>a(e.id,t),onError:I}),W=o.isError&&o.error instanceof g&&o.error.status===409,G=q({status:e.status,hasWorktree:!!e.worktreePath&&!W,branch:e.branch,changedFiles:o.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:M(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:O(!0);break;case`push`:L.mutate();break;case`create-pr`:R.mutate();break;case`open-terminal`:H.mutate();break;case`view-pr`:break}},X=o.data?.files??[],Z=(0,V.useMemo)(()=>P(X),[X]),Q=f?h:`unified`,$=!f||x;return(0,J.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(F,{run:e,tab:`changes`}),(0,J.jsx)(N,{bar:G,branch:e.branch,stat:o.data?.stat,mode:Q,wrap:$,onModeChange:y,onWrapChange:w,onAction:K}),o.data?.repointedHead?(0,J.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,J.jsx)(`code`,{children:o.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,J.jsx)(`code`,{children:o.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,o.isPending?(0,J.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):o.isError?(0,J.jsx)(b,{icon:W?(0,J.jsx)(m,{size:16}):(0,J.jsx)(_,{size:16}),tone:W?`neutral`:`danger`,heading:`h2`,title:W?`No changes to show`:`Could not load the changes`,subtitle:o.error.message}):X.length===0?(0,J.jsx)(b,{icon:(0,J.jsx)(m,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,J.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,J.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,J.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,J.jsx)(te,{root:Z,selected:T,onSelect:e=>{E(e),k.current?.scrollToPath(e)}})]}),(0,J.jsx)(z,{files:X,viewRef:k,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>l(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>U.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,J.jsx)(Y,{run:e,open:D,onOpenChange:O})]})}async function ne(e,t){try{let n=await y(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X as TaskChangesRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Jt as i,Qn as a,U as o,Zn as s,d as c,ei as l,er as u,gt as d,l as f,st as p,xa as m}from"./alert-dialog-DFJbVtBQ.js";import{u as h}from"./pill-D7x-JgPk.js";import{n as g}from"./diff-controls-C_7Ket1G.js";import{t as _}from"./run-header-C3oNFHTw.js";import{t as v}from"./project-router-_NlWrr1u.js";import{t as y}from"./search-x-I9Q8pgUa.js";import{t as b}from"./diff-stat-Cq4juy0u.js";import{n as x,r as S}from"./index-C1A6aKjy.js";import{t as C}from"./diff-DDUpEMjA2.js";import{t as w}from"./use-desktop-BaYgO7YW.js";import{t as T}from"./commit-list-DkjOXD46.js";var E=e(t(),1),D=n();function O(){let{id:e}=m(),t=s(e);return t.isPending?(0,D.jsx)(S,{tab:`changes`}):t.isError?(0,D.jsx)(x,{tab:`changes`,error:t.error}):(0,D.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=m(),n=u(e.id,h(e.status));return(0,D.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,D.jsx)(_,{run:e,tab:`commits`}),t?(0,D.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,D.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,D.jsx)(f,{icon:(0,D.jsx)(d,{size:16}),tone:n.error instanceof l&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof l&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,D.jsx)(f,{icon:(0,D.jsx)(d,{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,D.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,D.jsx)(T,{slot:`task-commits`,heading:(0,D.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,D.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){let n=r(e,t),a=w(),[s,u]=(0,E.useState)(`unified`),[p,m]=(0,E.useState)(!1),h=n.isError&&n.error instanceof l&&n.error.status===409,_=a?s:`unified`,x=!a||p;return(0,D.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,D.jsx)(c,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,D.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,D.jsx)(o,{size:16,"aria-hidden":`true`}),`All commits`]})}),n.data?(0,D.jsx)(b,{stat:n.data.stat}):null,(0,D.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,D.jsx)(g,{mode:s,wrap:p,onModeChange:u,onWrapChange:m})})]}),n.isPending?(0,D.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,D.jsx)(f,{icon:h?(0,D.jsx)(y,{}):(0,D.jsx)(i,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,D.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,D.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,D.jsx)(f,{icon:(0,D.jsx)(d,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,D.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`,children:(0,D.jsx)(C,{files:n.data.files,mode:_,wrap:x,className:`min-w-0`})})]})]})}function j({run:e}){let t=a(e.id,h(e.status));return t.isPending?(0,D.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,D.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,D.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,D.jsxs)(`h2`,{className:`mb-4 text-[15px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,D.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(v,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(p,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,D.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Jt as i,Qn as a,U as o,Zn as s,d as c,ei as l,er as u,gt as d,l as f,st as p,xa as m}from"./alert-dialog-DFJbVtBQ.js";import{u as h}from"./pill-D7x-JgPk.js";import{n as g}from"./diff-controls-C_7Ket1G.js";import{t as _}from"./run-header-C3oNFHTw.js";import{t as v}from"./project-router-_NlWrr1u.js";import{t as y}from"./search-x-I9Q8pgUa.js";import{t as b}from"./diff-stat-Cq4juy0u.js";import{n as x,r as S}from"./index-BWdizKd9.js";import{t as C}from"./diff-DDUpEMjA2.js";import{t as w}from"./use-desktop-BaYgO7YW.js";import{t as T}from"./commit-list-DGa1MVRq.js";var E=e(t(),1),D=n();function O(){let{id:e}=m(),t=s(e);return t.isPending?(0,D.jsx)(S,{tab:`changes`}):t.isError?(0,D.jsx)(x,{tab:`changes`,error:t.error}):(0,D.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=m(),n=u(e.id,h(e.status));return(0,D.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,D.jsx)(_,{run:e,tab:`commits`}),t?(0,D.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,D.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,D.jsx)(f,{icon:(0,D.jsx)(d,{size:16}),tone:n.error instanceof l&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof l&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,D.jsx)(f,{icon:(0,D.jsx)(d,{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,D.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,D.jsx)(T,{slot:`task-commits`,heading:(0,D.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,D.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){let n=r(e,t),a=w(),[s,u]=(0,E.useState)(`unified`),[p,m]=(0,E.useState)(!1),h=n.isError&&n.error instanceof l&&n.error.status===409,_=a?s:`unified`,x=!a||p;return(0,D.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,D.jsx)(c,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,D.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,D.jsx)(o,{size:16,"aria-hidden":`true`}),`All commits`]})}),n.data?(0,D.jsx)(b,{stat:n.data.stat}):null,(0,D.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,D.jsx)(g,{mode:s,wrap:p,onModeChange:u,onWrapChange:m})})]}),n.isPending?(0,D.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,D.jsx)(f,{icon:h?(0,D.jsx)(y,{}):(0,D.jsx)(i,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,D.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,D.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,D.jsx)(f,{icon:(0,D.jsx)(d,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,D.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`,children:(0,D.jsx)(C,{files:n.data.files,mode:_,wrap:x,className:`min-w-0`})})]})]})}function j({run:e}){let t=a(e.id,h(e.status));return t.isPending?(0,D.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,D.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,D.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,D.jsxs)(`h2`,{className:`mb-4 text-[15px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,D.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(v,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(p,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,D.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,Lt as i,Qi as a,X as o,Zn as s,d as c,ei as l,l as u,lt as d,nr as f,st as p,ut as m,xa as h}from"./alert-dialog-DFJbVtBQ.js";import{t as g}from"./utils-B8qbBJrk.js";import{t as _}from"./createLucideIcon-BHp8sXmF.js";import{t as v}from"./run-header-C3oNFHTw.js";import{a as y,i as b,r as x}from"./highlighter-CdHqIwFr.js";import{h as S,n as C,r as w}from"./index-C1A6aKjy.js";var T=_(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=_(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=_(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=_(`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`}]]),k=_(`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`}]]),A=e(t(),1),j=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function M(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:j.has(t.slice(n+1).toLowerCase())}function N(e){return e.tooLarge?`too-large`:M(e.path)?`image`:e.binary?`binary`:`text`}function P(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var F=n();function I({runId:e,path:t,className:n}){let i=f(e,t??void 0);if(t===null)return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(u,{icon:(0,F.jsx)(d,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(i.isPending)return(0,F.jsx)(R,{className:n,children:(0,F.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(i.isError){let e=i.error instanceof l&&i.error.status===409;return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(u,{icon:e?(0,F.jsx)(D,{}):(0,F.jsx)(r,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:i.error.message})})}return i.data.type===`file`?(0,F.jsx)(L,{runId:e,entry:i.data,className:n}):(0,F.jsx)(R,{className:n,children:(0,F.jsx)(u,{icon:(0,F.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function L({runId:e,entry:t,className:n}){let r=N(t);return(0,F.jsxs)(R,{className:n,children:[(0,F.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:P(t.size)})]}),r===`image`?(0,F.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,F.jsx)(`img`,{"data-slot":`file-preview-image`,src:a(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,F.jsx)(u,{icon:(0,F.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${P(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,F.jsx)(u,{icon:(0,F.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${P(t.size)} of binary data — no text preview.`}):(0,F.jsx)(V,{path:t.path,text:t.content??``})]})}function R({className:e,children:t}){return(0,F.jsx)(`section`,{"data-slot":`file-preview`,className:g(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,A.useMemo)(()=>t.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,Lt as i,Qi as a,X as o,Zn as s,d as c,ei as l,l as u,lt as d,nr as f,st as p,ut as m,xa as h}from"./alert-dialog-DFJbVtBQ.js";import{t as g}from"./utils-B8qbBJrk.js";import{t as _}from"./createLucideIcon-BHp8sXmF.js";import{t as v}from"./run-header-C3oNFHTw.js";import{a as y,i as b,r as x}from"./highlighter-CdHqIwFr.js";import{h as S,n as C,r as w}from"./index-BWdizKd9.js";var T=_(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=_(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=_(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=_(`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`}]]),k=_(`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`}]]),A=e(t(),1),j=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function M(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:j.has(t.slice(n+1).toLowerCase())}function N(e){return e.tooLarge?`too-large`:M(e.path)?`image`:e.binary?`binary`:`text`}function P(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var F=n();function I({runId:e,path:t,className:n}){let i=f(e,t??void 0);if(t===null)return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(u,{icon:(0,F.jsx)(d,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(i.isPending)return(0,F.jsx)(R,{className:n,children:(0,F.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(i.isError){let e=i.error instanceof l&&i.error.status===409;return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(u,{icon:e?(0,F.jsx)(D,{}):(0,F.jsx)(r,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:i.error.message})})}return i.data.type===`file`?(0,F.jsx)(L,{runId:e,entry:i.data,className:n}):(0,F.jsx)(R,{className:n,children:(0,F.jsx)(u,{icon:(0,F.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function L({runId:e,entry:t,className:n}){let r=N(t);return(0,F.jsxs)(R,{className:n,children:[(0,F.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:P(t.size)})]}),r===`image`?(0,F.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,F.jsx)(`img`,{"data-slot":`file-preview-image`,src:a(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,F.jsx)(u,{icon:(0,F.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${P(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,F.jsx)(u,{icon:(0,F.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${P(t.size)} of binary data — no text preview.`}):(0,F.jsx)(V,{path:t.path,text:t.content??``})]})}function R({className:e,children:t}){return(0,F.jsx)(`section`,{"data-slot":`file-preview`,className:g(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,A.useMemo)(()=>t.split(`
2
2
  `).map(e=>[{content:e}]),[t]),r=(0,A.useMemo)(()=>y(e),[e]),i=n.length>z,[a,o]=(0,A.useState)(null);return(0,A.useEffect)(()=>{if(r===null||i)return;let n=!1;return x(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:b(t,r)?.tokens??n}function V({path:e,text:t}){let n=B(e,t);return(0,F.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":y(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex px-4`,children:[(0,F.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,F.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function H({runId:e,selected:t,onSelect:n}){return(0,F.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,F.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,F.jsx)(U,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function U({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=f(e,t);return a.isPending?(0,F.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,F.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,F.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,F.jsx)(F.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,F.jsx)(W,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,F.jsx)(G,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function W({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[s,c]=(0,A.useState)(!1);return(0,F.jsxs)(`li`,{children:[(0,F.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":s?`open`:`closed`,"aria-expanded":s,onClick:()=>c(e=>!e),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,F.jsx)(o,{size:16,"aria-hidden":`true`,className:g(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,s&&`rotate-90`)}),(0,F.jsx)(m,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),s?(0,F.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,F.jsx)(U,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function G({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=M(t)?k:p;return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:g(`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`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,F.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,F.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:P(n)})]})})}function K(){let{id:e}=h(),t=s(e);return t.isPending?(0,F.jsx)(w,{tab:`files`}):t.isError?(0,F.jsx)(C,{tab:`files`,error:t.error}):(0,F.jsx)(q,{run:t.data})}function q({run:e}){let t=f(e.id,``),[n,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(``),d=t.isError&&t.error instanceof l&&t.error.status===409;return(0,F.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,F.jsx)(v,{run:e,tab:`files`}),t.isSuccess?(0,F.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),o.trim()&&a(o.trim())},children:[(0,F.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,F.jsx)(i,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,F.jsx)(S,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:o,onChange:e=>s(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,F.jsx)(c,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!o.trim(),children:`Open file`})]}):null,t.isPending?(0,F.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading files…`}):t.isError?(0,F.jsx)(u,{icon:d?(0,F.jsx)(O,{}):(0,F.jsx)(r,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,F.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,F.jsxs)(`aside`,{"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,F.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),(0,F.jsx)(H,{runId:e.id,selected:n,onSelect:a})]}),(0,F.jsx)(I,{runId:e.id,path:n,className:`min-h-[200px] min-w-0 flex-1 bg-card md:min-h-[400px]`})]}),(0,F.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.`})]})}export{K as TaskFilesRoute};
@@ -0,0 +1,9 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,Aa as i,Ai as a,Ca as o,Dn as s,Et as c,H as l,J as u,Jr as d,Kn as f,Kt as p,Ln as m,Lt as h,Ma as g,Na as _,Nn as v,Nr as y,Nt as b,Oa as x,Pr as S,Ta as C,X as w,Y as T,Zn as E,aa as D,ai as O,bt as k,d as A,di as ee,dn as j,ei as M,fa as N,hi as P,hn as F,it as te,ji as I,jn as L,l as R,mt as ne,oi as z,or as re,q as B,qt as V,rn as H,rt as ie,sr as ae,u as oe,ua as U,ur as se,wa as ce,xa as le,ya as ue}from"./alert-dialog-DFJbVtBQ.js";import{C as de,S as fe,T as pe,c as me,i as he,n as ge,s as _e,t as W,w as ve,x as ye,y as be}from"./utils-B8qbBJrk.js";import{n as xe,r as Se,t as Ce}from"./collapsible-CY3Kzhe7.js";import{n as we,s as Te,t as Ee}from"./agent-accounts-0XE1H17O.js";import{t as De}from"./textarea-DZV_YYw9.js";import{t as G}from"./createLucideIcon-BHp8sXmF.js";import{D as K,T as Oe,d as ke,h as Ae,k as je,l as Me,p as Ne,s as Pe,u as Fe,y as Ie}from"./pill-D7x-JgPk.js";import{t as Le}from"./external-link-BE6y205O.js";import{I as Re,S as ze,_ as Be,b as Ve,c as He,g as Ue,l as We,v as Ge,x as Ke}from"./prompt-templates-BAHuEV4s.js";import{i as qe,n as Je,r as Ye,t as Xe}from"./run-header-C3oNFHTw.js";import{s as Ze,t as q,u as Qe}from"./project-router-_NlWrr1u.js";import{t as $e}from"./message-square-B-MD-8rD.js";import{t as et}from"./search-x-I9Q8pgUa.js";import{t as tt}from"./square-terminal-B6RYYieR.js";import{t as nt}from"./markdown-zVtbO9Y3.js";import{c as rt,i as it,l as at,n as ot,o as st,s as ct,t as lt}from"./thread-loading-Bet4X9Ow.js";import{t as ut}from"./use-submit-shortcut-KWJsC906.js";import{t as dt}from"./lib-BQXq3kEf.js";import{t as ft}from"./zoomable-image-Idq840Ej.js";import{t as pt}from"./run-diff-BqNutNWV.js";var mt=120;function ht(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gt(e){let t=e.replace(/\s+/g,` `).trim();return t.length>mt?`${t.slice(0,mt-1)}…`:t}function J(e,...t){if(ht(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return gt(t)}}function _t(e){if(!ht(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return gt(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return gt(e.join(` `))}}function vt(e){if(!ht(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)ht(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function yt(e){return J(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function Y(e,t){return t?`${e} ${t}`:e}function bt(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:Y(`Ran`,_t(t)),subtitle:J(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:Y(`Edit`,J(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:Y(`Write`,J(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:Y(`Edit`,J(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=vt(t);return{toolKind:`edit`,title:Y(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:Y(`Read`,J(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:Y(`View image`,J(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:Y(`Search`,J(t,`pattern`,`query`)),subtitle:J(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:Y(`Fetch`,J(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:Y(`Web search`,J(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=J(t,`subagent_type`,`subagentType`),i=J(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=J(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:J(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=J(t,`server`),n=J(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:yt(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?gt(e):`Tool`,subtitle:yt(t)}}var xt=class extends i{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:g(t,n.data),hasPreviousPage:_(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function St(e,t){return C(e,xt,t)}var Ct=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),wt=G(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Tt=G(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Et=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Dt=G(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),X=e(t(),1),Ot=[`run-event`,`ui-event`];function kt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function At(e,t={}){let[n,r]=(0,X.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,X.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=kt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(he(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of Ot)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var jt=5,Mt=200,Nt=5e3;function Pt(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function Ft(e){let t=_e(),n=x(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],o=St({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>a(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:jt,retry:1}),s=ce({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>I(e,{signal:t}),retry:1}),c=o.isError||s.isError,l=At(c?e:void 0),u=o.data?.pages??[],d=u.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,X.useRef)(!1),p=(0,X.useCallback)(()=>{e===void 0||f.current||(f.current=!0,a(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>jt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=At(!c&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:Nt,compactAt:Mt,onCompact:p}),h=(0,X.useMemo)(()=>Pt(...u.map(e=>e.events)),[u]),g=(0,X.useMemo)(()=>c?l:Pt(h,m),[c,l,h,m]),_=(0,X.useMemo)(()=>{if(c)return l;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return Pt(e,g.filter(({seq:e})=>e>t))},[s.data,c,l,g]),v=(0,X.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),y=(0,X.useCallback)(async()=>{c||await n.resetQueries({queryKey:r,exact:!0})},[c,r,n]);return{visibleEvents:g,currentEvents:_,isPending:!c&&o.isPending,contextPending:!c&&s.isPending,fallback:c,hasOlder:!c&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:v,jumpToLatest:y,retainedPages:u.length}}var Z=n();function It({run:e}){let t=x(),n=o({mutationFn:()=>O(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:H.runs.detail(e.id)}),t.invalidateQueries({queryKey:H.runs.list()}),D(`This task will not resume itself`)},onError:e=>D(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Z.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(K,{tone:`pending`,pulse:!0}),(0,Z.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Z.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Z.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Z.jsx)(N,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var Lt=e=>e.kind===`tool`,Rt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,zt=(e,t,n)=>`${e} ${e===1?t:n}`;function Bt(e,t){let n=[];return e>0&&n.push(zt(e,`file`,`files`)),t>0&&n.push(zt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Vt(e){return`${e} earlier tool call${e===1?``:`s`}`}var Ht=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Ut(e){for(let t of Ht)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function Wt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(Lt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Bt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)Lt(e)&&Rt(e)&&!r.has(e.id)?o.push(e):(s(),Lt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Gt=new Map,Kt=(0,X.createContext)(null);function qt(){return(0,X.useContext)(Kt)}function Jt({runId:e,children:t}){let n=(0,X.useMemo)(()=>({get:t=>Gt.get(e)?.get(t),set:(t,n)=>{let r=Gt.get(e)??new Map;r.set(t,n),Gt.set(e,r)}}),[e]);return(0,Z.jsx)(Kt.Provider,{value:n,children:t})}function Yt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function Xt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Zt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Qt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function $t(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var en=new Map;function tn(e,t){en.set(e,t)}function nn(e){return en.get(e)}var rn=new Map;function an(e,t){rn.set(e,t)}function on(e,t){let n=rn.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}var sn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg`,accent:`text-message-agent-accent`,body:`max-md:text-[13px]`}};function cn({role:e,children:t,className:n,...r}){let i=sn[e];return(0,Z.jsxs)(`article`,{...r,"data-role":e,"aria-label":i.speaker,className:W(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,i.classes,n),children:[(0,Z.jsxs)(`p`,{className:W(`m-0 flex items-center gap-2 text-[11px] leading-none font-semibold tracking-[0.6px] uppercase`,i.accent),children:[(0,Z.jsx)($e,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i.label]}),(0,Z.jsx)(`div`,{className:W(`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,i.body),children:t})]})}function ln({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(e),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(),g=()=>{d(e),h(void 0),l(!0)},_=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}p(!0),h(void 0);try{await r?.(t),l(!1)}catch(e){h(e instanceof Error?e.message:`Could not save the message`)}finally{p(!1)}},v=async()=>{p(!0),h(void 0);try{await i?.()}catch(e){h(e instanceof Error?e.message:`Could not remove the message`)}finally{p(!1)}};return c?(0,Z.jsxs)(cn,{role:`user`,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,Z.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Z.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:f,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:f?(0,Z.jsx)(Qe,{className:`size-3.5 animate-spin`}):`Save`})]}),m?(0,Z.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:m}):null]}):(0,Z.jsxs)(cn,{role:`user`,"data-slot":`user-bubble`,className:`group`,children:[r||i?(0,Z.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,Z.jsx)(`button`,{type:`button`,"aria-label":a,onClick:g,disabled:f,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(Dt,{className:`size-3.5`})}):null,i?(0,Z.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void v(),disabled:f,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(V,{className:`size-3.5`})}):null]}):null,m?(0,Z.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:m}):null,(0,Z.jsx)(nt,{breaks:!0,children:e}),n.length>0?(0,Z.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>be(e.split(`/`).pop()??``)?(0,Z.jsx)(ft,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Z.jsxs)(`a`,{href:me(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,s>0?(0,Z.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function un({text:e}){return(0,Z.jsx)(cn,{role:`agent`,"data-slot":`assistant-message`,children:(0,Z.jsx)(nt,{children:e})})}function dn({note:e}){return(0,Z.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:W(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var fn={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function pn({incident:e}){let t=fn[e.provider];return(0,Z.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Z.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Z.jsx)(q,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function mn({text:e}){let t=(0,X.useId)();if(e.trim()===``)return null;let n=e.split(`
2
+ `,1)[0]??``,r=n.length<e.length;return(0,Z.jsxs)(Ce,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Z.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Z.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Z.jsx)(nt,{inline:!0,children:n})}),r?(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Z.jsx)(Se,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Z.jsx)(xe,{children:(0,Z.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Z.jsx)(nt,{children:e})})})]})}function hn(){return(0,Z.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,Z.jsx)(Qe,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Z.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var gn={read:qe,edit:Dt,delete:V,move:Tt,search:h,execute:tt,think:Ct,fetch:je,task:B,plan:c,other:r},_n=e=>e.split(`
3
+ `).length;function vn({text:e,streaming:t}){let[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(null),a=(0,X.useRef)(!0);(0,X.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=_n(e),s=!t&&!n&&o>12;return(0,Z.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Qt(e.currentTarget)}:void 0,className:W(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,Z.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,Z.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function yn({diffs:e}){return(0,Z.jsx)(Z.Fragment,{children:e.map((e,t)=>(0,Z.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,Z.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...bn(e.oldText).map((e,t)=>(0,Z.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...bn(e.newText).map((e,t)=>(0,Z.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
+ `).map((e,t)=>(0,Z.jsx)(xn,{text:e},t))})]},`${e.path}:${t}`))})}function bn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
5
+ `)}function xn({text:e}){return(0,Z.jsx)(`span`,{className:W(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function Sn(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Cn({item:e,nested:t=[],cacheKey:n,renderNested:i}){let a=qt(),[o,s]=(0,X.useState)(()=>n===void 0?null:a?.get(n)??null),c=e=>{n!==void 0&&a?.set(n,e),s(e)},l=e.status===`running`||e.status===`pending`,u=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,d=u&&(o??Sn(e)),{verb:f,detail:p}=Ut(e.title),m=gn[e.toolKind]??r;return(0,Z.jsxs)(Ce,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:d,onOpenChange:c,className:W(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,Z.jsxs)(Se,{disabled:!u,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:W(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!u&&`invisible`)}),(0,Z.jsx)(m,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:W(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:f}),p===void 0?null:(0,Z.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:p}),(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[l?(0,Z.jsx)(Qe,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,Z.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,Z.jsx)(`span`,{"data-slot":`tool-exit`,className:W(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,Z.jsx)(xe,{children:(0,Z.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,Z.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,Z.jsx)(yn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,Z.jsx)(vn,{text:e.output,streaming:l}):null,t.length>0?(0,Z.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:i?.(t,n??e.id)}):null]})})]})}function wn({group:e,scope:t}){return(0,Z.jsxs)(Ce,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,Z.jsxs)(Se,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,Z.jsx)(xe,{children:(0,Z.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,Z.jsx)(Cn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Tn({count:e,children:t}){return(0,Z.jsxs)(Ce,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,Z.jsxs)(Se,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,Z.jsx)(w,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),Vt(e)]}),(0,Z.jsx)(xe,{children:(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function En({image:e}){return(0,Z.jsx)(ft,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function Dn(e,t=null){let n=m(),r=j(),i=ke(e),a=i&&!e.runner,o=U(n.data),s=e.runner??(i?r.data?.defaultRunner:void 0)??`claude`,c=ze(t,o,s),l=o.includes(s),u=(i?ye(e.workflowDef,c):[c]).filter(e=>!o.includes(e)),d=n.isSuccess&&(!a||r.isSuccess)&&u.length===0,f=a&&r.isPending?`Checking task settings…`:a&&r.isError?`Task settings could not be loaded.`:n.isPending?`Checking agent providers…`:n.isError?`Provider authentication could not be verified.`:d?void 0:i?`Connect the required workflow providers (${u.join(`, `)}) to continue.`:`Connect an agent provider to continue.`;return{runners:o,currentRunner:s,runner:c,currentRunnerConnected:l,canContinue:d,providerPending:n.isPending||a&&r.isPending,providerError:n.isError,reason:f,runnerOverride:t!==null||!l?c:void 0}}function On(e){let t=x(),n=Ae(e).continueRun,r=j(),[i,a]=(0,X.useState)(null),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[m,h]=(0,X.useState)(e.id);m!==e.id&&(h(e.id),a(null),c(null),u(null),f(null));let g=Dn(e,i),{runners:_,canContinue:v,currentRunner:y,runner:b}=g,S=re(b,n),C=r.data?.modelsLocked===!0,w=b!==y,T=!C&&!w&&e.model?{...r.data?.defaultModels,[b]:e.model}:r.data?.defaultModels,E=C?null:s,D=Ge(b,S.data,[E,T?.[b]]),O=Ke(E,b,T,S.data),k=Ue(b,O,S.data),A=C?``:l??e.effort??``,N=Ve(A,k),P=!C&&l===null&&A!==``&&N===``,{accounts:F,repoAccount:I}=we(),L=[...e.steps].reverse().find(e=>e.sessionId),R=L?.profileId??e.agentProfile??`default`,z=w?I:{...I,[y]:R},B=F.some(e=>e.provider===b&&e.id===d)?d:null,V=o({mutationFn:({text:t,images:n})=>v?ee(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:g.runnerOverride,model:!C&&s!==null?O:void 0,effort:!C&&l!==null?N:P?``:void 0,agentProfile:B??void 0}):Promise.reject(Error(g.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:H.runs.all}),onError:e=>{e instanceof M&&e.status===409&&t.invalidateQueries({queryKey:H.runs.all})}});return{available:n,canContinue:v,startsNewConversation:!!L&&(b!==(L.backend??y)||(B??e.agentProfile??L.profileId??`default`)!==(L.profileId??`default`)),reason:g.reason,providerPending:g.providerPending,pills:(0,Z.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`session-engine-controls`,children:[_.length>1||_.some(e=>Ee(F,e))?(0,Z.jsx)(We,{icon:(0,Z.jsx)(p,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,value:b,accounts:F,account:B,repoAccount:z,onPick:(e,t)=>{f(t),e!==b&&(a(e),c(null))}}):(0,Z.jsx)(He,{icon:(0,Z.jsx)(p,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,readOnly:!0,slot:`session-runner-value`,ariaLabel:`Runner`,label:b,value:b,onPick:()=>{},options:[{value:b,label:b}]}),(0,Z.jsx)(He,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-effort-pill`,ariaLabel:`Effort`,label:k.find(e=>e.value===N)?.label??`auto`,value:N,readOnly:C,disabledHint:`Effort selection is locked to native coding-agent settings.`,onPick:e=>u(e),options:k.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]}),modelPicker:(0,Z.jsx)(He,{icon:(0,Z.jsx)(te,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-model-pill`,ariaLabel:`Model`,label:D.find(e=>e.id===O)?.label??`auto`,value:O,readOnly:C,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>{c(e);let t=Ue(b,e,S.data);N!==``&&Ve(N,t)===``&&u(``)},options:D.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Be(b,S.data,S.isError,S.isFetching)}),continueWith:(e,t)=>V.mutateAsync({text:e,images:t})}}var kn=120,An=e=>e!==`pending`&&e!==`running`,jn=e=>e.kind===`tool`&&e.toolKind===`task`,Q=e=>jn(e)&&e.parentItemId===void 0,Mn=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function Nn(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Q(e)&&t.has(e.id)))return n;return 0}function Pn(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function Fn(e){if(e.kind===`tool`)return In(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
6
+ `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return In(n)}}}function In(e){return e.length>kn?`${e.slice(0,kn-1).trimEnd()}…`:e}function Ln(e,t=!1){let n=Hn(e,e=>e.items.some(Q));if(n===-1)return[];let r=e=>!t&&!An(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Q);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Q)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?Nn(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!Mn(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>Rn(e,c.get(e.id)??[],t))}function Rn(e,t,n){let r={id:e.id,title:Ut(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=Pn(e);i!==void 0&&(r.agentType=i),n&&!An(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=Fn(t[e]);if(n!==void 0){r.activity=n;break}}return r}function zn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Bn(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function Vn(e){return e.find(e=>!An(e.status))??e[0]}function Hn(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function Un(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Q(e));if(i!==void 0)return Rn(i,Wn(e,t),n)}}function Wn(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Q(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)Mn(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var Gn=new Map,Kn=!1;function qn({runId:e,agents:t,onSelect:n}){let[r,i]=(0,X.useState)(()=>Gn.get(e)??Kn);if(t.length===0)return null;let{done:a,total:o}=zn(t),s=Vn(t);return(0,Z.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Gn.set(e,!t),!t)),"aria-expanded":r,className:W(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Z.jsx)(B,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Z.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,Z.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,Z.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,Bn(s)]}):null,(0,Z.jsx)(T,{"aria-hidden":!0,className:W(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Z.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,Z.jsx)(Jn,{agent:e,onSelect:n},e.id))}):null]})}function Jn({agent:e,onSelect:t}){let n=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Yn,{status:e.status,stalled:e.stalled===!0}),(0,Z.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,Z.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,Z.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Bn(e)}),(0,Z.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,Z.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,Z.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function Yn({status:e,stalled:t=!1}){return t?(0,Z.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,Z.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Z.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,Z.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Z.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,Z.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,Z.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Z.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var Xn=new Map;function Zn(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function Qn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function $n(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function er({runId:e,entries:t}){let[n,r]=(0,X.useState)(()=>Xn.get(e)??Zn());if(t.length===0)return null;let{done:i,total:a}=Qn(t),o=$n(t);return(0,Z.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":n?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-0.5 md:h-[3px]`,style:{background:`var(--grad)`}}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(t=>(Xn.set(e,!t),!t)),"aria-expanded":n,className:W(`flex min-h-11 w-full items-center md:min-h-0 gap-2 px-3.5 text-left text-[13px]`,n?`pt-2 pb-1.5`:`py-2`),children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,Z.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,i,`/`,a]}),!n&&o!==void 0?(0,Z.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,o.activeForm??o.content]}):null,(0,Z.jsx)(T,{"aria-hidden":!0,className:W(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!n&&`rotate-180`)})]}),n?(0,Z.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,Z.jsx)(tr,{entry:e},`${t}:${e.content}`))}):null]})}function tr({entry:e}){return(0,Z.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:W(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,Z.jsx)(nr,{status:e.status}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,Z.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function nr({status:e}){return e===`cancelled`?(0,Z.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,Z.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,Z.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Z.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,Z.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,Z.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Z.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,Z.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function rr(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,X.useRef)(null),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),d=(0,X.useRef)(!0),f=(0,X.useRef)(null),p=(0,X.useRef)(null),m=(0,X.useRef)(null),h=(0,X.useCallback)(e=>{let t=o.current;if(!t)return;let n=m.current;n?n.scrollTo(e):t.scrollTop=e},[]),g=(0,X.useCallback)(()=>{let e=o.current;e&&h(e.scrollHeight-e.clientHeight)},[h]),_=(0,X.useCallback)(()=>{if(o.current){if(p.current!==e){p.current=e;let t=nn(e);t&&!t.atBottom?(d.current=!1,f.current=t.top):(d.current=!0,f.current=null)}f.current===null?d.current&&g():h(f.current)}},[e,h,g]),v=(0,X.useCallback)(e=>{c(e),e&&(o.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),_())},[n,_]),y=(0,X.useCallback)(()=>{d.current&&g()},[g]),b=(0,X.useRef)(!1),x=(0,X.useRef)(!1),S=(0,X.useRef)(void 0),C=(0,X.useRef)(!1),w=(0,X.useRef)(!1),T=(0,X.useRef)(a);T.current=a;let E=(0,X.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),D=(0,X.useCallback)(()=>{let e=o.current;if(!e||!r||b.current)return;f.current=null,d.current=!1,b.current=!0;let t=e.scrollHeight,n=e.scrollTop,i=e.getBoundingClientRect().top,a=Xt(i,E(e));r().finally(()=>{requestAnimationFrame(()=>{let e=o.current;if(e){let r=n+Math.max(0,e.scrollHeight-t),i=e.getBoundingClientRect().top,o=a===void 0?-1:T.current.indexOf(a.key),s=m.current;s&&o>=0?s.scrollToIndex(o,{align:`start`,offset:-a.offset}):h(Zt(e.scrollTop,i,a,E(e),r))}b.current=!1})})},[E,r,h]);(0,X.useEffect)(()=>()=>clearTimeout(S.current),[]);let O=(0,X.useCallback)(()=>{let t=o.current;if(!t)return;f.current=null,d.current=!0,tn(e,{top:t.scrollHeight-t.clientHeight,atBottom:!0});let n=()=>{d.current&&g()};(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{n(),requestAnimationFrame(n)})})},[i,e,g]),k=a.at(-1),A=a.length;return(0,X.useLayoutEffect)(()=>{d.current&&g()},[k,A,g]),(0,X.useLayoutEffect)(()=>{!o.current||!s||_()},[s,_]),(0,X.useEffect)(()=>{let t=o.current,n=s;if(!t||!n)return;let r=0,i=null,a=!1,c=t.scrollTop,l=()=>{f.current=null,d.current=!1,r=0},p=()=>{r=Date.now()},m=e=>{if(e.deltaY<0){l();let e=!x.current;x.current=!0,clearTimeout(S.current),S.current=setTimeout(()=>{x.current=!1},180),e&&Yt(t)&&D()}else p()},_=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(l(),!e.repeat&&Yt(t)&&D()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&p()},v=()=>{a=!0,w.current=!1,c=t.scrollTop,Qt(t,80)||(l(),p())},y=()=>{a=!1},b=e=>{C.current=!1,i=e.touches[0]?.clientY??null},T=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(i!==null&&n>i+1?(l(),!C.current&&Yt(t)&&(C.current=!0,D())):i!==null&&n<i-1&&p(),i=n)},E=()=>{a&&!w.current&&t.scrollTop<c&&Yt(t)&&(w.current=!0,D()),c=t.scrollTop;let n=Qt(t,80);n&&f.current===null&&(d.current||Date.now()-r<2e3)&&(d.current=!0),u(!n),f.current===null&&tn(e,{top:t.scrollTop,atBottom:n})};t.addEventListener(`scroll`,E,{passive:!0}),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,b,{passive:!0}),t.addEventListener(`touchmove`,T,{passive:!0}),t.addEventListener(`pointerdown`,v,{passive:!0}),window.addEventListener(`pointerup`,y,{passive:!0}),t.addEventListener(`keydown`,_);let O;if(typeof ResizeObserver<`u`){O=new ResizeObserver(()=>{let e=f.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;h(Math.min(e,n)),n>=e&&(f.current=null)}else d.current&&g()}),O.observe(n);let e=n.closest(`[data-route="task-thread"]`),r=e?.querySelector(`[data-slot="run-header"]`),i=e?.querySelector(`[data-slot="thread-dock"]`);r&&O.observe(r),i&&O.observe(i)}return()=>{t.removeEventListener(`scroll`,E),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,b),t.removeEventListener(`touchmove`,T),t.removeEventListener(`pointerdown`,v),window.removeEventListener(`pointerup`,y),t.removeEventListener(`keydown`,_),O?.disconnect()}},[e,s,D,h,g]),{attachContent:v,scrollElRef:o,virtualizerRef:m,pillVisible:l,jumpToLatest:O,loadOlder:D,restickIfStuck:y}}function ir({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,Z.jsx)(ar,{runId:e,rows:t,controls:r}):(0,Z.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,className:`[overflow-anchor:none]`,children:t.map(e=>(0,Z.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function ar({runId:e,rows:t,controls:n}){return(0,Z.jsx)(or,{runId:e,rows:t,controls:n},e)}function or({runId:e,rows:t,controls:n}){let r=(0,X.useRef)(null),i=(0,X.useRef)(t),a=t[0]?.key,o=i.current[0]?.key,s=a!==o&&(t.some(e=>e.key===o)||i.current.some(e=>e.key===a));(0,X.useLayoutEffect)(()=>{i.current=t},[t]);let[c]=(0,X.useState)(()=>on(e,t.length)),l=(0,X.useRef)(t.length);l.current=t.length;let u=(0,X.useRef)(null),d=(0,X.useCallback)(t=>{n.virtualizerRef.current=t,t?u.current=t:u.current&&=(an(e,{rows:l.current,cache:u.current.cache}),null)},[e,n.virtualizerRef]),[f,p]=(0,X.useState)(0);return(0,X.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||p(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,Z.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,className:`[overflow-anchor:none]`,children:(0,Z.jsx)(dt,{ref:d,scrollRef:n.scrollElRef,startMargin:f,shift:s,...c===void 0?{}:{cache:c},children:t.map(e=>(0,Z.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function sr({onJump:e}){return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,Z.jsx)(l,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function cr(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[]},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[]},entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images}},entries:e.items});return n}function lr(e,t){return[{id:`agent:${e}`,entries:t}]}function ur(e,t){let n=[];for(let t of e){t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of Wt([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}})}return n}function dr({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c}){let l=(0,X.useMemo)(()=>ur(n,e),[n,e]),u=rr(`${e}:${t}`,{surface:r}),d=s??u,f=(0,X.useMemo)(()=>l.map(e=>({key:e.key,node:e.content.kind===`user-message`?(0,Z.jsx)(fr,{message:e.content.message,actions:o?.[e.key]}):(0,Z.jsx)(pr,{block:e.content.block,scope:e.scope,renderAsk:a})})),[o,a,l]),p=c??$t(``,f.length),m=f.length===0?i??null:(0,Z.jsx)(ir,{runId:`${e}:${t}`,rows:f,mode:p,controls:d});return(0,Z.jsx)(Jt,{runId:e,children:r===`panel`?(0,Z.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,Z.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:m}),d.pillVisible?(0,Z.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,Z.jsx)(sr,{onJump:d.jumpToLatest})}):null]}):m})}function fr({message:e,actions:t}){return(0,Z.jsx)(ln,{text:e.text,imageCount:e.imageCount,images:e.images,onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function pr({block:e,scope:t,renderAsk:n}){switch(e.kind){case`entry`:return(0,Z.jsx)(hr,{entry:e.entry,scope:t,renderAsk:n});case`tool-card`:return(0,Z.jsx)(Cn,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,Z.jsx)(mr,{entries:e,scope:t,renderAsk:n})});case`context-group`:return(0,Z.jsx)(wn,{group:e,scope:t});case`streak`:return(0,Z.jsx)(Tn,{count:e.count,children:e.blocks.map(e=>(0,Z.jsx)(pr,{block:e,scope:t,renderAsk:n},e.id))});default:return gr(e)}}function mr({entries:e,scope:t,renderAsk:n}){return Wt([...e]).map(e=>(0,Z.jsx)(pr,{block:e,scope:t,renderAsk:n},e.id))}function hr({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,Z.jsx)(un,{text:e.text}):(0,Z.jsx)(ln,{text:e.text});case`reasoning`:return(0,Z.jsx)(mn,{text:e.text});case`tool`:return(0,Z.jsx)(Cn,{item:e,cacheKey:`${t}:${e.id}`});case`note`:if(e.conversation){let t=e.conversation,n=`inline-flex min-h-11 max-w-full items-center break-all underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;return(0,Z.jsxs)(`div`,{"data-slot":`conversation-message`,className:`min-w-0 rounded-md border border-border px-4 py-3 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 min-w-0 space-y-1 break-all text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`p`,{className:`capitalize`,children:[`Agent `,t.kind]}),(0,Z.jsx)(`p`,{children:(0,Z.jsxs)(q,{className:n,to:`/tasks/${t.senderRunId}`,"aria-label":`Sender task ${t.senderRunId}`,children:[`Sender task `,t.senderRunId]})}),(0,Z.jsx)(`p`,{children:(0,Z.jsxs)(q,{className:n,to:`/tasks/${t.recipientRunId}`,"aria-label":`Recipient task ${t.recipientRunId}`,children:[`Recipient task `,t.recipientRunId]})}),(0,Z.jsxs)(`p`,{children:[`Message `,t.id,t.kind===`request`||t.requestId?` · Request ${t.requestId??t.id}`:``]}),(0,Z.jsxs)(`p`,{children:[`Delivery: `,t.delivery,t.state&&t.state!==`accepted`?` · ${t.state}`:``]})]}),(0,Z.jsx)(`div`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:(0,Z.jsx)(dn,{note:e})})]})}return e.attribution?(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-4 py-3 text-sm`,children:[(0,Z.jsx)(`p`,{className:`mb-2 break-all text-xs text-muted-foreground`,children:e.attribution.source===`agent`?`Agent input from parent ${e.attribution.parentRunId}`:`Worker lifecycle context for parent ${e.attribution.parentRunId}`}),(0,Z.jsx)(dn,{note:e})]}):(0,Z.jsx)(dn,{note:e});case`image`:return(0,Z.jsx)(En,{image:e});case`ask`:return n===void 0?(0,Z.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,Z.jsx)(pn,{incident:e});default:return gr(e)}}function gr(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function _r({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,Z.jsx)(it,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,Z.jsx)(st,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,Z.jsx)(vr,{runId:e,renderAsk:t,agent:n,entries:r})})})}function vr({runId:e,renderAsk:t,agent:n,entries:r}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(rt,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,Z.jsxs)(at,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,Z.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,Z.jsxs)(ct,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,Z.jsx)(yr,{status:n.status}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,Z.jsx)(dr,{runId:e,viewId:`agent:${n.id}`,sections:lr(n.id,r),mode:`panel`,renderAsk:t,empty:(0,Z.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function yr({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,Z.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:W(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function br({run:e}){return(0,Z.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-accent-strong/30 bg-accent-strong/10 px-3.5 py-2.5`,children:[(0,Z.jsx)(Re,{className:`size-4 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,Z.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,Z.jsx)(pt,{runId:e.id}),(0,Z.jsx)(xr,{run:e})]})}function xr({run:e}){let t=x(),n=(0,X.useRef)(null),[r,i]=(0,X.useState)(``),[a,s]=(0,X.useState)(null),c=Je(e.id),l=Dn(e),d=()=>t.invalidateQueries({queryKey:H.runs.all}),f=o({mutationFn:async t=>l.canContinue?ee(e.id,{text:`Review feedback:\n${t}`,runner:l.runnerOverride}):null,onSuccess:e=>{e!==null&&(i(``),d())},onError:e=>D(e.message,{tone:`danger`})}),p=o({mutationFn:()=>P(e.id),onSuccess:e=>{D(`Draft PR created — ${e.url}`),d()},onError:e=>{e instanceof M&&e.manual!==void 0&&s(e.manual),D(e.message,{tone:`danger`})}}),m=()=>{let e=r.trim();if(e.length===0){D(`Write what to change first.`),n.current?.focus();return}f.mutate(e)};return(0,Z.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,Z.jsx)(De,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{ut({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())},className:`min-h-[52px] text-[13px]`}),l.canContinue?null:(0,Z.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:l.reason}),l.providerPending?null:(0,Z.jsx)(q,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(A,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:l.reason??`Send the notes back into the agent's session`,"aria-describedby":l.canContinue?void 0:`review-provider-guidance`,disabled:f.isPending||!l.canContinue,onClick:m,children:[(0,Z.jsx)(wt,{"aria-hidden":`true`}),`Send back`]}),ge(e.pullRequestUrl)?(0,Z.jsx)(A,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,Z.jsx)(Le,{"aria-hidden":`true`}),`PR ↗`]})}):(0,Z.jsxs)(A,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,Z.jsx)(k,{"aria-hidden":`true`}),`Draft PR`]}),(0,Z.jsxs)(A,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`ml-auto`,title:Me(`review`),disabled:c.isPending,onClick:()=>c.mutate(),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Accept`]})]}),a===null?null:(0,Z.jsx)(Sr,{command:a})]})}function Sr({command:e}){return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>D(`Command copied to clipboard.`)).catch(()=>D(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(ie,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Cr(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var wr=1500;function Tr({status:e}){let t=(0,X.useRef)(e),[n,r]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Cr())return;r(!0);let i=setTimeout(()=>r(!1),wr);return()=>clearTimeout(i)},[e]),n?(0,Z.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,Z.jsx)(oe,{}),(0,Z.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,Z.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}function Er(e){let t=x(),[n,r]=(0,X.useState)(),i=Fe(e.status);(0,X.useEffect)(()=>{(!i||n&&n!==e.id)&&r(void 0)},[i,e.id,n]);let a=o({mutationFn:async()=>{r(e.id);try{if(!(await z(e.id)).cancelled)throw Error(`The task changed before Stop was accepted. Check its status and retry.`)}catch(e){throw r(void 0),e}},onSettled:()=>t.invalidateQueries({queryKey:H.runs.all})});return{stopping:!!e.stopping||a.isPending||i&&n===e.id,stop:()=>a.mutateAsync()}}function Dr(e,t){return`${e.header}: ${t.join(`, `)}`}function Or({ask:e,run:t}){return e.resolved?(0,Z.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,Z.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,Z.jsx)(kr,{ask:e,run:t})}function kr({ask:e,run:t}){let n=Pe(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,X.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>Dr(e,o[t]??[])).join(`
7
+ `)),d=n.mode===`resume`;return(0,Z.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-accent-strong/25 bg-accent-strong/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,Z.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,Z.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking`})}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,Z.jsx)(Ar,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(Dr(e,i)):c(t,i))}},e.id??t))}),a?d?(0,Z.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,Z.jsx)(A,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,Z.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,Z.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:n.reason}),(0,Z.jsx)(q,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,Z.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,Z.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function Ar({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,Z.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,Z.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`rounded-md bg-accent-strong px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),i?(0,Z.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,Z.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,Z.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:W(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-accent-strong/50 hover:bg-accent-strong/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong/60 bg-accent-strong/[0.06]`:`border-border bg-card`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,Z.jsx)(`span`,{"aria-hidden":!0,className:W(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,Z.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var jr=2e3;function Mr(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Nr(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`turn-end`&&r.seq>t&&(t=r.seq),(r.type===`turn.started`||r.type===`session.started`||r.type===`user-message`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Pr(e,t){let n=x(),r=(0,X.useMemo)(()=>Mr(t),[t]),i=(0,X.useMemo)(()=>Nr(t),[t]),a=e?.id,o=e?.status,s=e?.activity;(0,X.useEffect)(()=>{if(!(r!==0&&(o===`running`||o===`waiting`))&&!(i!==0&&o===`running`&&s!==`monitoring`)||a===void 0)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:H.runs.detail(a)}),n.invalidateQueries({queryKey:H.runs.list()})},jr);return()=>clearTimeout(e)},[r,i,a,o,s,n])}function Fr(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Ir(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function Lr(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function Rr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function zr(e){return e===`claude`||e===`codex`||e===`opencode`||e===`pi`?e:void 0}function Br(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+[\s\S]*$/,``)),n.includes(`CEZ:`)?n.split(`
8
+ `).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
9
+ `):n}function Vr(e){let t=e=>Br(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function Hr(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var Ur=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,Wr=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Gr(e){if(!Rr(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!Rr(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:Wr.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function Kr(e,t={}){let n=[],r=new Map,i,a=0,o,s=e=>{a+=1;let t={id:e===void 0?`turn-fallback-${a}`:`turn-seq-${e}`,entries:[],v2Items:!1};return n.push(t),t},c=()=>n.at(-1)??s(),l=(e,t)=>{let n=$(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})},d=new Map,f=new Set,p=new Set;for(let t of e)switch(t.type){case`conversation-message`:{let e=ve.safeParse(t);if(!e.success)break;let{message:n}=e.data,r=d.get(n.id);if(r){r.conversation&&r.conversation.delivery!==`delivered`&&(r.conversation.delivery=e.data.delivery);break}let i={kind:`note`,id:`conversation-message:${n.id}`,text:n.text,tone:`dim`,conversation:{...n,delivery:e.data.delivery}};d.set(n.id,i),c().entries.push({origin:`meta`,entry:i});break}case`request-outcome`:{let e=pe.safeParse(t);if(!e.success||f.has(e.data.outcome.requestId))break;let{outcome:n}=e.data;f.add(n.requestId),c().entries.push({origin:`meta`,entry:{kind:`note`,id:`request-outcome:${n.requestId}`,text:`Request outcome: ${n.status} · Request ${n.requestId}${n.replyId?` · Reply ${n.replyId}`:``}`,tone:`dim`}});break}case`agent-input`:{let e=de.safeParse(t);if(!e.success)break;let{input:n}=e.data;if(p.has(n.id))break;if(p.add(n.id),n.conversation){let e=d.get(n.id);if(e?.conversation)e.conversation.delivery=`delivered`;else{let e={kind:`note`,id:`conversation-message:${n.id}`,text:n.text,tone:`dim`,conversation:{id:n.id,...n.conversation,delivery:`delivered`}};d.set(n.id,e),c().entries.push({origin:`meta`,entry:e})}break}c().entries.push({origin:`meta`,entry:{kind:`note`,id:`agent-input:${n.id}`,text:n.text,tone:`dim`,attribution:{source:n.source,parentRunId:n.parentRunId}}});break}case`user-message`:{let e=$(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=s(t.seq);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=$(t.turnId),r=n.at(-1);r&&r.turnId===void 0&&!r.v2Items?r.turnId=e:s(t.seq).turnId=e;break}case`turn.completed`:{let e=$(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);i&&(i.completed={stopReason:$(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!Rr(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=l(t,i.id);u(r.get(a)?.turn??c(),i,a);break}case`item.delta`:{let e=$(t.itemId)??``,n=r.get(l(t,e)),i=$(t.delta)??``;if(!n||i===``||!Ur(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=c(),n=$(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=$(t.tool)??`Tool`;if(qr.has(n))break;let i=bt(n,t.input);if(i.toolKind===`plan`){let n=Gr(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:$(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get($(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=Hr(t.result);break}case`note`:case`lifecycle`:{let e=$(t.message)??``;if(e===``)break;let n=t.tone===`danger`?`danger`:`dim`;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:n}});break}case`error`:{let e=$(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=$(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=$(t.error)?` — ${$(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${$(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=$(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:$(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=zr(t.provider),n=$(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;c().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=$(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=$(t.name);r!==void 0&&(n.name=r),c().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(c().planEntries=t.entries);break;case`session.ended`:i={reason:$(t.reason)??`end_turn`,...$(t.message)===void 0?{}:{message:$(t.message)}};break;case`ask.requested`:{let e=$(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>Rr(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1};c().entries.push({origin:`meta`,entry:r}),o=r;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add(Br(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has(Br(e.entry.text,!0).trim()))),Vr(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:Br(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var qr=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function Jr(){let{id:e}=le(),t=E(e),n=Ft(e),r=t.data?.status,i=(0,X.useMemo)(()=>Kr(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,X.useMemo)(()=>Kr(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),o=(0,X.useRef)(void 0),c=(0,X.useCallback)(e=>{o.current=e},[]),{mutate:l}=s();if((0,X.useEffect)(()=>{t.data&&o.current!==t.data.id&&Oe(t.data)&&l(t.data.id)},[l,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),Pr(t.data,n.visibleEvents),t.isPending)return(0,Z.jsx)(lt,{});if(t.isError){let e=t.error instanceof M&&t.error.status===404;return(0,Z.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(R,{icon:e?(0,Z.jsx)(et,{}):(0,Z.jsx)(Et,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,Z.jsx)(A,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(q,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,Z.jsx)(lt,{}):(0,Z.jsx)(Yr,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:c})}function Yr({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){Ze();let a=r?fe(r.currentEvents)!==void 0:n.turns.some(e=>e.items.some(e=>e.kind===`ask`&&!e.resolved)),o=d(e,a),s=Lr(e.status,e.error),c=Fr(n),l=c!==void 0&&c.length>0?Qn(c):void 0,u=e.status===`running`||e.status===`waiting`,p=e.status===`queued`,m=On(e),h=Er(e),g=a||e.hasPendingHumanAsk===!0,_=!u&&!p&&m.available,b=_&&m.canContinue,x=!u&&e.status!==`queued`,C=(0,X.useMemo)(()=>Ln(n.turns,x),[n.turns,x]),[w,T]=(0,X.useState)(void 0),[E,D]=(0,X.useState)(e.id);E!==e.id&&(D(e.id),T(void 0));let O=(0,X.useMemo)(()=>w===void 0?void 0:Un(n.turns,w,x),[n.turns,w,x]),k=(0,X.useMemo)(()=>w===void 0?[]:Wn(n.turns,w),[n.turns,w]),A=se(e.id),ee=Pe(e),j=Ie(e),M=u&&!j.usable,N=_&&!m.canContinue,P=M||N,te=M?j.reason:m.reason,{mutateAsync:I}=L(e.id),{mutateAsync:R}=F(e.id),{mutateAsync:ne}=f(e.id),z=(0,X.useMemo)(()=>p?{onEditTask:async e=>{await I({task:e})},onEditMessage:(e,t)=>R({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>ne(e).then(()=>void 0)}:void 0,[p,I,R,ne]),re=(0,X.useMemo)(()=>cr(e,t),[e,t]),B=(0,X.useMemo)(()=>ur(re,e.id),[re,e.id]),V=(0,X.useCallback)(t=>(0,Z.jsx)(Or,{ask:t,run:e}),[e]),H=(0,X.useMemo)(()=>{if(z===void 0)return;let t={task:{onEdit:z.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>z.onEditMessage(n.id,e),onRemove:()=>z.onRemoveMessage(n.id)};return t},[z,e.queuedMessages]),ie=y(e,v()),{search:ae}=ue(),oe=$t(ae,B.length),U=rr(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:B.map(({key:e})=>e)});return Te(U.restickIfStuck),(0,Z.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(Xe,{run:e,hasPendingHumanAsk:a,planTally:l,onMarkedUnread:()=>i?.(e.id)}),(0,Z.jsxs)(`div`,{"data-slot":`session-conversation`,className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-2.5 px-[18px] py-3 md:gap-3.5 md:px-16 md:py-5`,children:[r?(0,Z.jsx)(Xr,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,retainedPages:r.retainedPages,onLoad:U.loadOlder}):null,(0,Z.jsx)(dr,{runId:e.id,viewId:`main`,sections:re,mode:`document`,renderAsk:V,messageActions:H,scrollControls:U,renderMode:oe}),t.turns.length===0?e.status===`queued`?(0,Z.jsx)(Zr,{run:e}):(0,Z.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`&&e.activity!==`monitoring`?(0,Z.jsx)(hn,{}):null,s&&s.state===`closed`?(0,Z.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":s.state,className:W(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,s.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[s.label,ge(S(e))?(0,Z.jsx)(`a`,{"data-slot":`pr-link`,href:S(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,ge(ie)?(0,Z.jsx)(`a`,{"data-slot":`issue-link`,href:ie,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,Z.jsx)(br,{run:e}):null]}),(0,Z.jsx)(Tr,{status:e.status}),(0,Z.jsx)(_r,{runId:e.id,renderAsk:V,agent:O,entries:k,onClose:()=>T(void 0)}),(0,Z.jsxs)(`div`,{"data-slot":`thread-dock`,className:`relative z-10 bg-background pt-1 pb-2 md:pt-1.5 md:pb-4`,children:[U.pillVisible?(0,Z.jsx)(`div`,{className:`pointer-events-none fixed right-6 bottom-[calc(24px+env(safe-area-inset-bottom))] z-30 flex justify-center`,children:(0,Z.jsx)(sr,{onJump:U.jumpToLatest})}):null,(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-1.5 px-[14px] md:gap-2.5 md:px-16`,children:[e.steps.length>0?(0,Z.jsx)(`div`,{"data-slot":`session-workflow-summary`,className:`rounded-xl border border-border bg-card px-3 py-2`,children:(0,Z.jsx)(Ye,{runId:e.id,steps:e.steps})}):null,(0,Z.jsx)(qn,{runId:e.id,agents:C,onSelect:T},`agents:${e.id}`),c!==void 0&&c.length>0?(0,Z.jsx)(er,{runId:e.id,entries:c},e.id):null,(0,Z.jsx)(It,{run:e}),e.status===`waiting`?(0,Z.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(K,{tone:o.tone,pulse:o.pulse}),o.bucket===`waiting`?`The agent is paused, waiting for your reply`:`Waiting on workers — you can send a message to resume`]}):null,p?(0,Z.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(K,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,b&&m.startsNewConversation?(0,Z.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:`Starts a new agent conversation.`}):null,(0,Z.jsx)(ot,{onStop:Ae(e).cancel?h.stop:void 0,stopOnEmpty:e.status===`queued`||e.status===`running`||e.status===`waiting`&&o.label===`waiting on workers`&&!g,stopping:h.stopping,retainDraftUntilSuccess:!0,compactFeedback:!0,pendingLabel:b?`Continuing…`:`Sending…`,failureHint:`Your draft is kept. Check the task status and connection, then retry.`,sessionControls:b?m.pills:void 0,sessionModel:b?m.modelPicker:void 0,onSubmit:b?(e,t)=>m.continueWith(e,t):p?(e,t)=>A.mutateAsync({text:e,images:t}):async(e,t)=>{let n=await ee.send(e,t);if(n!==void 0)throw Error(n)},disabled:P||!u&&!p&&!b,disabledReason:P?te:`Session closed — no session to resume.`,footerEnd:P&&!m.providerPending?(0,Z.jsx)(q,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):void 0,allowEmptySubmit:b&&!g,emptySubmitLabel:b&&!g?`Continue`:void 0,placeholder:p?`Add to the prompt — sent when the run starts…`:b?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>Ir(t)})]})]}),(0,Z.jsx)(`div`,{"data-slot":`thread-tail-anchor`,"aria-hidden":`true`,className:`h-px shrink-0 md:hidden`})]})}function Xr({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,Z.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,Z.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,Z.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":i,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:a,disabled:t,className:`rounded-md px-3 py-1.5 font-medium hover:bg-muted disabled:cursor-wait`,children:t?`Loading 100 earlier items…`:n?`Couldn’t load earlier items · Retry`:`Load 100 earlier items`}),(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Zr({run:e}){let t=Ne(ae().data??[],e.id);return(0,Z.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,Z.jsx)(K,{tone:`pending`,pulse:!0}),(0,Z.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,Z.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{Jr as TaskThreadRoute};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Ca as i,Ft as a,G as o,H as s,Ht as c,J as l,Jt as u,Lt as d,Oa as f,Ri as p,Vi as m,Y as h,Yt as g,Zt as _,_r as v,a as y,aa as b,at as x,c as ee,d as S,dr as C,ei as te,en as ne,gi as w,i as re,l as ie,mr as ae,n as oe,o as T,ot as E,qt as se,r as ce,rn as D,rt as le,s as O,st as ue,t as k,vi as de,xa as A}from"./alert-dialog-DFJbVtBQ.js";import{t as j}from"./utils-B8qbBJrk.js";import{i as M,l as fe,r as N,t as pe}from"./dropdown-menu-D_AapbCA.js";import{i as me,n as he,o as P,r as ge,s as _e,t as ve}from"./textarea-DZV_YYw9.js";import{i as ye,l as be,s as xe}from"./skills-DFBiAuJG.js";import{h as Se,i as Ce}from"./index-C1A6aKjy.js";import{n as we}from"./skill-empty-hint-oOtzR3v0.js";var F=e(n()),I=e(t());function Te(){var e=[...arguments];return(0,I.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var L=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function R(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ee(e){return`nodeType`in e}function z(e){return e?R(e)?e:Ee(e)?e.ownerDocument?.defaultView??window:window:window}function B(e){let{Document:t}=z(e);return e instanceof t}function V(e){return!R(e)&&e instanceof z(e).HTMLElement}function De(e){return e instanceof z(e).SVGElement}function Oe(e){return e?R(e)?e.document:Ee(e)?B(e)?e:V(e)||De(e)?e.ownerDocument:document:document:document}var H=L?I.useLayoutEffect:I.useEffect;function ke(e){let t=(0,I.useRef)(e);return H(()=>{t.current=e}),(0,I.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ae(){let e=(0,I.useRef)(null);return[(0,I.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,I.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function U(e,t){t===void 0&&(t=[e]);let n=(0,I.useRef)(e);return H(()=>{n.current!==e&&(n.current=e)},t),n}function je(e,t){let n=(0,I.useRef)();return(0,I.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Me(e){let t=ke(e),n=(0,I.useRef)(null);return[n,(0,I.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ne(e){let t=(0,I.useRef)();return(0,I.useEffect)(()=>{t.current=e},[e]),t.current}var Pe={};function Fe(e,t){return(0,I.useMemo)(()=>{if(t)return t;let n=Pe[e]==null?0:Pe[e]+1;return Pe[e]=n,e+`-`+n},[e,t])}function Ie(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var W=Ie(1),Le=Ie(-1);function Re(e){return`clientX`in e&&`clientY`in e}function ze(e){if(!e)return!1;let{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function Be(e){if(!e)return!1;let{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ve(e){if(Be(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Re(e)?{x:e.clientX,y:e.clientY}:null}var G=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[G.Translate.toString(e),G.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),He=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ue(e){return e.matches(He)?e:e.querySelector(He)}var K={display:`none`};function We(e){let{id:t,value:n}=e;return I.createElement(`div`,{id:t,style:K},n)}function Ge(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return I.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Ke(){let[e,t]=(0,I.useState)(``);return{announce:(0,I.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var qe=(0,I.createContext)(null);function Je(e){let t=(0,I.useContext)(qe);(0,I.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ye(){let[e]=(0,I.useState)(()=>new Set),t=(0,I.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,I.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Xe={draggable:`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Ca as i,Ft as a,G as o,H as s,Ht as c,J as l,Jt as u,Lt as d,Oa as f,Ri as p,Vi as m,Y as h,Yt as g,Zt as _,_r as v,a as y,aa as b,at as x,c as ee,d as S,dr as C,ei as te,en as ne,gi as w,i as re,l as ie,mr as ae,n as oe,o as T,ot as E,qt as se,r as ce,rn as D,rt as le,s as O,st as ue,t as k,vi as de,xa as A}from"./alert-dialog-DFJbVtBQ.js";import{t as j}from"./utils-B8qbBJrk.js";import{i as M,l as fe,r as N,t as pe}from"./dropdown-menu-D_AapbCA.js";import{i as me,n as he,o as P,r as ge,s as _e,t as ve}from"./textarea-DZV_YYw9.js";import{i as ye,l as be,s as xe}from"./skills-DFBiAuJG.js";import{h as Se,i as Ce}from"./index-BWdizKd9.js";import{n as we}from"./skill-empty-hint-oOtzR3v0.js";var F=e(n()),I=e(t());function Te(){var e=[...arguments];return(0,I.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var L=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function R(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ee(e){return`nodeType`in e}function z(e){return e?R(e)?e:Ee(e)?e.ownerDocument?.defaultView??window:window:window}function B(e){let{Document:t}=z(e);return e instanceof t}function V(e){return!R(e)&&e instanceof z(e).HTMLElement}function De(e){return e instanceof z(e).SVGElement}function Oe(e){return e?R(e)?e.document:Ee(e)?B(e)?e:V(e)||De(e)?e.ownerDocument:document:document:document}var H=L?I.useLayoutEffect:I.useEffect;function ke(e){let t=(0,I.useRef)(e);return H(()=>{t.current=e}),(0,I.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ae(){let e=(0,I.useRef)(null);return[(0,I.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,I.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function U(e,t){t===void 0&&(t=[e]);let n=(0,I.useRef)(e);return H(()=>{n.current!==e&&(n.current=e)},t),n}function je(e,t){let n=(0,I.useRef)();return(0,I.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Me(e){let t=ke(e),n=(0,I.useRef)(null);return[n,(0,I.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ne(e){let t=(0,I.useRef)();return(0,I.useEffect)(()=>{t.current=e},[e]),t.current}var Pe={};function Fe(e,t){return(0,I.useMemo)(()=>{if(t)return t;let n=Pe[e]==null?0:Pe[e]+1;return Pe[e]=n,e+`-`+n},[e,t])}function Ie(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var W=Ie(1),Le=Ie(-1);function Re(e){return`clientX`in e&&`clientY`in e}function ze(e){if(!e)return!1;let{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function Be(e){if(!e)return!1;let{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ve(e){if(Be(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Re(e)?{x:e.clientX,y:e.clientY}:null}var G=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[G.Translate.toString(e),G.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),He=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ue(e){return e.matches(He)?e:e.querySelector(He)}var K={display:`none`};function We(e){let{id:t,value:n}=e;return I.createElement(`div`,{id:t,style:K},n)}function Ge(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return I.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Ke(){let[e,t]=(0,I.useState)(``);return{announce:(0,I.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var qe=(0,I.createContext)(null);function Je(e){let t=(0,I.useContext)(qe);(0,I.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ye(){let[e]=(0,I.useState)(()=>new Set),t=(0,I.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,I.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Xe={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -47,7 +47,7 @@
47
47
  }
48
48
  })()
49
49
  </script>
50
- <script type="module" crossorigin src="/assets/index-C1A6aKjy.js"></script>
50
+ <script type="module" crossorigin src="/assets/index-BWdizKd9.js"></script>
51
51
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
52
52
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
53
53
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">